Completed
Push — master ( 57ec45...7a0770 )
by Yannick
33:58
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.
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.');
9
+		if ($this->db === null) {
10
+			die('Error: No DB connection.');
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)';
@@ -589,7 +601,9 @@  discard block
 block discarded – undo
589 601
 		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
590 602
 		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
591 603
 		    $translate = $Translation->ident2icao($q_item);
592
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
604
+		    if ($translate != $q_item) {
605
+		    	$additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
606
+		    }
593 607
 		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
594 608
 		    $additional_query .= ")";
595 609
 		}
@@ -807,7 +821,9 @@  discard block
 block discarded – undo
807 821
 		date_default_timezone_set($globalTimezone);
808 822
 		$datetime = new DateTime();
809 823
 		$offset = $datetime->format('P');
810
-	    } else $offset = '+00:00';
824
+	    } else {
825
+	    	$offset = '+00:00';
826
+	    }
811 827
 
812 828
 
813 829
 	    if ($date_array[1] != "")
@@ -1083,9 +1099,13 @@  discard block
 block discarded – undo
1083 1099
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1084 1100
 			}
1085 1101
 		}
1086
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1102
+                if ($sincedate != '') {
1103
+                	$query .= "AND date > '".$sincedate."' ";
1104
+                }
1087 1105
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1088
-	if ($limit) $query .= " LIMIT 0,10";
1106
+	if ($limit) {
1107
+		$query .= " LIMIT 0,10";
1108
+	}
1089 1109
       
1090 1110
 	
1091 1111
 	$sth = $this->db->prepare($query);
@@ -1129,9 +1149,13 @@  discard block
 block discarded – undo
1129 1149
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1130 1150
 			}
1131 1151
 		}
1132
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1152
+                if ($sincedate != '') {
1153
+                	$query .= "AND s.date > '".$sincedate."' ";
1154
+                }
1133 1155
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1134
-	if ($limit) $query .= " LIMIT 0,10";
1156
+	if ($limit) {
1157
+		$query .= " LIMIT 0,10";
1158
+	}
1135 1159
       
1136 1160
 	
1137 1161
 	$sth = $this->db->prepare($query);
Please login to merge, or discard this patch.
Indentation   +603 added lines, -603 removed lines patch added patch discarded remove patch
@@ -10,10 +10,10 @@  discard block
 block discarded – undo
10 10
 	}
11 11
 
12 12
 	/**
13
-	* Get SQL query part for filter used
14
-	* @param Array $filter the filter
15
-	* @return Array the SQL part
16
-	*/
13
+	 * Get SQL query part for filter used
14
+	 * @param Array $filter the filter
15
+	 * @return Array the SQL part
16
+	 */
17 17
 	public function getFilter($filter = array(),$where = false,$and = false) {
18 18
 		global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver;
19 19
 		$filters = array();
@@ -106,44 +106,44 @@  discard block
 block discarded – undo
106 106
 	}
107 107
 
108 108
 
109
-        /**
110
-        * Gets all the spotter information based on a particular callsign
111
-        *
112
-        * @return Array the spotter information
113
-        *
114
-        */
115
-        public function getLastArchiveTrackerDataByIdent($ident)
116
-        {
109
+		/**
110
+		 * Gets all the spotter information based on a particular callsign
111
+		 *
112
+		 * @return Array the spotter information
113
+		 *
114
+		 */
115
+		public function getLastArchiveTrackerDataByIdent($ident)
116
+		{
117 117
 		$Tracker = new Tracker($this->db);
118
-                date_default_timezone_set('UTC');
118
+				date_default_timezone_set('UTC');
119 119
 
120
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
-                $query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
120
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
121
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
122
+				$query  = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1";
123 123
 
124
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
124
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident));
125 125
 
126
-                return $spotter_array;
127
-        }
126
+				return $spotter_array;
127
+		}
128 128
 
129 129
 
130
-        /**
131
-        * Gets last the spotter information based on a particular id
132
-        *
133
-        * @return Array the spotter information
134
-        *
135
-        */
136
-        public function getLastArchiveTrackerDataById($id)
137
-        {
138
-    		$Tracker = new Tracker($this->db);
139
-                date_default_timezone_set('UTC');
140
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
141
-                //$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
-                //$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
-                $query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
130
+		/**
131
+		 * Gets last the spotter information based on a particular id
132
+		 *
133
+		 * @return Array the spotter information
134
+		 *
135
+		 */
136
+		public function getLastArchiveTrackerDataById($id)
137
+		{
138
+			$Tracker = new Tracker($this->db);
139
+				date_default_timezone_set('UTC');
140
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
141
+				//$query  = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id";
142
+				//$query  = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
143
+				$query  = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1";
144 144
 
145 145
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
146
-                  /*
146
+				  /*
147 147
                 try {
148 148
                         $Connection = new Connection();
149 149
                         $sth = Connection->$db->prepare($query);
@@ -153,232 +153,232 @@  discard block
 block discarded – undo
153 153
                 }
154 154
                 $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC);
155 155
                 */
156
-                $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
-
158
-                return $spotter_array;
159
-        }
160
-
161
-        /**
162
-        * Gets all the spotter information based on a particular id
163
-        *
164
-        * @return Array the spotter information
165
-        *
166
-        */
167
-        public function getAllArchiveTrackerDataById($id)
156
+				$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id));
157
+
158
+				return $spotter_array;
159
+		}
160
+
161
+		/**
162
+		 * Gets all the spotter information based on a particular id
163
+		 *
164
+		 * @return Array the spotter information
165
+		 *
166
+		 */
167
+		public function getAllArchiveTrackerDataById($id)
168 168
 	{
169
-                date_default_timezone_set('UTC');
170
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
171
-                $query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
169
+				date_default_timezone_set('UTC');
170
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
171
+				$query  = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date";
172 172
 
173 173
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
174 174
 
175
-                try {
176
-                        $sth = $this->db->prepare($query);
177
-                        $sth->execute(array(':id' => $id));
178
-                } catch(PDOException $e) {
179
-                        echo $e->getMessage();
180
-                        die;
181
-                }
182
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
183
-
184
-                return $spotter_array;
185
-        }
186
-
187
-        /**
188
-        * Gets coordinate & time spotter information based on a particular id
189
-        *
190
-        * @return Array the spotter information
191
-        *
192
-        */
193
-        public function getCoordArchiveTrackerDataById($id)
194
-        {
195
-                date_default_timezone_set('UTC');
196
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
197
-                $query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
175
+				try {
176
+						$sth = $this->db->prepare($query);
177
+						$sth->execute(array(':id' => $id));
178
+				} catch(PDOException $e) {
179
+						echo $e->getMessage();
180
+						die;
181
+				}
182
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
183
+
184
+				return $spotter_array;
185
+		}
186
+
187
+		/**
188
+		 * Gets coordinate & time spotter information based on a particular id
189
+		 *
190
+		 * @return Array the spotter information
191
+		 *
192
+		 */
193
+		public function getCoordArchiveTrackerDataById($id)
194
+		{
195
+				date_default_timezone_set('UTC');
196
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
197
+				$query  = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id";
198 198
 
199 199
 //              $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id));
200 200
 
201
-                try {
202
-                        $sth = $this->db->prepare($query);
203
-                        $sth->execute(array(':id' => $id));
204
-                } catch(PDOException $e) {
205
-                        echo $e->getMessage();
206
-                        die;
207
-                }
208
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
201
+				try {
202
+						$sth = $this->db->prepare($query);
203
+						$sth->execute(array(':id' => $id));
204
+				} catch(PDOException $e) {
205
+						echo $e->getMessage();
206
+						die;
207
+				}
208
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
209 209
 
210
-                return $spotter_array;
211
-        }
210
+				return $spotter_array;
211
+		}
212 212
 
213 213
 
214
-        /**
215
-        * Gets altitude information based on a particular callsign
216
-        *
217
-        * @return Array the spotter information
218
-        *
219
-        */
220
-        public function getAltitudeArchiveTrackerDataByIdent($ident)
221
-        {
214
+		/**
215
+		 * Gets altitude information based on a particular callsign
216
+		 *
217
+		 * @return Array the spotter information
218
+		 *
219
+		 */
220
+		public function getAltitudeArchiveTrackerDataByIdent($ident)
221
+		{
222 222
 
223
-                date_default_timezone_set('UTC');
223
+				date_default_timezone_set('UTC');
224 224
 
225
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
226
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
225
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
226
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
227 227
 
228
-                try {
229
-                        $sth = $this->db->prepare($query);
230
-                        $sth->execute(array(':ident' => $ident));
231
-                } catch(PDOException $e) {
232
-                        echo $e->getMessage();
233
-                        die;
234
-                }
235
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
228
+				try {
229
+						$sth = $this->db->prepare($query);
230
+						$sth->execute(array(':ident' => $ident));
231
+				} catch(PDOException $e) {
232
+						echo $e->getMessage();
233
+						die;
234
+				}
235
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
236 236
 
237
-                return $spotter_array;
238
-        }
237
+				return $spotter_array;
238
+		}
239 239
 
240
-        /**
241
-        * Gets altitude information based on a particular id
242
-        *
243
-        * @return Array the spotter information
244
-        *
245
-        */
246
-        public function getAltitudeArchiveTrackerDataById($id)
247
-        {
240
+		/**
241
+		 * Gets altitude information based on a particular id
242
+		 *
243
+		 * @return Array the spotter information
244
+		 *
245
+		 */
246
+		public function getAltitudeArchiveTrackerDataById($id)
247
+		{
248 248
 
249
-                date_default_timezone_set('UTC');
249
+				date_default_timezone_set('UTC');
250 250
 
251
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
252
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
251
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
252
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date";
253 253
 
254
-                try {
255
-                        $sth = $this->db->prepare($query);
256
-                        $sth->execute(array(':id' => $id));
257
-                } catch(PDOException $e) {
258
-                        echo $e->getMessage();
259
-                        die;
260
-                }
261
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
254
+				try {
255
+						$sth = $this->db->prepare($query);
256
+						$sth->execute(array(':id' => $id));
257
+				} catch(PDOException $e) {
258
+						echo $e->getMessage();
259
+						die;
260
+				}
261
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
262 262
 
263
-                return $spotter_array;
264
-        }
263
+				return $spotter_array;
264
+		}
265 265
 
266
-        /**
267
-        * Gets altitude & speed information based on a particular id
268
-        *
269
-        * @return Array the spotter information
270
-        *
271
-        */
272
-        public function getAltitudeSpeedArchiveTrackerDataById($id)
273
-        {
266
+		/**
267
+		 * Gets altitude & speed information based on a particular id
268
+		 *
269
+		 * @return Array the spotter information
270
+		 *
271
+		 */
272
+		public function getAltitudeSpeedArchiveTrackerDataById($id)
273
+		{
274 274
 
275
-                date_default_timezone_set('UTC');
275
+				date_default_timezone_set('UTC');
276 276
 
277
-                $id = filter_var($id, FILTER_SANITIZE_STRING);
278
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
277
+				$id = filter_var($id, FILTER_SANITIZE_STRING);
278
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date";
279 279
 
280
-                try {
281
-                        $sth = $this->db->prepare($query);
282
-                        $sth->execute(array(':id' => $id));
283
-                } catch(PDOException $e) {
284
-                        echo $e->getMessage();
285
-                        die;
286
-                }
287
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
280
+				try {
281
+						$sth = $this->db->prepare($query);
282
+						$sth->execute(array(':id' => $id));
283
+				} catch(PDOException $e) {
284
+						echo $e->getMessage();
285
+						die;
286
+				}
287
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
288 288
 
289
-                return $spotter_array;
290
-        }
289
+				return $spotter_array;
290
+		}
291 291
 
292 292
 
293
-        /**
294
-        * Gets altitude information based on a particular callsign
295
-        *
296
-        * @return Array the spotter information
297
-        *
298
-        */
299
-        public function getLastAltitudeArchiveTrackerDataByIdent($ident)
300
-        {
293
+		/**
294
+		 * Gets altitude information based on a particular callsign
295
+		 *
296
+		 * @return Array the spotter information
297
+		 *
298
+		 */
299
+		public function getLastAltitudeArchiveTrackerDataByIdent($ident)
300
+		{
301 301
 
302
-                date_default_timezone_set('UTC');
302
+				date_default_timezone_set('UTC');
303 303
 
304
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
-                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
304
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
305
+				$query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1";
306 306
 //                $query  = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident";
307 307
 
308
-                try {
309
-                        $sth = $this->db->prepare($query);
310
-                        $sth->execute(array(':ident' => $ident));
311
-                } catch(PDOException $e) {
312
-                        echo $e->getMessage();
313
-                        die;
314
-                }
315
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
308
+				try {
309
+						$sth = $this->db->prepare($query);
310
+						$sth->execute(array(':ident' => $ident));
311
+				} catch(PDOException $e) {
312
+						echo $e->getMessage();
313
+						die;
314
+				}
315
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
316 316
 
317
-                return $spotter_array;
318
-        }
317
+				return $spotter_array;
318
+		}
319 319
 
320 320
 
321 321
 
322
-       /**
323
-        * Gets all the archive spotter information
324
-        *
325
-        * @return Array the spotter information
326
-        *
327
-        */
328
-        public function getTrackerArchiveData($ident,$famtrackid,$date)
329
-        {
330
-    		$Tracker = new Tracker($this->db);
331
-                $ident = filter_var($ident, FILTER_SANITIZE_STRING);
332
-                $query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
322
+	   /**
323
+	    * Gets all the archive spotter information
324
+	    *
325
+	    * @return Array the spotter information
326
+	    *
327
+	    */
328
+		public function getTrackerArchiveData($ident,$famtrackid,$date)
329
+		{
330
+			$Tracker = new Tracker($this->db);
331
+				$ident = filter_var($ident, FILTER_SANITIZE_STRING);
332
+				$query  = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate";
333 333
 
334
-                $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
334
+				$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%'));
335 335
 
336
-                return $spotter_array;
337
-        }
336
+				return $spotter_array;
337
+		}
338 338
         
339
-        public function deleteTrackerArchiveTrackData()
340
-        {
339
+		public function deleteTrackerArchiveTrackData()
340
+		{
341 341
 		global $globalArchiveKeepTrackMonths;
342
-                date_default_timezone_set('UTC');
342
+				date_default_timezone_set('UTC');
343 343
 		$query = 'DELETE FROM tracker_archive WHERE tracker_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)';
344
-                try {
345
-                        $sth = $this->db->prepare($query);
346
-                        $sth->execute();
347
-                } catch(PDOException $e) {
348
-                        echo $e->getMessage();
349
-                        die;
350
-                }
344
+				try {
345
+						$sth = $this->db->prepare($query);
346
+						$sth->execute();
347
+				} catch(PDOException $e) {
348
+						echo $e->getMessage();
349
+						die;
350
+				}
351 351
 	}
352 352
 
353 353
 	/**
354
-        * Gets Minimal Live Tracker data
355
-        *
356
-        * @return Array the spotter information
357
-        *
358
-        */
359
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
360
-        {
361
-                global $globalDBdriver, $globalLiveInterval;
362
-                date_default_timezone_set('UTC');
363
-
364
-                $filter_query = '';
365
-                if (isset($filter['source']) && !empty($filter['source'])) {
366
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
367
-                }
368
-                // Use spotter_output also ?
369
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
370
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
371
-                }
372
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
373
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
374
-                }
375
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
376
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
377
-                }
354
+	 * Gets Minimal Live Tracker data
355
+	 *
356
+	 * @return Array the spotter information
357
+	 *
358
+	 */
359
+		public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
360
+		{
361
+				global $globalDBdriver, $globalLiveInterval;
362
+				date_default_timezone_set('UTC');
363
+
364
+				$filter_query = '';
365
+				if (isset($filter['source']) && !empty($filter['source'])) {
366
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
367
+				}
368
+				// Use spotter_output also ?
369
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
370
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
371
+				}
372
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
373
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
374
+				}
375
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
376
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
377
+				}
378 378
 
379
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
380
-                if ($globalDBdriver == 'mysql') {
381
-                        /*
379
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
380
+				if ($globalDBdriver == 'mysql') {
381
+						/*
382 382
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
383 383
                     		    FROM tracker_archive 
384 384
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -397,56 +397,56 @@  discard block
 block discarded – undo
397 397
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
398 398
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
399 399
                         	    '.$filter_query.' ORDER BY famtrackid';
400
-                } else {
401
-                        //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
402
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
400
+				} else {
401
+						//$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
402
+						$query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
403 403
                         	    FROM tracker_archive 
404 404
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
405 405
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
406 406
                         	    '.$filter_query.' ORDER BY famtrackid';
407
-                }
408
-                //echo $query;
409
-                try {
410
-                        $sth = $this->db->prepare($query);
411
-                        $sth->execute();
412
-                } catch(PDOException $e) {
413
-                        echo $e->getMessage();
414
-                        die;
415
-                }
416
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
407
+				}
408
+				//echo $query;
409
+				try {
410
+						$sth = $this->db->prepare($query);
411
+						$sth->execute();
412
+				} catch(PDOException $e) {
413
+						echo $e->getMessage();
414
+						die;
415
+				}
416
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
417 417
 
418
-                return $spotter_array;
419
-        }
418
+				return $spotter_array;
419
+		}
420 420
 
421 421
 	/**
422
-        * Gets Minimal Live Tracker data
423
-        *
424
-        * @return Array the spotter information
425
-        *
426
-        */
427
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
428
-        {
429
-                global $globalDBdriver, $globalLiveInterval;
430
-                date_default_timezone_set('UTC');
431
-
432
-                $filter_query = '';
433
-                if (isset($filter['source']) && !empty($filter['source'])) {
434
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
435
-                }
436
-                // Should use spotter_output also ?
437
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
438
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
439
-                }
440
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
441
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
442
-                }
443
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
444
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
445
-                }
422
+	 * Gets Minimal Live Tracker data
423
+	 *
424
+	 * @return Array the spotter information
425
+	 *
426
+	 */
427
+		public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
428
+		{
429
+				global $globalDBdriver, $globalLiveInterval;
430
+				date_default_timezone_set('UTC');
431
+
432
+				$filter_query = '';
433
+				if (isset($filter['source']) && !empty($filter['source'])) {
434
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
435
+				}
436
+				// Should use spotter_output also ?
437
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
438
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
439
+				}
440
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
441
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
442
+				}
443
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
444
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
445
+				}
446 446
 
447
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
448
-                if ($globalDBdriver == 'mysql') {
449
-                        /*
447
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
448
+				if ($globalDBdriver == 'mysql') {
449
+						/*
450 450
                         $query  = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk 
451 451
                     		    FROM tracker_archive 
452 452
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
@@ -457,95 +457,95 @@  discard block
 block discarded – undo
457 457
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
458 458
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
459 459
 
460
-                } else {
461
-                        //$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
462
-                       /*
460
+				} else {
461
+						//$query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao';
462
+					   /*
463 463
                         $query  = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
464 464
                         	    FROM tracker_archive_output 
465 465
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
466 466
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
467 467
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
468 468
                         */
469
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
469
+						$query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
470 470
                         	    FROM tracker_archive_output 
471 471
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
472 472
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
473 473
                         	    '.$filter_query.' LIMIT 200 OFFSET 0';
474 474
 //                        	    .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow';
475 475
                         	    
476
-                }
477
-                //echo $query;
478
-                try {
479
-                        $sth = $this->db->prepare($query);
480
-                        $sth->execute();
481
-                } catch(PDOException $e) {
482
-                        echo $e->getMessage();
483
-                        die;
484
-                }
485
-                $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
476
+				}
477
+				//echo $query;
478
+				try {
479
+						$sth = $this->db->prepare($query);
480
+						$sth->execute();
481
+				} catch(PDOException $e) {
482
+						echo $e->getMessage();
483
+						die;
484
+				}
485
+				$spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC);
486 486
 
487
-                return $spotter_array;
488
-        }
487
+				return $spotter_array;
488
+		}
489 489
 
490 490
 	 /**
491
-        * Gets count Live Tracker data
492
-        *
493
-        * @return Array the spotter information
494
-        *
495
-        */
496
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
497
-        {
498
-                global $globalDBdriver, $globalLiveInterval;
499
-                date_default_timezone_set('UTC');
500
-
501
-                $filter_query = '';
502
-                if (isset($filter['source']) && !empty($filter['source'])) {
503
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
504
-                }
505
-                if (isset($filter['airlines']) && !empty($filter['airlines'])) {
506
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
507
-                }
508
-                if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
509
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
510
-                }
511
-                if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
512
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
513
-                }
491
+	  * Gets count Live Tracker data
492
+	  *
493
+	  * @return Array the spotter information
494
+	  *
495
+	  */
496
+		public function getLiveTrackerCount($begindate,$enddate,$filter = array())
497
+		{
498
+				global $globalDBdriver, $globalLiveInterval;
499
+				date_default_timezone_set('UTC');
514 500
 
515
-                //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
516
-                if ($globalDBdriver == 'mysql') {
501
+				$filter_query = '';
502
+				if (isset($filter['source']) && !empty($filter['source'])) {
503
+						$filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
504
+				}
505
+				if (isset($filter['airlines']) && !empty($filter['airlines'])) {
506
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
507
+				}
508
+				if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
509
+						$filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
510
+				}
511
+				if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
512
+						$filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
513
+				}
514
+
515
+				//if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
516
+				if ($globalDBdriver == 'mysql') {
517 517
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb 
518 518
 			FROM tracker_archive l 
519 519
 			WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query;
520
-                } else {
520
+				} else {
521 521
 			$query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query;
522
-                }
523
-                //echo $query;
524
-                try {
525
-                        $sth = $this->db->prepare($query);
526
-                        $sth->execute();
527
-                } catch(PDOException $e) {
528
-                        echo $e->getMessage();
529
-                        die;
530
-                }
522
+				}
523
+				//echo $query;
524
+				try {
525
+						$sth = $this->db->prepare($query);
526
+						$sth->execute();
527
+				} catch(PDOException $e) {
528
+						echo $e->getMessage();
529
+						die;
530
+				}
531 531
 		$result = $sth->fetch(PDO::FETCH_ASSOC);
532 532
 		$sth->closeCursor();
533
-                return $result['nb'];
533
+				return $result['nb'];
534 534
 
535
-        }
535
+		}
536 536
 
537 537
 
538 538
 
539 539
 	// tracker_archive_output
540 540
 	
541
-    /**
542
-    * Gets all the spotter information
543
-    *
544
-    * @return Array the spotter information
545
-    *
546
-    */
547
-    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
548
-    {
541
+	/**
542
+	 * Gets all the spotter information
543
+	 *
544
+	 * @return Array the spotter information
545
+	 *
546
+	 */
547
+	public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
548
+	{
549 549
 	global $globalTimezone, $globalDBdriver;
550 550
 	require_once(dirname(__FILE__).'/class.Translation.php');
551 551
 	$Translation = new Translation($this->db);
@@ -559,159 +559,159 @@  discard block
 block discarded – undo
559 559
 	$filter_query = $this->getFilter($filters);
560 560
 	if ($q != "")
561 561
 	{
562
-	    if (!is_string($q))
563
-	    {
562
+		if (!is_string($q))
563
+		{
564 564
 		return false;
565
-	    } else {
565
+		} else {
566 566
 	        
567 567
 		$q_array = explode(" ", $q);
568 568
 		
569 569
 		foreach ($q_array as $q_item){
570
-		    $additional_query .= " AND (";
571
-		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
572
-		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
573
-		    $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
574
-		    $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
575
-		    $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
576
-		    $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
577
-		    $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
578
-		    $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
579
-		    $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
580
-		    $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
581
-		    $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
582
-		    $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
583
-		    $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
584
-		    $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
585
-		    $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
586
-		    $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
587
-		    $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
588
-		    $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
589
-		    $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
590
-		    $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
591
-		    $translate = $Translation->ident2icao($q_item);
592
-		    if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
593
-		    $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
594
-		    $additional_query .= ")";
570
+			$additional_query .= " AND (";
571
+			$additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
572
+			$additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
573
+			$additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR ";
574
+			$additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR ";
575
+			$additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR ";
576
+			$additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR ";
577
+			$additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR ";
578
+			$additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR ";
579
+			$additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR ";
580
+			$additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR ";
581
+			$additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR ";
582
+			$additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR ";
583
+			$additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR ";
584
+			$additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR ";
585
+			$additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR ";
586
+			$additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR ";
587
+			$additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR ";
588
+			$additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR ";
589
+			$additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR ";
590
+			$additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR ";
591
+			$translate = $Translation->ident2icao($q_item);
592
+			if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR ";
593
+			$additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')";
594
+			$additional_query .= ")";
595
+		}
595 596
 		}
596
-	    }
597 597
 	}
598 598
 	
599 599
 	if ($registration != "")
600 600
 	{
601
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
602
-	    if (!is_string($registration))
603
-	    {
601
+		$registration = filter_var($registration,FILTER_SANITIZE_STRING);
602
+		if (!is_string($registration))
603
+		{
604 604
 		return false;
605
-	    } else {
605
+		} else {
606 606
 		$additional_query .= " AND (tracker_archive_output.registration = '".$registration."')";
607
-	    }
607
+		}
608 608
 	}
609 609
 	
610 610
 	if ($aircraft_icao != "")
611 611
 	{
612
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
-	    if (!is_string($aircraft_icao))
614
-	    {
612
+		$aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
613
+		if (!is_string($aircraft_icao))
614
+		{
615 615
 		return false;
616
-	    } else {
616
+		} else {
617 617
 		$additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')";
618
-	    }
618
+		}
619 619
 	}
620 620
 	
621 621
 	if ($aircraft_manufacturer != "")
622 622
 	{
623
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
624
-	    if (!is_string($aircraft_manufacturer))
625
-	    {
623
+		$aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
624
+		if (!is_string($aircraft_manufacturer))
625
+		{
626 626
 		return false;
627
-	    } else {
627
+		} else {
628 628
 		$additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')";
629
-	    }
629
+		}
630 630
 	}
631 631
 	
632 632
 	if ($highlights == "true")
633 633
 	{
634
-	    if (!is_string($highlights))
635
-	    {
634
+		if (!is_string($highlights))
635
+		{
636 636
 		return false;
637
-	    } else {
637
+		} else {
638 638
 		$additional_query .= " AND (tracker_archive_output.highlight <> '')";
639
-	    }
639
+		}
640 640
 	}
641 641
 	
642 642
 	if ($airline_icao != "")
643 643
 	{
644
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
645
-	    if (!is_string($airline_icao))
646
-	    {
644
+		$airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
645
+		if (!is_string($airline_icao))
646
+		{
647 647
 		return false;
648
-	    } else {
648
+		} else {
649 649
 		$additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')";
650
-	    }
650
+		}
651 651
 	}
652 652
 	
653 653
 	if ($airline_country != "")
654 654
 	{
655
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
656
-	    if (!is_string($airline_country))
657
-	    {
655
+		$airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
656
+		if (!is_string($airline_country))
657
+		{
658 658
 		return false;
659
-	    } else {
659
+		} else {
660 660
 		$additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')";
661
-	    }
661
+		}
662 662
 	}
663 663
 	
664 664
 	if ($airline_type != "")
665 665
 	{
666
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
667
-	    if (!is_string($airline_type))
668
-	    {
666
+		$airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
667
+		if (!is_string($airline_type))
668
+		{
669 669
 		return false;
670
-	    } else {
670
+		} else {
671 671
 		if ($airline_type == "passenger")
672 672
 		{
673
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
673
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')";
674 674
 		}
675 675
 		if ($airline_type == "cargo")
676 676
 		{
677
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
677
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')";
678 678
 		}
679 679
 		if ($airline_type == "military")
680 680
 		{
681
-		    $additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
681
+			$additional_query .= " AND (tracker_archive_output.airline_type = 'military')";
682
+		}
682 683
 		}
683
-	    }
684 684
 	}
685 685
 	
686 686
 	if ($airport != "")
687 687
 	{
688
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
689
-	    if (!is_string($airport))
690
-	    {
688
+		$airport = filter_var($airport,FILTER_SANITIZE_STRING);
689
+		if (!is_string($airport))
690
+		{
691 691
 		return false;
692
-	    } else {
692
+		} else {
693 693
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))";
694
-	    }
694
+		}
695 695
 	}
696 696
 	
697 697
 	if ($airport_country != "")
698 698
 	{
699
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
700
-	    if (!is_string($airport_country))
701
-	    {
699
+		$airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
700
+		if (!is_string($airport_country))
701
+		{
702 702
 		return false;
703
-	    } else {
703
+		} else {
704 704
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))";
705
-	    }
705
+		}
706 706
 	}
707 707
     
708 708
 	if ($callsign != "")
709 709
 	{
710
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
711
-	    if (!is_string($callsign))
712
-	    {
710
+		$callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
711
+		if (!is_string($callsign))
712
+		{
713 713
 		return false;
714
-	    } else {
714
+		} else {
715 715
 		$translate = $Translation->ident2icao($callsign);
716 716
 		if ($translate != $callsign) {
717 717
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
@@ -719,99 +719,99 @@  discard block
 block discarded – undo
719 719
 		} else {
720 720
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
721 721
 		}
722
-	    }
722
+		}
723 723
 	}
724 724
 
725 725
 	if ($owner != "")
726 726
 	{
727
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
728
-	    if (!is_string($owner))
729
-	    {
727
+		$owner = filter_var($owner,FILTER_SANITIZE_STRING);
728
+		if (!is_string($owner))
729
+		{
730 730
 		return false;
731
-	    } else {
731
+		} else {
732 732
 		$additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')";
733
-	    }
733
+		}
734 734
 	}
735 735
 
736 736
 	if ($pilot_name != "")
737 737
 	{
738
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
739
-	    if (!is_string($pilot_name))
740
-	    {
738
+		$pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
739
+		if (!is_string($pilot_name))
740
+		{
741 741
 		return false;
742
-	    } else {
742
+		} else {
743 743
 		$additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')";
744
-	    }
744
+		}
745 745
 	}
746 746
 	
747 747
 	if ($pilot_id != "")
748 748
 	{
749
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
750
-	    if (!is_string($pilot_id))
751
-	    {
749
+		$pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
750
+		if (!is_string($pilot_id))
751
+		{
752 752
 		return false;
753
-	    } else {
753
+		} else {
754 754
 		$additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')";
755
-	    }
755
+		}
756 756
 	}
757 757
 	
758 758
 	if ($departure_airport_route != "")
759 759
 	{
760
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
761
-	    if (!is_string($departure_airport_route))
762
-	    {
760
+		$departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
761
+		if (!is_string($departure_airport_route))
762
+		{
763 763
 		return false;
764
-	    } else {
764
+		} else {
765 765
 		$additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')";
766
-	    }
766
+		}
767 767
 	}
768 768
 	
769 769
 	if ($arrival_airport_route != "")
770 770
 	{
771
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
772
-	    if (!is_string($arrival_airport_route))
773
-	    {
771
+		$arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
772
+		if (!is_string($arrival_airport_route))
773
+		{
774 774
 		return false;
775
-	    } else {
775
+		} else {
776 776
 		$additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')";
777
-	    }
777
+		}
778 778
 	}
779 779
 	
780 780
 	if ($altitude != "")
781 781
 	{
782
-	    $altitude_array = explode(",", $altitude);
782
+		$altitude_array = explode(",", $altitude);
783 783
 	    
784
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
784
+		$altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
+		$altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
786 786
 	    
787 787
 
788
-	    if ($altitude_array[1] != "")
789
-	    {                
788
+		if ($altitude_array[1] != "")
789
+		{                
790 790
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
791 791
 		$altitude_array[1] = substr($altitude_array[1], 0, -2);
792 792
 		$additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' ";
793
-	    } else {
793
+		} else {
794 794
 		$altitude_array[0] = substr($altitude_array[0], 0, -2);
795 795
 		$additional_query .= " AND altitude <= '".$altitude_array[0]."' ";
796
-	    }
796
+		}
797 797
 	}
798 798
 	
799 799
 	if ($date_posted != "")
800 800
 	{
801
-	    $date_array = explode(",", $date_posted);
801
+		$date_array = explode(",", $date_posted);
802 802
 	    
803
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
804
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
803
+		$date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
804
+		$date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
805 805
 	    
806
-	    if ($globalTimezone != '') {
806
+		if ($globalTimezone != '') {
807 807
 		date_default_timezone_set($globalTimezone);
808 808
 		$datetime = new DateTime();
809 809
 		$offset = $datetime->format('P');
810
-	    } else $offset = '+00:00';
810
+		} else $offset = '+00:00';
811 811
 
812 812
 
813
-	    if ($date_array[1] != "")
814
-	    {                
813
+		if ($date_array[1] != "")
814
+		{                
815 815
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
816 816
 		$date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1]));
817 817
 		if ($globalDBdriver == 'mysql') {
@@ -819,28 +819,28 @@  discard block
 block discarded – undo
819 819
 		} else {
820 820
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) ";
821 821
 		}
822
-	    } else {
822
+		} else {
823 823
 		$date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0]));
824
-                if ($globalDBdriver == 'mysql') {
824
+				if ($globalDBdriver == 'mysql') {
825 825
 			$additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' ";
826 826
 		} else {
827 827
 			$additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) ";
828 828
 		}
829
-	    }
829
+		}
830 830
 	}
831 831
 	
832 832
 	if ($limit != "")
833 833
 	{
834
-	    $limit_array = explode(",", $limit);
834
+		$limit_array = explode(",", $limit);
835 835
 	    
836
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
837
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
836
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
837
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
838 838
 	    
839
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
840
-	    {
839
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
840
+		{
841 841
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
842 842
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
843
-	    }
843
+		}
844 844
 	}
845 845
 	
846 846
 
@@ -871,33 +871,33 @@  discard block
 block discarded – undo
871 871
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
872 872
 
873 873
 	return $spotter_array;
874
-    }
874
+	}
875 875
 
876
-    public function deleteTrackerArchiveData()
877
-    {
876
+	public function deleteTrackerArchiveData()
877
+	{
878 878
 		global $globalArchiveKeepMonths, $globalDBdriver;
879
-                date_default_timezone_set('UTC');
880
-                if ($globalDBdriver == 'mysql') {
879
+				date_default_timezone_set('UTC');
880
+				if ($globalDBdriver == 'mysql') {
881 881
 			$query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)';
882 882
 		} else {
883 883
 			$query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'";
884 884
 		}
885
-                try {
886
-                        $sth = $this->db->prepare($query);
887
-                        $sth->execute();
888
-                } catch(PDOException $e) {
889
-                        return "error";
890
-                }
885
+				try {
886
+						$sth = $this->db->prepare($query);
887
+						$sth->execute();
888
+				} catch(PDOException $e) {
889
+						return "error";
890
+				}
891 891
 	}
892 892
 
893
-    /**
894
-    * Gets all the spotter information based on the callsign
895
-    *
896
-    * @return Array the spotter information
897
-    *
898
-    */
899
-    public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
900
-    {
893
+	/**
894
+	 * Gets all the spotter information based on the callsign
895
+	 *
896
+	 * @return Array the spotter information
897
+	 *
898
+	 */
899
+	public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '')
900
+	{
901 901
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
902 902
 	
903 903
 	date_default_timezone_set('UTC');
@@ -909,35 +909,35 @@  discard block
 block discarded – undo
909 909
 	
910 910
 	if ($ident != "")
911 911
 	{
912
-	    if (!is_string($ident))
913
-	    {
912
+		if (!is_string($ident))
913
+		{
914 914
 		return false;
915
-	    } else {
915
+		} else {
916 916
 		$additional_query = " AND (tracker_archive_output.ident = :ident)";
917 917
 		$query_values = array(':ident' => $ident);
918
-	    }
918
+		}
919 919
 	}
920 920
 	
921 921
 	if ($limit != "")
922 922
 	{
923
-	    $limit_array = explode(",", $limit);
923
+		$limit_array = explode(",", $limit);
924 924
 	    
925
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
926
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
925
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
926
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
927 927
 	    
928
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
929
-	    {
928
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
929
+		{
930 930
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
931 931
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
932
-	    }
932
+		}
933 933
 	}
934 934
 
935 935
 	if ($sort != "")
936 936
 	{
937
-	    $search_orderby_array = $Tracker->getOrderBy();
938
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
937
+		$search_orderby_array = $Tracker->getOrderBy();
938
+		$orderby_query = $search_orderby_array[$sort]['sql'];
939 939
 	} else {
940
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
940
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
941 941
 	}
942 942
 
943 943
 	$query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query;
@@ -945,17 +945,17 @@  discard block
 block discarded – undo
945 945
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
946 946
 
947 947
 	return $spotter_array;
948
-    }
948
+	}
949 949
 
950 950
 
951
-    /**
952
-    * Gets all the spotter information based on the owner
953
-    *
954
-    * @return Array the spotter information
955
-    *
956
-    */
957
-    public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
958
-    {
951
+	/**
952
+	 * Gets all the spotter information based on the owner
953
+	 *
954
+	 * @return Array the spotter information
955
+	 *
956
+	 */
957
+	public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array())
958
+	{
959 959
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
960 960
 	
961 961
 	date_default_timezone_set('UTC');
@@ -968,35 +968,35 @@  discard block
 block discarded – undo
968 968
 	
969 969
 	if ($owner != "")
970 970
 	{
971
-	    if (!is_string($owner))
972
-	    {
971
+		if (!is_string($owner))
972
+		{
973 973
 		return false;
974
-	    } else {
974
+		} else {
975 975
 		$additional_query = " AND (tracker_archive_output.owner_name = :owner)";
976 976
 		$query_values = array(':owner' => $owner);
977
-	    }
977
+		}
978 978
 	}
979 979
 	
980 980
 	if ($limit != "")
981 981
 	{
982
-	    $limit_array = explode(",", $limit);
982
+		$limit_array = explode(",", $limit);
983 983
 	    
984
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
985
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
984
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
985
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
986 986
 	    
987
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
988
-	    {
987
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
988
+		{
989 989
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
990 990
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
991
-	    }
991
+		}
992 992
 	}
993 993
 
994 994
 	if ($sort != "")
995 995
 	{
996
-	    $search_orderby_array = $Tracker->getOrderBy();
997
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
996
+		$search_orderby_array = $Tracker->getOrderBy();
997
+		$orderby_query = $search_orderby_array[$sort]['sql'];
998 998
 	} else {
999
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
999
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1000 1000
 	}
1001 1001
 
1002 1002
 	$query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query;
@@ -1004,16 +1004,16 @@  discard block
 block discarded – undo
1004 1004
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1005 1005
 
1006 1006
 	return $spotter_array;
1007
-    }
1008
-
1009
-    /**
1010
-    * Gets all the spotter information based on the pilot
1011
-    *
1012
-    * @return Array the spotter information
1013
-    *
1014
-    */
1015
-    public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1016
-    {
1007
+	}
1008
+
1009
+	/**
1010
+	 * Gets all the spotter information based on the pilot
1011
+	 *
1012
+	 * @return Array the spotter information
1013
+	 *
1014
+	 */
1015
+	public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array())
1016
+	{
1017 1017
 	$global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output";
1018 1018
 	
1019 1019
 	date_default_timezone_set('UTC');
@@ -1032,24 +1032,24 @@  discard block
 block discarded – undo
1032 1032
 	
1033 1033
 	if ($limit != "")
1034 1034
 	{
1035
-	    $limit_array = explode(",", $limit);
1035
+		$limit_array = explode(",", $limit);
1036 1036
 	    
1037
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1038
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1037
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1038
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1039 1039
 	    
1040
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1041
-	    {
1040
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1041
+		{
1042 1042
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1043 1043
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1044
-	    }
1044
+		}
1045 1045
 	}
1046 1046
 
1047 1047
 	if ($sort != "")
1048 1048
 	{
1049
-	    $search_orderby_array = $Tracker->getOrderBy();
1050
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1049
+		$search_orderby_array = $Tracker->getOrderBy();
1050
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1051 1051
 	} else {
1052
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1052
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1053 1053
 	}
1054 1054
 
1055 1055
 	$query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query;
@@ -1057,16 +1057,16 @@  discard block
 block discarded – undo
1057 1057
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1058 1058
 
1059 1059
 	return $spotter_array;
1060
-    }
1061
-
1062
-    /**
1063
-    * Gets all number of flight over countries
1064
-    *
1065
-    * @return Array the airline country list
1066
-    *
1067
-    */
1068
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1069
-    {
1060
+	}
1061
+
1062
+	/**
1063
+	 * Gets all number of flight over countries
1064
+	 *
1065
+	 * @return Array the airline country list
1066
+	 *
1067
+	 */
1068
+	public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1069
+	{
1070 1070
 	global $globalDBdriver;
1071 1071
 	/*
1072 1072
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1076,14 +1076,14 @@  discard block
 block discarded – undo
1076 1076
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb
1077 1077
 		    FROM countries c, tracker_archive s
1078 1078
 		    WHERE c.iso2 = s.over_country ";
1079
-                if ($olderthanmonths > 0) {
1080
-            		if ($globalDBdriver == 'mysql') {
1079
+				if ($olderthanmonths > 0) {
1080
+					if ($globalDBdriver == 'mysql') {
1081 1081
 				$query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1082 1082
 			} else {
1083 1083
 				$query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1084 1084
 			}
1085 1085
 		}
1086
-                if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1086
+				if ($sincedate != '') $query .= "AND date > '".$sincedate."' ";
1087 1087
 	$query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1088 1088
 	if ($limit) $query .= " LIMIT 0,10";
1089 1089
       
@@ -1096,23 +1096,23 @@  discard block
 block discarded – undo
1096 1096
         
1097 1097
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1098 1098
 	{
1099
-	    $temp_array['flight_count'] = $row['nb'];
1100
-	    $temp_array['flight_country'] = $row['name'];
1101
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1102
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1103
-	    $flight_array[] = $temp_array;
1099
+		$temp_array['flight_count'] = $row['nb'];
1100
+		$temp_array['flight_country'] = $row['name'];
1101
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1102
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1103
+		$flight_array[] = $temp_array;
1104 1104
 	}
1105 1105
 	return $flight_array;
1106
-    }
1107
-
1108
-    /**
1109
-    * Gets all number of flight over countries
1110
-    *
1111
-    * @return Array the airline country list
1112
-    *
1113
-    */
1114
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1115
-    {
1106
+	}
1107
+
1108
+	/**
1109
+	 * Gets all number of flight over countries
1110
+	 *
1111
+	 * @return Array the airline country list
1112
+	 *
1113
+	 */
1114
+	public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1115
+	{
1116 1116
 	global $globalDBdriver;
1117 1117
 	/*
1118 1118
 	$query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb 
@@ -1122,14 +1122,14 @@  discard block
 block discarded – undo
1122 1122
 	$query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb
1123 1123
 		    FROM countries c, tracker_archive s, spotter_output o
1124 1124
 		    WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid ";
1125
-                if ($olderthanmonths > 0) {
1126
-            		if ($globalDBdriver == 'mysql') {
1125
+				if ($olderthanmonths > 0) {
1126
+					if ($globalDBdriver == 'mysql') {
1127 1127
 				$query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) ';
1128 1128
 			} else {
1129 1129
 				$query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'";
1130 1130
 			}
1131 1131
 		}
1132
-                if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1132
+				if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' ";
1133 1133
 	$query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC";
1134 1134
 	if ($limit) $query .= " LIMIT 0,10";
1135 1135
       
@@ -1142,24 +1142,24 @@  discard block
 block discarded – undo
1142 1142
         
1143 1143
 	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1144 1144
 	{
1145
-	    $temp_array['airline_icao'] = $row['airline_icao'];
1146
-	    $temp_array['flight_count'] = $row['nb'];
1147
-	    $temp_array['flight_country'] = $row['name'];
1148
-	    $temp_array['flight_country_iso3'] = $row['iso3'];
1149
-	    $temp_array['flight_country_iso2'] = $row['iso2'];
1150
-	    $flight_array[] = $temp_array;
1145
+		$temp_array['airline_icao'] = $row['airline_icao'];
1146
+		$temp_array['flight_count'] = $row['nb'];
1147
+		$temp_array['flight_country'] = $row['name'];
1148
+		$temp_array['flight_country_iso3'] = $row['iso3'];
1149
+		$temp_array['flight_country_iso2'] = $row['iso2'];
1150
+		$flight_array[] = $temp_array;
1151 1151
 	}
1152 1152
 	return $flight_array;
1153
-    }
1154
-
1155
-    /**
1156
-    * Gets last spotter information based on a particular callsign
1157
-    *
1158
-    * @return Array the spotter information
1159
-    *
1160
-    */
1161
-    public function getDateArchiveTrackerDataById($id,$date)
1162
-    {
1153
+	}
1154
+
1155
+	/**
1156
+	 * Gets last spotter information based on a particular callsign
1157
+	 *
1158
+	 * @return Array the spotter information
1159
+	 *
1160
+	 */
1161
+	public function getDateArchiveTrackerDataById($id,$date)
1162
+	{
1163 1163
 	$Tracker = new Tracker($this->db);
1164 1164
 	date_default_timezone_set('UTC');
1165 1165
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
@@ -1167,16 +1167,16 @@  discard block
 block discarded – undo
1167 1167
 	$date = date('c',$date);
1168 1168
 	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1169 1169
 	return $spotter_array;
1170
-    }
1171
-
1172
-    /**
1173
-    * Gets all the spotter information based on a particular callsign
1174
-    *
1175
-    * @return Array the spotter information
1176
-    *
1177
-    */
1178
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1179
-    {
1170
+	}
1171
+
1172
+	/**
1173
+	 * Gets all the spotter information based on a particular callsign
1174
+	 *
1175
+	 * @return Array the spotter information
1176
+	 *
1177
+	 */
1178
+	public function getDateArchiveTrackerDataByIdent($ident,$date)
1179
+	{
1180 1180
 	$Tracker = new Tracker($this->db);
1181 1181
 	date_default_timezone_set('UTC');
1182 1182
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
@@ -1184,16 +1184,16 @@  discard block
 block discarded – undo
1184 1184
 	$date = date('c',$date);
1185 1185
 	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1186 1186
 	return $spotter_array;
1187
-    }
1188
-
1189
-    /**
1190
-    * Gets all the spotter information based on the airport
1191
-    *
1192
-    * @return Array the spotter information
1193
-    *
1194
-    */
1195
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1196
-    {
1187
+	}
1188
+
1189
+	/**
1190
+	 * Gets all the spotter information based on the airport
1191
+	 *
1192
+	 * @return Array the spotter information
1193
+	 *
1194
+	 */
1195
+	public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1196
+	{
1197 1197
 	global $global_query;
1198 1198
 	$Tracker = new Tracker($this->db);
1199 1199
 	date_default_timezone_set('UTC');
@@ -1204,35 +1204,35 @@  discard block
 block discarded – undo
1204 1204
 	
1205 1205
 	if ($airport != "")
1206 1206
 	{
1207
-	    if (!is_string($airport))
1208
-	    {
1207
+		if (!is_string($airport))
1208
+		{
1209 1209
 		return false;
1210
-	    } else {
1210
+		} else {
1211 1211
 		$additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))";
1212 1212
 		$query_values = array(':airport' => $airport);
1213
-	    }
1213
+		}
1214 1214
 	}
1215 1215
 	
1216 1216
 	if ($limit != "")
1217 1217
 	{
1218
-	    $limit_array = explode(",", $limit);
1218
+		$limit_array = explode(",", $limit);
1219 1219
 	    
1220
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+		$limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
+		$limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1222 1222
 	    
1223
-	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224
-	    {
1223
+		if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224
+		{
1225 1225
 		//$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1];
1226 1226
 		$limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0];
1227
-	    }
1227
+		}
1228 1228
 	}
1229 1229
 	
1230 1230
 	if ($sort != "")
1231 1231
 	{
1232
-	    $search_orderby_array = $Tracker->getOrderBy();
1233
-	    $orderby_query = $search_orderby_array[$sort]['sql'];
1232
+		$search_orderby_array = $Tracker->getOrderBy();
1233
+		$orderby_query = $search_orderby_array[$sort]['sql'];
1234 1234
 	} else {
1235
-	    $orderby_query = " ORDER BY tracker_archive_output.date DESC";
1235
+		$orderby_query = " ORDER BY tracker_archive_output.date DESC";
1236 1236
 	}
1237 1237
 
1238 1238
 	$query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query;
@@ -1240,6 +1240,6 @@  discard block
 block discarded – undo
1240 1240
 	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
1241 1241
 
1242 1242
 	return $spotter_array;
1243
-    }
1243
+	}
1244 1244
 }
1245 1245
 ?>
1246 1246
\ No newline at end of file
Please login to merge, or discard this patch.
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' => $over_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' => $over_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
         }
@@ -344,7 +344,7 @@  discard block
 block discarded – undo
344 344
                 try {
345 345
                         $sth = $this->db->prepare($query);
346 346
                         $sth->execute();
347
-                } catch(PDOException $e) {
347
+                } catch (PDOException $e) {
348 348
                         echo $e->getMessage();
349 349
                         die;
350 350
                 }
@@ -356,24 +356,24 @@  discard block
 block discarded – undo
356 356
         * @return Array the spotter information
357 357
         *
358 358
         */
359
-        public function getMinLiveTrackerData($begindate,$enddate,$filter = array())
359
+        public function getMinLiveTrackerData($begindate, $enddate, $filter = array())
360 360
         {
361 361
                 global $globalDBdriver, $globalLiveInterval;
362 362
                 date_default_timezone_set('UTC');
363 363
 
364 364
                 $filter_query = '';
365 365
                 if (isset($filter['source']) && !empty($filter['source'])) {
366
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
366
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
367 367
                 }
368 368
                 // Use spotter_output also ?
369 369
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
370
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
370
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
371 371
                 }
372 372
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
373 373
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
374 374
                 }
375 375
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
376
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
376
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
377 377
                 }
378 378
 
379 379
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 						GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid 
393 393
 				    AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
394 394
 */
395
-			$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 
395
+			$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 
396 396
 				    FROM tracker_archive 
397 397
 				    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
398 398
 				    WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' 
399 399
                         	    '.$filter_query.' ORDER BY famtrackid';
400 400
                 } else {
401 401
                         //$query  = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao';
402
-                        $query  = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
402
+                        $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category 
403 403
                         	    FROM tracker_archive 
404 404
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao
405 405
                         	    WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".'
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
                 try {
410 410
                         $sth = $this->db->prepare($query);
411 411
                         $sth->execute();
412
-                } catch(PDOException $e) {
412
+                } catch (PDOException $e) {
413 413
                         echo $e->getMessage();
414 414
                         die;
415 415
                 }
@@ -424,24 +424,24 @@  discard block
 block discarded – undo
424 424
         * @return Array the spotter information
425 425
         *
426 426
         */
427
-        public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array())
427
+        public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array())
428 428
         {
429 429
                 global $globalDBdriver, $globalLiveInterval;
430 430
                 date_default_timezone_set('UTC');
431 431
 
432 432
                 $filter_query = '';
433 433
                 if (isset($filter['source']) && !empty($filter['source'])) {
434
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
434
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
435 435
                 }
436 436
                 // Should use spotter_output also ?
437 437
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
438
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
438
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
439 439
                 }
440 440
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
441 441
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
442 442
                 }
443 443
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
444
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
444
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
445 445
                 }
446 446
 
447 447
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -451,7 +451,7 @@  discard block
 block discarded – undo
451 451
                     		    FROM tracker_archive 
452 452
                     		    INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao';
453 453
 			*/
454
-			$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 
454
+			$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 
455 455
 				    FROM tracker_archive_output 
456 456
 				    LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao 
457 457
 				    WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') 
@@ -466,7 +466,7 @@  discard block
 block discarded – undo
466 466
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
467 467
                         	    '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow';
468 468
                         */
469
-                        $query  = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
469
+                        $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow
470 470
                         	    FROM tracker_archive_output 
471 471
                         	    INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao
472 472
                         	    WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".'
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
                 try {
479 479
                         $sth = $this->db->prepare($query);
480 480
                         $sth->execute();
481
-                } catch(PDOException $e) {
481
+                } catch (PDOException $e) {
482 482
                         echo $e->getMessage();
483 483
                         die;
484 484
                 }
@@ -493,23 +493,23 @@  discard block
 block discarded – undo
493 493
         * @return Array the spotter information
494 494
         *
495 495
         */
496
-        public function getLiveTrackerCount($begindate,$enddate,$filter = array())
496
+        public function getLiveTrackerCount($begindate, $enddate, $filter = array())
497 497
         {
498 498
                 global $globalDBdriver, $globalLiveInterval;
499 499
                 date_default_timezone_set('UTC');
500 500
 
501 501
                 $filter_query = '';
502 502
                 if (isset($filter['source']) && !empty($filter['source'])) {
503
-                        $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') ";
503
+                        $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') ";
504 504
                 }
505 505
                 if (isset($filter['airlines']) && !empty($filter['airlines'])) {
506
-                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
506
+                        $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid ";
507 507
                 }
508 508
                 if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) {
509 509
                         $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid ";
510 510
                 }
511 511
                 if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) {
512
-                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')";
512
+                        $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')";
513 513
                 }
514 514
 
515 515
                 //if (!isset($globalLiveInterval)) $globalLiveInterval = '200';
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
                 try {
525 525
                         $sth = $this->db->prepare($query);
526 526
                         $sth->execute();
527
-                } catch(PDOException $e) {
527
+                } catch (PDOException $e) {
528 528
                         echo $e->getMessage();
529 529
                         die;
530 530
                 }
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
     * @return Array the spotter information
545 545
     *
546 546
     */
547
-    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array())
547
+    public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array())
548 548
     {
549 549
 	global $globalTimezone, $globalDBdriver;
550 550
 	require_once(dirname(__FILE__).'/class.Translation.php');
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 	        
567 567
 		$q_array = explode(" ", $q);
568 568
 		
569
-		foreach ($q_array as $q_item){
569
+		foreach ($q_array as $q_item) {
570 570
 		    $additional_query .= " AND (";
571 571
 		    $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR ";
572 572
 		    $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR ";
@@ -598,7 +598,7 @@  discard block
 block discarded – undo
598 598
 	
599 599
 	if ($registration != "")
600 600
 	{
601
-	    $registration = filter_var($registration,FILTER_SANITIZE_STRING);
601
+	    $registration = filter_var($registration, FILTER_SANITIZE_STRING);
602 602
 	    if (!is_string($registration))
603 603
 	    {
604 604
 		return false;
@@ -609,7 +609,7 @@  discard block
 block discarded – undo
609 609
 	
610 610
 	if ($aircraft_icao != "")
611 611
 	{
612
-	    $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING);
612
+	    $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING);
613 613
 	    if (!is_string($aircraft_icao))
614 614
 	    {
615 615
 		return false;
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	
621 621
 	if ($aircraft_manufacturer != "")
622 622
 	{
623
-	    $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING);
623
+	    $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING);
624 624
 	    if (!is_string($aircraft_manufacturer))
625 625
 	    {
626 626
 		return false;
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 	
642 642
 	if ($airline_icao != "")
643 643
 	{
644
-	    $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING);
644
+	    $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING);
645 645
 	    if (!is_string($airline_icao))
646 646
 	    {
647 647
 		return false;
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	
653 653
 	if ($airline_country != "")
654 654
 	{
655
-	    $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING);
655
+	    $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING);
656 656
 	    if (!is_string($airline_country))
657 657
 	    {
658 658
 		return false;
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
 	
664 664
 	if ($airline_type != "")
665 665
 	{
666
-	    $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING);
666
+	    $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING);
667 667
 	    if (!is_string($airline_type))
668 668
 	    {
669 669
 		return false;
@@ -685,7 +685,7 @@  discard block
 block discarded – undo
685 685
 	
686 686
 	if ($airport != "")
687 687
 	{
688
-	    $airport = filter_var($airport,FILTER_SANITIZE_STRING);
688
+	    $airport = filter_var($airport, FILTER_SANITIZE_STRING);
689 689
 	    if (!is_string($airport))
690 690
 	    {
691 691
 		return false;
@@ -696,7 +696,7 @@  discard block
 block discarded – undo
696 696
 	
697 697
 	if ($airport_country != "")
698 698
 	{
699
-	    $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING);
699
+	    $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING);
700 700
 	    if (!is_string($airport_country))
701 701
 	    {
702 702
 		return false;
@@ -707,7 +707,7 @@  discard block
 block discarded – undo
707 707
     
708 708
 	if ($callsign != "")
709 709
 	{
710
-	    $callsign = filter_var($callsign,FILTER_SANITIZE_STRING);
710
+	    $callsign = filter_var($callsign, FILTER_SANITIZE_STRING);
711 711
 	    if (!is_string($callsign))
712 712
 	    {
713 713
 		return false;
@@ -715,7 +715,7 @@  discard block
 block discarded – undo
715 715
 		$translate = $Translation->ident2icao($callsign);
716 716
 		if ($translate != $callsign) {
717 717
 			$additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)";
718
-			$query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate));
718
+			$query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate));
719 719
 		} else {
720 720
 			$additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')";
721 721
 		}
@@ -724,7 +724,7 @@  discard block
 block discarded – undo
724 724
 
725 725
 	if ($owner != "")
726 726
 	{
727
-	    $owner = filter_var($owner,FILTER_SANITIZE_STRING);
727
+	    $owner = filter_var($owner, FILTER_SANITIZE_STRING);
728 728
 	    if (!is_string($owner))
729 729
 	    {
730 730
 		return false;
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
 	if ($pilot_name != "")
737 737
 	{
738
-	    $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING);
738
+	    $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING);
739 739
 	    if (!is_string($pilot_name))
740 740
 	    {
741 741
 		return false;
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
 	
747 747
 	if ($pilot_id != "")
748 748
 	{
749
-	    $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT);
749
+	    $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT);
750 750
 	    if (!is_string($pilot_id))
751 751
 	    {
752 752
 		return false;
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
 	
758 758
 	if ($departure_airport_route != "")
759 759
 	{
760
-	    $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING);
760
+	    $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING);
761 761
 	    if (!is_string($departure_airport_route))
762 762
 	    {
763 763
 		return false;
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
 	
769 769
 	if ($arrival_airport_route != "")
770 770
 	{
771
-	    $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING);
771
+	    $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING);
772 772
 	    if (!is_string($arrival_airport_route))
773 773
 	    {
774 774
 		return false;
@@ -781,8 +781,8 @@  discard block
 block discarded – undo
781 781
 	{
782 782
 	    $altitude_array = explode(",", $altitude);
783 783
 	    
784
-	    $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
785
-	    $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION);
784
+	    $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
785
+	    $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION);
786 786
 	    
787 787
 
788 788
 	    if ($altitude_array[1] != "")
@@ -800,8 +800,8 @@  discard block
 block discarded – undo
800 800
 	{
801 801
 	    $date_array = explode(",", $date_posted);
802 802
 	    
803
-	    $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING);
804
-	    $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING);
803
+	    $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING);
804
+	    $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING);
805 805
 	    
806 806
 	    if ($globalTimezone != '') {
807 807
 		date_default_timezone_set($globalTimezone);
@@ -833,8 +833,8 @@  discard block
 block discarded – undo
833 833
 	{
834 834
 	    $limit_array = explode(",", $limit);
835 835
 	    
836
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
837
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
836
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
837
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
838 838
 	    
839 839
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
840 840
 	    {
@@ -845,8 +845,8 @@  discard block
 block discarded – undo
845 845
 	
846 846
 
847 847
 	if ($origLat != "" && $origLon != "" && $dist != "") {
848
-		$dist = number_format($dist*0.621371,2,'.','');
849
-		$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 
848
+		$dist = number_format($dist*0.621371, 2, '.', '');
849
+		$query = "SELECT tracker_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(tracker_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(tracker_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(tracker_archive.longitude as double precision))*pi()/180/2),2))) as distance 
850 850
                           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)) 
851 851
                           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";
852 852
 	} else {
@@ -863,12 +863,12 @@  discard block
 block discarded – undo
863 863
 			$additional_query .= " AND (tracker_archive_output.waypoints <> '')";
864 864
 		}
865 865
 
866
-		$query  = "SELECT tracker_archive_output.* FROM tracker_archive_output 
866
+		$query = "SELECT tracker_archive_output.* FROM tracker_archive_output 
867 867
 		    WHERE tracker_archive_output.ident <> '' 
868 868
 		    ".$additional_query."
869 869
 		    ".$filter_query.$orderby_query;
870 870
 	}
871
-	$spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query);
871
+	$spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query);
872 872
 
873 873
 	return $spotter_array;
874 874
     }
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
                 try {
886 886
                         $sth = $this->db->prepare($query);
887 887
                         $sth->execute();
888
-                } catch(PDOException $e) {
888
+                } catch (PDOException $e) {
889 889
                         return "error";
890 890
                 }
891 891
 	}
@@ -922,8 +922,8 @@  discard block
 block discarded – undo
922 922
 	{
923 923
 	    $limit_array = explode(",", $limit);
924 924
 	    
925
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
926
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
925
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
926
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
927 927
 	    
928 928
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
929 929
 	    {
@@ -964,7 +964,7 @@  discard block
 block discarded – undo
964 964
 	$query_values = array();
965 965
 	$limit_query = '';
966 966
 	$additional_query = '';
967
-	$filter_query = $this->getFilter($filter,true,true);
967
+	$filter_query = $this->getFilter($filter, true, true);
968 968
 	
969 969
 	if ($owner != "")
970 970
 	{
@@ -981,8 +981,8 @@  discard block
 block discarded – undo
981 981
 	{
982 982
 	    $limit_array = explode(",", $limit);
983 983
 	    
984
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
985
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
984
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
985
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
986 986
 	    
987 987
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
988 988
 	    {
@@ -1022,7 +1022,7 @@  discard block
 block discarded – undo
1022 1022
 	$query_values = array();
1023 1023
 	$limit_query = '';
1024 1024
 	$additional_query = '';
1025
-	$filter_query = $this->getFilter($filter,true,true);
1025
+	$filter_query = $this->getFilter($filter, true, true);
1026 1026
 	
1027 1027
 	if ($pilot != "")
1028 1028
 	{
@@ -1034,8 +1034,8 @@  discard block
 block discarded – undo
1034 1034
 	{
1035 1035
 	    $limit_array = explode(",", $limit);
1036 1036
 	    
1037
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1038
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1037
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1038
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1039 1039
 	    
1040 1040
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1041 1041
 	    {
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
     * @return Array the airline country list
1066 1066
     *
1067 1067
     */
1068
-    public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '')
1068
+    public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '')
1069 1069
     {
1070 1070
 	global $globalDBdriver;
1071 1071
 	/*
@@ -1094,7 +1094,7 @@  discard block
 block discarded – undo
1094 1094
 	$flight_array = array();
1095 1095
 	$temp_array = array();
1096 1096
         
1097
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1097
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1098 1098
 	{
1099 1099
 	    $temp_array['flight_count'] = $row['nb'];
1100 1100
 	    $temp_array['flight_country'] = $row['name'];
@@ -1111,7 +1111,7 @@  discard block
 block discarded – undo
1111 1111
     * @return Array the airline country list
1112 1112
     *
1113 1113
     */
1114
-    public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '')
1114
+    public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '')
1115 1115
     {
1116 1116
 	global $globalDBdriver;
1117 1117
 	/*
@@ -1140,7 +1140,7 @@  discard block
 block discarded – undo
1140 1140
 	$flight_array = array();
1141 1141
 	$temp_array = array();
1142 1142
         
1143
-	while($row = $sth->fetch(PDO::FETCH_ASSOC))
1143
+	while ($row = $sth->fetch(PDO::FETCH_ASSOC))
1144 1144
 	{
1145 1145
 	    $temp_array['airline_icao'] = $row['airline_icao'];
1146 1146
 	    $temp_array['flight_count'] = $row['nb'];
@@ -1158,14 +1158,14 @@  discard block
 block discarded – undo
1158 1158
     * @return Array the spotter information
1159 1159
     *
1160 1160
     */
1161
-    public function getDateArchiveTrackerDataById($id,$date)
1161
+    public function getDateArchiveTrackerDataById($id, $date)
1162 1162
     {
1163 1163
 	$Tracker = new Tracker($this->db);
1164 1164
 	date_default_timezone_set('UTC');
1165 1165
 	$id = filter_var($id, FILTER_SANITIZE_STRING);
1166
-	$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';
1167
-	$date = date('c',$date);
1168
-	$spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date));
1166
+	$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';
1167
+	$date = date('c', $date);
1168
+	$spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date));
1169 1169
 	return $spotter_array;
1170 1170
     }
1171 1171
 
@@ -1175,14 +1175,14 @@  discard block
 block discarded – undo
1175 1175
     * @return Array the spotter information
1176 1176
     *
1177 1177
     */
1178
-    public function getDateArchiveTrackerDataByIdent($ident,$date)
1178
+    public function getDateArchiveTrackerDataByIdent($ident, $date)
1179 1179
     {
1180 1180
 	$Tracker = new Tracker($this->db);
1181 1181
 	date_default_timezone_set('UTC');
1182 1182
 	$ident = filter_var($ident, FILTER_SANITIZE_STRING);
1183
-	$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';
1184
-	$date = date('c',$date);
1185
-	$spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date));
1183
+	$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';
1184
+	$date = date('c', $date);
1185
+	$spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date));
1186 1186
 	return $spotter_array;
1187 1187
     }
1188 1188
 
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
     * @return Array the spotter information
1193 1193
     *
1194 1194
     */
1195
-    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array())
1195
+    public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array())
1196 1196
     {
1197 1197
 	global $global_query;
1198 1198
 	$Tracker = new Tracker($this->db);
@@ -1200,7 +1200,7 @@  discard block
 block discarded – undo
1200 1200
 	$query_values = array();
1201 1201
 	$limit_query = '';
1202 1202
 	$additional_query = '';
1203
-	$filter_query = $this->getFilter($filters,true,true);
1203
+	$filter_query = $this->getFilter($filters, true, true);
1204 1204
 	
1205 1205
 	if ($airport != "")
1206 1206
 	{
@@ -1217,8 +1217,8 @@  discard block
 block discarded – undo
1217 1217
 	{
1218 1218
 	    $limit_array = explode(",", $limit);
1219 1219
 	    
1220
-	    $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT);
1221
-	    $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT);
1220
+	    $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT);
1221
+	    $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT);
1222 1222
 	    
1223 1223
 	    if ($limit_array[0] >= 0 && $limit_array[1] >= 0)
1224 1224
 	    {
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.
header.php 3 patches
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -8,31 +8,31 @@  discard block
 block discarded – undo
8 8
 if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9 9
 else $MapType = $globalMapProvider;
10 10
 if (isset($_GET['3d'])) {
11
-	setcookie('MapFormat','3d');
11
+	setcookie('MapFormat', '3d');
12 12
 } else if (isset($_GET['2d'])) {
13
-	setcookie('MapFormat','2d');
13
+	setcookie('MapFormat', '2d');
14 14
 }
15 15
 
16 16
 if (isset($_POST['archive'])) {
17
-	setcookie('archive','true');
18
-	setcookie('archive_begin',strtotime($_POST['start_date']));
19
-	setcookie('archive_end',strtotime($_POST['end_date']));
20
-	setcookie('archive_speed',$_POST['archivespeed']);
17
+	setcookie('archive', 'true');
18
+	setcookie('archive_begin', strtotime($_POST['start_date']));
19
+	setcookie('archive_end', strtotime($_POST['end_date']));
20
+	setcookie('archive_speed', $_POST['archivespeed']);
21 21
 }
22 22
 if (isset($_POST['noarchive'])) {
23
-	setcookie('archive','false',-1);
24
-	setcookie('archive_begin','',-1);
25
-	setcookie('archive_end','',-1);
26
-	setcookie('archive_speed','',-1);
23
+	setcookie('archive', 'false', -1);
24
+	setcookie('archive_begin', '', -1);
25
+	setcookie('archive_end', '', -1);
26
+	setcookie('archive_speed', '', -1);
27 27
 }
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30
-	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
30
+	$allfilters = array_filter(array_keys($_COOKIE), function($key) {
31
+	    return strpos($key, 'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
35
-		setcookie($filt,null,-1);
35
+		setcookie($filt, null, -1);
36 36
 	}
37 37
 }
38 38
 ?>
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
241 241
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
242 242
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
243
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
243
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
244 244
 <?php
245 245
 		if (!isset($type) || $type == 'aircraft') {
246 246
 ?>
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
311 311
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
312 312
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
313
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
313
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if (isset($latitude)) print '&latitude='.$latitude; ?><?php if (isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
314 314
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
315 315
 <?php
316 316
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
 ?>
590 590
       <div class="search">
591 591
       <form action="<?php print $globalURL; ?>/search" method="get">
592
-		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != ""){ print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
592
+		<input type="text" name="q" value="<?php if (isset($GET['q'])) { if ($_GET['q'] != "") { print $_GET['q']; } else { print _("Search"); } } else { print _("Search"); } ?>" onfocus="if (this.value=='search'){this.value='';}" /><button type="submit"><i class="fa fa-search"></i></button>
593 593
 	</form>
594 594
 	</div>
595 595
   	<div class="social">
@@ -607,7 +607,7 @@  discard block
 block discarded – undo
607 607
 	print '</div>';
608 608
 }
609 609
 
610
-if (strtolower($current_page) =='ident-detailed' || strtolower($current_page) == 'flightid-overview') {
610
+if (strtolower($current_page) == 'ident-detailed' || strtolower($current_page) == 'flightid-overview') {
611 611
 ?>
612 612
     <div class="top-header clear" role="main">
613 613
 <?php
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
     </div>
621 621
 <?php
622 622
 }
623
-if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
623
+if ((strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) || (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false))
624 624
 {
625 625
     ?>
626 626
     <div class="top-header clear" role="main">
@@ -633,15 +633,15 @@  discard block
 block discarded – undo
633 633
         var zoom = 13;
634 634
 //create the map
635 635
 <?php
636
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
636
+    if (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($airport_array[0]['latitude'])) {
637 637
 ?>
638 638
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
639 639
 <?php
640
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
640
+    } elseif (strpos(strtolower($current_page), 'airport-') !== false && strpos(strtolower($current_page), 'statistics-') === false) {
641 641
 ?>
642 642
   map = L.map('map', { zoomControl:true });
643 643
 <?php
644
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
644
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
645 645
 ?>
646 646
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
647 647
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
650 650
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
651 651
 <?php
652
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
652
+    } elseif (strpos(strtolower($current_page), 'route-') !== false && strpos(strtolower($current_page), 'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
653 653
 ?>
654 654
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
655 655
 <?php
Please login to merge, or discard this patch.
Braces   +77 added lines, -17 removed lines patch added patch discarded remove patch
@@ -3,10 +3,15 @@  discard block
 block discarded – undo
3 3
 //gets the page file and stores it in a variable
4 4
 $file_path = pathinfo($_SERVER['SCRIPT_NAME']);
5 5
 $current_page = $file_path['filename'];
6
-if ($globalTimezone == '') $globalTimezone = 'UTC';
6
+if ($globalTimezone == '') {
7
+	$globalTimezone = 'UTC';
8
+}
7 9
 date_default_timezone_set($globalTimezone);
8
-if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType'];
9
-else $MapType = $globalMapProvider;
10
+if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') {
11
+	$MapType = $_COOKIE['MapType'];
12
+} else {
13
+	$MapType = $globalMapProvider;
14
+}
10 15
 if (isset($_GET['3d'])) {
11 16
 	setcookie('MapFormat','3d');
12 17
 } else if (isset($_GET['2d'])) {
@@ -231,7 +236,13 @@  discard block
 block discarded – undo
231 236
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
232 237
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
233 238
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
234
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
239
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) {
240
+	print '&latitude='.$latitude;
241
+}
242
+?><?php if(isset($longitude)) {
243
+	print '&longitude='.$longitude;
244
+}
245
+?>&<?php print time(); ?>"></script>
235 246
 <?php
236 247
 		if (!isset($type) || $type == 'aircraft') {
237 248
 ?>
@@ -300,7 +311,13 @@  discard block
 block discarded – undo
300 311
 <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script>
301 312
 <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script>
302 313
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
303
-<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script>
314
+<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) {
315
+	print '&latitude='.$latitude;
316
+}
317
+?><?php if(isset($longitude)) {
318
+	print '&longitude='.$longitude;
319
+}
320
+?>&<?php print time(); ?>"></script>
304 321
 <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script>
305 322
 <?php
306 323
 		if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) {
@@ -381,7 +398,12 @@  discard block
 block discarded – undo
381 398
         <span class="icon-bar"></span>
382 399
       </button>
383 400
       <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a>
384
-      <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
401
+      <a class="navbar-brand" href="<?php if ($globalURL == '') {
402
+	print '/';
403
+} else {
404
+	print $globalURL;
405
+}
406
+?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a>
385 407
     </div>
386 408
     <div class="collapse navbar-collapse">
387 409
 
@@ -420,7 +442,10 @@  discard block
 block discarded – undo
420 442
 <?php
421 443
     }
422 444
 ?>
423
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
445
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
446
+	echo 'right-';
447
+}
448
+?>caret"></b></a>
424 449
           <ul class="dropdown-menu">
425 450
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
426 451
 <?php
@@ -491,8 +516,14 @@  discard block
 block discarded – undo
491 516
         </li>
492 517
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
493 518
       	<li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li>
494
-        <li class="dropdown<?php if ($sub) echo '-submenu'; ?>">
495
-          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
519
+        <li class="dropdown<?php if ($sub) {
520
+	echo '-submenu';
521
+}
522
+?>">
523
+          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) {
524
+	echo 'right-';
525
+}
526
+?>caret"></b></a>
496 527
           <ul class="dropdown-menu">
497 528
           	<li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li>
498 529
           	<li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li>
@@ -528,7 +559,10 @@  discard block
 block discarded – undo
528 559
 <?php
529 560
 	}
530 561
 ?>
531
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
562
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
563
+	echo 'right-';
564
+}
565
+?>caret"></b></a>
532 566
 		<ul class="dropdown-menu">
533 567
 		    <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li>
534 568
 		    <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -560,7 +594,10 @@  discard block
 block discarded – undo
560 594
 <?php
561 595
 	}
562 596
 ?>
563
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
597
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
598
+	echo 'right-';
599
+}
600
+?>caret"></b></a>
564 601
 		<ul class="dropdown-menu">
565 602
 		    <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li>
566 603
 		    <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -593,7 +630,10 @@  discard block
 block discarded – undo
593 630
 	}
594 631
 ?>
595 632
 <!--
596
-		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
633
+		<a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) {
634
+	echo 'right-';
635
+}
636
+?>caret"></b></a>
597 637
 		<ul class="dropdown-menu">
598 638
 		    <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li>
599 639
 		    <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li>
@@ -650,7 +690,9 @@  discard block
 block discarded – undo
650 690
   		        $alllang = $Language->getLanguages();
651 691
   		        foreach ($alllang as $key => $lang) {
652 692
   		            print '<option value="'.$key.'"';
653
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
693
+  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) {
694
+  		            	print ' selected ';
695
+  		            }
654 696
   		            print '>'.$lang[0].'</option>';
655 697
   		        }
656 698
   		    ?>
@@ -790,9 +832,24 @@  discard block
 block discarded – undo
790 832
 	$customid = $globalMapProvider;
791 833
 ?>
792 834
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
793
-        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>,
794
-        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>,
795
-        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>,
835
+        maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) {
836
+	print $globalMapCustomLayer[$customid]['maxZoom'];
837
+} else {
838
+	print '18';
839
+}
840
+?>,
841
+        minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) {
842
+	print $globalMapCustomLayer[$customid]['minZoom'];
843
+} else {
844
+	print '0';
845
+}
846
+?>,
847
+        noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) {
848
+	print 'false';
849
+} else {
850
+	print 'true';
851
+}
852
+?>,
796 853
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
797 854
     }).addTo(map);
798 855
 <?php
@@ -815,4 +872,7 @@  discard block
 block discarded – undo
815 872
 
816 873
 ?>
817 874
 
818
-<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear">
875
+<section class="container main-content <?php if (strtolower($current_page) == 'index') {
876
+	print 'index ';
877
+}
878
+?>clear">
Please login to merge, or discard this patch.
Indentation   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 // When button "Remove all filters" is clicked
29 29
 if (isset($_POST['removefilters'])) {
30 30
 	$allfilters = array_filter(array_keys($_COOKIE),function($key) {
31
-	    return strpos($key,'filter_') === 0;
31
+		return strpos($key,'filter_') === 0;
32 32
 	});
33 33
 	foreach ($allfilters as $filt) {
34 34
 		unset($_COOKIE[$filt]);
@@ -160,17 +160,17 @@  discard block
 block discarded – undo
160 160
 	}
161 161
 ?>
162 162
 <?php 
163
-    if (isset($_POST['archive'])) {
163
+	if (isset($_POST['archive'])) {
164 164
 ?>
165 165
 <script src="<?php print $globalURL; ?>/js/map.common.js"></script>
166 166
 <?php 
167
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
167
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
168 168
 ?>
169 169
 
170 170
 <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script>
171 171
 <?php    
172
-	    }
173
-    } else {
172
+		}
173
+	} else {
174 174
 ?>
175 175
 <?php
176 176
 /*	if (isset($globalBeta) && $globalBeta) {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 */
183 183
 ?>
184 184
 <?php 
185
-	    if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
185
+		if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) {
186 186
 ?>
187 187
 <?php
188 188
 //		if (isset($globalBeta) && $globalBeta) {
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 <script src="<?php print $globalURL; ?>/js/map-satellite.2d.js.php?<?php print time(); ?>"></script>
214 214
 <?php
215 215
 		}
216
-	    }
216
+		}
217 217
 ?>
218 218
 <?php
219 219
 //	}
220 220
 ?>
221 221
 <?php
222
-    }
222
+	}
223 223
 }
224 224
 ?>
225 225
 <?php
@@ -397,61 +397,61 @@  discard block
 block discarded – undo
397 397
       <ul class="nav navbar-nav">
398 398
 
399 399
 <?php 
400
-    $sub = false;
401
-    if (
400
+	$sub = false;
401
+	if (
402 402
 	(
403
-	    (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
403
+		(!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
404 404
 	) || 
405 405
 	(
406
-	    isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
406
+		isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
407 407
 	) || 
408 408
 	(
409
-	    isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
409
+		isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE))
410 410
 	) || 
411 411
 	(
412
-	    isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
412
+		isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))
413 413
 	)
414
-    ) {
414
+	) {
415 415
 	$sub = true;
416
-    }
416
+	}
417 417
 ?>
418 418
 <?php
419
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
419
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
420 420
 ?>
421 421
     <li class="dropdown">
422 422
 <?php
423
-    if ($sub) {
423
+	if ($sub) {
424 424
 ?>
425 425
       	<li class="dropdown">
426 426
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a>
427 427
 	<ul class="dropdown-menu multi-level">
428 428
       	<li class="dropdown-submenu">
429 429
 <?php
430
-    }
430
+	}
431 431
 ?>
432 432
           <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a>
433 433
           <ul class="dropdown-menu">
434 434
           	<li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li>
435 435
 <?php
436
-    if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
436
+	if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) {
437 437
 ?>
438 438
 			<li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li>
439 439
 <?php
440
-    }
440
+	}
441 441
 ?>
442 442
 			<li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li>
443 443
 <?php
444
-    if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
444
+	if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) {
445 445
 ?>
446 446
 			<li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li>
447 447
 <?php
448
-    } 
449
-    if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
448
+	} 
449
+	if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) {
450 450
 
451 451
 ?>
452 452
 			<li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li>
453 453
 <?php
454
-    }
454
+	}
455 455
 ?>
456 456
 			<li><hr /></li>
457 457
             <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li>
@@ -459,43 +459,43 @@  discard block
 block discarded – undo
459 459
             <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li>
460 460
             <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li>
461 461
             <?php
462
-        	if ($globalACARS) {
463
-        	    if (isset($globalDemo) && $globalDemo) {
464
-    	    ?>
462
+			if ($globalACARS) {
463
+				if (isset($globalDemo) && $globalDemo) {
464
+			?>
465 465
             <li><hr /></li>
466 466
             <li><i><?php echo _('ACARS data not available publicly'); ?></i></li>
467 467
             <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li>
468 468
             <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li>
469 469
             <?php
470
-        	    } else {
471
-    	    ?>
470
+				} else {
471
+			?>
472 472
             <li><hr /></li>
473 473
             <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li>
474 474
             <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li>
475 475
             <?php
476
-        	    }
477
-        	}
478
-    	    ?>
476
+				}
477
+			}
478
+			?>
479 479
     	    <?php
480
-    	        if (isset($globalAccidents) && $globalAccidents) {
481
-    	    ?>
480
+				if (isset($globalAccidents) && $globalAccidents) {
481
+			?>
482 482
             <li><hr /></li>
483 483
             <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li>
484 484
             <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li>
485 485
             <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li>
486 486
             <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li>
487 487
             <?php
488
-        	}
489
-    	    ?>
488
+			}
489
+			?>
490 490
             <li><hr /></li>
491 491
             <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li>
492 492
             <?php
493 493
 		if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) {
494
-	    ?>
494
+		?>
495 495
             <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li>
496 496
 	    <?php
497 497
 		}
498
-	    ?>
498
+		?>
499 499
           </ul>
500 500
         </li>
501 501
       	<li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li>
@@ -522,14 +522,14 @@  discard block
 block discarded – undo
522 522
     </ul>
523 523
 <?php
524 524
 	}
525
-    }
525
+	}
526 526
 ?>
527 527
 <?php
528
-    if (isset($globalMarine) && $globalMarine) {
528
+	if (isset($globalMarine) && $globalMarine) {
529 529
 ?>
530 530
     <li class="dropdown">
531 531
 <?php
532
-        if ($sub) {
532
+		if ($sub) {
533 533
 ?>
534 534
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a>
535 535
 	<ul class="dropdown-menu multi-level">
@@ -554,14 +554,14 @@  discard block
 block discarded – undo
554 554
 	}
555 555
 ?>
556 556
 <?php
557
-    }
557
+	}
558 558
 ?>
559 559
 <?php
560
-    if (isset($globalTracker) && $globalTracker) {
560
+	if (isset($globalTracker) && $globalTracker) {
561 561
 ?>
562 562
     <li class="dropdown">
563 563
 <?php
564
-        if ($sub) {
564
+		if ($sub) {
565 565
 ?>
566 566
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a>
567 567
 	<ul class="dropdown-menu multi-level">
@@ -586,14 +586,14 @@  discard block
 block discarded – undo
586 586
 	}
587 587
 ?>
588 588
 <?php
589
-    }
589
+	}
590 590
 ?>
591 591
 <?php
592
-    if (isset($globalSatellite) && $globalSatellite) {
592
+	if (isset($globalSatellite) && $globalSatellite) {
593 593
 ?>
594 594
     <li class="dropdown">
595 595
 <?php
596
-        if ($sub) {
596
+		if ($sub) {
597 597
 ?>
598 598
     <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellite"); ?> <b class="caret"></b></a>
599 599
 	<ul class="dropdown-menu multi-level">
@@ -620,7 +620,7 @@  discard block
 block discarded – undo
620 620
 	}
621 621
 ?>
622 622
 <?php
623
-    }
623
+	}
624 624
 ?>
625 625
 
626 626
         <li class="dropdown">
@@ -629,12 +629,12 @@  discard block
 block discarded – undo
629 629
           	<li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li>
630 630
           	<li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li>
631 631
 <?php
632
-    if (!isset($globalAircraft) || $globalAircraft === TRUE) {
632
+	if (!isset($globalAircraft) || $globalAircraft === TRUE) {
633 633
 ?>
634 634
 		<li><hr /></li>
635 635
 		<li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li>
636 636
 <?php
637
-    }
637
+	}
638 638
 ?>
639 639
 	    <?php if (isset($globalContribute) && $globalContribute) { ?>
640 640
                 <li><hr /></li>
@@ -655,14 +655,14 @@  discard block
 block discarded – undo
655 655
   	    <form>
656 656
   		<select class="selectpicker" data-width="120px" onchange="language(this);">
657 657
   		    <?php
658
-  		        $Language = new Language();
659
-  		        $alllang = $Language->getLanguages();
660
-  		        foreach ($alllang as $key => $lang) {
661
-  		            print '<option value="'.$key.'"';
662
-  		            if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
663
-  		            print '>'.$lang[0].'</option>';
664
-  		        }
665
-  		    ?>
658
+  				$Language = new Language();
659
+  				$alllang = $Language->getLanguages();
660
+  				foreach ($alllang as $key => $lang) {
661
+  					print '<option value="'.$key.'"';
662
+  					if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected ';
663
+  					print '>'.$lang[0].'</option>';
664
+  				}
665
+  			?>
666 666
   		</select>
667 667
   	    </form>
668 668
   	</div>
@@ -693,18 +693,18 @@  discard block
 block discarded – undo
693 693
 ?>
694 694
     <div class="top-header clear" role="main">
695 695
 <?php
696
-    if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
696
+	if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) {
697 697
 ?>
698 698
     <div id="archive-map"></div>
699 699
 <?php
700
-    }
700
+	}
701 701
 ?>
702 702
     </div>
703 703
 <?php
704 704
 }
705 705
 if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false))
706 706
 {
707
-    ?>
707
+	?>
708 708
     <div class="top-header clear" role="main">
709 709
         <div id="map"></div>
710 710
 	<link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" />
@@ -715,15 +715,15 @@  discard block
 block discarded – undo
715 715
         var zoom = 13;
716 716
 //create the map
717 717
 <?php
718
-    if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
718
+	if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) {
719 719
 ?>
720 720
   map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom);
721 721
 <?php
722
-    } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
722
+	} elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) {
723 723
 ?>
724 724
   map = L.map('map', { zoomControl:true });
725 725
 <?php
726
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
726
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) {
727 727
 ?>
728 728
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]);
729 729
     var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map);
@@ -731,22 +731,22 @@  discard block
 block discarded – undo
731 731
     var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
732 732
     var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map);
733 733
 <?php
734
-    } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
734
+	} elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) {
735 735
 ?>
736 736
   map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]);
737 737
 <?php
738
-    } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
738
+	} elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) {
739 739
 ?>
740 740
   map = L.map('map', { zoomControl:true });
741 741
 <?php
742
-    }
742
+	}
743 743
 ?>
744 744
   //initialize the layer group for the aircrft markers
745 745
   var layer_data = L.layerGroup();
746 746
 
747 747
   //a few title layers
748 748
 <?php
749
-    if ($globalMapProvider == 'Mapbox') {
749
+	if ($globalMapProvider == 'Mapbox') {
750 750
 ?>
751 751
   L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', {
752 752
     maxZoom: 18,
@@ -757,7 +757,7 @@  discard block
 block discarded – undo
757 757
     token : '<?php print $globalMapboxToken; ?>'
758 758
   }).addTo(map);
759 759
 <?php
760
-    } elseif ($globalMapProvider == 'MapQuest-OSM') {
760
+	} elseif ($globalMapProvider == 'MapQuest-OSM') {
761 761
 ?>
762 762
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
763 763
     maxZoom: 18,
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>'
767 767
   }).addTo(map);
768 768
 <?php
769
-    } elseif ($globalMapProvider == 'MapQuest-Aerial') {
769
+	} elseif ($globalMapProvider == 'MapQuest-Aerial') {
770 770
 ?>
771 771
   L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', {
772 772
     maxZoom: 18,
@@ -775,27 +775,27 @@  discard block
 block discarded – undo
775 775
       'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"'
776 776
   }).addTo(map);
777 777
 <?php
778
-    } elseif ($globalMapProvider == 'Google-Roadmap') {
778
+	} elseif ($globalMapProvider == 'Google-Roadmap') {
779 779
 ?>
780 780
     var googleLayer = new L.Google('ROADMAP');
781 781
     map.addLayer(googleLayer);
782 782
 <?php
783
-    } elseif ($globalMapProvider == 'Google-Satellite') {
783
+	} elseif ($globalMapProvider == 'Google-Satellite') {
784 784
 ?>
785 785
     var googleLayer = new L.Google('SATELLITE');
786 786
     map.addLayer(googleLayer);
787 787
 <?php
788
-    } elseif ($globalMapProvider == 'Google-Hybrid') {
788
+	} elseif ($globalMapProvider == 'Google-Hybrid') {
789 789
 ?>
790 790
     var googleLayer = new L.Google('HYBRID');
791 791
     map.addLayer(googleLayer);
792 792
 <?php
793
-    } elseif ($globalMapProvider == 'Google-Terrain') {
793
+	} elseif ($globalMapProvider == 'Google-Terrain') {
794 794
 ?>
795 795
     var googleLayer = new L.Google('Terrain');
796 796
     map.addLayer(googleLayer);
797 797
 <?php
798
-    } elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
798
+	} elseif (isset($globalMapCustomLayer[$globalMapProvider])) {
799 799
 	$customid = $globalMapProvider;
800 800
 ?>
801 801
     L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', {
@@ -805,8 +805,8 @@  discard block
 block discarded – undo
805 805
         attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>'
806 806
     }).addTo(map);
807 807
 <?php
808
-    //} elseif ($globalMapProvider == 'OpenStreetMap') {
809
-    } else {
808
+	//} elseif ($globalMapProvider == 'OpenStreetMap') {
809
+	} else {
810 810
 ?>
811 811
   L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
812 812
     maxZoom: 18,
@@ -815,7 +815,7 @@  discard block
 block discarded – undo
815 815
   }).addTo(map);
816 816
 
817 817
 <?php
818
-    }
818
+	}
819 819
 ?>
820 820
         </script>
821 821
     </div>
Please login to merge, or discard this patch.
pilot-detailed.php 2 patches
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -7,14 +7,14 @@  discard block
 block discarded – undo
7 7
 //require_once('require/class.SpotterLive.php');
8 8
 require_once('require/class.SpotterArchive.php');
9 9
 
10
-if (!isset($_GET['pilot'])){
10
+if (!isset($_GET['pilot'])) {
11 11
 	header('Location: '.$globalURL.'/');
12 12
 } else {
13 13
 	$Spotter = new Spotter();
14 14
 	$SpotterArchive = new SpotterArchive();
15 15
 	$Translation = new Translation();
16 16
 	//calculuation for the pagination
17
-	if(!isset($_GET['limit']))
17
+	if (!isset($_GET['limit']))
18 18
 	{
19 19
 		$limit_start = 0;
20 20
 		$limit_end = 25;
@@ -35,29 +35,29 @@  discard block
 block discarded – undo
35 35
 	
36 36
 	$page_url = $globalURL.'/pilot/'.$_GET['pilot'];
37 37
 	
38
-	$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING);
39
-	$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING);
40
-	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41
-	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
38
+	$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING);
39
+	$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING);
40
+	$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT);
41
+	$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') $filter = array_merge($filter, array('year' => $year));
44
+	if ($month != '') $filter = array_merge($filter, array('month' => $month));
45 45
 	if ($sort != '') 
46 46
 	{
47
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
47
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
48 48
 		if (empty($spotter_array)) {
49
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
49
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, $sort, $filter);
50 50
 		}
51 51
 	} else {
52
-		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
52
+		$spotter_array = $Spotter->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
53 53
 		if (empty($spotter_array)) {
54
-			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference,'',$filter);
54
+			$spotter_array = $SpotterArchive->getSpotterDataByPilot($pilot, $limit_start.",".$absolute_difference, '', $filter);
55 55
 		}
56 56
 	}
57 57
 
58 58
 	if (!empty($spotter_array))
59 59
 	{
60
-		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
60
+		$title = sprintf(_("Detailed View for %s"), $spotter_array[0]['pilot_name']);
61 61
 		$ident = $spotter_array[0]['ident'];
62 62
 		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63 63
 		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
@@ -118,23 +118,23 @@  discard block
 block discarded – undo
118 118
 			$Stats = new Stats();
119 119
 			$flights = $Stats->getStatsPilot($pilot);
120 120
 		} else $flights = 0;
121
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
121
+		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot, $filter);
122 122
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
123
-		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
123
+		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot, $filter));
124 124
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
125
-		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot,$filter));
125
+		$aircraft_registration = count($Spotter->countAllAircraftRegistrationByPilot($pilot, $filter));
126 126
 		print '<div><span class="label">'._("Aircrafts").'</span>'.$aircraft_registration.'</div>';
127
-		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot,$filter));
127
+		$aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByPilot($pilot, $filter));
128 128
 		print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>';
129
-		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
129
+		$airlines = count($Spotter->countAllAirlinesByPilot($pilot, $filter));
130 130
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
131
-		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
131
+		$duration = $Spotter->getFlightDurationByPilot($pilot, $filter);
132 132
 		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
133 133
 		print '</div>';
134 134
 	
135 135
 		include('owner-sub-menu.php');
136 136
 		print '<div class="table column">';
137
-		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>';
137
+		print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the pilot <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>';
138 138
 
139 139
 		include('table-output.php'); 
140 140
 		print '<div class="pagination">';
Please login to merge, or discard this patch.
Braces   +24 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,8 +40,12 @@  discard block
 block discarded – undo
40 40
 	$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT);
41 41
 	$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT);
42 42
 	$filter = array();
43
-	if ($year != '') $filter = array_merge($filter,array('year' => $year));
44
-	if ($month != '') $filter = array_merge($filter,array('month' => $month));
43
+	if ($year != '') {
44
+		$filter = array_merge($filter,array('year' => $year));
45
+	}
46
+	if ($month != '') {
47
+		$filter = array_merge($filter,array('month' => $month));
48
+	}
45 49
 	if ($sort != '') 
46 50
 	{
47 51
 		$spotter_array = $Spotter->getSpotterDataByPilot($pilot,$limit_start.",".$absolute_difference, $sort,$filter);
@@ -59,8 +63,12 @@  discard block
 block discarded – undo
59 63
 	{
60 64
 		$title = sprintf(_("Detailed View for %s"),$spotter_array[0]['pilot_name']);
61 65
 		$ident = $spotter_array[0]['ident'];
62
-		if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude'];
63
-		if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude'];
66
+		if (isset($spotter_array[0]['latitude'])) {
67
+			$latitude = $spotter_array[0]['latitude'];
68
+		}
69
+		if (isset($spotter_array[0]['longitude'])) {
70
+			$longitude = $spotter_array[0]['longitude'];
71
+		}
64 72
 		require_once('header.php');
65 73
 		/*
66 74
 		if (isset($globalArchive) && $globalArchive) {
@@ -113,12 +121,18 @@  discard block
 block discarded – undo
113 121
 		*/
114 122
 		print '<div class="info column">';
115 123
 		print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>';
116
-		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
124
+		if (isset($spotter_array[0]['pilot_id']) && $spotter_array[0]['pilot_id'] != '') {
125
+			print '<div><span class="label">'._("Pilot ID").'</span>'.$spotter_array[0]['pilot_id'].'</div>';
126
+		}
117 127
 		if ($year == '' && $month == '') {
118 128
 			$Stats = new Stats();
119 129
 			$flights = $Stats->getStatsPilot($pilot);
120
-		} else $flights = 0;
121
-		if ($flights == 0) $flights = $Spotter->countFlightsByPilot($pilot,$filter);
130
+		} else {
131
+			$flights = 0;
132
+		}
133
+		if ($flights == 0) {
134
+			$flights = $Spotter->countFlightsByPilot($pilot,$filter);
135
+		}
122 136
 		print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>';
123 137
 		$aircraft_type = count($Spotter->countAllAircraftTypesByPilot($pilot,$filter));
124 138
 		print '<div><span class="label">'._("Aircrafts type").'</span>'.$aircraft_type.'</div>';
@@ -129,7 +143,9 @@  discard block
 block discarded – undo
129 143
 		$airlines = count($Spotter->countAllAirlinesByPilot($pilot,$filter));
130 144
 		print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>';
131 145
 		$duration = $Spotter->getFlightDurationByPilot($pilot,$filter);
132
-		if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
146
+		if ($duration != '0') {
147
+			print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>';
148
+		}
133 149
 		print '</div>';
134 150
 	
135 151
 		include('owner-sub-menu.php');
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
 	$flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],';
68 68
 }
@@ -111,8 +111,8 @@  discard block
 block discarded – undo
111 111
 	print '</thead>';
112 112
 	print '<tbody>';
113 113
 	$i = 1;
114
-	array_splice($flightover_array,10);
115
-	foreach($flightover_array as $flightover_item)
114
+	array_splice($flightover_array, 10);
115
+	foreach ($flightover_array as $flightover_item)
116 116
 	{
117 117
 		print '<tr>';
118 118
 		print '<td><strong>'.$i.'</strong></td>';
Please login to merge, or discard this patch.
Braces   +7 added lines, -3 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'); 
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.
require/class.MarineImport.php 3 patches
Spacing   +83 added lines, -83 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	    if (isset($this->all_tracked[$key]['id'])) {
59 59
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
60 60
     		$Marine = new Marine($this->db);
61
-        	$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
61
+        	$Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
62 62
             }
63 63
 	}
64 64
     }
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
70 70
 	foreach ($this->all_tracked as $key => $flight) {
71 71
     	    if (isset($flight['lastupdate'])) {
72
-        	if ($flight['lastupdate'] < (time()-3000)) {
72
+        	if ($flight['lastupdate'] < (time() - 3000)) {
73 73
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74 74
             		if (isset($this->all_tracked[$key]['id'])) {
75 75
             		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
             		    //$real_arrival = $this->arrival($key);
82 82
             		    $Marine = new Marine($this->db);
83 83
             		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
84
-				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
84
+				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']);
85 85
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
86 86
 			    }
87 87
 			    // Put in archive
@@ -95,14 +95,14 @@  discard block
 block discarded – undo
95 95
     }
96 96
 
97 97
     public function add($line) {
98
-	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
98
+	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine;
99 99
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
100 100
 	date_default_timezone_set('UTC');
101 101
 	$dataFound = false;
102 102
 	$send = false;
103 103
 	
104 104
 	// SBS format is CSV format
105
-	if(is_array($line) && isset($line['mmsi'])) {
105
+	if (is_array($line) && isset($line['mmsi'])) {
106 106
 	    //print_r($line);
107 107
   	    if (isset($line['mmsi'])) {
108 108
 
@@ -126,18 +126,18 @@  discard block
 block discarded – undo
126 126
 		
127 127
 		if (!isset($this->all_tracked[$id])) {
128 128
 		    $this->all_tracked[$id] = array();
129
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
130
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
131
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
129
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0));
130
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => ''));
131
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time()));
132 132
 		    if (!isset($line['id'])) {
133 133
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
134
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
135
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
134
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi')));
135
+		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id']));
136 136
 		    if ($globalAllTracked !== FALSE) $dataFound = true;
137 137
 		}
138 138
 		
139 139
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
140
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
140
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi']));
141 141
 		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
142 142
 			$Marine = new Marine($this->db);
143 143
 			$identity = $Marine->getIdentity($line['mmsi']);
@@ -151,64 +151,64 @@  discard block
 block discarded – undo
151 151
 		    }
152 152
 		}
153 153
 		if (isset($line['type_id'])) {
154
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
154
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id'])));
155 155
 		}
156 156
 		if (isset($line['type']) && $line['type'] != '') {
157
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
157
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type']));
158 158
 		}
159 159
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
160
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
160
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type']));
161 161
 		}
162 162
 		if (isset($line['imo']) && $line['imo'] != '') {
163
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
163
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo']));
164 164
 		}
165 165
 		if (isset($line['callsign']) && $line['callsign'] != '') {
166
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
166
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign']));
167 167
 		}
168 168
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
169
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
169
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code']));
170 170
 		}
171 171
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
172
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
172
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date']));
173 173
 		}
174 174
 
175 175
 
176 176
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
177 177
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
178
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
178
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident'])));
179 179
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
180 180
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
181 181
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
182 182
 				$timeelapsed = microtime(true);
183 183
 				$Marine = new Marine($this->db);
184 184
 				$fromsource = NULL;
185
-				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
185
+				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource);
186 186
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
187 187
 				$Marine->db = null;
188
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
188
+				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
189 189
 			    }
190 190
 			}
191 191
 		    }
192
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
192
+		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident']));
193 193
 		}
194 194
 
195
-		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
195
+		if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) {
196 196
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
197
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
197
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime']));
198 198
 		    } else {
199 199
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
200 200
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
201 201
 				return '';
202 202
 		    }
203
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
203
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) {
204 204
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
205 205
 			return '';
206
-		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
206
+		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) {
207 207
 			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
208 208
 			return '';
209 209
 		} elseif (!isset($line['datetime'])) {
210 210
 			date_default_timezone_set('UTC');
211
-			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
211
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s')));
212 212
 		} else {
213 213
 			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
214 214
 			return '';
@@ -216,24 +216,24 @@  discard block
 block discarded – undo
216 216
 
217 217
 
218 218
 		if (isset($line['speed'])) {
219
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
219
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'])));
220
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true));
221 221
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
222
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
222
+		    $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm');
223 223
 		    if ($distance > 1000 && $distance < 10000) {
224 224
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
225 225
 			$speed = $speed*3.6;
226
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
226
+			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed)));
227 227
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
228 228
 		    }
229 229
 		}
230 230
 
231 231
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
232
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
232
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']);
233 233
 	    	    else unset($timediff);
234
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
234
+	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) {
235 235
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
236
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
236
+			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) {
237 237
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
238 238
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
239 239
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -242,10 +242,10 @@  discard block
 block discarded – undo
242 242
 				$timeelapsed = microtime(true);
243 243
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
244 244
 				    $Marine = new Marine($this->db);
245
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
245
+				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']);
246 246
 				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
247 247
 				    $Marine->db = null;
248
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
248
+				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
249 249
 				}
250 250
 				$this->tmd = 0;
251 251
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
@@ -254,52 +254,52 @@  discard block
 block discarded – undo
254 254
 
255 255
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
256 256
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
257
-				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
257
+				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
258 258
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
259 259
 				    $dataFound = true;
260 260
 				    $this->all_tracked[$id]['time_last_coord'] = time();
261 261
 				}
262
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
262
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude']));
263 263
 			}
264 264
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
265 265
 			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
266 266
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
267
-				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
267
+				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
268 268
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
269 269
 				    $dataFound = true;
270 270
 				    $this->all_tracked[$id]['time_last_coord'] = time();
271 271
 				}
272
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
272
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude']));
273 273
 			}
274 274
 
275 275
 		    } else if ($globalDebug && $timediff > 20) {
276 276
 			$this->tmd = $this->tmd + 1;
277 277
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
278
-			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
279
-			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
278
+			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -";
279
+			echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - ";
280 280
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
281 281
 		    }
282 282
 		}
283 283
 		if (isset($line['last_update']) && $line['last_update'] != '') {
284 284
 		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
285
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
285
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update']));
286 286
 		}
287 287
 		if (isset($line['format_source']) && $line['format_source'] != '') {
288
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
288
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source']));
289 289
 		}
290 290
 		if (isset($line['source_name']) && $line['source_name'] != '') {
291
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
291
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name']));
292 292
 		}
293 293
 		if (isset($line['status']) && $line['status'] != '') {
294
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
294
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status']));
295 295
 		}
296 296
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
297
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
297
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id']));
298 298
 		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
299 299
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
300 300
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
301 301
 				$Marine = new Marine($this->db);
302
-				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
302
+				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']);
303 303
 				unset($Marine);
304 304
 			    }
305 305
 			}
@@ -307,18 +307,18 @@  discard block
 block discarded – undo
307 307
 		}
308 308
 
309 309
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
310
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
310
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true));
311 311
 		}
312 312
 		
313 313
 		if (isset($line['heading']) && $line['heading'] != '') {
314
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
315
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
316
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
314
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
315
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading'])));
316
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true));
317 317
 		    //$dataFound = true;
318 318
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
319
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
320
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
321
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
319
+  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
320
+		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading)));
321
+		    if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
322 322
   		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
323 323
   		}
324 324
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
329 329
 		    $this->all_tracked[$id]['lastupdate'] = time();
330 330
 		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
331
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
331
+		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
332 332
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
333 333
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
334 334
 				    if ($globalDebug) echo "Check if aircraft is already in DB...";
@@ -336,37 +336,37 @@  discard block
 block discarded – undo
336 336
 				    $MarineLive = new MarineLive($this->db);
337 337
 				    if (isset($line['id'])) {
338 338
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
339
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
339
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
340 340
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
341 341
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
342
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
342
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
343 343
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
344 344
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
345
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
345
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
346 346
 				    } else $recent_ident = '';
347
-				    $MarineLive->db=null;
347
+				    $MarineLive->db = null;
348 348
 				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
349 349
 				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
350 350
 				} else $recent_ident = '';
351 351
 			    } else {
352 352
 				$recent_ident = '';
353
-				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
353
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0));
354 354
 			    }
355 355
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
356
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
356
+			    if ($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
357 357
 			    {
358 358
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
359 359
 				//adds the spotter data for the archive
360 360
 				    $highlight = '';
361
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
361
+				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
362 362
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
363 363
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
364 364
 					    $timeelapsed = microtime(true);
365 365
 					    $Marine = new Marine($this->db);
366
-					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
366
+					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']);
367 367
 					    $Marine->db = null;
368 368
 					    if ($globalDebug && isset($result)) echo $result."\n";
369
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
369
+					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
370 370
 					}
371 371
 				    }
372 372
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
@@ -374,15 +374,15 @@  discard block
 block discarded – undo
374 374
 					$Stats = new Stats($this->db);
375 375
 					if (!empty($this->stats)) {
376 376
 					    if ($globalDebug) echo 'Add source stats : ';
377
-				    	    foreach($this->stats as $date => $data) {
378
-						foreach($data as $source => $sourced) {
377
+				    	    foreach ($this->stats as $date => $data) {
378
+						foreach ($data as $source => $sourced) {
379 379
 					    	    //print_r($sourced);
380
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
381
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
380
+				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date);
381
+				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date);
382 382
 				    		    if (isset($sourced['msg'])) {
383 383
 				    			if (time() - $sourced['msg']['date'] > 10) {
384 384
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
385
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
385
+				    		    	    echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date);
386 386
 			    			    	    unset($this->stats[$date][$source]['msg']);
387 387
 			    				}
388 388
 			    			    }
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
407 407
 					$MarineLive = new MarineLive($this->db);
408 408
 					$MarineLive->deleteLiveMarineData();
409
-					$MarineLive->db=null;
409
+					$MarineLive->db = null;
410 410
 					if ($globalDebug) echo " Done\n";
411 411
 				    }
412 412
 				    $this->last_delete = time();
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
418 418
 				    if (isset($globalDaemon) && !$globalDaemon) {
419 419
 					$Marine = new Marine($this->db);
420
-					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
420
+					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']);
421 421
 					$Marine->db = null;
422 422
 				    }
423 423
 				}
@@ -432,20 +432,20 @@  discard block
 block discarded – undo
432 432
 		    $ignoreImport = false;
433 433
 
434 434
 		    if (!$ignoreImport) {
435
-			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
435
+			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
436 436
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
437 437
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
438 438
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
439 439
 					$timeelapsed = microtime(true);
440 440
 					$MarineLive = new MarineLive($this->db);
441
-					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
441
+					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
442 442
 					$MarineLive->db = null;
443 443
 					if ($globalDebug) echo $result."\n";
444
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
444
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n";
445 445
 				    }
446 446
 				}
447 447
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
448
-				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
448
+				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']);
449 449
 				}
450 450
 				$this->all_tracked[$id]['putinarchive'] = false;
451 451
 
@@ -464,19 +464,19 @@  discard block
 block discarded – undo
464 464
 							$latitude = $globalCenterLatitude;
465 465
 							$longitude = $globalCenterLongitude;
466 466
 						}
467
-						$this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude);
467
+						$this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude);
468 468
 					} else {
469 469
 						$latitude = $this->source_location[$source]['latitude'];
470 470
 						$longitude = $this->source_location[$source]['longitude'];
471 471
 					}
472
-					$stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
472
+					$stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
473 473
 					//$stats_heading = $stats_heading%22.5;
474 474
 					$stats_heading = round($stats_heading/22.5);
475
-					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
475
+					$stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']);
476 476
 					$current_date = date('Y-m-d');
477 477
 					if ($stats_heading == 16) $stats_heading = 0;
478 478
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
479
-						for ($i=0;$i<=15;$i++) {
479
+						for ($i = 0; $i <= 15; $i++) {
480 480
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
481 481
 						}
482 482
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
@@ -491,9 +491,9 @@  discard block
 block discarded – undo
491 491
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
492 492
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
493 493
 						    end($this->stats[$current_date][$source]['hist']);
494
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
494
+						    $mini = key($this->stats[$current_date][$source]['hist']) + 10;
495 495
 						} else $mini = 0;
496
-						for ($i=$mini;$i<=$distance;$i+=10) {
496
+						for ($i = $mini; $i <= $distance; $i += 10) {
497 497
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
498 498
 						}
499 499
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
@@ -505,7 +505,7 @@  discard block
 block discarded – undo
505 505
 
506 506
 				$this->all_tracked[$id]['lastupdate'] = time();
507 507
 				if ($this->all_tracked[$id]['putinarchive']) $send = true;
508
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
508
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n";
509 509
 			//$this->del();
510 510
 			
511 511
 			
Please login to merge, or discard this patch.
Indentation   +204 added lines, -204 removed lines patch added patch discarded remove patch
@@ -9,25 +9,25 @@  discard block
 block discarded – undo
9 9
 require_once(dirname(__FILE__).'/class.Stats.php');
10 10
 require_once(dirname(__FILE__).'/class.Source.php');
11 11
 if (isset($globalServerAPRS) && $globalServerAPRS) {
12
-    require_once(dirname(__FILE__).'/class.APRS.php');
12
+	require_once(dirname(__FILE__).'/class.APRS.php');
13 13
 }
14 14
 
15 15
 class MarineImport {
16
-    private $all_tracked = array();
17
-    private $last_delete_hourly = 0;
18
-    private $last_delete = 0;
19
-    private $stats = array();
20
-    private $tmd = 0;
21
-    private $source_location = array();
22
-    public $db = null;
23
-    public $nb = 0;
16
+	private $all_tracked = array();
17
+	private $last_delete_hourly = 0;
18
+	private $last_delete = 0;
19
+	private $stats = array();
20
+	private $tmd = 0;
21
+	private $source_location = array();
22
+	public $db = null;
23
+	public $nb = 0;
24 24
 
25
-    public function __construct($dbc = null) {
25
+	public function __construct($dbc = null) {
26 26
 	global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB;
27 27
 	if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
28
-	    $Connection = new Connection($dbc);
29
-	    $this->db = $Connection->db();
30
-	    date_default_timezone_set('UTC');
28
+		$Connection = new Connection($dbc);
29
+		$this->db = $Connection->db();
30
+		date_default_timezone_set('UTC');
31 31
 	}
32 32
 	// Get previous source stats
33 33
 	/*
@@ -46,55 +46,55 @@  discard block
 block discarded – undo
46 46
 	}
47 47
 	*/
48 48
 	if (isset($globalServerAPRS) && $globalServerAPRS) {
49
-	    $APRSMarine = new APRSMarine();
50
-	    //$APRSSpotter->connect();
49
+		$APRSMarine = new APRSMarine();
50
+		//$APRSSpotter->connect();
51
+	}
51 52
 	}
52
-    }
53 53
 
54
-    public function checkAll() {
54
+	public function checkAll() {
55 55
 	global $globalDebug;
56 56
 	if ($globalDebug) echo "Update last seen tracked data...\n";
57 57
 	foreach ($this->all_tracked as $key => $flight) {
58
-	    if (isset($this->all_tracked[$key]['id'])) {
58
+		if (isset($this->all_tracked[$key]['id'])) {
59 59
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
60
-    		$Marine = new Marine($this->db);
61
-        	$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
62
-            }
60
+			$Marine = new Marine($this->db);
61
+			$Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
62
+			}
63
+	}
63 64
 	}
64
-    }
65 65
 
66
-    public function del() {
66
+	public function del() {
67 67
 	global $globalDebug, $globalNoDB, $globalNoImport;
68 68
 	// Delete old infos
69 69
 	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
70 70
 	foreach ($this->all_tracked as $key => $flight) {
71
-    	    if (isset($flight['lastupdate'])) {
72
-        	if ($flight['lastupdate'] < (time()-3000)) {
73
-            	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74
-            		if (isset($this->all_tracked[$key]['id'])) {
75
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
76
-			    /*
71
+			if (isset($flight['lastupdate'])) {
72
+			if ($flight['lastupdate'] < (time()-3000)) {
73
+					if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74
+					if (isset($this->all_tracked[$key]['id'])) {
75
+						if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
76
+				/*
77 77
 			    $MarineLive = new MarineLive();
78 78
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
79 79
 			    $MarineLive->db = null;
80 80
 			    */
81
-            		    //$real_arrival = $this->arrival($key);
82
-            		    $Marine = new Marine($this->db);
83
-            		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
81
+						//$real_arrival = $this->arrival($key);
82
+						$Marine = new Marine($this->db);
83
+						if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
84 84
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
85 85
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
86
-			    }
87
-			    // Put in archive
86
+				}
87
+				// Put in archive
88 88
 //				$Marine->db = null;
89 89
 			}
90
-            	    }
91
-            	    unset($this->all_tracked[$key]);
92
-    	        }
93
-	    }
94
-        }
95
-    }
90
+					}
91
+					unset($this->all_tracked[$key]);
92
+				}
93
+		}
94
+		}
95
+	}
96 96
 
97
-    public function add($line) {
97
+	public function add($line) {
98 98
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
99 99
 	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
100 100
 	date_default_timezone_set('UTC');
@@ -103,83 +103,83 @@  discard block
 block discarded – undo
103 103
 	
104 104
 	// SBS format is CSV format
105 105
 	if(is_array($line) && isset($line['mmsi'])) {
106
-	    //print_r($line);
107
-  	    if (isset($line['mmsi'])) {
106
+		//print_r($line);
107
+  		if (isset($line['mmsi'])) {
108 108
 
109 109
 		
110 110
 		// Increment message number
111 111
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
112
-		    $current_date = date('Y-m-d');
113
-		    if (isset($line['source_name'])) $source = $line['source_name'];
114
-		    else $source = '';
115
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
116
-		    if (!isset($this->stats[$current_date][$source]['msg'])) {
117
-		    	$this->stats[$current_date][$source]['msg']['date'] = time();
118
-		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
119
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
112
+			$current_date = date('Y-m-d');
113
+			if (isset($line['source_name'])) $source = $line['source_name'];
114
+			else $source = '';
115
+			if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
116
+			if (!isset($this->stats[$current_date][$source]['msg'])) {
117
+				$this->stats[$current_date][$source]['msg']['date'] = time();
118
+				$this->stats[$current_date][$source]['msg']['nb'] = 1;
119
+			} else $this->stats[$current_date][$source]['msg']['nb'] += 1;
120 120
 		}
121 121
 		
122 122
 		
123 123
 		$Common = new Common();
124 124
 		$AIS = new AIS();
125
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
126
-	        else $id = trim($line['id']);
125
+			if (!isset($line['id'])) $id = trim($line['mmsi']);
126
+			else $id = trim($line['id']);
127 127
 		
128 128
 		if (!isset($this->all_tracked[$id])) {
129
-		    $this->all_tracked[$id] = array();
130
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
131
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
132
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
133
-		    if (!isset($line['id'])) {
129
+			$this->all_tracked[$id] = array();
130
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0));
131
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
132
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
133
+			if (!isset($line['id'])) {
134 134
 			if (!isset($globalDaemon)) $globalDaemon = TRUE;
135 135
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
136
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
137
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
136
+			 } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
137
+			if ($globalAllTracked !== FALSE) $dataFound = true;
138 138
 		}
139 139
 		
140 140
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
141
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
142
-		    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
141
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi']));
142
+			if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
143 143
 			$Marine = new Marine($this->db);
144 144
 			$identity = $Marine->getIdentity($line['mmsi']);
145 145
 			if (!empty($identity)) {
146
-			    $this->all_tracked[$id]['ident'] = $identity['ship_name'];
147
-			    $this->all_tracked[$id]['type'] = $identity['type'];
146
+				$this->all_tracked[$id]['ident'] = $identity['ship_name'];
147
+				$this->all_tracked[$id]['type'] = $identity['type'];
148 148
 			}
149 149
 			//print_r($identity);
150 150
 			unset($Marine);
151 151
 			//$dataFound = true;
152
-		    }
152
+			}
153 153
 		}
154 154
 		if (isset($line['type_id'])) {
155
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
155
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id'])));
156 156
 		}
157 157
 		if (isset($line['type']) && $line['type'] != '') {
158
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
158
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type']));
159 159
 		}
160 160
 		if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') {
161
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
161
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type']));
162 162
 		}
163 163
 		if (isset($line['imo']) && $line['imo'] != '') {
164
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
164
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo']));
165 165
 		}
166 166
 		if (isset($line['callsign']) && $line['callsign'] != '') {
167
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
167
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign']));
168 168
 		}
169 169
 		if (isset($line['arrival_code']) && $line['arrival_code'] != '') {
170
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
170
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code']));
171 171
 		}
172 172
 		if (isset($line['arrival_date']) && $line['arrival_date'] != '') {
173
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
173
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date']));
174 174
 		}
175 175
 
176 176
 
177 177
 		//if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) {
178 178
 		if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) {
179
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
180
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
179
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident'])));
180
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
181 181
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
182
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
182
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
183 183
 				$timeelapsed = microtime(true);
184 184
 				$Marine = new Marine($this->db);
185 185
 				$fromsource = NULL;
@@ -187,20 +187,20 @@  discard block
 block discarded – undo
187 187
 				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
188 188
 				$Marine->db = null;
189 189
 				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
190
-			    }
190
+				}
191
+			}
191 192
 			}
192
-		    }
193
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
193
+			if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
194 194
 		}
195 195
 
196 196
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
197
-		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
197
+			if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
198 198
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
199
-		    } else {
199
+			} else {
200 200
 				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
201 201
 				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
202 202
 				return '';
203
-		    }
203
+			}
204 204
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
205 205
 			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
206 206
 			return '';
@@ -217,24 +217,24 @@  discard block
 block discarded – undo
217 217
 
218 218
 
219 219
 		if (isset($line['speed'])) {
220
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
221
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
220
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'])));
221
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true));
222 222
 		} else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) {
223
-		    $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
224
-		    if ($distance > 1000 && $distance < 10000) {
223
+			$distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m');
224
+			if ($distance > 1000 && $distance < 10000) {
225 225
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
226 226
 			$speed = $speed*3.6;
227 227
 			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
228 228
   			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
229
-		    }
229
+			}
230 230
 		}
231 231
 
232
-	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
233
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
234
-	    	    else unset($timediff);
235
-	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
232
+			if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
233
+				if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
234
+				else unset($timediff);
235
+				if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
236 236
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
237
-			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
237
+				if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
238 238
 				$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
239 239
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
240 240
 				$this->all_tracked[$id]['putinarchive'] = true;
@@ -242,211 +242,211 @@  discard block
 block discarded – undo
242 242
 				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
243 243
 				$timeelapsed = microtime(true);
244 244
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
245
-				    $Marine = new Marine($this->db);
246
-				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
247
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
248
-				    $Marine->db = null;
249
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
245
+					$Marine = new Marine($this->db);
246
+					$all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
247
+					if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
248
+					$Marine->db = null;
249
+					if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
250 250
 				}
251 251
 				$this->tmd = 0;
252 252
 				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
253
-			    }
253
+				}
254 254
 			}
255 255
 
256 256
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
257 257
 				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
258 258
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
259
-				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
260
-				    $dataFound = true;
261
-				    $this->all_tracked[$id]['time_last_coord'] = time();
259
+					$this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
260
+					$dataFound = true;
261
+					$this->all_tracked[$id]['time_last_coord'] = time();
262 262
 				}
263 263
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
264 264
 			}
265 265
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
266
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
266
+				if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
267 267
 				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
268 268
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
269
-				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
270
-				    $dataFound = true;
271
-				    $this->all_tracked[$id]['time_last_coord'] = time();
269
+					$this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
270
+					$dataFound = true;
271
+					$this->all_tracked[$id]['time_last_coord'] = time();
272 272
 				}
273 273
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude']));
274 274
 			}
275 275
 
276
-		    } else if ($globalDebug && $timediff > 20) {
276
+			} else if ($globalDebug && $timediff > 20) {
277 277
 			$this->tmd = $this->tmd + 1;
278 278
 			echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n";
279 279
 			echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -";
280 280
 			echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - ";
281 281
 			echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n";
282
-		    }
282
+			}
283 283
 		}
284 284
 		if (isset($line['last_update']) && $line['last_update'] != '') {
285
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
286
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
285
+			if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
286
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
287 287
 		}
288 288
 		if (isset($line['format_source']) && $line['format_source'] != '') {
289
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
289
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source']));
290 290
 		}
291 291
 		if (isset($line['source_name']) && $line['source_name'] != '') {
292
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
292
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name']));
293 293
 		}
294 294
 		if (isset($line['status']) && $line['status'] != '') {
295
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
295
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status']));
296 296
 		}
297 297
 		if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) {
298
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
299
-		    if ($this->all_tracked[$id]['addedMarine'] == 1) {
298
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id']));
299
+			if ($this->all_tracked[$id]['addedMarine'] == 1) {
300 300
 			if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
301
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
301
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
302 302
 				$Marine = new Marine($this->db);
303 303
 				$Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']);
304 304
 				unset($Marine);
305
-			    }
305
+				}
306
+			}
306 307
 			}
307
-		    }
308 308
 		}
309 309
 
310 310
 		if (isset($line['noarchive']) && $line['noarchive'] === true) {
311
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
311
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true));
312 312
 		}
313 313
 		
314 314
 		if (isset($line['heading']) && $line['heading'] != '') {
315
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
316
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
317
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
318
-		    //$dataFound = true;
315
+			if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
316
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
317
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
318
+			//$dataFound = true;
319 319
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
320
-  		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
321
-		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
322
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
323
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
320
+  			$heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
321
+			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
322
+			if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
323
+  			if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
324 324
   		}
325 325
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
326 326
 
327 327
 
328 328
 
329 329
 		if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) {
330
-		    $this->all_tracked[$id]['lastupdate'] = time();
331
-		    if ($this->all_tracked[$id]['addedMarine'] == 0) {
332
-		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
333
-			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
330
+			$this->all_tracked[$id]['lastupdate'] = time();
331
+			if ($this->all_tracked[$id]['addedMarine'] == 0) {
332
+				if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
333
+				if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
334 334
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
335
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
336
-				    $timeelapsed = microtime(true);
337
-				    $MarineLive = new MarineLive($this->db);
338
-				    if (isset($line['id'])) {
335
+					if ($globalDebug) echo "Check if aircraft is already in DB...";
336
+					$timeelapsed = microtime(true);
337
+					$MarineLive = new MarineLive($this->db);
338
+					if (isset($line['id'])) {
339 339
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
340 340
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
341
-				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
341
+					} elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
342 342
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
343 343
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
344
-				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
344
+					} elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
345 345
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
346 346
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
347
-				    } else $recent_ident = '';
348
-				    $MarineLive->db=null;
349
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
350
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
347
+					} else $recent_ident = '';
348
+					$MarineLive->db=null;
349
+					if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
350
+					elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
351 351
 				} else $recent_ident = '';
352
-			    } else {
352
+				} else {
353 353
 				$recent_ident = '';
354 354
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
355
-			    }
356
-			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
357
-			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
358
-			    {
355
+				}
356
+				//if there was no aircraft with the same callsign within the last hour and go post it into the archive
357
+				if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
358
+				{
359 359
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
360 360
 				//adds the spotter data for the archive
361
-				    $highlight = '';
362
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
363
-				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
361
+					$highlight = '';
362
+					if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
363
+					if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
364 364
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
365
-					    $timeelapsed = microtime(true);
366
-					    $Marine = new Marine($this->db);
367
-					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
368
-					    $Marine->db = null;
369
-					    if ($globalDebug && isset($result)) echo $result."\n";
370
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
365
+						$timeelapsed = microtime(true);
366
+						$Marine = new Marine($this->db);
367
+						$result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
368
+						$Marine->db = null;
369
+						if ($globalDebug && isset($result)) echo $result."\n";
370
+						if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
371 371
 					}
372
-				    }
373
-				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
372
+					}
373
+					if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
374 374
 					// Add source stat in DB
375 375
 					$Stats = new Stats($this->db);
376 376
 					if (!empty($this->stats)) {
377
-					    if ($globalDebug) echo 'Add source stats : ';
378
-				    	    foreach($this->stats as $date => $data) {
377
+						if ($globalDebug) echo 'Add source stats : ';
378
+							foreach($this->stats as $date => $data) {
379 379
 						foreach($data as $source => $sourced) {
380
-					    	    //print_r($sourced);
381
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
382
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
383
-				    		    if (isset($sourced['msg'])) {
384
-				    			if (time() - $sourced['msg']['date'] > 10) {
385
-				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
386
-				    		    	    echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
387
-			    			    	    unset($this->stats[$date][$source]['msg']);
388
-			    				}
389
-			    			    }
390
-			    			}
391
-			    			if ($date != date('Y-m-d')) {
392
-			    			    unset($this->stats[$date]);
393
-			    			}
394
-				    	    }
395
-				    	    if ($globalDebug) echo 'Done'."\n";
380
+								//print_r($sourced);
381
+									if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
382
+									if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
383
+								if (isset($sourced['msg'])) {
384
+								if (time() - $sourced['msg']['date'] > 10) {
385
+										$nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
386
+										echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date);
387
+										unset($this->stats[$date][$source]['msg']);
388
+								}
389
+								}
390
+							}
391
+							if ($date != date('Y-m-d')) {
392
+								unset($this->stats[$date]);
393
+							}
394
+							}
395
+							if ($globalDebug) echo 'Done'."\n";
396 396
 					}
397 397
 					$Stats->db = null;
398
-				    }
398
+					}
399 399
 				    
400
-				    $this->del();
400
+					$this->del();
401 401
 				//$ignoreImport = false;
402 402
 				$this->all_tracked[$id]['addedMarine'] = 1;
403 403
 				//print_r($this->all_tracked[$id]);
404 404
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
405
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
406
-				    //MarineLive->deleteLiveMarineDataNotUpdated();
407
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
405
+					if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
406
+					//MarineLive->deleteLiveMarineDataNotUpdated();
407
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
408 408
 					$MarineLive = new MarineLive($this->db);
409 409
 					$MarineLive->deleteLiveMarineData();
410 410
 					$MarineLive->db=null;
411 411
 					if ($globalDebug) echo " Done\n";
412
-				    }
413
-				    $this->last_delete = time();
412
+					}
413
+					$this->last_delete = time();
414 414
 				}
415
-			    } elseif ($recent_ident != '') {
415
+				} elseif ($recent_ident != '') {
416 416
 				$this->all_tracked[$id]['id'] = $recent_ident;
417 417
 				$this->all_tracked[$id]['addedMarine'] = 1;
418 418
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
419
-				    if (isset($globalDaemon) && !$globalDaemon) {
419
+					if (isset($globalDaemon) && !$globalDaemon) {
420 420
 					$Marine = new Marine($this->db);
421 421
 					$Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']);
422 422
 					$Marine->db = null;
423
-				    }
423
+					}
424 424
 				}
425 425
 				
426
-			    }
426
+				}
427
+			}
427 428
 			}
428
-		    }
429
-		    //adds the spotter LIVE data
430
-		    if ($globalDebug) {
429
+			//adds the spotter LIVE data
430
+			if ($globalDebug) {
431 431
 			echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n";
432
-		    }
433
-		    $ignoreImport = false;
432
+			}
433
+			$ignoreImport = false;
434 434
 
435
-		    if (!$ignoreImport) {
435
+			if (!$ignoreImport) {
436 436
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
437 437
 				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
438 438
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
439
-				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
439
+					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
440 440
 					$timeelapsed = microtime(true);
441 441
 					$MarineLive = new MarineLive($this->db);
442 442
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
443 443
 					$MarineLive->db = null;
444 444
 					if ($globalDebug) echo $result."\n";
445 445
 					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
446
-				    }
446
+					}
447 447
 				}
448 448
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
449
-				    $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
449
+					$APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
450 450
 				}
451 451
 				$this->all_tracked[$id]['putinarchive'] = false;
452 452
 
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 					if ($stats_heading == 16) $stats_heading = 0;
479 479
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
480 480
 						for ($i=0;$i<=15;$i++) {
481
-						    $this->stats[$current_date][$source]['polar'][$i] = 0;
481
+							$this->stats[$current_date][$source]['polar'][$i] = 0;
482 482
 						}
483 483
 						$this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance;
484 484
 					} else {
@@ -491,11 +491,11 @@  discard block
 block discarded – undo
491 491
 					//var_dump($this->stats);
492 492
 					if (!isset($this->stats[$current_date][$source]['hist'][$distance])) {
493 493
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
494
-						    end($this->stats[$current_date][$source]['hist']);
495
-						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
494
+							end($this->stats[$current_date][$source]['hist']);
495
+							$mini = key($this->stats[$current_date][$source]['hist'])+10;
496 496
 						} else $mini = 0;
497 497
 						for ($i=$mini;$i<=$distance;$i+=10) {
498
-						    $this->stats[$current_date][$source]['hist'][$i] = 0;
498
+							$this->stats[$current_date][$source]['hist'][$i] = 0;
499 499
 						}
500 500
 						$this->stats[$current_date][$source]['hist'][$distance] = 1;
501 501
 					} else {
@@ -511,24 +511,24 @@  discard block
 block discarded – undo
511 511
 			
512 512
 			
513 513
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
514
-			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
514
+				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
515 515
 				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
516 516
 				$MarineLive = new MarineLive($this->db);
517 517
 				$MarineLive->deleteLiveMarineDataNotUpdated();
518 518
 				$MarineLive->db = null;
519 519
 				//MarineLive->deleteLiveMarineData();
520 520
 				if ($globalDebug) echo " Done\n";
521
-			    }
522
-			    $this->last_delete_hourly = time();
521
+				}
522
+				$this->last_delete_hourly = time();
523 523
 			}
524 524
 			
525
-		    }
526
-		    //$ignoreImport = false;
525
+			}
526
+			//$ignoreImport = false;
527 527
 		}
528 528
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
529 529
 		if ($send) return $this->all_tracked[$id];
530
-	    }
530
+		}
531
+	}
531 532
 	}
532
-    }
533 533
 }
534 534
 ?>
Please login to merge, or discard this patch.
Braces   +193 added lines, -66 removed lines patch added patch discarded remove patch
@@ -53,7 +53,9 @@  discard block
 block discarded – undo
53 53
 
54 54
     public function checkAll() {
55 55
 	global $globalDebug;
56
-	if ($globalDebug) echo "Update last seen tracked data...\n";
56
+	if ($globalDebug) {
57
+		echo "Update last seen tracked data...\n";
58
+	}
57 59
 	foreach ($this->all_tracked as $key => $flight) {
58 60
 	    if (isset($this->all_tracked[$key]['id'])) {
59 61
 		//echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].'  '.$this->all_tracked[$key]['longitude']."\n";
@@ -66,13 +68,17 @@  discard block
 block discarded – undo
66 68
     public function del() {
67 69
 	global $globalDebug, $globalNoDB, $globalNoImport;
68 70
 	// Delete old infos
69
-	if ($globalDebug) echo 'Delete old values and update latest data...'."\n";
71
+	if ($globalDebug) {
72
+		echo 'Delete old values and update latest data...'."\n";
73
+	}
70 74
 	foreach ($this->all_tracked as $key => $flight) {
71 75
     	    if (isset($flight['lastupdate'])) {
72 76
         	if ($flight['lastupdate'] < (time()-3000)) {
73 77
             	    if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) {
74 78
             		if (isset($this->all_tracked[$key]['id'])) {
75
-            		    if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
79
+            		    if ($globalDebug) {
80
+            		    	echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n";
81
+            		    }
76 82
 			    /*
77 83
 			    $MarineLive = new MarineLive();
78 84
             		    $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']);
@@ -82,7 +88,9 @@  discard block
 block discarded – undo
82 88
             		    $Marine = new Marine($this->db);
83 89
             		    if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') {
84 90
 				$result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']);
85
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
91
+				if ($globalDebug && $result != 'success') {
92
+					echo '!!! ERROR : '.$result."\n";
93
+				}
86 94
 			    }
87 95
 			    // Put in archive
88 96
 //				$Marine->db = null;
@@ -96,7 +104,9 @@  discard block
 block discarded – undo
96 104
 
97 105
     public function add($line) {
98 106
 	global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine;
99
-	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02';
107
+	if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') {
108
+		$globalCoordMinChange = '0.02';
109
+	}
100 110
 	date_default_timezone_set('UTC');
101 111
 	$dataFound = false;
102 112
 	$send = false;
@@ -110,20 +120,30 @@  discard block
 block discarded – undo
110 120
 		// Increment message number
111 121
 		if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) {
112 122
 		    $current_date = date('Y-m-d');
113
-		    if (isset($line['source_name'])) $source = $line['source_name'];
114
-		    else $source = '';
115
-		    if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source'];
123
+		    if (isset($line['source_name'])) {
124
+		    	$source = $line['source_name'];
125
+		    } else {
126
+		    	$source = '';
127
+		    }
128
+		    if ($source == '' || $line['format_source'] == 'aprs') {
129
+		    	$source = $line['format_source'];
130
+		    }
116 131
 		    if (!isset($this->stats[$current_date][$source]['msg'])) {
117 132
 		    	$this->stats[$current_date][$source]['msg']['date'] = time();
118 133
 		    	$this->stats[$current_date][$source]['msg']['nb'] = 1;
119
-		    } else $this->stats[$current_date][$source]['msg']['nb'] += 1;
134
+		    } else {
135
+		    	$this->stats[$current_date][$source]['msg']['nb'] += 1;
136
+		    }
120 137
 		}
121 138
 		
122 139
 		
123 140
 		$Common = new Common();
124 141
 		$AIS = new AIS();
125
-	        if (!isset($line['id'])) $id = trim($line['mmsi']);
126
-	        else $id = trim($line['id']);
142
+	        if (!isset($line['id'])) {
143
+	        	$id = trim($line['mmsi']);
144
+	        } else {
145
+	        	$id = trim($line['id']);
146
+	        }
127 147
 		
128 148
 		if (!isset($this->all_tracked[$id])) {
129 149
 		    $this->all_tracked[$id] = array();
@@ -131,10 +151,16 @@  discard block
 block discarded – undo
131 151
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => ''));
132 152
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time()));
133 153
 		    if (!isset($line['id'])) {
134
-			if (!isset($globalDaemon)) $globalDaemon = TRUE;
154
+			if (!isset($globalDaemon)) {
155
+				$globalDaemon = TRUE;
156
+			}
135 157
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi')));
136
-		     } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
137
-		    if ($globalAllTracked !== FALSE) $dataFound = true;
158
+		     } else {
159
+		     	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id']));
160
+		     }
161
+		    if ($globalAllTracked !== FALSE) {
162
+		    	$dataFound = true;
163
+		    }
138 164
 		}
139 165
 		
140 166
 		if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) {
@@ -184,34 +210,49 @@  discard block
 block discarded – undo
184 210
 				$Marine = new Marine($this->db);
185 211
 				$fromsource = NULL;
186 212
 				$result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource);
187
-				if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n";
213
+				if ($globalDebug && $result != 'success') {
214
+					echo '!!! ERROR : '.$result."\n";
215
+				}
188 216
 				$Marine->db = null;
189
-				if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
217
+				if ($globalDebugTimeElapsed) {
218
+					echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
219
+				}
190 220
 			    }
191 221
 			}
192 222
 		    }
193
-		    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
223
+		    if (!isset($this->all_tracked[$id]['id'])) {
224
+		    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident']));
225
+		    }
194 226
 		}
195 227
 
196 228
 		if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) {
197 229
 		    if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) {
198 230
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime']));
199 231
 		    } else {
200
-				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
201
-				elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
232
+				if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
233
+					echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n";
234
+				} elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) {
235
+					echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n";
236
+				}
202 237
 				return '';
203 238
 		    }
204 239
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) {
205
-			if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
240
+			if ($globalDebug) {
241
+				echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
242
+			}
206 243
 			return '';
207 244
 		} elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) {
208
-			if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
245
+			if ($globalDebug) {
246
+				echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
247
+			}
209 248
 			return '';
210 249
 		} elseif (!isset($line['datetime'])) {
211 250
 			date_default_timezone_set('UTC');
212 251
 			$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s')));
213 252
 		} else {
214
-			if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
253
+			if ($globalDebug) {
254
+				echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!";
255
+			}
215 256
 			return '';
216 257
 		}
217 258
 
@@ -224,14 +265,21 @@  discard block
 block discarded – undo
224 265
 		    if ($distance > 1000 && $distance < 10000) {
225 266
 			$speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']);
226 267
 			$speed = $speed*3.6;
227
-			if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
228
-  			if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
268
+			if ($speed < 1000) {
269
+				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed)));
270
+			}
271
+  			if ($globalDebug) {
272
+  				echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n";
273
+  			}
229 274
 		    }
230 275
 		}
231 276
 
232 277
 	        if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) {
233
-	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
234
-	    	    else unset($timediff);
278
+	    	    if (isset($this->all_tracked[$id]['time_last_coord'])) {
279
+	    	    	$timediff = round(time()-$this->all_tracked[$id]['time_last_coord']);
280
+	    	    } else {
281
+	    	    	unset($timediff);
282
+	    	    }
235 283
 	    	    if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) {
236 284
 			if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) {
237 285
 			    if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) {
@@ -239,22 +287,32 @@  discard block
 block discarded – undo
239 287
 				$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
240 288
 				$this->all_tracked[$id]['putinarchive'] = true;
241 289
 				
242
-				if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
290
+				if ($globalDebug) {
291
+					echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... ';
292
+				}
243 293
 				$timeelapsed = microtime(true);
244 294
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
245 295
 				    $Marine = new Marine($this->db);
246 296
 				    $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']);
247
-				    if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2'];
297
+				    if (!empty($all_country)) {
298
+				    	$this->all_tracked[$id]['over_country'] = $all_country['iso2'];
299
+				    }
248 300
 				    $Marine->db = null;
249
-				    if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
301
+				    if ($globalDebugTimeElapsed) {
302
+				    	echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
303
+				    }
250 304
 				}
251 305
 				$this->tmd = 0;
252
-				if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
306
+				if ($globalDebug) {
307
+					echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n";
308
+				}
253 309
 			    }
254 310
 			}
255 311
 
256 312
 			if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) {
257
-				if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
313
+				if (!isset($this->all_tracked[$id]['archive_latitude'])) {
314
+					$this->all_tracked[$id]['archive_latitude'] = $line['latitude'];
315
+				}
258 316
 				if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
259 317
 				    $this->all_tracked[$id]['livedb_latitude'] = $line['latitude'];
260 318
 				    $dataFound = true;
@@ -263,8 +321,12 @@  discard block
 block discarded – undo
263 321
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude']));
264 322
 			}
265 323
 			if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) {
266
-			    if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360;
267
-				if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
324
+			    if ($line['longitude'] > 180) {
325
+			    	$line['longitude'] = $line['longitude'] - 360;
326
+			    }
327
+				if (!isset($this->all_tracked[$id]['archive_longitude'])) {
328
+					$this->all_tracked[$id]['archive_longitude'] = $line['longitude'];
329
+				}
268 330
 				if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') {
269 331
 				    $this->all_tracked[$id]['livedb_longitude'] = $line['longitude'];
270 332
 				    $dataFound = true;
@@ -282,7 +344,9 @@  discard block
 block discarded – undo
282 344
 		    }
283 345
 		}
284 346
 		if (isset($line['last_update']) && $line['last_update'] != '') {
285
-		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true;
347
+		    if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) {
348
+		    	$dataFound = true;
349
+		    }
286 350
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update']));
287 351
 		}
288 352
 		if (isset($line['format_source']) && $line['format_source'] != '') {
@@ -312,15 +376,21 @@  discard block
 block discarded – undo
312 376
 		}
313 377
 		
314 378
 		if (isset($line['heading']) && $line['heading'] != '') {
315
-		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true;
379
+		    if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) {
380
+		    	$this->all_tracked[$id]['putinarchive'] = true;
381
+		    }
316 382
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading'])));
317 383
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true));
318 384
 		    //$dataFound = true;
319 385
   		} elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) {
320 386
   		    $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
321 387
 		    $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading)));
322
-		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true;
323
-  		    if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
388
+		    if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) {
389
+		    	$this->all_tracked[$id]['putinarchive'] = true;
390
+		    }
391
+  		    if ($globalDebug) {
392
+  		    	echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n";
393
+  		    }
324 394
   		}
325 395
 		//if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false;
326 396
 
@@ -332,23 +402,38 @@  discard block
 block discarded – undo
332 402
 		        if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == ''  || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
333 403
 			    if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) {
334 404
 				if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
335
-				    if ($globalDebug) echo "Check if aircraft is already in DB...";
405
+				    if ($globalDebug) {
406
+				    	echo "Check if aircraft is already in DB...";
407
+				    }
336 408
 				    $timeelapsed = microtime(true);
337 409
 				    $MarineLive = new MarineLive($this->db);
338 410
 				    if (isset($line['id'])) {
339 411
 					$recent_ident = $MarineLive->checkIdRecent($line['id']);
340
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
412
+					if ($globalDebugTimeElapsed) {
413
+						echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
414
+					}
341 415
 				    } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') {
342 416
 					$recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']);
343
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
417
+					if ($globalDebugTimeElapsed) {
418
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
419
+					}
344 420
 				    } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') {
345 421
 					$recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']);
346
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
347
-				    } else $recent_ident = '';
422
+					if ($globalDebugTimeElapsed) {
423
+						echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
424
+					}
425
+				    } else {
426
+				    	$recent_ident = '';
427
+				    }
348 428
 				    $MarineLive->db=null;
349
-				    if ($globalDebug && $recent_ident == '') echo " Not in DB.\n";
350
-				    elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n";
351
-				} else $recent_ident = '';
429
+				    if ($globalDebug && $recent_ident == '') {
430
+				    	echo " Not in DB.\n";
431
+				    } elseif ($globalDebug && $recent_ident != '') {
432
+				    	echo " Already in DB.\n";
433
+				    }
434
+				} else {
435
+					$recent_ident = '';
436
+				}
352 437
 			    } else {
353 438
 				$recent_ident = '';
354 439
 				$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0));
@@ -356,30 +441,44 @@  discard block
 block discarded – undo
356 441
 			    //if there was no aircraft with the same callsign within the last hour and go post it into the archive
357 442
 			    if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '')
358 443
 			    {
359
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
444
+				if ($globalDebug) {
445
+					echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : ";
446
+				}
360 447
 				//adds the spotter data for the archive
361 448
 				    $highlight = '';
362
-				    if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
449
+				    if (!isset($this->all_tracked[$id]['id'])) {
450
+				    	$this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi')));
451
+				    }
363 452
 				    if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
364 453
 					if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
365 454
 					    $timeelapsed = microtime(true);
366 455
 					    $Marine = new Marine($this->db);
367 456
 					    $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']);
368 457
 					    $Marine->db = null;
369
-					    if ($globalDebug && isset($result)) echo $result."\n";
370
-					    if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
458
+					    if ($globalDebug && isset($result)) {
459
+					    	echo $result."\n";
460
+					    }
461
+					    if ($globalDebugTimeElapsed) {
462
+					    	echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
463
+					    }
371 464
 					}
372 465
 				    }
373 466
 				    if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
374 467
 					// Add source stat in DB
375 468
 					$Stats = new Stats($this->db);
376 469
 					if (!empty($this->stats)) {
377
-					    if ($globalDebug) echo 'Add source stats : ';
470
+					    if ($globalDebug) {
471
+					    	echo 'Add source stats : ';
472
+					    }
378 473
 				    	    foreach($this->stats as $date => $data) {
379 474
 						foreach($data as $source => $sourced) {
380 475
 					    	    //print_r($sourced);
381
-				    	    	    if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
382
-				    	    	    if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
476
+				    	    	    if (isset($sourced['polar'])) {
477
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date);
478
+				    	    	    }
479
+				    	    	    if (isset($sourced['hist'])) {
480
+				    	    	    	echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date);
481
+				    	    	    }
383 482
 				    		    if (isset($sourced['msg'])) {
384 483
 				    			if (time() - $sourced['msg']['date'] > 10) {
385 484
 				    		    	    $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date']));
@@ -392,7 +491,9 @@  discard block
 block discarded – undo
392 491
 			    			    unset($this->stats[$date]);
393 492
 			    			}
394 493
 				    	    }
395
-				    	    if ($globalDebug) echo 'Done'."\n";
494
+				    	    if ($globalDebug) {
495
+				    	    	echo 'Done'."\n";
496
+				    	    }
396 497
 					}
397 498
 					$Stats->db = null;
398 499
 				    }
@@ -402,13 +503,17 @@  discard block
 block discarded – undo
402 503
 				$this->all_tracked[$id]['addedMarine'] = 1;
403 504
 				//print_r($this->all_tracked[$id]);
404 505
 				if ($this->last_delete == 0 || time() - $this->last_delete > 1800) {
405
-				    if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours...";
506
+				    if ($globalDebug) {
507
+				    	echo "---- Deleting Live Marine data older than 9 hours...";
508
+				    }
406 509
 				    //MarineLive->deleteLiveMarineDataNotUpdated();
407 510
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
408 511
 					$MarineLive = new MarineLive($this->db);
409 512
 					$MarineLive->deleteLiveMarineData();
410 513
 					$MarineLive->db=null;
411
-					if ($globalDebug) echo " Done\n";
514
+					if ($globalDebug) {
515
+						echo " Done\n";
516
+					}
412 517
 				    }
413 518
 				    $this->last_delete = time();
414 519
 				}
@@ -434,15 +539,21 @@  discard block
 block discarded – undo
434 539
 
435 540
 		    if (!$ignoreImport) {
436 541
 			if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) {
437
-				if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
542
+				if ($globalDebug) {
543
+					echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : ";
544
+				}
438 545
 				if (!isset($globalNoImport) || $globalNoImport !== TRUE) {
439 546
 				    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
440 547
 					$timeelapsed = microtime(true);
441 548
 					$MarineLive = new MarineLive($this->db);
442 549
 					$result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']);
443 550
 					$MarineLive->db = null;
444
-					if ($globalDebug) echo $result."\n";
445
-					if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
551
+					if ($globalDebug) {
552
+						echo $result."\n";
553
+					}
554
+					if ($globalDebugTimeElapsed) {
555
+						echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n";
556
+					}
446 557
 				    }
447 558
 				}
448 559
 				if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) {
@@ -454,7 +565,9 @@  discard block
 block discarded – undo
454 565
 				
455 566
 				if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') {
456 567
 					$source = $this->all_tracked[$id]['source_name'];
457
-					if ($source == '') $source = $this->all_tracked[$id]['format_source'];
568
+					if ($source == '') {
569
+						$source = $this->all_tracked[$id]['format_source'];
570
+					}
458 571
 					if (!isset($this->source_location[$source])) {
459 572
 						$Location = new Source($this->db);
460 573
 						$coord = $Location->getLocationInfobySourceName($source);
@@ -475,7 +588,9 @@  discard block
 block discarded – undo
475 588
 					$stats_heading = round($stats_heading/22.5);
476 589
 					$stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']);
477 590
 					$current_date = date('Y-m-d');
478
-					if ($stats_heading == 16) $stats_heading = 0;
591
+					if ($stats_heading == 16) {
592
+						$stats_heading = 0;
593
+					}
479 594
 					if (!isset($this->stats[$current_date][$source]['polar'][1])) {
480 595
 						for ($i=0;$i<=15;$i++) {
481 596
 						    $this->stats[$current_date][$source]['polar'][$i] = 0;
@@ -493,7 +608,9 @@  discard block
 block discarded – undo
493 608
 						if (isset($this->stats[$current_date][$source]['hist'][0])) {
494 609
 						    end($this->stats[$current_date][$source]['hist']);
495 610
 						    $mini = key($this->stats[$current_date][$source]['hist'])+10;
496
-						} else $mini = 0;
611
+						} else {
612
+							$mini = 0;
613
+						}
497 614
 						for ($i=$mini;$i<=$distance;$i+=10) {
498 615
 						    $this->stats[$current_date][$source]['hist'][$i] = 0;
499 616
 						}
@@ -505,19 +622,27 @@  discard block
 block discarded – undo
505 622
 				
506 623
 
507 624
 				$this->all_tracked[$id]['lastupdate'] = time();
508
-				if ($this->all_tracked[$id]['putinarchive']) $send = true;
509
-			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
625
+				if ($this->all_tracked[$id]['putinarchive']) {
626
+					$send = true;
627
+				}
628
+			} elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) {
629
+				echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n";
630
+			}
510 631
 			//$this->del();
511 632
 			
512 633
 			
513 634
 			if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) {
514 635
 			    if (!isset($globalNoDB) || $globalNoDB !== TRUE) {
515
-				if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour...";
636
+				if ($globalDebug) {
637
+					echo "---- Deleting Live Marine data Not updated since 2 hour...";
638
+				}
516 639
 				$MarineLive = new MarineLive($this->db);
517 640
 				$MarineLive->deleteLiveMarineDataNotUpdated();
518 641
 				$MarineLive->db = null;
519 642
 				//MarineLive->deleteLiveMarineData();
520
-				if ($globalDebug) echo " Done\n";
643
+				if ($globalDebug) {
644
+					echo " Done\n";
645
+				}
521 646
 			    }
522 647
 			    $this->last_delete_hourly = time();
523 648
 			}
@@ -526,7 +651,9 @@  discard block
 block discarded – undo
526 651
 		    //$ignoreImport = false;
527 652
 		}
528 653
 		//if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN);
529
-		if ($send) return $this->all_tracked[$id];
654
+		if ($send) {
655
+			return $this->all_tracked[$id];
656
+		}
530 657
 	    }
531 658
 	}
532 659
     }
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.
Braces   +288 added lines, -113 removed lines patch added patch discarded remove patch
@@ -48,27 +48,52 @@  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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-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_Airlines']) && $_COOKIE['filter_Airlines'] != '') {
80
+	$filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
81
+}
82
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') {
83
+	$filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
84
+}
85
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') {
86
+	$filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
87
+}
88
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') {
89
+	$filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING);
90
+}
68 91
 
69 92
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 93
 	$min = true;
71
-} else $min = false;
94
+} else {
95
+	$min = false;
96
+}
72 97
 
73 98
 if (isset($_GET['ident'])) {
74 99
 	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
@@ -162,20 +187,30 @@  discard block
 block discarded – undo
162 187
 			$flightcnt = $SpotterLive->getLiveSpotterCount($filter);
163 188
 		}
164 189
 	}
165
-	if ($flightcnt == '') $flightcnt = 0;
166
-} else $flightcnt = 0;
190
+	if ($flightcnt == '') {
191
+		$flightcnt = 0;
192
+	}
193
+	} else {
194
+	$flightcnt = 0;
195
+}
167 196
 
168 197
 $sqltime = round(microtime(true)-$begintime,2);
169 198
 
170
-if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
171
-else $usenextlatlon = true;
199
+if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) {
200
+	$usenextlatlon = false;
201
+} else {
202
+	$usenextlatlon = true;
203
+}
172 204
 $j = 0;
173 205
 $prev_flightaware_id = '';
174 206
 $aircrafts_shadow = array();
175 207
 $output = '{';
176 208
 	$output .= '"type": "FeatureCollection",';
177
-		if ($min) $output .= '"minimal": "true",';
178
-		else $output .= '"minimal": "false",';
209
+		if ($min) {
210
+			$output .= '"minimal": "true",';
211
+		} else {
212
+			$output .= '"minimal": "false",';
213
+		}
179 214
 		//$output .= '"fc": "'.$flightcnt.'",';
180 215
 		$output .= '"sqt": "'.$sqltime.'",';
181 216
 
@@ -219,18 +254,29 @@  discard block
 block discarded – undo
219 254
 						}
220 255
 						$output .= '"properties": {';
221 256
 						if (isset($spotter_item['flightaware_id'])) {
222
-							if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
223
-							else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
257
+							if ($compress) {
258
+								$output .= '"fi": "'.$spotter_item['flightaware_id'].'",';
259
+							} else {
260
+								$output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",';
261
+							}
224 262
 						} elseif (isset($spotter_item['famtrackid'])) {
225
-							if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",';
226
-							else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
263
+							if ($compress) {
264
+								$output .= '"fti": "'.$spotter_item['famtrackid'].'",';
265
+							} else {
266
+								$output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",';
267
+							}
227 268
 						} elseif (isset($spotter_item['fammarine_id'])) {
228
-							if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
229
-							else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
269
+							if ($compress) {
270
+								$output .= '"fmi": "'.$spotter_item['fammarine_id'].'",';
271
+							} else {
272
+								$output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",';
273
+							}
230 274
 						}
231 275
 							$output .= '"fc": "'.$flightcnt.'",';
232 276
 							$output .= '"sqt": "'.$sqltime.'",';
233
-							if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
277
+							if (isset($begindate)) {
278
+								$output .= '"archive_date": "'.$begindate.'",';
279
+							}
234 280
 
235 281
 /*
236 282
 							if ($min) $output .= '"minimal": "true",';
@@ -238,14 +284,22 @@  discard block
 block discarded – undo
238 284
 */
239 285
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
240 286
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
241
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
242
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
287
+							if ($compress) {
288
+								$output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
289
+							} else {
290
+								$output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
291
+							}
243 292
 							//"
244 293
 						} else {
245
-							if ($compress) $output .= '"c": "NA",';
246
-							else $output .= '"callsign": "NA",';
294
+							if ($compress) {
295
+								$output .= '"c": "NA",';
296
+							} else {
297
+								$output .= '"callsign": "NA",';
298
+							}
299
+						}
300
+						if (isset($spotter_item['registration'])) {
301
+							$output .= '"registration": "'.$spotter_item['registration'].'",';
247 302
 						}
248
-						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
249 303
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
250 304
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
251 305
 							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
@@ -258,16 +312,23 @@  discard block
 block discarded – undo
258 312
 							$output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",';
259 313
 						}
260 314
 						if (!isset($spotter_item['aircraft_shadow']) && !$tracker) {
261
-							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = '';
262
-							else {
315
+							if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') {
316
+								$spotter_item['aircraft_shadow'] = '';
317
+							} else {
263 318
 								$aircraft_icao = $spotter_item['aircraft_icao'];
264
-								if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
265
-								else {
319
+								if (isset($aircrafts_shadow[$aircraft_icao])) {
320
+									$spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao];
321
+								} else {
266 322
 									$aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']);
267
-									if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
268
-									elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png';
269
-									elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
270
-									else $spotter_item['aircraft_shadow'] = '';
323
+									if (count($aircraft_info) > 0) {
324
+										$spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow'];
325
+									} elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') {
326
+										$spotter_item['aircraft_shadow'] = 'PA18.png';
327
+									} elseif ($aircraft_icao == 'PARAGLIDER') {
328
+										$spotter_item['aircraft_shadow'] = 'PARAGLIDER.png';
329
+									} else {
330
+										$spotter_item['aircraft_shadow'] = '';
331
+									}
271 332
 									$aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow'];
272 333
 								}
273 334
 							}
@@ -275,73 +336,139 @@  discard block
 block discarded – undo
275 336
 						if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') {
276 337
 							if ($tracker) {
277 338
 								if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') {
278
-									if ($compress) $output .= '"as": "ambulance.png",';
279
-									else $output .= '"aircraft_shadow": "ambulance.png",';
339
+									if ($compress) {
340
+										$output .= '"as": "ambulance.png",';
341
+									} else {
342
+										$output .= '"aircraft_shadow": "ambulance.png",';
343
+									}
280 344
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') {
281
-									if ($compress) $output .= '"as": "police.png",';
282
-									else $output .= '"aircraft_shadow": "police.png",';
345
+									if ($compress) {
346
+										$output .= '"as": "police.png",';
347
+									} else {
348
+										$output .= '"aircraft_shadow": "police.png",';
349
+									}
283 350
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') {
284
-									if ($compress) $output .= '"as": "ship.png",';
285
-									else $output .= '"aircraft_shadow": "ship.png",';
351
+									if ($compress) {
352
+										$output .= '"as": "ship.png",';
353
+									} else {
354
+										$output .= '"aircraft_shadow": "ship.png",';
355
+									}
286 356
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') {
287
-									if ($compress) $output .= '"as": "ship.png",';
288
-									else $output .= '"aircraft_shadow": "ship.png",';
357
+									if ($compress) {
358
+										$output .= '"as": "ship.png",';
359
+									} else {
360
+										$output .= '"aircraft_shadow": "ship.png",';
361
+									}
289 362
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') {
290
-									if ($compress) $output .= '"as": "ship.png",';
291
-									else $output .= '"aircraft_shadow": "ship.png",';
363
+									if ($compress) {
364
+										$output .= '"as": "ship.png",';
365
+									} else {
366
+										$output .= '"aircraft_shadow": "ship.png",';
367
+									}
292 368
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') {
293
-									if ($compress) $output .= '"as": "truck.png",';
294
-									else $output .= '"aircraft_shadow": "truck.png",';
369
+									if ($compress) {
370
+										$output .= '"as": "truck.png",';
371
+									} else {
372
+										$output .= '"aircraft_shadow": "truck.png",';
373
+									}
295 374
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') {
296
-									if ($compress) $output .= '"as": "truck.png",';
297
-									else $output .= '"aircraft_shadow": "truck.png",';
375
+									if ($compress) {
376
+										$output .= '"as": "truck.png",';
377
+									} else {
378
+										$output .= '"aircraft_shadow": "truck.png",';
379
+									}
298 380
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') {
299
-									if ($compress) $output .= '"as": "aircraft.png",';
300
-									else $output .= '"aircraft_shadow": "aircraft.png",';
381
+									if ($compress) {
382
+										$output .= '"as": "aircraft.png",';
383
+									} else {
384
+										$output .= '"aircraft_shadow": "aircraft.png",';
385
+									}
301 386
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') {
302
-									if ($compress) $output .= '"as": "aircraft.png",';
303
-									else $output .= '"aircraft_shadow": "aircraft.png",';
387
+									if ($compress) {
388
+										$output .= '"as": "aircraft.png",';
389
+									} else {
390
+										$output .= '"aircraft_shadow": "aircraft.png",';
391
+									}
304 392
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') {
305
-									if ($compress) $output .= '"as": "helico.png",';
306
-									else $output .= '"aircraft_shadow": "helico.png",';
393
+									if ($compress) {
394
+										$output .= '"as": "helico.png",';
395
+									} else {
396
+										$output .= '"aircraft_shadow": "helico.png",';
397
+									}
307 398
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') {
308
-									if ($compress) $output .= '"as": "rail.png",';
309
-									else $output .= '"aircraft_shadow": "rail.png",';
399
+									if ($compress) {
400
+										$output .= '"as": "rail.png",';
401
+									} else {
402
+										$output .= '"aircraft_shadow": "rail.png",';
403
+									}
310 404
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') {
311
-									if ($compress) $output .= '"as": "firetruck.png",';
312
-									else $output .= '"aircraft_shadow": "firetruck.png",';
405
+									if ($compress) {
406
+										$output .= '"as": "firetruck.png",';
407
+									} else {
408
+										$output .= '"aircraft_shadow": "firetruck.png",';
409
+									}
313 410
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') {
314
-									if ($compress) $output .= '"as": "bus.png",';
315
-									else $output .= '"aircraft_shadow": "bus.png",';
411
+									if ($compress) {
412
+										$output .= '"as": "bus.png",';
413
+									} else {
414
+										$output .= '"aircraft_shadow": "bus.png",';
415
+									}
316 416
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') {
317
-									if ($compress) $output .= '"as": "phone.png",';
318
-									else $output .= '"aircraft_shadow": "phone.png",';
417
+									if ($compress) {
418
+										$output .= '"as": "phone.png",';
419
+									} else {
420
+										$output .= '"aircraft_shadow": "phone.png",';
421
+									}
319 422
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') {
320
-									if ($compress) $output .= '"as": "jogger.png",';
321
-									else $output .= '"aircraft_shadow": "jogger.png",';
423
+									if ($compress) {
424
+										$output .= '"as": "jogger.png",';
425
+									} else {
426
+										$output .= '"aircraft_shadow": "jogger.png",';
427
+									}
322 428
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') {
323
-									if ($compress) $output .= '"as": "bike.png",';
324
-									else $output .= '"aircraft_shadow": "bike.png",';
429
+									if ($compress) {
430
+										$output .= '"as": "bike.png",';
431
+									} else {
432
+										$output .= '"aircraft_shadow": "bike.png",';
433
+									}
325 434
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') {
326
-									if ($compress) $output .= '"as": "motorcycle.png",';
327
-									else $output .= '"aircraft_shadow": "motorcycle.png",';
435
+									if ($compress) {
436
+										$output .= '"as": "motorcycle.png",';
437
+									} else {
438
+										$output .= '"aircraft_shadow": "motorcycle.png",';
439
+									}
328 440
 								} elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') {
329
-									if ($compress) $output .= '"as": "balloon.png",';
330
-									else $output .= '"aircraft_shadow": "balloon.png",';
441
+									if ($compress) {
442
+										$output .= '"as": "balloon.png",';
443
+									} else {
444
+										$output .= '"aircraft_shadow": "balloon.png",';
445
+									}
331 446
 								} else {
332
-									if ($compress) $output .= '"as": "car.png",';
333
-									else $output .= '"aircraft_shadow": "car.png",';
447
+									if ($compress) {
448
+										$output .= '"as": "car.png",';
449
+									} else {
450
+										$output .= '"aircraft_shadow": "car.png",';
451
+									}
334 452
 								}
335 453
 							} elseif ($marine) {
336
-								if ($compress) $output .= '"as": "ship.png",';
337
-								else $output .= '"aircraft_shadow": "ship.png",';
454
+								if ($compress) {
455
+									$output .= '"as": "ship.png",';
456
+								} else {
457
+									$output .= '"aircraft_shadow": "ship.png",';
458
+								}
338 459
 							} else {
339
-								if ($compress) $output .= '"as": "default.png",';
340
-								else $output .= '"aircraft_shadow": "default.png",';
460
+								if ($compress) {
461
+									$output .= '"as": "default.png",';
462
+								} else {
463
+									$output .= '"aircraft_shadow": "default.png",';
464
+								}
341 465
 							}
342 466
 						} else {
343
-							if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
344
-							else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
467
+							if ($compress) {
468
+								$output .= '"as": "'.$spotter_item['aircraft_shadow'].'",';
469
+							} else {
470
+								$output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",';
471
+							}
345 472
 						}
346 473
 						if (isset($spotter_item['airline_name'])) {
347 474
 							$output .= '"airline_name": "'.$spotter_item['airline_name'].'",';
@@ -349,8 +476,11 @@  discard block
 block discarded – undo
349 476
 							$output .= '"airline_name": "NA",';
350 477
 						}
351 478
 						if (isset($spotter_item['departure_airport'])) {
352
-							if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",';
353
-							else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
479
+							if ($compress) {
480
+								$output .= '"dac": "'.$spotter_item['departure_airport'].'",';
481
+							} else {
482
+								$output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",';
483
+							}
354 484
 						}
355 485
 						if (isset($spotter_item['departure_airport_city'])) {
356 486
 							$output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",';
@@ -362,8 +492,11 @@  discard block
 block discarded – undo
362 492
 							$output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",';
363 493
 						}
364 494
 						if (isset($spotter_item['arrival_airport'])) {
365
-							if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
366
-							else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
495
+							if ($compress) {
496
+								$output .= '"aac": "'.$spotter_item['arrival_airport'].'",';
497
+							} else {
498
+								$output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",';
499
+							}
367 500
 						}
368 501
 						if (isset($spotter_item['arrival_airport_city'])) {
369 502
 							$output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",';
@@ -382,11 +515,17 @@  discard block
 block discarded – undo
382 515
 						}
383 516
 						
384 517
 						if (isset($spotter_item['altitude'])) {
385
-							if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",';
386
-							else $output .= '"altitude": "'.$spotter_item['altitude'].'",';
518
+							if ($compress) {
519
+								$output .= '"a": "'.$spotter_item['altitude'].'",';
520
+							} else {
521
+								$output .= '"altitude": "'.$spotter_item['altitude'].'",';
522
+							}
523
+						}
524
+						if ($compress) {
525
+							$output .= '"h": "'.$spotter_item['heading'].'",';
526
+						} else {
527
+							$output .= '"heading": "'.$spotter_item['heading'].'",';
387 528
 						}
388
-						if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",';
389
-						else $output .= '"heading": "'.$spotter_item['heading'].'",';
390 529
 						
391 530
 						if (isset($archivespeed)) {
392 531
 							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
@@ -396,7 +535,9 @@  discard block
 block discarded – undo
396 535
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
397 536
 						}
398 537
 
399
-						if (!$min) $output .= '"image": "'.$image.'",';
538
+						if (!$min) {
539
+							$output .= '"image": "'.$image.'",';
540
+						}
400 541
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
401 542
 							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
402 543
 						}
@@ -404,8 +545,11 @@  discard block
 block discarded – undo
404 545
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
405 546
 						}
406 547
 						if (isset($spotter_item['squawk'])) {
407
-							if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",';
408
-							else $output .= '"squawk": "'.$spotter_item['squawk'].'",';
548
+							if ($compress) {
549
+								$output .= '"sq": "'.$spotter_item['squawk'].'",';
550
+							} else {
551
+								$output .= '"squawk": "'.$spotter_item['squawk'].'",';
552
+							}
409 553
 						}
410 554
 						if (isset($spotter_item['squawk_usage'])) {
411 555
 							$output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",';
@@ -424,14 +568,23 @@  discard block
 block discarded – undo
424 568
 						}
425 569
 						// type when not aircraft ?
426 570
 						if (isset($spotter_item['type'])) {
427
-							if ($compress) $output .= '"t": "'.$spotter_item['type'].'"';
428
-							else $output .= '"type": "'.$spotter_item['type'].'"';
571
+							if ($compress) {
572
+								$output .= '"t": "'.$spotter_item['type'].'"';
573
+							} else {
574
+								$output .= '"type": "'.$spotter_item['type'].'"';
575
+							}
429 576
 						} elseif ($marine) {
430
-							if ($compress) $output .= '"t": "ship"';
431
-							else $output .= '"type": "ship"';
577
+							if ($compress) {
578
+								$output .= '"t": "ship"';
579
+							} else {
580
+								$output .= '"type": "ship"';
581
+							}
432 582
 						} else {
433
-							if ($compress) $output .= '"t": "aircraft"';
434
-							else $output .= '"type": "aircraft"';
583
+							if ($compress) {
584
+								$output .= '"t": "aircraft"';
585
+							} else {
586
+								$output .= '"type": "aircraft"';
587
+							}
435 588
 						}
436 589
 						$output .= '},';
437 590
 						$output .= '"geometry": {';
@@ -499,7 +652,9 @@  discard block
 block discarded – undo
499 652
 			}
500 653
 */
501 654
 				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
502
-				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
655
+				if ($history == '' && isset($_COOKIE['history'])) {
656
+					$history = $_COOKIE['history'];
657
+				}
503 658
 				
504 659
 				if (
505 660
 				    (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') 
@@ -543,8 +698,11 @@  discard block
 block discarded – undo
543 698
 									$output_history .= ']}},';
544 699
 									$output .= $output_history;
545 700
 								}
546
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
547
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
701
+								if ($compress) {
702
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
703
+								} else {
704
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
705
+								}
548 706
 							}
549 707
 							$output_history .= '[';
550 708
 							$output_history .=  $spotter_history['longitude'].', ';
@@ -563,9 +721,14 @@  discard block
 block discarded – undo
563 721
 							$prev_alt = $alt;
564 722
 						} else {
565 723
 							if ($d == false) {
566
-								if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
567
-								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
568
-							} else $d = true;
724
+								if ($compress) {
725
+									$output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": [';
726
+								} else {
727
+									$output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
728
+								}
729
+							} else {
730
+								$d = true;
731
+							}
569 732
 							$output_history .= '[';
570 733
 							$output_history .=  $spotter_history['longitude'].', ';
571 734
 							$output_history .=  $spotter_history['latitude'];
@@ -586,7 +749,9 @@  discard block
 block discarded – undo
586 749
 							$output_historyd = '[';
587 750
 							$output_historyd .=  $spotter_item['longitude'].', ';
588 751
 							$output_historyd .=  $spotter_item['latitude'];
589
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
752
+							if (isset($spotter_history['altitude'])) {
753
+								$output_historyd .=  ','.$spotter_item['altitude']*30.48;
754
+							}
590 755
 							$output_historyd .= '],';
591 756
 							//$output_history = $output_historyd.$output_history;
592 757
 							$output_history = $output_history.$output_historyd;
@@ -608,8 +773,11 @@  discard block
 block discarded – undo
608 773
 				        && $spotter_item['arrival_airport'] != 'NA' 
609 774
 				        && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") 
610 775
 				    	    || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) {
611
-				    if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
612
-				    else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
776
+				    if ($compress) {
777
+				    	$output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": [';
778
+				    } else {
779
+				    	$output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": [';
780
+				    }
613 781
 				    if (isset($spotter_item['departure_airport_latitude'])) {
614 782
 					$output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],';
615 783
 				    } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') {
@@ -642,8 +810,11 @@  discard block
 block discarded – undo
642 810
 				    	    || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) 
643 811
 				    	    || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) {
644 812
 				    $havedata = false;
645
-				    if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
646
-				    else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
813
+				    if ($compress) {
814
+				    	$output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": [';
815
+				    } else {
816
+				    	$output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": [';
817
+				    }
647 818
 				    $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],';
648 819
 
649 820
 				    if (isset($spotter_item['arrival_airport_latitude'])) {
@@ -658,7 +829,9 @@  discard block
 block discarded – undo
658 829
 				    }
659 830
 				    //$output_dest  = substr($output_dest, 0, -1);
660 831
 				    $output_dest .= ']}},';
661
-				    if ($havedata) $output .= $output_dest;
832
+				    if ($havedata) {
833
+				    	$output .= $output_dest;
834
+				    }
662 835
 				    unset($output_dest);
663 836
 				}
664 837
 			}
@@ -666,7 +839,9 @@  discard block
 block discarded – undo
666 839
 			$output .= ']';
667 840
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
668 841
 			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
669
-			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
842
+			if (isset($begindate)) {
843
+				$output .= '"archive_date": "'.$begindate.'",';
844
+			}
670 845
 			$output .= '"fc": "'.$j.'"';
671 846
 		} else {
672 847
 			$output .= '"features": ';
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -55,23 +55,23 @@  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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING);
65
-if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING);
66
-if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING);
67
-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_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING);
65
+if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING);
66
+if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING);
67
+if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING);
68 68
 
69 69
 if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) {
70 70
 	$min = true;
71 71
 } else $min = false;
72 72
 
73 73
 if (isset($_GET['ident'])) {
74
-	$ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING));
74
+	$ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING));
75 75
 	if ($tracker) {
76 76
 		$spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident);
77 77
 	} elseif ($marine) {
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	}
86 86
 	$allhistory = true;
87 87
 } elseif (isset($_GET['flightaware_id'])) {
88
-	$flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING);
88
+	$flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING);
89 89
 	$spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id);
90 90
 	if (empty($spotter_array)) {
91 91
 		$from_archive = true;
@@ -93,44 +93,44 @@  discard block
 block discarded – undo
93 93
 	}
94 94
 	$allhistory = true;
95 95
 } elseif (isset($_GET['famtrack_id'])) {
96
-	$famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING));
96
+	$famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING));
97 97
 	$spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id);
98 98
 	$allhistory = true;
99 99
 } elseif (isset($_GET['fammarine_id'])) {
100
-	$fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING));
100
+	$fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING));
101 101
 	$spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id);
102 102
 	$allhistory = true;
103 103
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) {
104 104
 //} elseif (isset($_GET['coord'])) {
105 105
 	$usecoord = true;
106
-	$coord = explode(',',$_GET['coord']);
106
+	$coord = explode(',', $_GET['coord']);
107 107
 	if ($tracker) {
108
-		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter);
108
+		$spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter);
109 109
 	} elseif ($marine) {
110
-		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter);
110
+		$spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter);
111 111
 	} else {
112
-		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter);
112
+		$spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter);
113 113
 	}
114 114
 } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) {
115 115
 	$usecoord = true;
116
-	$coord = explode(',',$_GET['coord']);
116
+	$coord = explode(',', $_GET['coord']);
117 117
 	if ($tracker) {
118
-		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter);
118
+		$spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter);
119 119
 	} elseif ($marine) {
120
-		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter);
120
+		$spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter);
121 121
 	} else {
122
-		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter);
122
+		$spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter);
123 123
 	}
124 124
 } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) {
125 125
 	$from_archive = true;
126 126
 //	$begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
127 127
 //	$enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~')));
128
-	$begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT);
129
-	$enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT);
130
-	$archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT);
131
-	$begindate = date('Y-m-d H:i:s',$begindate);
132
-	$enddate = date('Y-m-d H:i:s',$enddate);
133
-	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter);
128
+	$begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT);
129
+	$enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT);
130
+	$archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT);
131
+	$begindate = date('Y-m-d H:i:s', $begindate);
132
+	$enddate = date('Y-m-d H:i:s', $enddate);
133
+	$spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter);
134 134
 } elseif ($min) {
135 135
 	if ($tracker) {
136 136
 		$spotter_array = $TrackerLive->getMinLiveTrackerData($filter);
@@ -142,17 +142,17 @@  discard block
 block discarded – undo
142 142
 #	$min = true;
143 143
 } else {
144 144
 	if ($tracker) {
145
-		$spotter_array = $TrackerLive->getLiveTrackerData('','',$filter);
145
+		$spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter);
146 146
 	} elseif ($marine) {
147
-		$spotter_array = $marineLive->getLiveMarineData('','',$filter);
147
+		$spotter_array = $marineLive->getLiveMarineData('', '', $filter);
148 148
 	} else {
149
-		$spotter_array = $SpotterLive->getLiveSpotterData('','',$filter);
149
+		$spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter);
150 150
 	}
151 151
 }
152 152
 
153 153
 if ($usecoord) {
154 154
 	if (isset($_GET['archive'])) {
155
-		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter);
155
+		$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter);
156 156
 	} else {
157 157
 		if ($tracker) {
158 158
 			$flightcnt = $TrackerLive->getLiveTrackerCount($filter);
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	if ($flightcnt == '') $flightcnt = 0;
166 166
 } else $flightcnt = 0;
167 167
 
168
-$sqltime = round(microtime(true)-$begintime,2);
168
+$sqltime = round(microtime(true) - $begintime, 2);
169 169
 
170 170
 if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false;
171 171
 else $usenextlatlon = true;
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		if (!empty($spotter_array) && is_array($spotter_array))
183 183
 		{
184 184
 			$output .= '"features": [';
185
-			foreach($spotter_array as $spotter_item)
185
+			foreach ($spotter_array as $spotter_item)
186 186
 			{
187 187
 				$j++;
188 188
 				date_default_timezone_set('UTC');
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 */
239 239
 							//$output .= '"fc": "'.$spotter_item['nb'].'",';
240 240
 						if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') {
241
-							if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",';
242
-							else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",';
241
+							if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",';
242
+							else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",';
243 243
 							//"
244 244
 						} else {
245 245
 							if ($compress) $output .= '"c": "NA",';
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 						if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",';
249 249
 						if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) {
250 250
 							$output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",';
251
-							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",';
251
+							$output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",';
252 252
 						} elseif (isset($spotter_item['aircraft_type'])) {
253 253
 							$output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",';
254 254
 						} elseif (!$min) {
@@ -389,16 +389,16 @@  discard block
 block discarded – undo
389 389
 						else $output .= '"heading": "'.$spotter_item['heading'].'",';
390 390
 						
391 391
 						if (isset($archivespeed)) {
392
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed);
392
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed);
393 393
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
394 394
 						} elseif ($usenextlatlon) {
395
-							$nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']);
395
+							$nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']);
396 396
 							$output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],';
397 397
 						}
398 398
 
399 399
 						if (!$min) $output .= '"image": "'.$image.'",';
400 400
 						if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') {
401
-							$output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",';
401
+							$output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",';
402 402
 						}
403 403
 						if (isset($spotter_item['image_source_website'])) {
404 404
 							$output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",';
@@ -420,7 +420,7 @@  discard block
 block discarded – undo
420 420
 							$output .= '"waypoints": "'.$spotter_item['waypoints'].'",';
421 421
 						}
422 422
 						if (isset($spotter_item['acars'])) {
423
-							$output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",';
423
+							$output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",';
424 424
 						}
425 425
 						// type when not aircraft ?
426 426
 						if (isset($spotter_item['type'])) {
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
                 
499 499
 			}
500 500
 */
501
-				$history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING);
501
+				$history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING);
502 502
 				if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history'];
503 503
 				
504 504
 				if (
@@ -506,11 +506,11 @@  discard block
 block discarded – undo
506 506
 				    || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory)
507 507
 				//    || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))
508 508
 				//    || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident'])
509
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
509
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
510 510
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])
511
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id']))
511
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id']))
512 512
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id'])
513
-				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid']))
513
+				    || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid']))
514 514
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid'])
515 515
 				    ) {
516 516
 					if ($tracker) {
@@ -547,9 +547,9 @@  discard block
 block discarded – undo
547 547
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": [';
548 548
 							}
549 549
 							$output_history .= '[';
550
-							$output_history .=  $spotter_history['longitude'].', ';
551
-							$output_history .=  $spotter_history['latitude'].', ';
552
-							$output_history .=  $spotter_history['altitude']*30.48;
550
+							$output_history .= $spotter_history['longitude'].', ';
551
+							$output_history .= $spotter_history['latitude'].', ';
552
+							$output_history .= $spotter_history['altitude']*30.48;
553 553
 							$output_history .= '],';
554 554
 							/*
555 555
 							if ($from_archive === false) {
@@ -567,8 +567,8 @@  discard block
 block discarded – undo
567 567
 								else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": [';
568 568
 							} else $d = true;
569 569
 							$output_history .= '[';
570
-							$output_history .=  $spotter_history['longitude'].', ';
571
-							$output_history .=  $spotter_history['latitude'];
570
+							$output_history .= $spotter_history['longitude'].', ';
571
+							$output_history .= $spotter_history['latitude'];
572 572
 							$output_history .= '],';
573 573
 							/*
574 574
 							if ($from_archive === false) {
@@ -584,9 +584,9 @@  discard block
 block discarded – undo
584 584
 					
585 585
 						if ($from_archive === false) {
586 586
 							$output_historyd = '[';
587
-							$output_historyd .=  $spotter_item['longitude'].', ';
588
-							$output_historyd .=  $spotter_item['latitude'];
589
-							if (isset($spotter_history['altitude'])) $output_historyd .=  ','.$spotter_item['altitude']*30.48;
587
+							$output_historyd .= $spotter_item['longitude'].', ';
588
+							$output_historyd .= $spotter_item['latitude'];
589
+							if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48;
590 590
 							$output_historyd .= '],';
591 591
 							//$output_history = $output_historyd.$output_history;
592 592
 							$output_history = $output_history.$output_historyd;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 					}
601 601
 				}
602 602
 				
603
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
603
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
604 604
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
605 605
 				     && (isset($spotter_item['departure_airport']) 
606 606
 				        && $spotter_item['departure_airport'] != 'NA' 
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 
635 635
 				//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))))) {
636 636
 				//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))))) {
637
-				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id']))
637
+				if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id']))
638 638
 				    || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']))
639 639
 				     && (isset($spotter_item['arrival_airport']) 
640 640
 				        && $spotter_item['arrival_airport'] != 'NA' 
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
 			$output  = substr($output, 0, -1);
666 666
 			$output .= ']';
667 667
 			$output .= ',"initial_sqltime": "'.$sqltime.'",';
668
-			$output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",';
668
+			$output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",';
669 669
 			if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",';
670 670
 			$output .= '"fc": "'.$j.'"';
671 671
 		} else {
Please login to merge, or discard this patch.