@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | require_once('header.php'); |
24 | 24 | |
25 | 25 | //calculuation for the pagination |
26 | -if(!isset($_GET['limit'])) |
|
26 | +if (!isset($_GET['limit'])) |
|
27 | 27 | { |
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
30 | 30 | $absolute_difference = 25; |
31 | -} else { |
|
31 | +} else { |
|
32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
33 | 33 | $limit_start = $limit_explode[0]; |
34 | 34 | $limit_end = $limit_explode[1]; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
52 | 52 | else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
53 | 53 | |
54 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
54 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
55 | 55 | $sql_begin = microtime(true); |
56 | 56 | if ($type == 'marine') { |
57 | 57 | $spotter_array = $Marine->getLatestMarineData($limit_start.",".$absolute_difference, $sort); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } else { |
61 | 61 | $spotter_array = $Spotter->getLatestSpotterData($limit_start.",".$absolute_difference, $sort); |
62 | 62 | } |
63 | -$sql_time = microtime(true)-$sql_begin; |
|
63 | +$sql_time = microtime(true) - $sql_begin; |
|
64 | 64 | $page_begin = microtime(true); |
65 | 65 | if (!empty($spotter_array)) |
66 | 66 | { |
@@ -77,6 +77,6 @@ discard block |
||
77 | 77 | print '</div>'; |
78 | 78 | print '</div>'; |
79 | 79 | } |
80 | -$page_time = microtime(true)-$page_begin; |
|
80 | +$page_time = microtime(true) - $page_begin; |
|
81 | 81 | require_once('footer.php'); |
82 | 82 | ?> |
83 | 83 | \ No newline at end of file |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
30 | 30 | $absolute_difference = 25; |
31 | -} else { |
|
31 | +} else { |
|
32 | 32 | $limit_explode = explode(",", $_GET['limit']); |
33 | 33 | $limit_start = $limit_explode[0]; |
34 | 34 | $limit_end = $limit_explode[1]; |
@@ -47,9 +47,13 @@ discard block |
||
47 | 47 | print '<h1>'._("Latest Activity").'</h1>'; |
48 | 48 | print '</div>'; |
49 | 49 | print '<div class="table column">'; |
50 | -if ($type == 'marine') print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
51 | -elseif ($type == 'tracker') print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
52 | -else print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
50 | +if ($type == 'marine') { |
|
51 | + print '<p>'._("The table below shows the detailed information of all recent vessels.").'</p>'; |
|
52 | +} elseif ($type == 'tracker') { |
|
53 | + print '<p>'._("The table below shows the detailed information of all recent trackers.").'</p>'; |
|
54 | +} else { |
|
55 | + print '<p>'._("The table below shows the detailed information of all recent flights.").'</p>'; |
|
56 | +} |
|
53 | 57 | |
54 | 58 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
55 | 59 | $sql_begin = microtime(true); |
@@ -14,7 +14,7 @@ |
||
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; |
@@ -9,10 +9,10 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | /** |
12 | - * Get SQL query part for filter used |
|
13 | - * @param Array $filter the filter |
|
14 | - * @return Array the SQL part |
|
15 | - */ |
|
12 | + * Get SQL query part for filter used |
|
13 | + * @param Array $filter the filter |
|
14 | + * @return Array the SQL part |
|
15 | + */ |
|
16 | 16 | public function getFilter($filter = array(),$where = false,$and = false) { |
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
@@ -108,44 +108,44 @@ discard block |
||
108 | 108 | } |
109 | 109 | |
110 | 110 | |
111 | - /** |
|
112 | - * Gets all the spotter information based on a particular callsign |
|
113 | - * |
|
114 | - * @return Array the spotter information |
|
115 | - * |
|
116 | - */ |
|
117 | - public function getLastArchiveTrackerDataByIdent($ident) |
|
118 | - { |
|
111 | + /** |
|
112 | + * Gets all the spotter information based on a particular callsign |
|
113 | + * |
|
114 | + * @return Array the spotter information |
|
115 | + * |
|
116 | + */ |
|
117 | + public function getLastArchiveTrackerDataByIdent($ident) |
|
118 | + { |
|
119 | 119 | $Tracker = new Tracker($this->db); |
120 | - date_default_timezone_set('UTC'); |
|
120 | + date_default_timezone_set('UTC'); |
|
121 | 121 | |
122 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
123 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
124 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
123 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
124 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
125 | 125 | |
126 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
126 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
127 | 127 | |
128 | - return $spotter_array; |
|
129 | - } |
|
128 | + return $spotter_array; |
|
129 | + } |
|
130 | 130 | |
131 | 131 | |
132 | - /** |
|
133 | - * Gets last the spotter information based on a particular id |
|
134 | - * |
|
135 | - * @return Array the spotter information |
|
136 | - * |
|
137 | - */ |
|
138 | - public function getLastArchiveTrackerDataById($id) |
|
139 | - { |
|
140 | - $Tracker = new Tracker($this->db); |
|
141 | - date_default_timezone_set('UTC'); |
|
142 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
143 | - //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
144 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
145 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
132 | + /** |
|
133 | + * Gets last the spotter information based on a particular id |
|
134 | + * |
|
135 | + * @return Array the spotter information |
|
136 | + * |
|
137 | + */ |
|
138 | + public function getLastArchiveTrackerDataById($id) |
|
139 | + { |
|
140 | + $Tracker = new Tracker($this->db); |
|
141 | + date_default_timezone_set('UTC'); |
|
142 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
143 | + //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
144 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
145 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
146 | 146 | |
147 | 147 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
148 | - /* |
|
148 | + /* |
|
149 | 149 | try { |
150 | 150 | $Connection = new Connection(); |
151 | 151 | $sth = Connection->$db->prepare($query); |
@@ -155,232 +155,232 @@ discard block |
||
155 | 155 | } |
156 | 156 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
157 | 157 | */ |
158 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
159 | - |
|
160 | - return $spotter_array; |
|
161 | - } |
|
162 | - |
|
163 | - /** |
|
164 | - * Gets all the spotter information based on a particular id |
|
165 | - * |
|
166 | - * @return Array the spotter information |
|
167 | - * |
|
168 | - */ |
|
169 | - public function getAllArchiveTrackerDataById($id) |
|
158 | + $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
159 | + |
|
160 | + return $spotter_array; |
|
161 | + } |
|
162 | + |
|
163 | + /** |
|
164 | + * Gets all the spotter information based on a particular id |
|
165 | + * |
|
166 | + * @return Array the spotter information |
|
167 | + * |
|
168 | + */ |
|
169 | + public function getAllArchiveTrackerDataById($id) |
|
170 | 170 | { |
171 | - date_default_timezone_set('UTC'); |
|
172 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
173 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
171 | + date_default_timezone_set('UTC'); |
|
172 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
173 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
174 | 174 | |
175 | 175 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
176 | 176 | |
177 | - try { |
|
178 | - $sth = $this->db->prepare($query); |
|
179 | - $sth->execute(array(':id' => $id)); |
|
180 | - } catch(PDOException $e) { |
|
181 | - echo $e->getMessage(); |
|
182 | - die; |
|
183 | - } |
|
184 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
185 | - |
|
186 | - return $spotter_array; |
|
187 | - } |
|
188 | - |
|
189 | - /** |
|
190 | - * Gets coordinate & time spotter information based on a particular id |
|
191 | - * |
|
192 | - * @return Array the spotter information |
|
193 | - * |
|
194 | - */ |
|
195 | - public function getCoordArchiveTrackerDataById($id) |
|
196 | - { |
|
197 | - date_default_timezone_set('UTC'); |
|
198 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
199 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
177 | + try { |
|
178 | + $sth = $this->db->prepare($query); |
|
179 | + $sth->execute(array(':id' => $id)); |
|
180 | + } catch(PDOException $e) { |
|
181 | + echo $e->getMessage(); |
|
182 | + die; |
|
183 | + } |
|
184 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
185 | + |
|
186 | + return $spotter_array; |
|
187 | + } |
|
188 | + |
|
189 | + /** |
|
190 | + * Gets coordinate & time spotter information based on a particular id |
|
191 | + * |
|
192 | + * @return Array the spotter information |
|
193 | + * |
|
194 | + */ |
|
195 | + public function getCoordArchiveTrackerDataById($id) |
|
196 | + { |
|
197 | + date_default_timezone_set('UTC'); |
|
198 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
199 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
200 | 200 | |
201 | 201 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
202 | 202 | |
203 | - try { |
|
204 | - $sth = $this->db->prepare($query); |
|
205 | - $sth->execute(array(':id' => $id)); |
|
206 | - } catch(PDOException $e) { |
|
207 | - echo $e->getMessage(); |
|
208 | - die; |
|
209 | - } |
|
210 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
203 | + try { |
|
204 | + $sth = $this->db->prepare($query); |
|
205 | + $sth->execute(array(':id' => $id)); |
|
206 | + } catch(PDOException $e) { |
|
207 | + echo $e->getMessage(); |
|
208 | + die; |
|
209 | + } |
|
210 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
211 | 211 | |
212 | - return $spotter_array; |
|
213 | - } |
|
212 | + return $spotter_array; |
|
213 | + } |
|
214 | 214 | |
215 | 215 | |
216 | - /** |
|
217 | - * Gets altitude information based on a particular callsign |
|
218 | - * |
|
219 | - * @return Array the spotter information |
|
220 | - * |
|
221 | - */ |
|
222 | - public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
223 | - { |
|
216 | + /** |
|
217 | + * Gets altitude information based on a particular callsign |
|
218 | + * |
|
219 | + * @return Array the spotter information |
|
220 | + * |
|
221 | + */ |
|
222 | + public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
223 | + { |
|
224 | 224 | |
225 | - date_default_timezone_set('UTC'); |
|
225 | + date_default_timezone_set('UTC'); |
|
226 | 226 | |
227 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
228 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
227 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
228 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
229 | 229 | |
230 | - try { |
|
231 | - $sth = $this->db->prepare($query); |
|
232 | - $sth->execute(array(':ident' => $ident)); |
|
233 | - } catch(PDOException $e) { |
|
234 | - echo $e->getMessage(); |
|
235 | - die; |
|
236 | - } |
|
237 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
230 | + try { |
|
231 | + $sth = $this->db->prepare($query); |
|
232 | + $sth->execute(array(':ident' => $ident)); |
|
233 | + } catch(PDOException $e) { |
|
234 | + echo $e->getMessage(); |
|
235 | + die; |
|
236 | + } |
|
237 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
238 | 238 | |
239 | - return $spotter_array; |
|
240 | - } |
|
239 | + return $spotter_array; |
|
240 | + } |
|
241 | 241 | |
242 | - /** |
|
243 | - * Gets altitude information based on a particular id |
|
244 | - * |
|
245 | - * @return Array the spotter information |
|
246 | - * |
|
247 | - */ |
|
248 | - public function getAltitudeArchiveTrackerDataById($id) |
|
249 | - { |
|
242 | + /** |
|
243 | + * Gets altitude information based on a particular id |
|
244 | + * |
|
245 | + * @return Array the spotter information |
|
246 | + * |
|
247 | + */ |
|
248 | + public function getAltitudeArchiveTrackerDataById($id) |
|
249 | + { |
|
250 | 250 | |
251 | - date_default_timezone_set('UTC'); |
|
251 | + date_default_timezone_set('UTC'); |
|
252 | 252 | |
253 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
254 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
253 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
254 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
255 | 255 | |
256 | - try { |
|
257 | - $sth = $this->db->prepare($query); |
|
258 | - $sth->execute(array(':id' => $id)); |
|
259 | - } catch(PDOException $e) { |
|
260 | - echo $e->getMessage(); |
|
261 | - die; |
|
262 | - } |
|
263 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
256 | + try { |
|
257 | + $sth = $this->db->prepare($query); |
|
258 | + $sth->execute(array(':id' => $id)); |
|
259 | + } catch(PDOException $e) { |
|
260 | + echo $e->getMessage(); |
|
261 | + die; |
|
262 | + } |
|
263 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
264 | 264 | |
265 | - return $spotter_array; |
|
266 | - } |
|
265 | + return $spotter_array; |
|
266 | + } |
|
267 | 267 | |
268 | - /** |
|
269 | - * Gets altitude & speed information based on a particular id |
|
270 | - * |
|
271 | - * @return Array the spotter information |
|
272 | - * |
|
273 | - */ |
|
274 | - public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
275 | - { |
|
268 | + /** |
|
269 | + * Gets altitude & speed information based on a particular id |
|
270 | + * |
|
271 | + * @return Array the spotter information |
|
272 | + * |
|
273 | + */ |
|
274 | + public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
275 | + { |
|
276 | 276 | |
277 | - date_default_timezone_set('UTC'); |
|
277 | + date_default_timezone_set('UTC'); |
|
278 | 278 | |
279 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
280 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
279 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
280 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
281 | 281 | |
282 | - try { |
|
283 | - $sth = $this->db->prepare($query); |
|
284 | - $sth->execute(array(':id' => $id)); |
|
285 | - } catch(PDOException $e) { |
|
286 | - echo $e->getMessage(); |
|
287 | - die; |
|
288 | - } |
|
289 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
282 | + try { |
|
283 | + $sth = $this->db->prepare($query); |
|
284 | + $sth->execute(array(':id' => $id)); |
|
285 | + } catch(PDOException $e) { |
|
286 | + echo $e->getMessage(); |
|
287 | + die; |
|
288 | + } |
|
289 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
290 | 290 | |
291 | - return $spotter_array; |
|
292 | - } |
|
291 | + return $spotter_array; |
|
292 | + } |
|
293 | 293 | |
294 | 294 | |
295 | - /** |
|
296 | - * Gets altitude information based on a particular callsign |
|
297 | - * |
|
298 | - * @return Array the spotter information |
|
299 | - * |
|
300 | - */ |
|
301 | - public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
302 | - { |
|
295 | + /** |
|
296 | + * Gets altitude information based on a particular callsign |
|
297 | + * |
|
298 | + * @return Array the spotter information |
|
299 | + * |
|
300 | + */ |
|
301 | + public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
302 | + { |
|
303 | 303 | |
304 | - date_default_timezone_set('UTC'); |
|
304 | + date_default_timezone_set('UTC'); |
|
305 | 305 | |
306 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
307 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
306 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
307 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
308 | 308 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
309 | 309 | |
310 | - try { |
|
311 | - $sth = $this->db->prepare($query); |
|
312 | - $sth->execute(array(':ident' => $ident)); |
|
313 | - } catch(PDOException $e) { |
|
314 | - echo $e->getMessage(); |
|
315 | - die; |
|
316 | - } |
|
317 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
310 | + try { |
|
311 | + $sth = $this->db->prepare($query); |
|
312 | + $sth->execute(array(':ident' => $ident)); |
|
313 | + } catch(PDOException $e) { |
|
314 | + echo $e->getMessage(); |
|
315 | + die; |
|
316 | + } |
|
317 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
318 | 318 | |
319 | - return $spotter_array; |
|
320 | - } |
|
319 | + return $spotter_array; |
|
320 | + } |
|
321 | 321 | |
322 | 322 | |
323 | 323 | |
324 | - /** |
|
325 | - * Gets all the archive spotter information |
|
326 | - * |
|
327 | - * @return Array the spotter information |
|
328 | - * |
|
329 | - */ |
|
330 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
331 | - { |
|
332 | - $Tracker = new Tracker($this->db); |
|
333 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
334 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
324 | + /** |
|
325 | + * Gets all the archive spotter information |
|
326 | + * |
|
327 | + * @return Array the spotter information |
|
328 | + * |
|
329 | + */ |
|
330 | + public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
331 | + { |
|
332 | + $Tracker = new Tracker($this->db); |
|
333 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
334 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
335 | 335 | |
336 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
336 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
337 | 337 | |
338 | - return $spotter_array; |
|
339 | - } |
|
338 | + return $spotter_array; |
|
339 | + } |
|
340 | 340 | |
341 | - public function deleteTrackerArchiveTrackData() |
|
342 | - { |
|
341 | + public function deleteTrackerArchiveTrackData() |
|
342 | + { |
|
343 | 343 | global $globalArchiveKeepTrackMonths; |
344 | - date_default_timezone_set('UTC'); |
|
344 | + date_default_timezone_set('UTC'); |
|
345 | 345 | $query = 'DELETE FROM tracker_archive WHERE tracker_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)'; |
346 | - try { |
|
347 | - $sth = $this->db->prepare($query); |
|
348 | - $sth->execute(); |
|
349 | - } catch(PDOException $e) { |
|
350 | - echo $e->getMessage(); |
|
351 | - die; |
|
352 | - } |
|
346 | + try { |
|
347 | + $sth = $this->db->prepare($query); |
|
348 | + $sth->execute(); |
|
349 | + } catch(PDOException $e) { |
|
350 | + echo $e->getMessage(); |
|
351 | + die; |
|
352 | + } |
|
353 | 353 | } |
354 | 354 | |
355 | 355 | /** |
356 | - * Gets Minimal Live Tracker data |
|
357 | - * |
|
358 | - * @return Array the spotter information |
|
359 | - * |
|
360 | - */ |
|
361 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
362 | - { |
|
363 | - global $globalDBdriver, $globalLiveInterval; |
|
364 | - date_default_timezone_set('UTC'); |
|
365 | - |
|
366 | - $filter_query = ''; |
|
367 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
368 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
369 | - } |
|
370 | - // Use spotter_output also ? |
|
371 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
372 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
373 | - } |
|
374 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
375 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
376 | - } |
|
377 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
378 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
379 | - } |
|
356 | + * Gets Minimal Live Tracker data |
|
357 | + * |
|
358 | + * @return Array the spotter information |
|
359 | + * |
|
360 | + */ |
|
361 | + public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
362 | + { |
|
363 | + global $globalDBdriver, $globalLiveInterval; |
|
364 | + date_default_timezone_set('UTC'); |
|
365 | + |
|
366 | + $filter_query = ''; |
|
367 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
368 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
369 | + } |
|
370 | + // Use spotter_output also ? |
|
371 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
372 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
373 | + } |
|
374 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
375 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
376 | + } |
|
377 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
378 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
379 | + } |
|
380 | 380 | |
381 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
382 | - if ($globalDBdriver == 'mysql') { |
|
383 | - /* |
|
381 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
382 | + if ($globalDBdriver == 'mysql') { |
|
383 | + /* |
|
384 | 384 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
385 | 385 | FROM tracker_archive |
386 | 386 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -399,56 +399,56 @@ discard block |
||
399 | 399 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
400 | 400 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
401 | 401 | '.$filter_query.' ORDER BY famtrackid'; |
402 | - } else { |
|
403 | - //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
404 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
402 | + } else { |
|
403 | + //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
404 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
405 | 405 | FROM tracker_archive |
406 | 406 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
407 | 407 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
408 | 408 | '.$filter_query.' ORDER BY famtrackid'; |
409 | - } |
|
410 | - //echo $query; |
|
411 | - try { |
|
412 | - $sth = $this->db->prepare($query); |
|
413 | - $sth->execute(); |
|
414 | - } catch(PDOException $e) { |
|
415 | - echo $e->getMessage(); |
|
416 | - die; |
|
417 | - } |
|
418 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
409 | + } |
|
410 | + //echo $query; |
|
411 | + try { |
|
412 | + $sth = $this->db->prepare($query); |
|
413 | + $sth->execute(); |
|
414 | + } catch(PDOException $e) { |
|
415 | + echo $e->getMessage(); |
|
416 | + die; |
|
417 | + } |
|
418 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
419 | 419 | |
420 | - return $spotter_array; |
|
421 | - } |
|
420 | + return $spotter_array; |
|
421 | + } |
|
422 | 422 | |
423 | 423 | /** |
424 | - * Gets Minimal Live Tracker data |
|
425 | - * |
|
426 | - * @return Array the spotter information |
|
427 | - * |
|
428 | - */ |
|
429 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
430 | - { |
|
431 | - global $globalDBdriver, $globalLiveInterval; |
|
432 | - date_default_timezone_set('UTC'); |
|
433 | - |
|
434 | - $filter_query = ''; |
|
435 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
436 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
437 | - } |
|
438 | - // Should use spotter_output also ? |
|
439 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
440 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
441 | - } |
|
442 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
443 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
444 | - } |
|
445 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
446 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
447 | - } |
|
424 | + * Gets Minimal Live Tracker data |
|
425 | + * |
|
426 | + * @return Array the spotter information |
|
427 | + * |
|
428 | + */ |
|
429 | + public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
430 | + { |
|
431 | + global $globalDBdriver, $globalLiveInterval; |
|
432 | + date_default_timezone_set('UTC'); |
|
433 | + |
|
434 | + $filter_query = ''; |
|
435 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
436 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
437 | + } |
|
438 | + // Should use spotter_output also ? |
|
439 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
440 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
441 | + } |
|
442 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
443 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
444 | + } |
|
445 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
446 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
447 | + } |
|
448 | 448 | |
449 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
450 | - if ($globalDBdriver == 'mysql') { |
|
451 | - /* |
|
449 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
450 | + if ($globalDBdriver == 'mysql') { |
|
451 | + /* |
|
452 | 452 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
453 | 453 | FROM tracker_archive |
454 | 454 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -459,95 +459,95 @@ discard block |
||
459 | 459 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
460 | 460 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
461 | 461 | |
462 | - } else { |
|
463 | - //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
464 | - /* |
|
462 | + } else { |
|
463 | + //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
464 | + /* |
|
465 | 465 | $query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
466 | 466 | FROM tracker_archive_output |
467 | 467 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
468 | 468 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
469 | 469 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
470 | 470 | */ |
471 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
471 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
472 | 472 | FROM tracker_archive_output |
473 | 473 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
474 | 474 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
475 | 475 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
476 | 476 | // .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
477 | 477 | |
478 | - } |
|
479 | - //echo $query; |
|
480 | - try { |
|
481 | - $sth = $this->db->prepare($query); |
|
482 | - $sth->execute(); |
|
483 | - } catch(PDOException $e) { |
|
484 | - echo $e->getMessage(); |
|
485 | - die; |
|
486 | - } |
|
487 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
478 | + } |
|
479 | + //echo $query; |
|
480 | + try { |
|
481 | + $sth = $this->db->prepare($query); |
|
482 | + $sth->execute(); |
|
483 | + } catch(PDOException $e) { |
|
484 | + echo $e->getMessage(); |
|
485 | + die; |
|
486 | + } |
|
487 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
488 | 488 | |
489 | - return $spotter_array; |
|
490 | - } |
|
489 | + return $spotter_array; |
|
490 | + } |
|
491 | 491 | |
492 | 492 | /** |
493 | - * Gets count Live Tracker data |
|
494 | - * |
|
495 | - * @return Array the spotter information |
|
496 | - * |
|
497 | - */ |
|
498 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
499 | - { |
|
500 | - global $globalDBdriver, $globalLiveInterval; |
|
501 | - date_default_timezone_set('UTC'); |
|
502 | - |
|
503 | - $filter_query = ''; |
|
504 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
505 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
506 | - } |
|
507 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
508 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
509 | - } |
|
510 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
511 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
512 | - } |
|
513 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
514 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
515 | - } |
|
493 | + * Gets count Live Tracker data |
|
494 | + * |
|
495 | + * @return Array the spotter information |
|
496 | + * |
|
497 | + */ |
|
498 | + public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
499 | + { |
|
500 | + global $globalDBdriver, $globalLiveInterval; |
|
501 | + date_default_timezone_set('UTC'); |
|
516 | 502 | |
517 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
518 | - if ($globalDBdriver == 'mysql') { |
|
503 | + $filter_query = ''; |
|
504 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
505 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
506 | + } |
|
507 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
508 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
509 | + } |
|
510 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
511 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
512 | + } |
|
513 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
514 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
515 | + } |
|
516 | + |
|
517 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
518 | + if ($globalDBdriver == 'mysql') { |
|
519 | 519 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb |
520 | 520 | FROM tracker_archive l |
521 | 521 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
522 | - } else { |
|
522 | + } else { |
|
523 | 523 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
524 | - } |
|
525 | - //echo $query; |
|
526 | - try { |
|
527 | - $sth = $this->db->prepare($query); |
|
528 | - $sth->execute(); |
|
529 | - } catch(PDOException $e) { |
|
530 | - echo $e->getMessage(); |
|
531 | - die; |
|
532 | - } |
|
524 | + } |
|
525 | + //echo $query; |
|
526 | + try { |
|
527 | + $sth = $this->db->prepare($query); |
|
528 | + $sth->execute(); |
|
529 | + } catch(PDOException $e) { |
|
530 | + echo $e->getMessage(); |
|
531 | + die; |
|
532 | + } |
|
533 | 533 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
534 | 534 | $sth->closeCursor(); |
535 | - return $result['nb']; |
|
535 | + return $result['nb']; |
|
536 | 536 | |
537 | - } |
|
537 | + } |
|
538 | 538 | |
539 | 539 | |
540 | 540 | |
541 | 541 | // tracker_archive_output |
542 | 542 | |
543 | - /** |
|
544 | - * Gets all the spotter information |
|
545 | - * |
|
546 | - * @return Array the spotter information |
|
547 | - * |
|
548 | - */ |
|
549 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
550 | - { |
|
543 | + /** |
|
544 | + * Gets all the spotter information |
|
545 | + * |
|
546 | + * @return Array the spotter information |
|
547 | + * |
|
548 | + */ |
|
549 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
550 | + { |
|
551 | 551 | global $globalTimezone, $globalDBdriver; |
552 | 552 | require_once(dirname(__FILE__).'/class.Translation.php'); |
553 | 553 | $Translation = new Translation(); |
@@ -561,159 +561,159 @@ discard block |
||
561 | 561 | $filter_query = $this->getFilter($filters); |
562 | 562 | if ($q != "") |
563 | 563 | { |
564 | - if (!is_string($q)) |
|
565 | - { |
|
564 | + if (!is_string($q)) |
|
565 | + { |
|
566 | 566 | return false; |
567 | - } else { |
|
567 | + } else { |
|
568 | 568 | |
569 | 569 | $q_array = explode(" ", $q); |
570 | 570 | |
571 | 571 | foreach ($q_array as $q_item){ |
572 | - $additional_query .= " AND ("; |
|
573 | - $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
574 | - $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
575 | - $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
576 | - $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
577 | - $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
578 | - $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
579 | - $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
580 | - $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
581 | - $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
582 | - $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
583 | - $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
584 | - $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
585 | - $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
586 | - $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
587 | - $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
588 | - $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
589 | - $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
590 | - $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
591 | - $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
592 | - $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
593 | - $translate = $Translation->ident2icao($q_item); |
|
594 | - if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
595 | - $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
596 | - $additional_query .= ")"; |
|
572 | + $additional_query .= " AND ("; |
|
573 | + $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
574 | + $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
575 | + $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
576 | + $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
577 | + $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
578 | + $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
579 | + $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
580 | + $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
581 | + $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
582 | + $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
583 | + $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
584 | + $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
585 | + $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
586 | + $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
587 | + $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
588 | + $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
589 | + $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
590 | + $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
591 | + $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
592 | + $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
593 | + $translate = $Translation->ident2icao($q_item); |
|
594 | + if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
595 | + $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
596 | + $additional_query .= ")"; |
|
597 | + } |
|
597 | 598 | } |
598 | - } |
|
599 | 599 | } |
600 | 600 | |
601 | 601 | if ($registration != "") |
602 | 602 | { |
603 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
604 | - if (!is_string($registration)) |
|
605 | - { |
|
603 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
604 | + if (!is_string($registration)) |
|
605 | + { |
|
606 | 606 | return false; |
607 | - } else { |
|
607 | + } else { |
|
608 | 608 | $additional_query .= " AND (tracker_archive_output.registration = '".$registration."')"; |
609 | - } |
|
609 | + } |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | if ($aircraft_icao != "") |
613 | 613 | { |
614 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
615 | - if (!is_string($aircraft_icao)) |
|
616 | - { |
|
614 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
615 | + if (!is_string($aircraft_icao)) |
|
616 | + { |
|
617 | 617 | return false; |
618 | - } else { |
|
618 | + } else { |
|
619 | 619 | $additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
620 | - } |
|
620 | + } |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | if ($aircraft_manufacturer != "") |
624 | 624 | { |
625 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
626 | - if (!is_string($aircraft_manufacturer)) |
|
627 | - { |
|
625 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
626 | + if (!is_string($aircraft_manufacturer)) |
|
627 | + { |
|
628 | 628 | return false; |
629 | - } else { |
|
629 | + } else { |
|
630 | 630 | $additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
631 | - } |
|
631 | + } |
|
632 | 632 | } |
633 | 633 | |
634 | 634 | if ($highlights == "true") |
635 | 635 | { |
636 | - if (!is_string($highlights)) |
|
637 | - { |
|
636 | + if (!is_string($highlights)) |
|
637 | + { |
|
638 | 638 | return false; |
639 | - } else { |
|
639 | + } else { |
|
640 | 640 | $additional_query .= " AND (tracker_archive_output.highlight <> '')"; |
641 | - } |
|
641 | + } |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | if ($airline_icao != "") |
645 | 645 | { |
646 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
647 | - if (!is_string($airline_icao)) |
|
648 | - { |
|
646 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
647 | + if (!is_string($airline_icao)) |
|
648 | + { |
|
649 | 649 | return false; |
650 | - } else { |
|
650 | + } else { |
|
651 | 651 | $additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')"; |
652 | - } |
|
652 | + } |
|
653 | 653 | } |
654 | 654 | |
655 | 655 | if ($airline_country != "") |
656 | 656 | { |
657 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
658 | - if (!is_string($airline_country)) |
|
659 | - { |
|
657 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
658 | + if (!is_string($airline_country)) |
|
659 | + { |
|
660 | 660 | return false; |
661 | - } else { |
|
661 | + } else { |
|
662 | 662 | $additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')"; |
663 | - } |
|
663 | + } |
|
664 | 664 | } |
665 | 665 | |
666 | 666 | if ($airline_type != "") |
667 | 667 | { |
668 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
669 | - if (!is_string($airline_type)) |
|
670 | - { |
|
668 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
669 | + if (!is_string($airline_type)) |
|
670 | + { |
|
671 | 671 | return false; |
672 | - } else { |
|
672 | + } else { |
|
673 | 673 | if ($airline_type == "passenger") |
674 | 674 | { |
675 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
675 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
676 | 676 | } |
677 | 677 | if ($airline_type == "cargo") |
678 | 678 | { |
679 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
679 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
680 | 680 | } |
681 | 681 | if ($airline_type == "military") |
682 | 682 | { |
683 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
683 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
684 | + } |
|
684 | 685 | } |
685 | - } |
|
686 | 686 | } |
687 | 687 | |
688 | 688 | if ($airport != "") |
689 | 689 | { |
690 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
691 | - if (!is_string($airport)) |
|
692 | - { |
|
690 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
691 | + if (!is_string($airport)) |
|
692 | + { |
|
693 | 693 | return false; |
694 | - } else { |
|
694 | + } else { |
|
695 | 695 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))"; |
696 | - } |
|
696 | + } |
|
697 | 697 | } |
698 | 698 | |
699 | 699 | if ($airport_country != "") |
700 | 700 | { |
701 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
702 | - if (!is_string($airport_country)) |
|
703 | - { |
|
701 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
702 | + if (!is_string($airport_country)) |
|
703 | + { |
|
704 | 704 | return false; |
705 | - } else { |
|
705 | + } else { |
|
706 | 706 | $additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))"; |
707 | - } |
|
707 | + } |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | if ($callsign != "") |
711 | 711 | { |
712 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
713 | - if (!is_string($callsign)) |
|
714 | - { |
|
712 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
713 | + if (!is_string($callsign)) |
|
714 | + { |
|
715 | 715 | return false; |
716 | - } else { |
|
716 | + } else { |
|
717 | 717 | $translate = $Translation->ident2icao($callsign); |
718 | 718 | if ($translate != $callsign) { |
719 | 719 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
@@ -721,99 +721,99 @@ discard block |
||
721 | 721 | } else { |
722 | 722 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
723 | 723 | } |
724 | - } |
|
724 | + } |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | if ($owner != "") |
728 | 728 | { |
729 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
730 | - if (!is_string($owner)) |
|
731 | - { |
|
729 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
730 | + if (!is_string($owner)) |
|
731 | + { |
|
732 | 732 | return false; |
733 | - } else { |
|
733 | + } else { |
|
734 | 734 | $additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')"; |
735 | - } |
|
735 | + } |
|
736 | 736 | } |
737 | 737 | |
738 | 738 | if ($pilot_name != "") |
739 | 739 | { |
740 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
741 | - if (!is_string($pilot_name)) |
|
742 | - { |
|
740 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
741 | + if (!is_string($pilot_name)) |
|
742 | + { |
|
743 | 743 | return false; |
744 | - } else { |
|
744 | + } else { |
|
745 | 745 | $additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')"; |
746 | - } |
|
746 | + } |
|
747 | 747 | } |
748 | 748 | |
749 | 749 | if ($pilot_id != "") |
750 | 750 | { |
751 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
752 | - if (!is_string($pilot_id)) |
|
753 | - { |
|
751 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
752 | + if (!is_string($pilot_id)) |
|
753 | + { |
|
754 | 754 | return false; |
755 | - } else { |
|
755 | + } else { |
|
756 | 756 | $additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')"; |
757 | - } |
|
757 | + } |
|
758 | 758 | } |
759 | 759 | |
760 | 760 | if ($departure_airport_route != "") |
761 | 761 | { |
762 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
763 | - if (!is_string($departure_airport_route)) |
|
764 | - { |
|
762 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
763 | + if (!is_string($departure_airport_route)) |
|
764 | + { |
|
765 | 765 | return false; |
766 | - } else { |
|
766 | + } else { |
|
767 | 767 | $additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
768 | - } |
|
768 | + } |
|
769 | 769 | } |
770 | 770 | |
771 | 771 | if ($arrival_airport_route != "") |
772 | 772 | { |
773 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
774 | - if (!is_string($arrival_airport_route)) |
|
775 | - { |
|
773 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
774 | + if (!is_string($arrival_airport_route)) |
|
775 | + { |
|
776 | 776 | return false; |
777 | - } else { |
|
777 | + } else { |
|
778 | 778 | $additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
779 | - } |
|
779 | + } |
|
780 | 780 | } |
781 | 781 | |
782 | 782 | if ($altitude != "") |
783 | 783 | { |
784 | - $altitude_array = explode(",", $altitude); |
|
784 | + $altitude_array = explode(",", $altitude); |
|
785 | 785 | |
786 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
787 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
786 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
787 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | 788 | |
789 | 789 | |
790 | - if ($altitude_array[1] != "") |
|
791 | - { |
|
790 | + if ($altitude_array[1] != "") |
|
791 | + { |
|
792 | 792 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
793 | 793 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
794 | 794 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
795 | - } else { |
|
795 | + } else { |
|
796 | 796 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
797 | 797 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
798 | - } |
|
798 | + } |
|
799 | 799 | } |
800 | 800 | |
801 | 801 | if ($date_posted != "") |
802 | 802 | { |
803 | - $date_array = explode(",", $date_posted); |
|
803 | + $date_array = explode(",", $date_posted); |
|
804 | 804 | |
805 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
806 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
805 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
806 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
807 | 807 | |
808 | - if ($globalTimezone != '') { |
|
808 | + if ($globalTimezone != '') { |
|
809 | 809 | date_default_timezone_set($globalTimezone); |
810 | 810 | $datetime = new DateTime(); |
811 | 811 | $offset = $datetime->format('P'); |
812 | - } else $offset = '+00:00'; |
|
812 | + } else $offset = '+00:00'; |
|
813 | 813 | |
814 | 814 | |
815 | - if ($date_array[1] != "") |
|
816 | - { |
|
815 | + if ($date_array[1] != "") |
|
816 | + { |
|
817 | 817 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
818 | 818 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
819 | 819 | if ($globalDBdriver == 'mysql') { |
@@ -821,28 +821,28 @@ discard block |
||
821 | 821 | } else { |
822 | 822 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
823 | 823 | } |
824 | - } else { |
|
824 | + } else { |
|
825 | 825 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
826 | - if ($globalDBdriver == 'mysql') { |
|
826 | + if ($globalDBdriver == 'mysql') { |
|
827 | 827 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
828 | 828 | } else { |
829 | 829 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
830 | 830 | } |
831 | - } |
|
831 | + } |
|
832 | 832 | } |
833 | 833 | |
834 | 834 | if ($limit != "") |
835 | 835 | { |
836 | - $limit_array = explode(",", $limit); |
|
836 | + $limit_array = explode(",", $limit); |
|
837 | 837 | |
838 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
839 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
838 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
839 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
840 | 840 | |
841 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
842 | - { |
|
841 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
842 | + { |
|
843 | 843 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
844 | 844 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
845 | - } |
|
845 | + } |
|
846 | 846 | } |
847 | 847 | |
848 | 848 | |
@@ -873,33 +873,33 @@ discard block |
||
873 | 873 | $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
874 | 874 | |
875 | 875 | return $spotter_array; |
876 | - } |
|
876 | + } |
|
877 | 877 | |
878 | - public function deleteTrackerArchiveData() |
|
879 | - { |
|
878 | + public function deleteTrackerArchiveData() |
|
879 | + { |
|
880 | 880 | global $globalArchiveKeepMonths, $globalDBdriver; |
881 | - date_default_timezone_set('UTC'); |
|
882 | - if ($globalDBdriver == 'mysql') { |
|
881 | + date_default_timezone_set('UTC'); |
|
882 | + if ($globalDBdriver == 'mysql') { |
|
883 | 883 | $query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
884 | 884 | } else { |
885 | 885 | $query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
886 | 886 | } |
887 | - try { |
|
888 | - $sth = $this->db->prepare($query); |
|
889 | - $sth->execute(); |
|
890 | - } catch(PDOException $e) { |
|
891 | - return "error"; |
|
892 | - } |
|
887 | + try { |
|
888 | + $sth = $this->db->prepare($query); |
|
889 | + $sth->execute(); |
|
890 | + } catch(PDOException $e) { |
|
891 | + return "error"; |
|
892 | + } |
|
893 | 893 | } |
894 | 894 | |
895 | - /** |
|
896 | - * Gets all the spotter information based on the callsign |
|
897 | - * |
|
898 | - * @return Array the spotter information |
|
899 | - * |
|
900 | - */ |
|
901 | - public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
902 | - { |
|
895 | + /** |
|
896 | + * Gets all the spotter information based on the callsign |
|
897 | + * |
|
898 | + * @return Array the spotter information |
|
899 | + * |
|
900 | + */ |
|
901 | + public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
902 | + { |
|
903 | 903 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
904 | 904 | |
905 | 905 | date_default_timezone_set('UTC'); |
@@ -911,35 +911,35 @@ discard block |
||
911 | 911 | |
912 | 912 | if ($ident != "") |
913 | 913 | { |
914 | - if (!is_string($ident)) |
|
915 | - { |
|
914 | + if (!is_string($ident)) |
|
915 | + { |
|
916 | 916 | return false; |
917 | - } else { |
|
917 | + } else { |
|
918 | 918 | $additional_query = " AND (tracker_archive_output.ident = :ident)"; |
919 | 919 | $query_values = array(':ident' => $ident); |
920 | - } |
|
920 | + } |
|
921 | 921 | } |
922 | 922 | |
923 | 923 | if ($limit != "") |
924 | 924 | { |
925 | - $limit_array = explode(",", $limit); |
|
925 | + $limit_array = explode(",", $limit); |
|
926 | 926 | |
927 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
928 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
927 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
928 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
929 | 929 | |
930 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
931 | - { |
|
930 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
931 | + { |
|
932 | 932 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
933 | 933 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
934 | - } |
|
934 | + } |
|
935 | 935 | } |
936 | 936 | |
937 | 937 | if ($sort != "") |
938 | 938 | { |
939 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
940 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
939 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
940 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
941 | 941 | } else { |
942 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
942 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
943 | 943 | } |
944 | 944 | |
945 | 945 | $query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -947,17 +947,17 @@ discard block |
||
947 | 947 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
948 | 948 | |
949 | 949 | return $spotter_array; |
950 | - } |
|
950 | + } |
|
951 | 951 | |
952 | 952 | |
953 | - /** |
|
954 | - * Gets all the spotter information based on the owner |
|
955 | - * |
|
956 | - * @return Array the spotter information |
|
957 | - * |
|
958 | - */ |
|
959 | - public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
960 | - { |
|
953 | + /** |
|
954 | + * Gets all the spotter information based on the owner |
|
955 | + * |
|
956 | + * @return Array the spotter information |
|
957 | + * |
|
958 | + */ |
|
959 | + public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
960 | + { |
|
961 | 961 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
962 | 962 | |
963 | 963 | date_default_timezone_set('UTC'); |
@@ -970,35 +970,35 @@ discard block |
||
970 | 970 | |
971 | 971 | if ($owner != "") |
972 | 972 | { |
973 | - if (!is_string($owner)) |
|
974 | - { |
|
973 | + if (!is_string($owner)) |
|
974 | + { |
|
975 | 975 | return false; |
976 | - } else { |
|
976 | + } else { |
|
977 | 977 | $additional_query = " AND (tracker_archive_output.owner_name = :owner)"; |
978 | 978 | $query_values = array(':owner' => $owner); |
979 | - } |
|
979 | + } |
|
980 | 980 | } |
981 | 981 | |
982 | 982 | if ($limit != "") |
983 | 983 | { |
984 | - $limit_array = explode(",", $limit); |
|
984 | + $limit_array = explode(",", $limit); |
|
985 | 985 | |
986 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
987 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
986 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
987 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | 988 | |
989 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
990 | - { |
|
989 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
990 | + { |
|
991 | 991 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
992 | 992 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
993 | - } |
|
993 | + } |
|
994 | 994 | } |
995 | 995 | |
996 | 996 | if ($sort != "") |
997 | 997 | { |
998 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
999 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
998 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
999 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1000 | 1000 | } else { |
1001 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1001 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1002 | 1002 | } |
1003 | 1003 | |
1004 | 1004 | $query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1006,16 +1006,16 @@ discard block |
||
1006 | 1006 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1007 | 1007 | |
1008 | 1008 | return $spotter_array; |
1009 | - } |
|
1010 | - |
|
1011 | - /** |
|
1012 | - * Gets all the spotter information based on the pilot |
|
1013 | - * |
|
1014 | - * @return Array the spotter information |
|
1015 | - * |
|
1016 | - */ |
|
1017 | - public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1018 | - { |
|
1009 | + } |
|
1010 | + |
|
1011 | + /** |
|
1012 | + * Gets all the spotter information based on the pilot |
|
1013 | + * |
|
1014 | + * @return Array the spotter information |
|
1015 | + * |
|
1016 | + */ |
|
1017 | + public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1018 | + { |
|
1019 | 1019 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
1020 | 1020 | |
1021 | 1021 | date_default_timezone_set('UTC'); |
@@ -1034,24 +1034,24 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | if ($limit != "") |
1036 | 1036 | { |
1037 | - $limit_array = explode(",", $limit); |
|
1037 | + $limit_array = explode(",", $limit); |
|
1038 | 1038 | |
1039 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1040 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1039 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1040 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1041 | 1041 | |
1042 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1043 | - { |
|
1042 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1043 | + { |
|
1044 | 1044 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1045 | 1045 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1046 | - } |
|
1046 | + } |
|
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | if ($sort != "") |
1050 | 1050 | { |
1051 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
1052 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1051 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
1052 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1053 | 1053 | } else { |
1054 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1054 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | $query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1059,16 +1059,16 @@ discard block |
||
1059 | 1059 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1060 | 1060 | |
1061 | 1061 | return $spotter_array; |
1062 | - } |
|
1063 | - |
|
1064 | - /** |
|
1065 | - * Gets all number of flight over countries |
|
1066 | - * |
|
1067 | - * @return Array the airline country list |
|
1068 | - * |
|
1069 | - */ |
|
1070 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1071 | - { |
|
1062 | + } |
|
1063 | + |
|
1064 | + /** |
|
1065 | + * Gets all number of flight over countries |
|
1066 | + * |
|
1067 | + * @return Array the airline country list |
|
1068 | + * |
|
1069 | + */ |
|
1070 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1071 | + { |
|
1072 | 1072 | global $globalDBdriver; |
1073 | 1073 | /* |
1074 | 1074 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1078,14 +1078,14 @@ discard block |
||
1078 | 1078 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
1079 | 1079 | FROM countries c, tracker_archive s |
1080 | 1080 | WHERE c.iso2 = s.over_country "; |
1081 | - if ($olderthanmonths > 0) { |
|
1082 | - if ($globalDBdriver == 'mysql') { |
|
1081 | + if ($olderthanmonths > 0) { |
|
1082 | + if ($globalDBdriver == 'mysql') { |
|
1083 | 1083 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1084 | 1084 | } else { |
1085 | 1085 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1086 | 1086 | } |
1087 | 1087 | } |
1088 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1088 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1089 | 1089 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1090 | 1090 | if ($limit) $query .= " LIMIT 0,10"; |
1091 | 1091 | |
@@ -1098,23 +1098,23 @@ discard block |
||
1098 | 1098 | |
1099 | 1099 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1100 | 1100 | { |
1101 | - $temp_array['flight_count'] = $row['nb']; |
|
1102 | - $temp_array['flight_country'] = $row['name']; |
|
1103 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1104 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1105 | - $flight_array[] = $temp_array; |
|
1101 | + $temp_array['flight_count'] = $row['nb']; |
|
1102 | + $temp_array['flight_country'] = $row['name']; |
|
1103 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1104 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1105 | + $flight_array[] = $temp_array; |
|
1106 | 1106 | } |
1107 | 1107 | return $flight_array; |
1108 | - } |
|
1109 | - |
|
1110 | - /** |
|
1111 | - * Gets all number of flight over countries |
|
1112 | - * |
|
1113 | - * @return Array the airline country list |
|
1114 | - * |
|
1115 | - */ |
|
1116 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1117 | - { |
|
1108 | + } |
|
1109 | + |
|
1110 | + /** |
|
1111 | + * Gets all number of flight over countries |
|
1112 | + * |
|
1113 | + * @return Array the airline country list |
|
1114 | + * |
|
1115 | + */ |
|
1116 | + public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1117 | + { |
|
1118 | 1118 | global $globalDBdriver; |
1119 | 1119 | /* |
1120 | 1120 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1124,14 +1124,14 @@ discard block |
||
1124 | 1124 | $query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb |
1125 | 1125 | FROM countries c, tracker_archive s, spotter_output o |
1126 | 1126 | WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid "; |
1127 | - if ($olderthanmonths > 0) { |
|
1128 | - if ($globalDBdriver == 'mysql') { |
|
1127 | + if ($olderthanmonths > 0) { |
|
1128 | + if ($globalDBdriver == 'mysql') { |
|
1129 | 1129 | $query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1130 | 1130 | } else { |
1131 | 1131 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1132 | 1132 | } |
1133 | 1133 | } |
1134 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1134 | + if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1135 | 1135 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1136 | 1136 | if ($limit) $query .= " LIMIT 0,10"; |
1137 | 1137 | |
@@ -1144,24 +1144,24 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1146 | 1146 | { |
1147 | - $temp_array['airline_icao'] = $row['airline_icao']; |
|
1148 | - $temp_array['flight_count'] = $row['nb']; |
|
1149 | - $temp_array['flight_country'] = $row['name']; |
|
1150 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1151 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1152 | - $flight_array[] = $temp_array; |
|
1147 | + $temp_array['airline_icao'] = $row['airline_icao']; |
|
1148 | + $temp_array['flight_count'] = $row['nb']; |
|
1149 | + $temp_array['flight_country'] = $row['name']; |
|
1150 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1151 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1152 | + $flight_array[] = $temp_array; |
|
1153 | 1153 | } |
1154 | 1154 | return $flight_array; |
1155 | - } |
|
1156 | - |
|
1157 | - /** |
|
1158 | - * Gets last spotter information based on a particular callsign |
|
1159 | - * |
|
1160 | - * @return Array the spotter information |
|
1161 | - * |
|
1162 | - */ |
|
1163 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1164 | - { |
|
1155 | + } |
|
1156 | + |
|
1157 | + /** |
|
1158 | + * Gets last spotter information based on a particular callsign |
|
1159 | + * |
|
1160 | + * @return Array the spotter information |
|
1161 | + * |
|
1162 | + */ |
|
1163 | + public function getDateArchiveTrackerDataById($id,$date) |
|
1164 | + { |
|
1165 | 1165 | $Tracker = new Tracker($this->db); |
1166 | 1166 | date_default_timezone_set('UTC'); |
1167 | 1167 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -1169,16 +1169,16 @@ discard block |
||
1169 | 1169 | $date = date('c',$date); |
1170 | 1170 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
1171 | 1171 | return $spotter_array; |
1172 | - } |
|
1173 | - |
|
1174 | - /** |
|
1175 | - * Gets all the spotter information based on a particular callsign |
|
1176 | - * |
|
1177 | - * @return Array the spotter information |
|
1178 | - * |
|
1179 | - */ |
|
1180 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1181 | - { |
|
1172 | + } |
|
1173 | + |
|
1174 | + /** |
|
1175 | + * Gets all the spotter information based on a particular callsign |
|
1176 | + * |
|
1177 | + * @return Array the spotter information |
|
1178 | + * |
|
1179 | + */ |
|
1180 | + public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1181 | + { |
|
1182 | 1182 | $Tracker = new Tracker($this->db); |
1183 | 1183 | date_default_timezone_set('UTC'); |
1184 | 1184 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -1186,16 +1186,16 @@ discard block |
||
1186 | 1186 | $date = date('c',$date); |
1187 | 1187 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
1188 | 1188 | return $spotter_array; |
1189 | - } |
|
1190 | - |
|
1191 | - /** |
|
1192 | - * Gets all the spotter information based on the airport |
|
1193 | - * |
|
1194 | - * @return Array the spotter information |
|
1195 | - * |
|
1196 | - */ |
|
1197 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1198 | - { |
|
1189 | + } |
|
1190 | + |
|
1191 | + /** |
|
1192 | + * Gets all the spotter information based on the airport |
|
1193 | + * |
|
1194 | + * @return Array the spotter information |
|
1195 | + * |
|
1196 | + */ |
|
1197 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1198 | + { |
|
1199 | 1199 | global $global_query; |
1200 | 1200 | $Tracker = new Tracker(); |
1201 | 1201 | date_default_timezone_set('UTC'); |
@@ -1206,35 +1206,35 @@ discard block |
||
1206 | 1206 | |
1207 | 1207 | if ($airport != "") |
1208 | 1208 | { |
1209 | - if (!is_string($airport)) |
|
1210 | - { |
|
1209 | + if (!is_string($airport)) |
|
1210 | + { |
|
1211 | 1211 | return false; |
1212 | - } else { |
|
1212 | + } else { |
|
1213 | 1213 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))"; |
1214 | 1214 | $query_values = array(':airport' => $airport); |
1215 | - } |
|
1215 | + } |
|
1216 | 1216 | } |
1217 | 1217 | |
1218 | 1218 | if ($limit != "") |
1219 | 1219 | { |
1220 | - $limit_array = explode(",", $limit); |
|
1220 | + $limit_array = explode(",", $limit); |
|
1221 | 1221 | |
1222 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1223 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1222 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1223 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1224 | 1224 | |
1225 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1226 | - { |
|
1225 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1226 | + { |
|
1227 | 1227 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1228 | 1228 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1229 | - } |
|
1229 | + } |
|
1230 | 1230 | } |
1231 | 1231 | |
1232 | 1232 | if ($sort != "") |
1233 | 1233 | { |
1234 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
1235 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1234 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
1235 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1236 | 1236 | } else { |
1237 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1237 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | $query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1242,6 +1242,6 @@ discard block |
||
1242 | 1242 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1243 | 1243 | |
1244 | 1244 | return $spotter_array; |
1245 | - } |
|
1245 | + } |
|
1246 | 1246 | } |
1247 | 1247 | ?> |
1248 | 1248 | \ No newline at end of file |
@@ -13,33 +13,33 @@ discard block |
||
13 | 13 | * @param Array $filter the filter |
14 | 14 | * @return Array the SQL part |
15 | 15 | */ |
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
22 | 22 | } else { |
23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | if (isset($filter[0]['source'])) { |
27 | - $filters = array_merge($filters,$filter); |
|
27 | + $filters = array_merge($filters, $filter); |
|
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
34 | 34 | if (isset($flt['source'])) { |
35 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
35 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
36 | 36 | } else { |
37 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_archive.famtrackid"; |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | if (isset($filter['source']) && !empty($filter['source'])) { |
42 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
42 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
43 | 43 | } |
44 | 44 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
45 | 45 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -67,38 +67,38 @@ discard block |
||
67 | 67 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_archive_output.date) = '".$filter['day']."'"; |
68 | 68 | } |
69 | 69 | } |
70 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
70 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_archive.famtrackid"; |
|
71 | 71 | } |
72 | 72 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
73 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
73 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
74 | 74 | } |
75 | 75 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
76 | 76 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
77 | 77 | if ($filter_query_where != '') { |
78 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
78 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
79 | 79 | } |
80 | 80 | $filter_query = $filter_query_join.$filter_query_where; |
81 | 81 | return $filter_query; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // tracker_archive |
85 | - public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') { |
|
85 | + public function addTrackerArchiveData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') { |
|
86 | 86 | require_once(dirname(__FILE__).'/class.Tracker.php'); |
87 | 87 | if ($over_country == '') { |
88 | 88 | $Tracker = new Tracker($this->db); |
89 | - $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
89 | + $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
90 | 90 | if (!empty($data_country)) $country = $data_country['iso2']; |
91 | 91 | else $country = ''; |
92 | 92 | } else $country = $over_country; |
93 | 93 | // Route is not added in tracker_archive |
94 | - $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
94 | + $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
95 | 95 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
96 | - $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); |
|
96 | + $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 | 97 | try { |
98 | 98 | $sth = $this->db->prepare($query); |
99 | 99 | $sth->execute($query_values); |
100 | 100 | $sth->closeCursor(); |
101 | - } catch(PDOException $e) { |
|
101 | + } catch (PDOException $e) { |
|
102 | 102 | return "error : ".$e->getMessage(); |
103 | 103 | } |
104 | 104 | return "success"; |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | |
119 | 119 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
120 | 120 | //$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"; |
121 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
121 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
122 | 122 | |
123 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
123 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident)); |
|
124 | 124 | |
125 | 125 | return $spotter_array; |
126 | 126 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
140 | 140 | //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
141 | 141 | //$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"; |
142 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
142 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
143 | 143 | |
144 | 144 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
145 | 145 | /* |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
154 | 154 | */ |
155 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
155 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id)); |
|
156 | 156 | |
157 | 157 | return $spotter_array; |
158 | 158 | } |
@@ -167,14 +167,14 @@ discard block |
||
167 | 167 | { |
168 | 168 | date_default_timezone_set('UTC'); |
169 | 169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
170 | - $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
170 | + $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
171 | 171 | |
172 | 172 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
173 | 173 | |
174 | 174 | try { |
175 | 175 | $sth = $this->db->prepare($query); |
176 | 176 | $sth->execute(array(':id' => $id)); |
177 | - } catch(PDOException $e) { |
|
177 | + } catch (PDOException $e) { |
|
178 | 178 | echo $e->getMessage(); |
179 | 179 | die; |
180 | 180 | } |
@@ -193,14 +193,14 @@ discard block |
||
193 | 193 | { |
194 | 194 | date_default_timezone_set('UTC'); |
195 | 195 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
196 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
196 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
197 | 197 | |
198 | 198 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
199 | 199 | |
200 | 200 | try { |
201 | 201 | $sth = $this->db->prepare($query); |
202 | 202 | $sth->execute(array(':id' => $id)); |
203 | - } catch(PDOException $e) { |
|
203 | + } catch (PDOException $e) { |
|
204 | 204 | echo $e->getMessage(); |
205 | 205 | die; |
206 | 206 | } |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | date_default_timezone_set('UTC'); |
223 | 223 | |
224 | 224 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
225 | - $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 | + $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 | 226 | |
227 | 227 | try { |
228 | 228 | $sth = $this->db->prepare($query); |
229 | 229 | $sth->execute(array(':ident' => $ident)); |
230 | - } catch(PDOException $e) { |
|
230 | + } catch (PDOException $e) { |
|
231 | 231 | echo $e->getMessage(); |
232 | 232 | die; |
233 | 233 | } |
@@ -248,12 +248,12 @@ discard block |
||
248 | 248 | date_default_timezone_set('UTC'); |
249 | 249 | |
250 | 250 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
251 | - $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 | + $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 | 252 | |
253 | 253 | try { |
254 | 254 | $sth = $this->db->prepare($query); |
255 | 255 | $sth->execute(array(':id' => $id)); |
256 | - } catch(PDOException $e) { |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo $e->getMessage(); |
258 | 258 | die; |
259 | 259 | } |
@@ -274,12 +274,12 @@ discard block |
||
274 | 274 | date_default_timezone_set('UTC'); |
275 | 275 | |
276 | 276 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
277 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
277 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
278 | 278 | |
279 | 279 | try { |
280 | 280 | $sth = $this->db->prepare($query); |
281 | 281 | $sth->execute(array(':id' => $id)); |
282 | - } catch(PDOException $e) { |
|
282 | + } catch (PDOException $e) { |
|
283 | 283 | echo $e->getMessage(); |
284 | 284 | die; |
285 | 285 | } |
@@ -301,13 +301,13 @@ discard block |
||
301 | 301 | date_default_timezone_set('UTC'); |
302 | 302 | |
303 | 303 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
304 | - $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 | + $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 | 305 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
306 | 306 | |
307 | 307 | try { |
308 | 308 | $sth = $this->db->prepare($query); |
309 | 309 | $sth->execute(array(':ident' => $ident)); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | echo $e->getMessage(); |
312 | 312 | die; |
313 | 313 | } |
@@ -324,13 +324,13 @@ discard block |
||
324 | 324 | * @return Array the spotter information |
325 | 325 | * |
326 | 326 | */ |
327 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
327 | + public function getTrackerArchiveData($ident, $famtrackid, $date) |
|
328 | 328 | { |
329 | 329 | $Tracker = new Tracker($this->db); |
330 | 330 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
331 | - $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"; |
|
331 | + $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 | 332 | |
333 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
333 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':famtrackid' => $famtrackid, ':date' => $date.'%')); |
|
334 | 334 | |
335 | 335 | return $spotter_array; |
336 | 336 | } |
@@ -343,7 +343,7 @@ discard block |
||
343 | 343 | try { |
344 | 344 | $sth = $this->db->prepare($query); |
345 | 345 | $sth->execute(); |
346 | - } catch(PDOException $e) { |
|
346 | + } catch (PDOException $e) { |
|
347 | 347 | echo $e->getMessage(); |
348 | 348 | die; |
349 | 349 | } |
@@ -355,24 +355,24 @@ discard block |
||
355 | 355 | * @return Array the spotter information |
356 | 356 | * |
357 | 357 | */ |
358 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
358 | + public function getMinLiveTrackerData($begindate, $enddate, $filter = array()) |
|
359 | 359 | { |
360 | 360 | global $globalDBdriver, $globalLiveInterval; |
361 | 361 | date_default_timezone_set('UTC'); |
362 | 362 | |
363 | 363 | $filter_query = ''; |
364 | 364 | if (isset($filter['source']) && !empty($filter['source'])) { |
365 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
365 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
366 | 366 | } |
367 | 367 | // Use spotter_output also ? |
368 | 368 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
369 | - $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 "; |
|
369 | + $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 | 370 | } |
371 | 371 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
372 | 372 | $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 "; |
373 | 373 | } |
374 | 374 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
375 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
375 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
376 | 376 | } |
377 | 377 | |
378 | 378 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -391,14 +391,14 @@ discard block |
||
391 | 391 | GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid |
392 | 392 | AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
393 | 393 | */ |
394 | - $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 |
|
394 | + $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 | 395 | FROM tracker_archive |
396 | 396 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
397 | 397 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
398 | 398 | '.$filter_query.' ORDER BY famtrackid'; |
399 | 399 | } else { |
400 | 400 | //$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'; |
401 | - $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 |
|
401 | + $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 | 402 | FROM tracker_archive |
403 | 403 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
404 | 404 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | try { |
409 | 409 | $sth = $this->db->prepare($query); |
410 | 410 | $sth->execute(); |
411 | - } catch(PDOException $e) { |
|
411 | + } catch (PDOException $e) { |
|
412 | 412 | echo $e->getMessage(); |
413 | 413 | die; |
414 | 414 | } |
@@ -423,24 +423,24 @@ discard block |
||
423 | 423 | * @return Array the spotter information |
424 | 424 | * |
425 | 425 | */ |
426 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
426 | + public function getMinLiveTrackerDataPlayback($begindate, $enddate, $filter = array()) |
|
427 | 427 | { |
428 | 428 | global $globalDBdriver, $globalLiveInterval; |
429 | 429 | date_default_timezone_set('UTC'); |
430 | 430 | |
431 | 431 | $filter_query = ''; |
432 | 432 | if (isset($filter['source']) && !empty($filter['source'])) { |
433 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
433 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
434 | 434 | } |
435 | 435 | // Should use spotter_output also ? |
436 | 436 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
437 | - $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 "; |
|
437 | + $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 | 438 | } |
439 | 439 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
440 | 440 | $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 "; |
441 | 441 | } |
442 | 442 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
443 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
443 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | FROM tracker_archive |
451 | 451 | 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'; |
452 | 452 | */ |
453 | - $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 |
|
453 | + $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 | 454 | FROM tracker_archive_output |
455 | 455 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive_output.aircraft_icao = a.icao |
456 | 456 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
466 | 466 | '.$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'; |
467 | 467 | */ |
468 | - $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 |
|
468 | + $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 | 469 | FROM tracker_archive_output |
470 | 470 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
471 | 471 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | try { |
478 | 478 | $sth = $this->db->prepare($query); |
479 | 479 | $sth->execute(); |
480 | - } catch(PDOException $e) { |
|
480 | + } catch (PDOException $e) { |
|
481 | 481 | echo $e->getMessage(); |
482 | 482 | die; |
483 | 483 | } |
@@ -492,23 +492,23 @@ discard block |
||
492 | 492 | * @return Array the spotter information |
493 | 493 | * |
494 | 494 | */ |
495 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
495 | + public function getLiveTrackerCount($begindate, $enddate, $filter = array()) |
|
496 | 496 | { |
497 | 497 | global $globalDBdriver, $globalLiveInterval; |
498 | 498 | date_default_timezone_set('UTC'); |
499 | 499 | |
500 | 500 | $filter_query = ''; |
501 | 501 | if (isset($filter['source']) && !empty($filter['source'])) { |
502 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
502 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
503 | 503 | } |
504 | 504 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
505 | - $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 "; |
|
505 | + $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 | 506 | } |
507 | 507 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
508 | 508 | $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
509 | 509 | } |
510 | 510 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
511 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
511 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
512 | 512 | } |
513 | 513 | |
514 | 514 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | try { |
524 | 524 | $sth = $this->db->prepare($query); |
525 | 525 | $sth->execute(); |
526 | - } catch(PDOException $e) { |
|
526 | + } catch (PDOException $e) { |
|
527 | 527 | echo $e->getMessage(); |
528 | 528 | die; |
529 | 529 | } |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | * @return Array the spotter information |
544 | 544 | * |
545 | 545 | */ |
546 | - 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()) |
|
546 | + 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 | 547 | { |
548 | 548 | global $globalTimezone, $globalDBdriver; |
549 | 549 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | |
566 | 566 | $q_array = explode(" ", $q); |
567 | 567 | |
568 | - foreach ($q_array as $q_item){ |
|
568 | + foreach ($q_array as $q_item) { |
|
569 | 569 | $additional_query .= " AND ("; |
570 | 570 | $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
571 | 571 | $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | |
598 | 598 | if ($registration != "") |
599 | 599 | { |
600 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
600 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
601 | 601 | if (!is_string($registration)) |
602 | 602 | { |
603 | 603 | return false; |
@@ -608,7 +608,7 @@ discard block |
||
608 | 608 | |
609 | 609 | if ($aircraft_icao != "") |
610 | 610 | { |
611 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
611 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
612 | 612 | if (!is_string($aircraft_icao)) |
613 | 613 | { |
614 | 614 | return false; |
@@ -619,7 +619,7 @@ discard block |
||
619 | 619 | |
620 | 620 | if ($aircraft_manufacturer != "") |
621 | 621 | { |
622 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
622 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
623 | 623 | if (!is_string($aircraft_manufacturer)) |
624 | 624 | { |
625 | 625 | return false; |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | |
641 | 641 | if ($airline_icao != "") |
642 | 642 | { |
643 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
643 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
644 | 644 | if (!is_string($airline_icao)) |
645 | 645 | { |
646 | 646 | return false; |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | if ($airline_country != "") |
653 | 653 | { |
654 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
654 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
655 | 655 | if (!is_string($airline_country)) |
656 | 656 | { |
657 | 657 | return false; |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | |
663 | 663 | if ($airline_type != "") |
664 | 664 | { |
665 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
665 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
666 | 666 | if (!is_string($airline_type)) |
667 | 667 | { |
668 | 668 | return false; |
@@ -684,7 +684,7 @@ discard block |
||
684 | 684 | |
685 | 685 | if ($airport != "") |
686 | 686 | { |
687 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
687 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
688 | 688 | if (!is_string($airport)) |
689 | 689 | { |
690 | 690 | return false; |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | |
696 | 696 | if ($airport_country != "") |
697 | 697 | { |
698 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
698 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
699 | 699 | if (!is_string($airport_country)) |
700 | 700 | { |
701 | 701 | return false; |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | |
707 | 707 | if ($callsign != "") |
708 | 708 | { |
709 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
709 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
710 | 710 | if (!is_string($callsign)) |
711 | 711 | { |
712 | 712 | return false; |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | $translate = $Translation->ident2icao($callsign); |
715 | 715 | if ($translate != $callsign) { |
716 | 716 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
717 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
717 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
718 | 718 | } else { |
719 | 719 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
720 | 720 | } |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | |
724 | 724 | if ($owner != "") |
725 | 725 | { |
726 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
726 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
727 | 727 | if (!is_string($owner)) |
728 | 728 | { |
729 | 729 | return false; |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | if ($pilot_name != "") |
736 | 736 | { |
737 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
737 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
738 | 738 | if (!is_string($pilot_name)) |
739 | 739 | { |
740 | 740 | return false; |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | |
746 | 746 | if ($pilot_id != "") |
747 | 747 | { |
748 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
748 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
749 | 749 | if (!is_string($pilot_id)) |
750 | 750 | { |
751 | 751 | return false; |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | |
757 | 757 | if ($departure_airport_route != "") |
758 | 758 | { |
759 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
759 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
760 | 760 | if (!is_string($departure_airport_route)) |
761 | 761 | { |
762 | 762 | return false; |
@@ -767,7 +767,7 @@ discard block |
||
767 | 767 | |
768 | 768 | if ($arrival_airport_route != "") |
769 | 769 | { |
770 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
770 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
771 | 771 | if (!is_string($arrival_airport_route)) |
772 | 772 | { |
773 | 773 | return false; |
@@ -780,8 +780,8 @@ discard block |
||
780 | 780 | { |
781 | 781 | $altitude_array = explode(",", $altitude); |
782 | 782 | |
783 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
784 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
783 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
784 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
785 | 785 | |
786 | 786 | |
787 | 787 | if ($altitude_array[1] != "") |
@@ -799,8 +799,8 @@ discard block |
||
799 | 799 | { |
800 | 800 | $date_array = explode(",", $date_posted); |
801 | 801 | |
802 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
803 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
802 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
803 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
804 | 804 | |
805 | 805 | if ($globalTimezone != '') { |
806 | 806 | date_default_timezone_set($globalTimezone); |
@@ -832,8 +832,8 @@ discard block |
||
832 | 832 | { |
833 | 833 | $limit_array = explode(",", $limit); |
834 | 834 | |
835 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
836 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
835 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
836 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
837 | 837 | |
838 | 838 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
839 | 839 | { |
@@ -844,8 +844,8 @@ discard block |
||
844 | 844 | |
845 | 845 | |
846 | 846 | if ($origLat != "" && $origLon != "" && $dist != "") { |
847 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
848 | - $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 |
|
847 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
848 | + $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 |
|
849 | 849 | 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)) |
850 | 850 | 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"; |
851 | 851 | } else { |
@@ -862,12 +862,12 @@ discard block |
||
862 | 862 | $additional_query .= " AND (tracker_archive_output.waypoints <> '')"; |
863 | 863 | } |
864 | 864 | |
865 | - $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
865 | + $query = "SELECT tracker_archive_output.* FROM tracker_archive_output |
|
866 | 866 | WHERE tracker_archive_output.ident <> '' |
867 | 867 | ".$additional_query." |
868 | 868 | ".$filter_query.$orderby_query; |
869 | 869 | } |
870 | - $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
|
870 | + $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
|
871 | 871 | |
872 | 872 | return $spotter_array; |
873 | 873 | } |
@@ -884,7 +884,7 @@ discard block |
||
884 | 884 | try { |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute(); |
887 | - } catch(PDOException $e) { |
|
887 | + } catch (PDOException $e) { |
|
888 | 888 | return "error"; |
889 | 889 | } |
890 | 890 | } |
@@ -921,8 +921,8 @@ discard block |
||
921 | 921 | { |
922 | 922 | $limit_array = explode(",", $limit); |
923 | 923 | |
924 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
925 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
924 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
925 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
926 | 926 | |
927 | 927 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
928 | 928 | { |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | $query_values = array(); |
964 | 964 | $limit_query = ''; |
965 | 965 | $additional_query = ''; |
966 | - $filter_query = $this->getFilter($filter,true,true); |
|
966 | + $filter_query = $this->getFilter($filter, true, true); |
|
967 | 967 | |
968 | 968 | if ($owner != "") |
969 | 969 | { |
@@ -980,8 +980,8 @@ discard block |
||
980 | 980 | { |
981 | 981 | $limit_array = explode(",", $limit); |
982 | 982 | |
983 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
984 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
983 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
984 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
985 | 985 | |
986 | 986 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
987 | 987 | { |
@@ -1021,7 +1021,7 @@ discard block |
||
1021 | 1021 | $query_values = array(); |
1022 | 1022 | $limit_query = ''; |
1023 | 1023 | $additional_query = ''; |
1024 | - $filter_query = $this->getFilter($filter,true,true); |
|
1024 | + $filter_query = $this->getFilter($filter, true, true); |
|
1025 | 1025 | |
1026 | 1026 | if ($pilot != "") |
1027 | 1027 | { |
@@ -1033,8 +1033,8 @@ discard block |
||
1033 | 1033 | { |
1034 | 1034 | $limit_array = explode(",", $limit); |
1035 | 1035 | |
1036 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1037 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1036 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1037 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1038 | 1038 | |
1039 | 1039 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1040 | 1040 | { |
@@ -1064,7 +1064,7 @@ discard block |
||
1064 | 1064 | * @return Array the airline country list |
1065 | 1065 | * |
1066 | 1066 | */ |
1067 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1067 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1068 | 1068 | { |
1069 | 1069 | global $globalDBdriver; |
1070 | 1070 | /* |
@@ -1093,7 +1093,7 @@ discard block |
||
1093 | 1093 | $flight_array = array(); |
1094 | 1094 | $temp_array = array(); |
1095 | 1095 | |
1096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1097 | 1097 | { |
1098 | 1098 | $temp_array['flight_count'] = $row['nb']; |
1099 | 1099 | $temp_array['flight_country'] = $row['name']; |
@@ -1110,7 +1110,7 @@ discard block |
||
1110 | 1110 | * @return Array the airline country list |
1111 | 1111 | * |
1112 | 1112 | */ |
1113 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1113 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1114 | 1114 | { |
1115 | 1115 | global $globalDBdriver; |
1116 | 1116 | /* |
@@ -1139,7 +1139,7 @@ discard block |
||
1139 | 1139 | $flight_array = array(); |
1140 | 1140 | $temp_array = array(); |
1141 | 1141 | |
1142 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1142 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1143 | 1143 | { |
1144 | 1144 | $temp_array['airline_icao'] = $row['airline_icao']; |
1145 | 1145 | $temp_array['flight_count'] = $row['nb']; |
@@ -1157,14 +1157,14 @@ discard block |
||
1157 | 1157 | * @return Array the spotter information |
1158 | 1158 | * |
1159 | 1159 | */ |
1160 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1160 | + public function getDateArchiveTrackerDataById($id, $date) |
|
1161 | 1161 | { |
1162 | 1162 | $Tracker = new Tracker($this->db); |
1163 | 1163 | date_default_timezone_set('UTC'); |
1164 | 1164 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1165 | - $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'; |
|
1166 | - $date = date('c',$date); |
|
1167 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1165 | + $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'; |
|
1166 | + $date = date('c', $date); |
|
1167 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1168 | 1168 | return $spotter_array; |
1169 | 1169 | } |
1170 | 1170 | |
@@ -1174,14 +1174,14 @@ discard block |
||
1174 | 1174 | * @return Array the spotter information |
1175 | 1175 | * |
1176 | 1176 | */ |
1177 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1177 | + public function getDateArchiveTrackerDataByIdent($ident, $date) |
|
1178 | 1178 | { |
1179 | 1179 | $Tracker = new Tracker($this->db); |
1180 | 1180 | date_default_timezone_set('UTC'); |
1181 | 1181 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1182 | - $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'; |
|
1183 | - $date = date('c',$date); |
|
1184 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1182 | + $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'; |
|
1183 | + $date = date('c', $date); |
|
1184 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1185 | 1185 | return $spotter_array; |
1186 | 1186 | } |
1187 | 1187 | |
@@ -1191,7 +1191,7 @@ discard block |
||
1191 | 1191 | * @return Array the spotter information |
1192 | 1192 | * |
1193 | 1193 | */ |
1194 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1194 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1195 | 1195 | { |
1196 | 1196 | global $global_query; |
1197 | 1197 | $Tracker = new Tracker(); |
@@ -1199,7 +1199,7 @@ discard block |
||
1199 | 1199 | $query_values = array(); |
1200 | 1200 | $limit_query = ''; |
1201 | 1201 | $additional_query = ''; |
1202 | - $filter_query = $this->getFilter($filters,true,true); |
|
1202 | + $filter_query = $this->getFilter($filters, true, true); |
|
1203 | 1203 | |
1204 | 1204 | if ($airport != "") |
1205 | 1205 | { |
@@ -1216,8 +1216,8 @@ discard block |
||
1216 | 1216 | { |
1217 | 1217 | $limit_array = explode(",", $limit); |
1218 | 1218 | |
1219 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1220 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1219 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1220 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1221 | 1221 | |
1222 | 1222 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1223 | 1223 | { |
@@ -26,7 +26,9 @@ discard block |
||
26 | 26 | if (isset($filter[0]['source'])) { |
27 | 27 | $filters = array_merge($filters,$filter); |
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) { |
|
30 | + $filter = array_merge($filter,$globalFilter); |
|
31 | + } |
|
30 | 32 | $filter_query_join = ''; |
31 | 33 | $filter_query_where = ''; |
32 | 34 | foreach($filters as $flt) { |
@@ -72,8 +74,11 @@ discard block |
||
72 | 74 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
73 | 75 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
74 | 76 | } |
75 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
76 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
77 | + if ($filter_query_where == '' && $where) { |
|
78 | + $filter_query_where = ' WHERE'; |
|
79 | + } elseif ($filter_query_where != '' && $and) { |
|
80 | + $filter_query_where .= ' AND'; |
|
81 | + } |
|
77 | 82 | if ($filter_query_where != '') { |
78 | 83 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
79 | 84 | } |
@@ -87,9 +92,14 @@ discard block |
||
87 | 92 | if ($over_country == '') { |
88 | 93 | $Tracker = new Tracker($this->db); |
89 | 94 | $data_country = $Tracker->getCountryFromLatitudeLongitude($latitude,$longitude); |
90 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
91 | - else $country = ''; |
|
92 | - } else $country = $over_country; |
|
95 | + if (!empty($data_country)) { |
|
96 | + $country = $data_country['iso2']; |
|
97 | + } else { |
|
98 | + $country = ''; |
|
99 | + } |
|
100 | + } else { |
|
101 | + $country = $over_country; |
|
102 | + } |
|
93 | 103 | // Route is not added in tracker_archive |
94 | 104 | $query = 'INSERT INTO tracker_archive (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
95 | 105 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
@@ -588,7 +598,9 @@ discard block |
||
588 | 598 | $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
589 | 599 | $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
590 | 600 | $translate = $Translation->ident2icao($q_item); |
591 | - if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
601 | + if ($translate != $q_item) { |
|
602 | + $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
603 | + } |
|
592 | 604 | $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
593 | 605 | $additional_query .= ")"; |
594 | 606 | } |
@@ -806,7 +818,9 @@ discard block |
||
806 | 818 | date_default_timezone_set($globalTimezone); |
807 | 819 | $datetime = new DateTime(); |
808 | 820 | $offset = $datetime->format('P'); |
809 | - } else $offset = '+00:00'; |
|
821 | + } else { |
|
822 | + $offset = '+00:00'; |
|
823 | + } |
|
810 | 824 | |
811 | 825 | |
812 | 826 | if ($date_array[1] != "") |
@@ -1082,9 +1096,13 @@ discard block |
||
1082 | 1096 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1083 | 1097 | } |
1084 | 1098 | } |
1085 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1099 | + if ($sincedate != '') { |
|
1100 | + $query .= "AND date > '".$sincedate."' "; |
|
1101 | + } |
|
1086 | 1102 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1087 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1103 | + if ($limit) { |
|
1104 | + $query .= " LIMIT 0,10"; |
|
1105 | + } |
|
1088 | 1106 | |
1089 | 1107 | |
1090 | 1108 | $sth = $this->db->prepare($query); |
@@ -1128,9 +1146,13 @@ discard block |
||
1128 | 1146 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1129 | 1147 | } |
1130 | 1148 | } |
1131 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1149 | + if ($sincedate != '') { |
|
1150 | + $query .= "AND s.date > '".$sincedate."' "; |
|
1151 | + } |
|
1132 | 1152 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1133 | - if ($limit) $query .= " LIMIT 0,10"; |
|
1153 | + if ($limit) { |
|
1154 | + $query .= " LIMIT 0,10"; |
|
1155 | + } |
|
1134 | 1156 | |
1135 | 1157 | |
1136 | 1158 | $sth = $this->db->prepare($query); |
@@ -7,7 +7,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
483 | 492 | } else { |
@@ -496,7 +505,9 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
502 | 513 | } else { |
@@ -514,7 +525,9 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
519 | 532 | print '</td>'."\n"; |
520 | 533 | } else { |
@@ -565,8 +578,9 @@ discard block |
||
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 |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
589 | 605 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -616,7 +632,9 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
621 | 639 | print '</td>'."\n"; |
622 | 640 | } else { |
@@ -630,7 +648,9 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
635 | 655 | print '</td>'."\n"; |
636 | 656 | } else { |
@@ -783,15 +803,21 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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>'; |
@@ -277,7 +277,7 @@ discard block |
||
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 |
||
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 |
||
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"; |
@@ -4,8 +4,8 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -514,7 +514,7 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -532,7 +532,7 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
538 | 538 | print '</td>'."\n"; |
@@ -576,7 +576,7 @@ discard block |
||
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 |
||
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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$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">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -636,7 +636,7 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
642 | 642 | print '</td>'."\n"; |
@@ -650,7 +650,7 @@ discard block |
||
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">© '.$spotter_item['image_copyright'].'</div>'; |
656 | 656 | print '</td>'."\n"; |
@@ -759,7 +759,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -8,31 +8,31 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -28,7 +28,7 @@ discard block |
||
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]); |
@@ -167,17 +167,17 @@ discard block |
||
167 | 167 | } |
168 | 168 | ?> |
169 | 169 | <?php |
170 | - if (isset($_POST['archive'])) { |
|
170 | + if (isset($_POST['archive'])) { |
|
171 | 171 | ?> |
172 | 172 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
173 | 173 | <?php |
174 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
174 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
175 | 175 | ?> |
176 | 176 | |
177 | 177 | <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> |
178 | 178 | <?php |
179 | - } |
|
180 | - } else { |
|
179 | + } |
|
180 | + } else { |
|
181 | 181 | ?> |
182 | 182 | <?php |
183 | 183 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | */ |
190 | 190 | ?> |
191 | 191 | <?php |
192 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
192 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
193 | 193 | ?> |
194 | 194 | <?php |
195 | 195 | // if (isset($globalBeta) && $globalBeta) { |
@@ -216,13 +216,13 @@ discard block |
||
216 | 216 | <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script> |
217 | 217 | <?php |
218 | 218 | } |
219 | - } |
|
219 | + } |
|
220 | 220 | ?> |
221 | 221 | <?php |
222 | 222 | // } |
223 | 223 | ?> |
224 | 224 | <?php |
225 | - } |
|
225 | + } |
|
226 | 226 | } |
227 | 227 | ?> |
228 | 228 | <?php |
@@ -398,48 +398,48 @@ discard block |
||
398 | 398 | <ul class="nav navbar-nav"> |
399 | 399 | |
400 | 400 | <?php |
401 | - $sub = false; |
|
402 | - if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
401 | + $sub = false; |
|
402 | + if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE))) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
403 | 403 | $sub = true; |
404 | - } |
|
404 | + } |
|
405 | 405 | ?> |
406 | 406 | <?php |
407 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
407 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
408 | 408 | ?> |
409 | 409 | <li class="dropdown"> |
410 | 410 | <?php |
411 | - if ($sub) { |
|
411 | + if ($sub) { |
|
412 | 412 | ?> |
413 | 413 | <li class="dropdown"> |
414 | 414 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a> |
415 | 415 | <ul class="dropdown-menu multi-level"> |
416 | 416 | <li class="dropdown-submenu"> |
417 | 417 | <?php |
418 | - } |
|
418 | + } |
|
419 | 419 | ?> |
420 | 420 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
421 | 421 | <ul class="dropdown-menu"> |
422 | 422 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li> |
423 | 423 | <?php |
424 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
424 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
425 | 425 | ?> |
426 | 426 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
427 | 427 | <?php |
428 | - } |
|
428 | + } |
|
429 | 429 | ?> |
430 | 430 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
431 | 431 | <?php |
432 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
432 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
433 | 433 | ?> |
434 | 434 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
435 | 435 | <?php |
436 | - } |
|
437 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
436 | + } |
|
437 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
438 | 438 | |
439 | 439 | ?> |
440 | 440 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
441 | 441 | <?php |
442 | - } |
|
442 | + } |
|
443 | 443 | ?> |
444 | 444 | <li><hr /></li> |
445 | 445 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -447,43 +447,43 @@ discard block |
||
447 | 447 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
448 | 448 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
449 | 449 | <?php |
450 | - if ($globalACARS) { |
|
451 | - if (isset($globalDemo) && $globalDemo) { |
|
452 | - ?> |
|
450 | + if ($globalACARS) { |
|
451 | + if (isset($globalDemo) && $globalDemo) { |
|
452 | + ?> |
|
453 | 453 | <li><hr /></li> |
454 | 454 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
455 | 455 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
456 | 456 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
457 | 457 | <?php |
458 | - } else { |
|
459 | - ?> |
|
458 | + } else { |
|
459 | + ?> |
|
460 | 460 | <li><hr /></li> |
461 | 461 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
462 | 462 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
463 | 463 | <?php |
464 | - } |
|
465 | - } |
|
466 | - ?> |
|
464 | + } |
|
465 | + } |
|
466 | + ?> |
|
467 | 467 | <?php |
468 | - if (isset($globalAccidents) && $globalAccidents) { |
|
469 | - ?> |
|
468 | + if (isset($globalAccidents) && $globalAccidents) { |
|
469 | + ?> |
|
470 | 470 | <li><hr /></li> |
471 | 471 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
472 | 472 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
473 | 473 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
474 | 474 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
475 | 475 | <?php |
476 | - } |
|
477 | - ?> |
|
476 | + } |
|
477 | + ?> |
|
478 | 478 | <li><hr /></li> |
479 | 479 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
480 | 480 | <?php |
481 | 481 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
482 | - ?> |
|
482 | + ?> |
|
483 | 483 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
484 | 484 | <?php |
485 | 485 | } |
486 | - ?> |
|
486 | + ?> |
|
487 | 487 | </ul> |
488 | 488 | </li> |
489 | 489 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -503,14 +503,14 @@ discard block |
||
503 | 503 | </ul> |
504 | 504 | <?php |
505 | 505 | } |
506 | - } |
|
506 | + } |
|
507 | 507 | ?> |
508 | 508 | <?php |
509 | - if (isset($globalMarine) && $globalMarine) { |
|
509 | + if (isset($globalMarine) && $globalMarine) { |
|
510 | 510 | ?> |
511 | 511 | <li class="dropdown"> |
512 | 512 | <?php |
513 | - if ($sub) { |
|
513 | + if ($sub) { |
|
514 | 514 | ?> |
515 | 515 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a> |
516 | 516 | <ul class="dropdown-menu multi-level"> |
@@ -535,14 +535,14 @@ discard block |
||
535 | 535 | } |
536 | 536 | ?> |
537 | 537 | <?php |
538 | - } |
|
538 | + } |
|
539 | 539 | ?> |
540 | 540 | <?php |
541 | - if (isset($globalTracker) && $globalTracker) { |
|
541 | + if (isset($globalTracker) && $globalTracker) { |
|
542 | 542 | ?> |
543 | 543 | <li class="dropdown"> |
544 | 544 | <?php |
545 | - if ($sub) { |
|
545 | + if ($sub) { |
|
546 | 546 | ?> |
547 | 547 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
548 | 548 | <ul class="dropdown-menu multi-level"> |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | } |
568 | 568 | ?> |
569 | 569 | <?php |
570 | - } |
|
570 | + } |
|
571 | 571 | ?> |
572 | 572 | |
573 | 573 | <li class="dropdown"> |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
577 | 577 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
578 | 578 | <?php |
579 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
579 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
580 | 580 | ?> |
581 | 581 | <li><hr /></li> |
582 | 582 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
583 | 583 | <?php |
584 | - } |
|
584 | + } |
|
585 | 585 | ?> |
586 | 586 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
587 | 587 | <li><hr /></li> |
@@ -602,14 +602,14 @@ discard block |
||
602 | 602 | <form> |
603 | 603 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
604 | 604 | <?php |
605 | - $Language = new Language(); |
|
606 | - $alllang = $Language->getLanguages(); |
|
607 | - foreach ($alllang as $key => $lang) { |
|
608 | - print '<option value="'.$key.'"'; |
|
609 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
610 | - print '>'.$lang[0].'</option>'; |
|
611 | - } |
|
612 | - ?> |
|
605 | + $Language = new Language(); |
|
606 | + $alllang = $Language->getLanguages(); |
|
607 | + foreach ($alllang as $key => $lang) { |
|
608 | + print '<option value="'.$key.'"'; |
|
609 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
610 | + print '>'.$lang[0].'</option>'; |
|
611 | + } |
|
612 | + ?> |
|
613 | 613 | </select> |
614 | 614 | </form> |
615 | 615 | </div> |
@@ -640,18 +640,18 @@ discard block |
||
640 | 640 | ?> |
641 | 641 | <div class="top-header clear" role="main"> |
642 | 642 | <?php |
643 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
643 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
644 | 644 | ?> |
645 | 645 | <div id="archive-map"></div> |
646 | 646 | <?php |
647 | - } |
|
647 | + } |
|
648 | 648 | ?> |
649 | 649 | </div> |
650 | 650 | <?php |
651 | 651 | } |
652 | 652 | 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)) |
653 | 653 | { |
654 | - ?> |
|
654 | + ?> |
|
655 | 655 | <div class="top-header clear" role="main"> |
656 | 656 | <div id="map"></div> |
657 | 657 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -662,15 +662,15 @@ discard block |
||
662 | 662 | var zoom = 13; |
663 | 663 | //create the map |
664 | 664 | <?php |
665 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
665 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
666 | 666 | ?> |
667 | 667 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
668 | 668 | <?php |
669 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
669 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
670 | 670 | ?> |
671 | 671 | map = L.map('map', { zoomControl:true }); |
672 | 672 | <?php |
673 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
673 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
674 | 674 | ?> |
675 | 675 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
676 | 676 | 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); |
@@ -678,22 +678,22 @@ discard block |
||
678 | 678 | 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); |
679 | 679 | 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); |
680 | 680 | <?php |
681 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
681 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
682 | 682 | ?> |
683 | 683 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
684 | 684 | <?php |
685 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
685 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
686 | 686 | ?> |
687 | 687 | map = L.map('map', { zoomControl:true }); |
688 | 688 | <?php |
689 | - } |
|
689 | + } |
|
690 | 690 | ?> |
691 | 691 | //initialize the layer group for the aircrft markers |
692 | 692 | var layer_data = L.layerGroup(); |
693 | 693 | |
694 | 694 | //a few title layers |
695 | 695 | <?php |
696 | - if ($globalMapProvider == 'Mapbox') { |
|
696 | + if ($globalMapProvider == 'Mapbox') { |
|
697 | 697 | ?> |
698 | 698 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
699 | 699 | maxZoom: 18, |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | token : '<?php print $globalMapboxToken; ?>' |
705 | 705 | }).addTo(map); |
706 | 706 | <?php |
707 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
707 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
708 | 708 | ?> |
709 | 709 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
710 | 710 | maxZoom: 18, |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
714 | 714 | }).addTo(map); |
715 | 715 | <?php |
716 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
716 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
717 | 717 | ?> |
718 | 718 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
719 | 719 | maxZoom: 18, |
@@ -722,27 +722,27 @@ discard block |
||
722 | 722 | '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"' |
723 | 723 | }).addTo(map); |
724 | 724 | <?php |
725 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
725 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
726 | 726 | ?> |
727 | 727 | var googleLayer = new L.Google('ROADMAP'); |
728 | 728 | map.addLayer(googleLayer); |
729 | 729 | <?php |
730 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
730 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
731 | 731 | ?> |
732 | 732 | var googleLayer = new L.Google('SATELLITE'); |
733 | 733 | map.addLayer(googleLayer); |
734 | 734 | <?php |
735 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
735 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
736 | 736 | ?> |
737 | 737 | var googleLayer = new L.Google('HYBRID'); |
738 | 738 | map.addLayer(googleLayer); |
739 | 739 | <?php |
740 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
740 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
741 | 741 | ?> |
742 | 742 | var googleLayer = new L.Google('Terrain'); |
743 | 743 | map.addLayer(googleLayer); |
744 | 744 | <?php |
745 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
745 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
746 | 746 | $customid = $globalMapProvider; |
747 | 747 | ?> |
748 | 748 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -752,8 +752,8 @@ discard block |
||
752 | 752 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
753 | 753 | }).addTo(map); |
754 | 754 | <?php |
755 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
756 | - } else { |
|
755 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
756 | + } else { |
|
757 | 757 | ?> |
758 | 758 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
759 | 759 | maxZoom: 18, |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | }).addTo(map); |
763 | 763 | |
764 | 764 | <?php |
765 | - } |
|
765 | + } |
|
766 | 766 | ?> |
767 | 767 | </script> |
768 | 768 | </div> |
@@ -3,10 +3,15 @@ discard block |
||
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'])) { |
@@ -240,7 +245,13 @@ discard block |
||
240 | 245 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
241 | 246 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
242 | 247 | <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> |
|
248 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
249 | + print '&latitude='.$latitude; |
|
250 | +} |
|
251 | +?><?php if(isset($longitude)) { |
|
252 | + print '&longitude='.$longitude; |
|
253 | +} |
|
254 | +?>&<?php print time(); ?>"></script> |
|
244 | 255 | <?php |
245 | 256 | if (!isset($type) || $type == 'aircraft') { |
246 | 257 | ?> |
@@ -310,7 +321,13 @@ discard block |
||
310 | 321 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
311 | 322 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
312 | 323 | <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> |
|
324 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
325 | + print '&latitude='.$latitude; |
|
326 | +} |
|
327 | +?><?php if(isset($longitude)) { |
|
328 | + print '&longitude='.$longitude; |
|
329 | +} |
|
330 | +?>&<?php print time(); ?>"></script> |
|
314 | 331 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
315 | 332 | <?php |
316 | 333 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -391,7 +408,12 @@ discard block |
||
391 | 408 | <span class="icon-bar"></span> |
392 | 409 | </button> |
393 | 410 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle navbar-toggle-search"><i class="fa fa-search"></i></a> |
394 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
411 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
412 | + print '/'; |
|
413 | +} else { |
|
414 | + print $globalURL; |
|
415 | +} |
|
416 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
395 | 417 | </div> |
396 | 418 | <div class="collapse navbar-collapse"> |
397 | 419 | |
@@ -417,7 +439,10 @@ discard block |
||
417 | 439 | <?php |
418 | 440 | } |
419 | 441 | ?> |
420 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
442 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
443 | + echo 'right-'; |
|
444 | +} |
|
445 | +?>caret"></b></a> |
|
421 | 446 | <ul class="dropdown-menu"> |
422 | 447 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircrafts Types"); ?></a></li> |
423 | 448 | <?php |
@@ -488,8 +513,14 @@ discard block |
||
488 | 513 | </li> |
489 | 514 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
490 | 515 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
491 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
492 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
516 | + <li class="dropdown<?php if ($sub) { |
|
517 | + echo '-submenu'; |
|
518 | +} |
|
519 | +?>"> |
|
520 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
521 | + echo 'right-'; |
|
522 | +} |
|
523 | +?>caret"></b></a> |
|
493 | 524 | <ul class="dropdown-menu"> |
494 | 525 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
495 | 526 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -518,7 +549,10 @@ discard block |
||
518 | 549 | <?php |
519 | 550 | } |
520 | 551 | ?> |
521 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
552 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
553 | + echo 'right-'; |
|
554 | +} |
|
555 | +?>caret"></b></a> |
|
522 | 556 | <ul class="dropdown-menu"> |
523 | 557 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
524 | 558 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -550,7 +584,10 @@ discard block |
||
550 | 584 | <?php |
551 | 585 | } |
552 | 586 | ?> |
553 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
587 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
588 | + echo 'right-'; |
|
589 | +} |
|
590 | +?>caret"></b></a> |
|
554 | 591 | <ul class="dropdown-menu"> |
555 | 592 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
556 | 593 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -606,7 +643,9 @@ discard block |
||
606 | 643 | $alllang = $Language->getLanguages(); |
607 | 644 | foreach ($alllang as $key => $lang) { |
608 | 645 | print '<option value="'.$key.'"'; |
609 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
646 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
647 | + print ' selected '; |
|
648 | + } |
|
610 | 649 | print '>'.$lang[0].'</option>'; |
611 | 650 | } |
612 | 651 | ?> |
@@ -746,9 +785,24 @@ discard block |
||
746 | 785 | $customid = $globalMapProvider; |
747 | 786 | ?> |
748 | 787 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
749 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
750 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
751 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
788 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
789 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
790 | +} else { |
|
791 | + print '18'; |
|
792 | +} |
|
793 | +?>, |
|
794 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
795 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
796 | +} else { |
|
797 | + print '0'; |
|
798 | +} |
|
799 | +?>, |
|
800 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
801 | + print 'false'; |
|
802 | +} else { |
|
803 | + print 'true'; |
|
804 | +} |
|
805 | +?>, |
|
752 | 806 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
753 | 807 | }).addTo(map); |
754 | 808 | <?php |
@@ -771,4 +825,7 @@ discard block |
||
771 | 825 | |
772 | 826 | ?> |
773 | 827 | |
774 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
828 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
829 | + print 'index '; |
|
830 | +} |
|
831 | +?>clear"> |
@@ -7,14 +7,14 @@ discard block |
||
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 |
||
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 |
||
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">'; |
@@ -40,8 +40,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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'); |
@@ -21,7 +21,7 @@ |
||
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'); |
@@ -19,7 +19,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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>'; |
@@ -4,7 +4,9 @@ discard block |
||
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 |
||
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'); |
@@ -37,7 +37,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
224 | 224 | </ul> |
225 | 225 | </div> |
226 | 226 | <?php |
227 | - } |
|
227 | + } |
|
228 | 228 | ?> |
229 | 229 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | print '<option value="all">All</option>'; |
24 | 24 | } |
25 | - foreach($airlines as $airline) { |
|
25 | + foreach ($airlines as $airline) { |
|
26 | 26 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
27 | 27 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
28 | 28 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if (!isset($type) || $type == 'aircraft') { |
46 | 46 | ?> |
47 | 47 | <li class="dropdown"> |
48 | - <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="#" > |
|
48 | + <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="#" > |
|
49 | 49 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
50 | 50 | </a> |
51 | 51 | <ul class="dropdown-menu"> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | </ul> |
57 | 57 | </li> |
58 | 58 | <li class="dropdown"> |
59 | - <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="#"> |
|
59 | + <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="#"> |
|
60 | 60 | <?php echo _("Airline"); ?> <span class="caret"></span> |
61 | 61 | </a> |
62 | 62 | <ul class="dropdown-menu" role="menu"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </ul> |
67 | 67 | </li> |
68 | 68 | <li class="dropdown"> |
69 | - <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="#"> |
|
69 | + <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="#"> |
|
70 | 70 | <?php echo _("Airport"); ?> <span class="caret"></span> |
71 | 71 | </a> |
72 | 72 | <ul class="dropdown-menu" role="menu"> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | </ul> |
78 | 78 | </li> |
79 | 79 | <li class="dropdown"> |
80 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
80 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
81 | 81 | <?php echo _("Route"); ?> <span class="caret"></span> |
82 | 82 | </a> |
83 | 83 | <ul class="dropdown-menu" role="menu"> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </ul> |
87 | 87 | </li> |
88 | 88 | <li class="dropdown"> |
89 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
89 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
90 | 90 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
91 | 91 | </a> |
92 | 92 | <ul class="dropdown-menu" role="menu"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
99 | 99 | ?> |
100 | 100 | <li class="dropdown"> |
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="#"> |
|
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="#"> |
|
102 | 102 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
103 | 103 | </a> |
104 | 104 | <ul class="dropdown-menu" role="menu"> |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } elseif ($type == 'marine' || $type == 'tracker') { |
114 | 114 | ?> |
115 | 115 | <li class="dropdown"> |
116 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
116 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
117 | 117 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
118 | 118 | </a> |
119 | 119 | <ul class="dropdown-menu" role="menu"> |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if (!isset($type) || $type == 'aircraft') { |
136 | 136 | ?> |
137 | 137 | <li class="dropdown"> |
138 | - <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="#" > |
|
138 | + <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="#" > |
|
139 | 139 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
140 | 140 | </a> |
141 | 141 | <ul class="dropdown-menu"> |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | </ul> |
147 | 147 | </li> |
148 | 148 | <li class="dropdown"> |
149 | - <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="#"> |
|
149 | + <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="#"> |
|
150 | 150 | <?php echo _("Airline"); ?> <span class="caret"></span> |
151 | 151 | </a> |
152 | 152 | <ul class="dropdown-menu" role="menu"> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | </ul> |
157 | 157 | </li> |
158 | 158 | <li class="dropdown"> |
159 | - <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="#"> |
|
159 | + <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="#"> |
|
160 | 160 | <?php echo _("Airport"); ?> <span class="caret"></span> |
161 | 161 | </a> |
162 | 162 | <ul class="dropdown-menu" role="menu"> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | </li> |
169 | 169 | <!-- |
170 | 170 | <li class="dropdown"> |
171 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
171 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
172 | 172 | <?php echo _("Route"); ?> <span class="caret"></span> |
173 | 173 | </a> |
174 | 174 | <ul class="dropdown-menu" role="menu"> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | --> |
180 | 180 | <!-- |
181 | 181 | <li class="dropdown"> |
182 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
182 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
183 | 183 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
184 | 184 | </a> |
185 | 185 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ?> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
197 | 197 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
198 | 198 | </a> |
199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } elseif ($type == 'marine' || $type == 'tracker') { |
210 | 210 | ?> |
211 | 211 | <li class="dropdown"> |
212 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
212 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
213 | 213 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
214 | 214 | </a> |
215 | 215 | <ul class="dropdown-menu" role="menu"> |
@@ -4,7 +4,13 @@ discard block |
||
4 | 4 | <div class="stats_airline"> |
5 | 5 | |
6 | 6 | <form id="changedate" method="post"> |
7 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
7 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
8 | + echo $year.'-'; |
|
9 | +} |
|
10 | +?><?php if (isset($month) && $month != '') { |
|
11 | + echo $month; |
|
12 | +} |
|
13 | +?>" /> |
|
8 | 14 | </form> |
9 | 15 | <?php |
10 | 16 | if (!isset($type) || $type == 'aircraft') { |
@@ -15,7 +21,9 @@ discard block |
||
15 | 21 | <?php |
16 | 22 | require_once('require/class.Stats.php'); |
17 | 23 | $Stats = new Stats(); |
18 | - if (!isset($filter_name)) $filter_name = ''; |
|
24 | + if (!isset($filter_name)) { |
|
25 | + $filter_name = ''; |
|
26 | + } |
|
19 | 27 | $airlines = $Stats->getAllAirlineNames($filter_name); |
20 | 28 | if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) { |
21 | 29 | print '<option value="all" selected>All</option>'; |
@@ -49,10 +57,22 @@ discard block |
||
49 | 57 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
50 | 58 | </a> |
51 | 59 | <ul class="dropdown-menu"> |
52 | - <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> |
|
53 | - <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> |
|
54 | - <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> |
|
55 | - <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> |
|
60 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
61 | + echo '/'.$airline_icao; |
|
62 | +} |
|
63 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
64 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
65 | + echo '/'.$airline_icao; |
|
66 | +} |
|
67 | +?>"><?php echo _("Registration"); ?></a></li> |
|
68 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
69 | + echo '/'.$airline_icao; |
|
70 | +} |
|
71 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
72 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
73 | + echo '/'.$airline_icao; |
|
74 | +} |
|
75 | +?>"><?php echo _("Country"); ?></a></li> |
|
56 | 76 | </ul> |
57 | 77 | </li> |
58 | 78 | <li class="dropdown"> |
@@ -60,9 +80,18 @@ discard block |
||
60 | 80 | <?php echo _("Airline"); ?> <span class="caret"></span> |
61 | 81 | </a> |
62 | 82 | <ul class="dropdown-menu" role="menu"> |
63 | - <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> |
|
64 | - <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> |
|
65 | - <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> |
|
83 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
84 | + echo '/'.$airline_icao; |
|
85 | +} |
|
86 | +?>"><?php echo _("Airline"); ?></a></li> |
|
87 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
88 | + echo '/'.$airline_icao; |
|
89 | +} |
|
90 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
91 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
92 | + echo '/'.$airline_icao; |
|
93 | +} |
|
94 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
66 | 95 | </ul> |
67 | 96 | </li> |
68 | 97 | <li class="dropdown"> |
@@ -70,10 +99,22 @@ discard block |
||
70 | 99 | <?php echo _("Airport"); ?> <span class="caret"></span> |
71 | 100 | </a> |
72 | 101 | <ul class="dropdown-menu" role="menu"> |
73 | - <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> |
|
74 | - <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> |
|
75 | - <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> |
|
76 | - <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> |
|
102 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
103 | + echo '/'.$airline_icao; |
|
104 | +} |
|
105 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
106 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
107 | + echo '/'.$airline_icao; |
|
108 | +} |
|
109 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
110 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
111 | + echo '/'.$airline_icao; |
|
112 | +} |
|
113 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
114 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
115 | + echo '/'.$airline_icao; |
|
116 | +} |
|
117 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
77 | 118 | </ul> |
78 | 119 | </li> |
79 | 120 | <li class="dropdown"> |
@@ -81,8 +122,14 @@ discard block |
||
81 | 122 | <?php echo _("Route"); ?> <span class="caret"></span> |
82 | 123 | </a> |
83 | 124 | <ul class="dropdown-menu" role="menu"> |
84 | - <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> |
|
85 | - <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> |
|
125 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
126 | + echo '/'.$airline_icao; |
|
127 | +} |
|
128 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
129 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
130 | + echo '/'.$airline_icao; |
|
131 | +} |
|
132 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
86 | 133 | </ul> |
87 | 134 | </li> |
88 | 135 | <li class="dropdown"> |
@@ -90,8 +137,14 @@ discard block |
||
90 | 137 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
91 | 138 | </a> |
92 | 139 | <ul class="dropdown-menu" role="menu"> |
93 | - <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> |
|
94 | - <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> |
|
140 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
141 | + echo '/'.$airline_icao; |
|
142 | +} |
|
143 | +?>"><?php echo _("Date"); ?></a></li> |
|
144 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
145 | + echo '/'.$airline_icao; |
|
146 | +} |
|
147 | +?>"><?php echo _("Time"); ?></a></li> |
|
95 | 148 | </ul> |
96 | 149 | </li> |
97 | 150 | <?php |
@@ -139,9 +192,18 @@ discard block |
||
139 | 192 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
140 | 193 | </a> |
141 | 194 | <ul class="dropdown-menu"> |
142 | - <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> |
|
143 | - <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> |
|
144 | - <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> |
|
195 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
196 | + echo '/'.$airline_icao; |
|
197 | +} |
|
198 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
199 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
200 | + echo '/'.$airline_icao; |
|
201 | +} |
|
202 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
203 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
204 | + echo '/'.$airline_icao; |
|
205 | +} |
|
206 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
145 | 207 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
146 | 208 | </ul> |
147 | 209 | </li> |
@@ -150,9 +212,18 @@ discard block |
||
150 | 212 | <?php echo _("Airline"); ?> <span class="caret"></span> |
151 | 213 | </a> |
152 | 214 | <ul class="dropdown-menu" role="menu"> |
153 | - <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> |
|
154 | - <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> |
|
155 | - <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> |
|
215 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
216 | + echo '/'.$airline_icao; |
|
217 | +} |
|
218 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
219 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
220 | + echo '/'.$airline_icao; |
|
221 | +} |
|
222 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
223 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
224 | + echo '/'.$airline_icao; |
|
225 | +} |
|
226 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
156 | 227 | </ul> |
157 | 228 | </li> |
158 | 229 | <li class="dropdown"> |
@@ -160,10 +231,22 @@ discard block |
||
160 | 231 | <?php echo _("Airport"); ?> <span class="caret"></span> |
161 | 232 | </a> |
162 | 233 | <ul class="dropdown-menu" role="menu"> |
163 | - <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> |
|
164 | - <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> |
|
165 | - <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> |
|
166 | - <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> |
|
234 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
235 | + echo '/'.$airline_icao; |
|
236 | +} |
|
237 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
238 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
239 | + echo '/'.$airline_icao; |
|
240 | +} |
|
241 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
242 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
243 | + echo '/'.$airline_icao; |
|
244 | +} |
|
245 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
246 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
247 | + echo '/'.$airline_icao; |
|
248 | +} |
|
249 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
167 | 250 | </ul> |
168 | 251 | </li> |
169 | 252 | <!-- |
@@ -58,7 +58,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -9,25 +9,25 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -53,7 +53,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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(); |
460 | 573 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -475,7 +588,9 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -18,11 +18,15 @@ discard block |
||
18 | 18 | require_once('require/class.Spotter.php'); |
19 | 19 | } |
20 | 20 | |
21 | -if (!isset($filter_name)) $filter_name = ''; |
|
21 | +if (!isset($filter_name)) { |
|
22 | + $filter_name = ''; |
|
23 | +} |
|
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($type == 'aircraft' && $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 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
27 | 31 | $Spotter = new Spotter(); |
28 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -53,7 +57,12 @@ discard block |
||
53 | 57 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
54 | 58 | <div class="column"> |
55 | 59 | <div class="info"> |
56 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
60 | + <h1><?php if (isset($airline_name)) { |
|
61 | + echo _("Statistics for ").$airline_name; |
|
62 | +} else { |
|
63 | + echo _("Statistics"); |
|
64 | +} |
|
65 | +?></h1> |
|
57 | 66 | <?php |
58 | 67 | if ($type == 'aircraft') { |
59 | 68 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -61,7 +70,9 @@ discard block |
||
61 | 70 | if (isset($last_update[0]['value'])) { |
62 | 71 | date_default_timezone_set('UTC'); |
63 | 72 | $lastupdate = strtotime($last_update[0]['value']); |
64 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
73 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
74 | + date_default_timezone_set($globalTimezone); |
|
75 | + } |
|
65 | 76 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
66 | 77 | } |
67 | 78 | } |
@@ -139,14 +150,18 @@ discard block |
||
139 | 150 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
140 | 151 | <?php |
141 | 152 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
143 | - else { |
|
153 | + if (count($aircraft_array) == 0) { |
|
154 | + print _("No data available"); |
|
155 | + } else { |
|
144 | 156 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
145 | 157 | $aircraft_data = ''; |
146 | 158 | foreach($aircraft_array as $aircraft_item) |
147 | 159 | { |
148 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
160 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
161 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
162 | + } else { |
|
163 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
164 | + } |
|
150 | 165 | } |
151 | 166 | $aircraft_data = substr($aircraft_data, 0, -1); |
152 | 167 | print 'var series = ['.$aircraft_data.'];'; |
@@ -163,11 +178,17 @@ discard block |
||
163 | 178 | <?php |
164 | 179 | if ($year != '' && $month != '') { |
165 | 180 | ?> |
166 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
181 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
182 | + echo '/'.$airline_icao; |
|
183 | +} |
|
184 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
167 | 185 | <?php |
168 | 186 | } else { |
169 | 187 | ?> |
170 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
188 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
189 | + echo '/'.$airline_icao; |
|
190 | +} |
|
191 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
171 | 192 | <?php |
172 | 193 | } |
173 | 194 | ?> |
@@ -198,11 +219,15 @@ discard block |
||
198 | 219 | print '</script>'; |
199 | 220 | if ($year != '' && $month != '') { |
200 | 221 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
201 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
222 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
223 | + echo '/'.$airline_icao; |
|
224 | + } |
|
202 | 225 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
203 | 226 | } else { |
204 | 227 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
205 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
228 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
229 | + echo '/'.$airline_icao; |
|
230 | + } |
|
206 | 231 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
207 | 232 | } |
208 | 233 | print '</div>'; |
@@ -224,8 +249,9 @@ discard block |
||
224 | 249 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
225 | 250 | <?php |
226 | 251 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
227 | - if (count($marine_array) == 0) print _("No data available"); |
|
228 | - else { |
|
252 | + if (count($marine_array) == 0) { |
|
253 | + print _("No data available"); |
|
254 | + } else { |
|
229 | 255 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
230 | 256 | $marine_data = ''; |
231 | 257 | foreach($marine_array as $marine_item) |
@@ -272,8 +298,9 @@ discard block |
||
272 | 298 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
273 | 299 | <?php |
274 | 300 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
275 | - if (count($tracker_array) == 0) print _("No data available"); |
|
276 | - else { |
|
301 | + if (count($tracker_array) == 0) { |
|
302 | + print _("No data available"); |
|
303 | + } else { |
|
277 | 304 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
278 | 305 | $tracker_data = ''; |
279 | 306 | foreach($tracker_array as $tracker_item) |
@@ -328,8 +355,9 @@ discard block |
||
328 | 355 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 356 | <?php |
330 | 357 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
331 | - if (count($pilot_array) == 0) print _("No data available"); |
|
332 | - else { |
|
358 | + if (count($pilot_array) == 0) { |
|
359 | + print _("No data available"); |
|
360 | + } else { |
|
333 | 361 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 362 | $pilot_data = ''; |
335 | 363 | foreach($pilot_array as $pilot_item) |
@@ -348,7 +376,9 @@ discard block |
||
348 | 376 | } |
349 | 377 | print '<div class="more">'; |
350 | 378 | print '<a href="'.$globalURL.'/statistics/pilot'; |
351 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
379 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
380 | + echo '/'.$airline_icao; |
|
381 | + } |
|
352 | 382 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
353 | 383 | print '</div>'; |
354 | 384 | ?> |
@@ -362,8 +392,9 @@ discard block |
||
362 | 392 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
363 | 393 | <?php |
364 | 394 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
365 | - if (count($owner_array) == 0) print _("No data available"); |
|
366 | - else { |
|
395 | + if (count($owner_array) == 0) { |
|
396 | + print _("No data available"); |
|
397 | + } else { |
|
367 | 398 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
368 | 399 | $owner_data = ''; |
369 | 400 | foreach($owner_array as $owner_item) |
@@ -382,7 +413,10 @@ discard block |
||
382 | 413 | } |
383 | 414 | ?> |
384 | 415 | <div class="more"> |
385 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
416 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
417 | + echo '/'.$airline_icao; |
|
418 | +} |
|
419 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
386 | 420 | </div> |
387 | 421 | </div> |
388 | 422 | |
@@ -395,8 +429,9 @@ discard block |
||
395 | 429 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
396 | 430 | <?php |
397 | 431 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
398 | - if (count($flightover_array) == 0) print _("No data available"); |
|
399 | - else { |
|
432 | + if (count($flightover_array) == 0) { |
|
433 | + print _("No data available"); |
|
434 | + } else { |
|
400 | 435 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 436 | print 'var series = ['; |
402 | 437 | $flightover_data = ''; |
@@ -439,7 +474,10 @@ discard block |
||
439 | 474 | } |
440 | 475 | ?> |
441 | 476 | <div class="more"> |
442 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
477 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
478 | + echo '/'.$airline_icao; |
|
479 | +} |
|
480 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
443 | 481 | </div> |
444 | 482 | </div> |
445 | 483 | <?php |
@@ -461,8 +499,9 @@ discard block |
||
461 | 499 | <div class="col-md-6"> |
462 | 500 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
463 | 501 | <?php |
464 | - if (count($flightover_array) == 0) print _("No data available"); |
|
465 | - else { |
|
502 | + if (count($flightover_array) == 0) { |
|
503 | + print _("No data available"); |
|
504 | + } else { |
|
466 | 505 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
467 | 506 | print 'var series = ['; |
468 | 507 | $flightover_data = ''; |
@@ -521,8 +560,9 @@ discard block |
||
521 | 560 | <div class="col-md-6"> |
522 | 561 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
523 | 562 | <?php |
524 | - if (count($flightover_array) == 0) print _("No data available"); |
|
525 | - else { |
|
563 | + if (count($flightover_array) == 0) { |
|
564 | + print _("No data available"); |
|
565 | + } else { |
|
526 | 566 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
527 | 567 | print 'var series = ['; |
528 | 568 | $flightover_data = ''; |
@@ -632,7 +672,9 @@ discard block |
||
632 | 672 | });"; |
633 | 673 | print '</script>'; |
634 | 674 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
635 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
675 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
676 | + echo '/'.$airline_icao; |
|
677 | + } |
|
636 | 678 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
637 | 679 | } |
638 | 680 | ?> |
@@ -694,7 +736,9 @@ discard block |
||
694 | 736 | });"; |
695 | 737 | print '</script>'; |
696 | 738 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
697 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
739 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
740 | + echo '/'.$airline_icao; |
|
741 | + } |
|
698 | 742 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
699 | 743 | } |
700 | 744 | ?> |
@@ -715,8 +759,9 @@ discard block |
||
715 | 759 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
716 | 760 | <?php |
717 | 761 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
718 | - if (count($year_array) == 0) print _("No data available"); |
|
719 | - else { |
|
762 | + if (count($year_array) == 0) { |
|
763 | + print _("No data available"); |
|
764 | + } else { |
|
720 | 765 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
721 | 766 | $year_data = ''; |
722 | 767 | $year_cnt = ''; |
@@ -736,7 +781,10 @@ discard block |
||
736 | 781 | } |
737 | 782 | ?> |
738 | 783 | <div class="more"> |
739 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
784 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
785 | + echo '/'.$airline_icao; |
|
786 | +} |
|
787 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
740 | 788 | </div> |
741 | 789 | </div> |
742 | 790 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -744,8 +792,9 @@ discard block |
||
744 | 792 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
745 | 793 | <?php |
746 | 794 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
747 | - if (count($month_array) == 0) print _("No data available"); |
|
748 | - else { |
|
795 | + if (count($month_array) == 0) { |
|
796 | + print _("No data available"); |
|
797 | + } else { |
|
749 | 798 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
750 | 799 | $month_data = ''; |
751 | 800 | $month_cnt = ''; |
@@ -765,7 +814,10 @@ discard block |
||
765 | 814 | } |
766 | 815 | ?> |
767 | 816 | <div class="more"> |
768 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
817 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
818 | + echo '/'.$airline_icao; |
|
819 | +} |
|
820 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
769 | 821 | </div> |
770 | 822 | </div> |
771 | 823 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -774,8 +826,9 @@ discard block |
||
774 | 826 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
775 | 827 | <?php |
776 | 828 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
777 | - if (empty($date_array)) print _("No data available"); |
|
778 | - else { |
|
829 | + if (empty($date_array)) { |
|
830 | + print _("No data available"); |
|
831 | + } else { |
|
779 | 832 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
780 | 833 | $date_data = ''; |
781 | 834 | $date_cnt = ''; |
@@ -795,7 +848,10 @@ discard block |
||
795 | 848 | } |
796 | 849 | ?> |
797 | 850 | <div class="more"> |
798 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
851 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
852 | + echo '/'.$airline_icao; |
|
853 | +} |
|
854 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
799 | 855 | </div> |
800 | 856 | </div> |
801 | 857 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -803,8 +859,9 @@ discard block |
||
803 | 859 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
804 | 860 | <?php |
805 | 861 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
806 | - if (empty($hour_array)) print _("No data available"); |
|
807 | - else { |
|
862 | + if (empty($hour_array)) { |
|
863 | + print _("No data available"); |
|
864 | + } else { |
|
808 | 865 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
809 | 866 | $hour_data = ''; |
810 | 867 | $hour_cnt = ''; |
@@ -824,7 +881,10 @@ discard block |
||
824 | 881 | } |
825 | 882 | ?> |
826 | 883 | <div class="more"> |
827 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
884 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
885 | + echo '/'.$airline_icao; |
|
886 | +} |
|
887 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
828 | 888 | </div> |
829 | 889 | </div> |
830 | 890 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -846,8 +906,9 @@ discard block |
||
846 | 906 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
847 | 907 | <?php |
848 | 908 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
849 | - if (count($year_array) == 0) print _("No data available"); |
|
850 | - else { |
|
909 | + if (count($year_array) == 0) { |
|
910 | + print _("No data available"); |
|
911 | + } else { |
|
851 | 912 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
852 | 913 | $year_data = ''; |
853 | 914 | $year_cnt = ''; |
@@ -876,8 +937,9 @@ discard block |
||
876 | 937 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
877 | 938 | <?php |
878 | 939 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
879 | - if (count($month_array) == 0) print _("No data available"); |
|
880 | - else { |
|
940 | + if (count($month_array) == 0) { |
|
941 | + print _("No data available"); |
|
942 | + } else { |
|
881 | 943 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
882 | 944 | $month_data = ''; |
883 | 945 | $month_cnt = ''; |
@@ -906,8 +968,9 @@ discard block |
||
906 | 968 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
907 | 969 | <?php |
908 | 970 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
909 | - if (empty($date_array)) print _("No data available"); |
|
910 | - else { |
|
971 | + if (empty($date_array)) { |
|
972 | + print _("No data available"); |
|
973 | + } else { |
|
911 | 974 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
912 | 975 | $date_data = ''; |
913 | 976 | $date_cnt = ''; |
@@ -935,8 +998,9 @@ discard block |
||
935 | 998 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
936 | 999 | <?php |
937 | 1000 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
938 | - if (empty($hour_array)) print _("No data available"); |
|
939 | - else { |
|
1001 | + if (empty($hour_array)) { |
|
1002 | + print _("No data available"); |
|
1003 | + } else { |
|
940 | 1004 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
941 | 1005 | $hour_data = ''; |
942 | 1006 | $hour_cnt = ''; |
@@ -978,8 +1042,9 @@ discard block |
||
978 | 1042 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
979 | 1043 | <?php |
980 | 1044 | $year_array = $Tracker->countAllMonthsLastYear(true); |
981 | - if (count($year_array) == 0) print _("No data available"); |
|
982 | - else { |
|
1045 | + if (count($year_array) == 0) { |
|
1046 | + print _("No data available"); |
|
1047 | + } else { |
|
983 | 1048 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
984 | 1049 | $year_data = ''; |
985 | 1050 | $year_cnt = ''; |
@@ -1008,8 +1073,9 @@ discard block |
||
1008 | 1073 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1009 | 1074 | <?php |
1010 | 1075 | $month_array = $Tracker->countAllDatesLastMonth(); |
1011 | - if (count($month_array) == 0) print _("No data available"); |
|
1012 | - else { |
|
1076 | + if (count($month_array) == 0) { |
|
1077 | + print _("No data available"); |
|
1078 | + } else { |
|
1013 | 1079 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1014 | 1080 | $month_data = ''; |
1015 | 1081 | $month_cnt = ''; |
@@ -1038,8 +1104,9 @@ discard block |
||
1038 | 1104 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1039 | 1105 | <?php |
1040 | 1106 | $date_array = $Tracker->countAllDatesLast7Days(); |
1041 | - if (empty($date_array)) print _("No data available"); |
|
1042 | - else { |
|
1107 | + if (empty($date_array)) { |
|
1108 | + print _("No data available"); |
|
1109 | + } else { |
|
1043 | 1110 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1044 | 1111 | $date_data = ''; |
1045 | 1112 | $date_cnt = ''; |
@@ -1067,8 +1134,9 @@ discard block |
||
1067 | 1134 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1068 | 1135 | <?php |
1069 | 1136 | $hour_array = $Tracker->countAllHours('hour',true); |
1070 | - if (empty($hour_array)) print _("No data available"); |
|
1071 | - else { |
|
1137 | + if (empty($hour_array)) { |
|
1138 | + print _("No data available"); |
|
1139 | + } else { |
|
1072 | 1140 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1073 | 1141 | $hour_data = ''; |
1074 | 1142 | $hour_cnt = ''; |
@@ -1110,8 +1178,9 @@ discard block |
||
1110 | 1178 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1111 | 1179 | <?php |
1112 | 1180 | $year_array = $Stats->countFatalitiesByYear(); |
1113 | - if (count($year_array) == 0) print _("No data available"); |
|
1114 | - else { |
|
1181 | + if (count($year_array) == 0) { |
|
1182 | + print _("No data available"); |
|
1183 | + } else { |
|
1115 | 1184 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1116 | 1185 | $year_data = ''; |
1117 | 1186 | $year_cnt = ''; |
@@ -1141,8 +1210,9 @@ discard block |
||
1141 | 1210 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1142 | 1211 | <?php |
1143 | 1212 | $year_array = $Stats->countFatalitiesLast12Months(); |
1144 | - if (count($year_array) == 0) print _("No data available"); |
|
1145 | - else { |
|
1213 | + if (count($year_array) == 0) { |
|
1214 | + print _("No data available"); |
|
1215 | + } else { |
|
1146 | 1216 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1147 | 1217 | $year_data = ''; |
1148 | 1218 | $year_cnt = ''; |
@@ -1212,8 +1282,11 @@ discard block |
||
1212 | 1282 | $distance = $distance; |
1213 | 1283 | $unit = 'km'; |
1214 | 1284 | } |
1215 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1216 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1285 | + if (!isset($polar_data)) { |
|
1286 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1287 | + } else { |
|
1288 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1289 | + } |
|
1217 | 1290 | } |
1218 | 1291 | ?> |
1219 | 1292 | <div class="col-md-6"> |
@@ -1273,9 +1346,12 @@ discard block |
||
1273 | 1346 | foreach ($msg as $eachmsg) { |
1274 | 1347 | //$eachmsg = $msg[0]; |
1275 | 1348 | $data = $eachmsg['source_data']; |
1276 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1277 | - else $max = 500; |
|
1278 | -?> |
|
1349 | + if ($data > 500) { |
|
1350 | + $max = (round(($data+100)/100))*100; |
|
1351 | + } else { |
|
1352 | + $max = 500; |
|
1353 | + } |
|
1354 | + ?> |
|
1279 | 1355 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1280 | 1356 | <script> |
1281 | 1357 | var g = new JustGage({ |
@@ -79,24 +79,24 @@ discard block |
||
79 | 79 | <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
80 | 80 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
81 | 81 | <?php |
82 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
82 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
83 | 83 | ?> |
84 | 84 | <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
85 | 85 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
86 | 86 | <?php |
87 | - } |
|
88 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
89 | - ?> |
|
87 | + } |
|
88 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
89 | + ?> |
|
90 | 90 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
91 | 91 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
92 | 92 | <?php |
93 | - } |
|
94 | - ?> |
|
93 | + } |
|
94 | + ?> |
|
95 | 95 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
96 | 96 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
97 | 97 | <?php |
98 | - if ($airline_icao == '') { |
|
99 | - ?> |
|
98 | + if ($airline_icao == '') { |
|
99 | + ?> |
|
100 | 100 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
101 | 101 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
102 | 102 | <?php |
@@ -139,39 +139,39 @@ discard block |
||
139 | 139 | <div class="col-md-6"> |
140 | 140 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
141 | 141 | <?php |
142 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
143 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
144 | - else { |
|
145 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
146 | - $aircraft_data = ''; |
|
147 | - foreach($aircraft_array as $aircraft_item) |
|
148 | - { |
|
149 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
151 | - } |
|
152 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
153 | - print 'var series = ['.$aircraft_data.'];'; |
|
154 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
155 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
156 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
157 | - print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
158 | - print 'dataset'; |
|
159 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
160 | - print '</script>'; |
|
161 | - } |
|
162 | - ?> |
|
142 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
143 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
144 | + else { |
|
145 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
146 | + $aircraft_data = ''; |
|
147 | + foreach($aircraft_array as $aircraft_item) |
|
148 | + { |
|
149 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | + else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
151 | + } |
|
152 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
153 | + print 'var series = ['.$aircraft_data.'];'; |
|
154 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
155 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
156 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
157 | + print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
158 | + print 'dataset'; |
|
159 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
160 | + print '</script>'; |
|
161 | + } |
|
162 | + ?> |
|
163 | 163 | <div class="more"> |
164 | 164 | <?php |
165 | - if ($year != '' && $month != '') { |
|
166 | - ?> |
|
165 | + if ($year != '' && $month != '') { |
|
166 | + ?> |
|
167 | 167 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
168 | 168 | <?php |
169 | - } else { |
|
170 | - ?> |
|
169 | + } else { |
|
170 | + ?> |
|
171 | 171 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
172 | 172 | <?php |
173 | - } |
|
174 | - ?> |
|
173 | + } |
|
174 | + ?> |
|
175 | 175 | </div> |
176 | 176 | </div> |
177 | 177 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -224,29 +224,29 @@ discard block |
||
224 | 224 | <div class="col-md-6"> |
225 | 225 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
226 | 226 | <?php |
227 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
228 | - if (count($marine_array) == 0) print _("No data available"); |
|
229 | - else { |
|
230 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
231 | - $marine_data = ''; |
|
232 | - foreach($marine_array as $marine_item) |
|
233 | - { |
|
234 | - $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
235 | - } |
|
236 | - $marine_data = substr($marine_data, 0, -1); |
|
237 | - print 'var series = ['.$marine_data.'];'; |
|
238 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
239 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
240 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
241 | - print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
242 | - print 'dataset'; |
|
243 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
244 | - print '</script>'; |
|
245 | - } |
|
246 | - ?> |
|
227 | + $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
228 | + if (count($marine_array) == 0) print _("No data available"); |
|
229 | + else { |
|
230 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
231 | + $marine_data = ''; |
|
232 | + foreach($marine_array as $marine_item) |
|
233 | + { |
|
234 | + $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
235 | + } |
|
236 | + $marine_data = substr($marine_data, 0, -1); |
|
237 | + print 'var series = ['.$marine_data.'];'; |
|
238 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
239 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
240 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
241 | + print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
242 | + print 'dataset'; |
|
243 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
244 | + print '</script>'; |
|
245 | + } |
|
246 | + ?> |
|
247 | 247 | <div class="more"> |
248 | 248 | <?php |
249 | - /* |
|
249 | + /* |
|
250 | 250 | if ($year != '' && $month != '') { |
251 | 251 | ?> |
252 | 252 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | <?php |
258 | 258 | } |
259 | 259 | */ |
260 | - ?> |
|
260 | + ?> |
|
261 | 261 | </div> |
262 | 262 | </div> |
263 | 263 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -272,29 +272,29 @@ discard block |
||
272 | 272 | <div class="col-md-6"> |
273 | 273 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
274 | 274 | <?php |
275 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | - if (count($tracker_array) == 0) print _("No data available"); |
|
277 | - else { |
|
278 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
279 | - $tracker_data = ''; |
|
280 | - foreach($tracker_array as $tracker_item) |
|
281 | - { |
|
282 | - $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
283 | - } |
|
284 | - $tracker_data = substr($tracker_data, 0, -1); |
|
285 | - print 'var series = ['.$tracker_data.'];'; |
|
286 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
287 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
288 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
289 | - print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
290 | - print 'dataset'; |
|
291 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
292 | - print '</script>'; |
|
293 | - } |
|
294 | - ?> |
|
275 | + $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + if (count($tracker_array) == 0) print _("No data available"); |
|
277 | + else { |
|
278 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
279 | + $tracker_data = ''; |
|
280 | + foreach($tracker_array as $tracker_item) |
|
281 | + { |
|
282 | + $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
283 | + } |
|
284 | + $tracker_data = substr($tracker_data, 0, -1); |
|
285 | + print 'var series = ['.$tracker_data.'];'; |
|
286 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
287 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
288 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
289 | + print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
290 | + print 'dataset'; |
|
291 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
292 | + print '</script>'; |
|
293 | + } |
|
294 | + ?> |
|
295 | 295 | <div class="more"> |
296 | 296 | <?php |
297 | - /* |
|
297 | + /* |
|
298 | 298 | if ($year != '' && $month != '') { |
299 | 299 | ?> |
300 | 300 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php |
306 | 306 | } |
307 | 307 | */ |
308 | - ?> |
|
308 | + ?> |
|
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
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 ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $title = _("Statistics"); |
35 | 35 | } |
36 | 36 | |
37 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
38 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
37 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
38 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
39 | 39 | |
40 | 40 | require_once('header.php'); |
41 | 41 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | date_default_timezone_set('UTC'); |
63 | 63 | $lastupdate = strtotime($last_update[0]['value']); |
64 | 64 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
65 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
65 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | ?> |
@@ -74,31 +74,31 @@ discard block |
||
74 | 74 | <?php |
75 | 75 | if ($type == 'aircraft') { |
76 | 76 | ?> |
77 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
78 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
79 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
77 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
78 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
79 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
81 | 81 | <?php |
82 | 82 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
83 | 83 | ?> |
84 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
84 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
86 | 86 | <?php |
87 | 87 | } |
88 | 88 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
89 | 89 | ?> |
90 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
91 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
90 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
91 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
92 | 92 | <?php |
93 | 93 | } |
94 | 94 | ?> |
95 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
96 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
95 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
96 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
97 | 97 | <?php |
98 | 98 | if ($airline_icao == '') { |
99 | 99 | ?> |
100 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
101 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
100 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
101 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
102 | 102 | <?php |
103 | 103 | } |
104 | 104 | ?> |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
107 | 107 | if ($airline_icao == '' || $airline_icao == 'all') { |
108 | 108 | ?> |
109 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
110 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
109 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
110 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
111 | 111 | <?php |
112 | 112 | } |
113 | 113 | } |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | <?php |
116 | 116 | } elseif ($type == 'marine') { |
117 | 117 | ?> |
118 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
119 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
120 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
121 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
118 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
119 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
120 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
121 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
122 | 122 | <?php |
123 | 123 | } elseif ($type == 'tracker') { |
124 | 124 | ?> |
125 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
126 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
127 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
128 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
125 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
126 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
127 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
128 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
129 | 129 | <?php |
130 | 130 | } |
131 | 131 | ?> |
132 | 132 | </p> |
133 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
134 | 134 | <div class="specific-stats"> |
135 | 135 | <?php |
136 | 136 | if ($type == 'aircraft') { |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | <div class="col-md-6"> |
140 | 140 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
141 | 141 | <?php |
142 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
142 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
143 | 143 | if (count($aircraft_array) == 0) print _("No data available"); |
144 | 144 | else { |
145 | 145 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
146 | 146 | $aircraft_data = ''; |
147 | - foreach($aircraft_array as $aircraft_item) |
|
147 | + foreach ($aircraft_array as $aircraft_item) |
|
148 | 148 | { |
149 | 149 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
150 | 150 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | ?> |
175 | 175 | </div> |
176 | 176 | </div> |
177 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
177 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
178 | 178 | <?php |
179 | 179 | // echo $airline_icao; |
180 | 180 | if ($airline_icao == '' || $airline_icao == 'all') { |
181 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
181 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
182 | 182 | if (count($airline_array) > 0) { |
183 | 183 | print '<div class="col-md-6">'; |
184 | 184 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
185 | 185 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
186 | 186 | $airline_data = ''; |
187 | - foreach($airline_array as $airline_item) |
|
187 | + foreach ($airline_array as $airline_item) |
|
188 | 188 | { |
189 | 189 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
190 | 190 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | ?> |
212 | 212 | </div> |
213 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
213 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
214 | 214 | <?php |
215 | 215 | } |
216 | 216 | ?> |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | <div class="col-md-6"> |
225 | 225 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
226 | 226 | <?php |
227 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
227 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
228 | 228 | if (count($marine_array) == 0) print _("No data available"); |
229 | 229 | else { |
230 | 230 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
231 | 231 | $marine_data = ''; |
232 | - foreach($marine_array as $marine_item) |
|
232 | + foreach ($marine_array as $marine_item) |
|
233 | 233 | { |
234 | 234 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
235 | 235 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | ?> |
261 | 261 | </div> |
262 | 262 | </div> |
263 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
263 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
264 | 264 | <!-- </div>--> |
265 | 265 | <?php |
266 | 266 | } |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | <div class="col-md-6"> |
273 | 273 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
274 | 274 | <?php |
275 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
275 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
276 | 276 | if (count($tracker_array) == 0) print _("No data available"); |
277 | 277 | else { |
278 | 278 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
279 | 279 | $tracker_data = ''; |
280 | - foreach($tracker_array as $tracker_item) |
|
280 | + foreach ($tracker_array as $tracker_item) |
|
281 | 281 | { |
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | ?> |
319 | 319 | <div class="row column"> |
320 | 320 | <?php |
321 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
321 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
322 | 322 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
323 | 323 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
324 | 324 | if (empty($flightover_array)) { |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
331 | 331 | <?php |
332 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
332 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
333 | 333 | if (count($pilot_array) == 0) print _("No data available"); |
334 | 334 | else { |
335 | 335 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
336 | 336 | $pilot_data = ''; |
337 | - foreach($pilot_array as $pilot_item) |
|
337 | + foreach ($pilot_array as $pilot_item) |
|
338 | 338 | { |
339 | 339 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
340 | 340 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | ?> |
357 | 357 | </div> |
358 | 358 | |
359 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
359 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
360 | 360 | <?php |
361 | 361 | } |
362 | 362 | // else { |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | <div class="col-md-6"> |
366 | 366 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
367 | 367 | <?php |
368 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
368 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
369 | 369 | if (count($owner_array) == 0) print _("No data available"); |
370 | 370 | else { |
371 | 371 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
372 | 372 | $owner_data = ''; |
373 | - foreach($owner_array as $owner_item) |
|
373 | + foreach ($owner_array as $owner_item) |
|
374 | 374 | { |
375 | 375 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
376 | 376 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | </div> |
391 | 391 | </div> |
392 | 392 | |
393 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
393 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
394 | 394 | <?php |
395 | 395 | } |
396 | 396 | if (!empty($flightover_array)) { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
405 | 405 | print 'var series = ['; |
406 | 406 | $flightover_data = ''; |
407 | - foreach($flightover_array as $flightover_item) |
|
407 | + foreach ($flightover_array as $flightover_item) |
|
408 | 408 | { |
409 | 409 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
410 | 410 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | </div> |
453 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
453 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
454 | 454 | |
455 | 455 | |
456 | 456 | </div> |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
471 | 471 | print 'var series = ['; |
472 | 472 | $flightover_data = ''; |
473 | - foreach($flightover_array as $flightover_item) |
|
473 | + foreach ($flightover_array as $flightover_item) |
|
474 | 474 | { |
475 | 475 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
476 | 476 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
531 | 531 | print 'var series = ['; |
532 | 532 | $flightover_data = ''; |
533 | - foreach($flightover_array as $flightover_item) |
|
533 | + foreach ($flightover_array as $flightover_item) |
|
534 | 534 | { |
535 | 535 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
536 | 536 | } |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | <div class="row column"> |
584 | 584 | <div class="col-md-6"> |
585 | 585 | <?php |
586 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
586 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
587 | 587 | if (count($airport_airport_array) > 0) { |
588 | 588 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
589 | 589 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
590 | 590 | print "\n"; |
591 | 591 | print 'var series = ['; |
592 | 592 | $airport_data = ''; |
593 | - foreach($airport_airport_array as $airport_item) |
|
593 | + foreach ($airport_airport_array as $airport_item) |
|
594 | 594 | { |
595 | 595 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
596 | 596 | } |
@@ -641,18 +641,18 @@ discard block |
||
641 | 641 | } |
642 | 642 | ?> |
643 | 643 | </div> |
644 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
644 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
645 | 645 | |
646 | 646 | <div class="col-md-6"> |
647 | 647 | <?php |
648 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
648 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
649 | 649 | if (count($airport_airport_array2) > 0) { |
650 | 650 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
651 | 651 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
652 | 652 | print "\n"; |
653 | 653 | print 'var series = ['; |
654 | 654 | $airport_data = ''; |
655 | - foreach($airport_airport_array2 as $airport_item) |
|
655 | + foreach ($airport_airport_array2 as $airport_item) |
|
656 | 656 | { |
657 | 657 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
658 | 658 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | ?> |
705 | 705 | </div> |
706 | 706 | </div> |
707 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
707 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
708 | 708 | <?php |
709 | 709 | } |
710 | 710 | ?> |
@@ -718,19 +718,19 @@ discard block |
||
718 | 718 | <div class="col-md-6"> |
719 | 719 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
720 | 720 | <?php |
721 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
721 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
722 | 722 | if (count($year_array) == 0) print _("No data available"); |
723 | 723 | else { |
724 | 724 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
725 | 725 | $year_data = ''; |
726 | 726 | $year_cnt = ''; |
727 | - foreach($year_array as $year_item) |
|
727 | + foreach ($year_array as $year_item) |
|
728 | 728 | { |
729 | 729 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
730 | 730 | $year_cnt .= $year_item['date_count'].','; |
731 | 731 | } |
732 | 732 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
733 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
733 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
734 | 734 | print 'c3.generate({ |
735 | 735 | bindto: "#chart8", |
736 | 736 | data: { x: "x", |
@@ -743,23 +743,23 @@ discard block |
||
743 | 743 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
744 | 744 | </div> |
745 | 745 | </div> |
746 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
746 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
747 | 747 | <div class="col-md-6"> |
748 | 748 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
749 | 749 | <?php |
750 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
750 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
751 | 751 | if (count($month_array) == 0) print _("No data available"); |
752 | 752 | else { |
753 | 753 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
754 | 754 | $month_data = ''; |
755 | 755 | $month_cnt = ''; |
756 | - foreach($month_array as $month_item) |
|
756 | + foreach ($month_array as $month_item) |
|
757 | 757 | { |
758 | 758 | $month_data .= '"'.$month_item['date_name'].'",'; |
759 | 759 | $month_cnt .= $month_item['date_count'].','; |
760 | 760 | } |
761 | 761 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
762 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
762 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
763 | 763 | print 'c3.generate({ |
764 | 764 | bindto: "#chart9", |
765 | 765 | data: { x: "x", |
@@ -772,24 +772,24 @@ discard block |
||
772 | 772 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
773 | 773 | </div> |
774 | 774 | </div> |
775 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
775 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
776 | 776 | |
777 | 777 | <div class="col-md-6"> |
778 | 778 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
779 | 779 | <?php |
780 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
780 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
781 | 781 | if (empty($date_array)) print _("No data available"); |
782 | 782 | else { |
783 | 783 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
784 | 784 | $date_data = ''; |
785 | 785 | $date_cnt = ''; |
786 | - foreach($date_array as $date_item) |
|
786 | + foreach ($date_array as $date_item) |
|
787 | 787 | { |
788 | 788 | $date_data .= '"'.$date_item['date_name'].'",'; |
789 | 789 | $date_cnt .= $date_item['date_count'].','; |
790 | 790 | } |
791 | 791 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
792 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
792 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
793 | 793 | print 'c3.generate({ |
794 | 794 | bindto: "#chart5", |
795 | 795 | data: { x: "x", |
@@ -802,23 +802,23 @@ discard block |
||
802 | 802 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
803 | 803 | </div> |
804 | 804 | </div> |
805 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
805 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
806 | 806 | <div class="col-md-6"> |
807 | 807 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
808 | 808 | <?php |
809 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
809 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
810 | 810 | if (empty($hour_array)) print _("No data available"); |
811 | 811 | else { |
812 | 812 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
813 | 813 | $hour_data = ''; |
814 | 814 | $hour_cnt = ''; |
815 | - foreach($hour_array as $hour_item) |
|
815 | + foreach ($hour_array as $hour_item) |
|
816 | 816 | { |
817 | 817 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
818 | 818 | $hour_cnt .= $hour_item['hour_count'].','; |
819 | 819 | } |
820 | 820 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
821 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
821 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
822 | 822 | print 'c3.generate({ |
823 | 823 | bindto: "#chart6", |
824 | 824 | data: { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
832 | 832 | </div> |
833 | 833 | </div> |
834 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
834 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
835 | 835 | </div> |
836 | 836 | <?php |
837 | 837 | } |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | <div class="col-md-6"> |
850 | 850 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
851 | 851 | <?php |
852 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
852 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
853 | 853 | if (count($year_array) == 0) print _("No data available"); |
854 | 854 | else { |
855 | 855 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
856 | 856 | $year_data = ''; |
857 | 857 | $year_cnt = ''; |
858 | - foreach($year_array as $year_item) |
|
858 | + foreach ($year_array as $year_item) |
|
859 | 859 | { |
860 | 860 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
861 | 861 | $year_cnt .= $year_item['date_count'].','; |
862 | 862 | } |
863 | 863 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
864 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
864 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
865 | 865 | print 'c3.generate({ |
866 | 866 | bindto: "#chart8", |
867 | 867 | data: { x: "x", |
@@ -875,23 +875,23 @@ discard block |
||
875 | 875 | </div> |
876 | 876 | </div> |
877 | 877 | |
878 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
878 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
879 | 879 | <div class="col-md-6"> |
880 | 880 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
881 | 881 | <?php |
882 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
882 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
883 | 883 | if (count($month_array) == 0) print _("No data available"); |
884 | 884 | else { |
885 | 885 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
886 | 886 | $month_data = ''; |
887 | 887 | $month_cnt = ''; |
888 | - foreach($month_array as $month_item) |
|
888 | + foreach ($month_array as $month_item) |
|
889 | 889 | { |
890 | 890 | $month_data .= '"'.$month_item['date_name'].'",'; |
891 | 891 | $month_cnt .= $month_item['date_count'].','; |
892 | 892 | } |
893 | 893 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
894 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
894 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
895 | 895 | print 'c3.generate({ |
896 | 896 | bindto: "#chart9", |
897 | 897 | data: { x: "x", |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
905 | 905 | </div> |
906 | 906 | </div> |
907 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
907 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
908 | 908 | |
909 | 909 | <div class="col-md-6"> |
910 | 910 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
911 | 911 | <?php |
912 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
912 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
913 | 913 | if (empty($date_array)) print _("No data available"); |
914 | 914 | else { |
915 | 915 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
916 | 916 | $date_data = ''; |
917 | 917 | $date_cnt = ''; |
918 | - foreach($date_array as $date_item) |
|
918 | + foreach ($date_array as $date_item) |
|
919 | 919 | { |
920 | 920 | $date_data .= '"'.$date_item['date_name'].'",'; |
921 | 921 | $date_cnt .= $date_item['date_count'].','; |
922 | 922 | } |
923 | 923 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
924 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
924 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
925 | 925 | print 'c3.generate({ |
926 | 926 | bindto: "#chart5", |
927 | 927 | data: { x: "x", |
@@ -934,23 +934,23 @@ discard block |
||
934 | 934 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
935 | 935 | </div> |
936 | 936 | </div> |
937 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
937 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
938 | 938 | <div class="col-md-6"> |
939 | 939 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
940 | 940 | <?php |
941 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
941 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
942 | 942 | if (empty($hour_array)) print _("No data available"); |
943 | 943 | else { |
944 | 944 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
945 | 945 | $hour_data = ''; |
946 | 946 | $hour_cnt = ''; |
947 | - foreach($hour_array as $hour_item) |
|
947 | + foreach ($hour_array as $hour_item) |
|
948 | 948 | { |
949 | 949 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
950 | 950 | $hour_cnt .= $hour_item['hour_count'].','; |
951 | 951 | } |
952 | 952 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
953 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
953 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
954 | 954 | print 'c3.generate({ |
955 | 955 | bindto: "#chart6", |
956 | 956 | data: { |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
964 | 964 | </div> |
965 | 965 | </div> |
966 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
966 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
967 | 967 | </div> |
968 | 968 | <?php |
969 | 969 | } |
@@ -987,13 +987,13 @@ discard block |
||
987 | 987 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
988 | 988 | $year_data = ''; |
989 | 989 | $year_cnt = ''; |
990 | - foreach($year_array as $year_item) |
|
990 | + foreach ($year_array as $year_item) |
|
991 | 991 | { |
992 | 992 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
993 | 993 | $year_cnt .= $year_item['date_count'].','; |
994 | 994 | } |
995 | 995 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
996 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
996 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
997 | 997 | print 'c3.generate({ |
998 | 998 | bindto: "#chart8", |
999 | 999 | data: { x: "x", |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | </div> |
1008 | 1008 | </div> |
1009 | 1009 | |
1010 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1010 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1011 | 1011 | <div class="col-md-6"> |
1012 | 1012 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1013 | 1013 | <?php |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1018 | 1018 | $month_data = ''; |
1019 | 1019 | $month_cnt = ''; |
1020 | - foreach($month_array as $month_item) |
|
1020 | + foreach ($month_array as $month_item) |
|
1021 | 1021 | { |
1022 | 1022 | $month_data .= '"'.$month_item['date_name'].'",'; |
1023 | 1023 | $month_cnt .= $month_item['date_count'].','; |
1024 | 1024 | } |
1025 | 1025 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1026 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1026 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1027 | 1027 | print 'c3.generate({ |
1028 | 1028 | bindto: "#chart9", |
1029 | 1029 | data: { x: "x", |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1037 | 1037 | </div> |
1038 | 1038 | </div> |
1039 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1039 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1040 | 1040 | |
1041 | 1041 | <div class="col-md-6"> |
1042 | 1042 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1047,13 +1047,13 @@ discard block |
||
1047 | 1047 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1048 | 1048 | $date_data = ''; |
1049 | 1049 | $date_cnt = ''; |
1050 | - foreach($date_array as $date_item) |
|
1050 | + foreach ($date_array as $date_item) |
|
1051 | 1051 | { |
1052 | 1052 | $date_data .= '"'.$date_item['date_name'].'",'; |
1053 | 1053 | $date_cnt .= $date_item['date_count'].','; |
1054 | 1054 | } |
1055 | 1055 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1056 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1056 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1057 | 1057 | print 'c3.generate({ |
1058 | 1058 | bindto: "#chart5", |
1059 | 1059 | data: { x: "x", |
@@ -1066,23 +1066,23 @@ discard block |
||
1066 | 1066 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1067 | 1067 | </div> |
1068 | 1068 | </div> |
1069 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1069 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1070 | 1070 | <div class="col-md-6"> |
1071 | 1071 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1072 | 1072 | <?php |
1073 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1073 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1074 | 1074 | if (empty($hour_array)) print _("No data available"); |
1075 | 1075 | else { |
1076 | 1076 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1077 | 1077 | $hour_data = ''; |
1078 | 1078 | $hour_cnt = ''; |
1079 | - foreach($hour_array as $hour_item) |
|
1079 | + foreach ($hour_array as $hour_item) |
|
1080 | 1080 | { |
1081 | 1081 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1082 | 1082 | $hour_cnt .= $hour_item['hour_count'].','; |
1083 | 1083 | } |
1084 | 1084 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1085 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1085 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1086 | 1086 | print 'c3.generate({ |
1087 | 1087 | bindto: "#chart6", |
1088 | 1088 | data: { |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1096 | 1096 | </div> |
1097 | 1097 | </div> |
1098 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1098 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1099 | 1099 | </div> |
1100 | 1100 | <?php |
1101 | 1101 | } |
@@ -1119,13 +1119,13 @@ discard block |
||
1119 | 1119 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1120 | 1120 | $year_data = ''; |
1121 | 1121 | $year_cnt = ''; |
1122 | - foreach($year_array as $year_item) |
|
1122 | + foreach ($year_array as $year_item) |
|
1123 | 1123 | { |
1124 | 1124 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1125 | 1125 | $year_cnt .= $year_item['count'].','; |
1126 | 1126 | } |
1127 | 1127 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1128 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1128 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1129 | 1129 | print 'c3.generate({ |
1130 | 1130 | bindto: "#chart32", |
1131 | 1131 | data: { x: "x", |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1139 | 1139 | </div> |
1140 | 1140 | </div> |
1141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1142 | 1142 | |
1143 | 1143 | <div class="row column"> |
1144 | 1144 | <div class="col-md-6"> |
@@ -1150,13 +1150,13 @@ discard block |
||
1150 | 1150 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1151 | 1151 | $year_data = ''; |
1152 | 1152 | $year_cnt = ''; |
1153 | - foreach($year_array as $year_item) |
|
1153 | + foreach ($year_array as $year_item) |
|
1154 | 1154 | { |
1155 | 1155 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1156 | 1156 | $year_cnt .= $year_item['count'].','; |
1157 | 1157 | } |
1158 | 1158 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1159 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1159 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1160 | 1160 | print 'c3.generate({ |
1161 | 1161 | bindto: "#chart33", |
1162 | 1162 | data: { x: "x", |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1170 | 1170 | </div> |
1171 | 1171 | </div> |
1172 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1172 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1173 | 1173 | <br/> |
1174 | 1174 | <?php |
1175 | 1175 | } |
@@ -1185,19 +1185,19 @@ discard block |
||
1185 | 1185 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1186 | 1186 | if ($year == '' && $month == '') { |
1187 | 1187 | if ($type == 'aircraft') { |
1188 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1188 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1189 | 1189 | } elseif ($type == 'marine') { |
1190 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1190 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1191 | 1191 | } elseif ($type == 'tracker') { |
1192 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1192 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1193 | 1193 | } |
1194 | 1194 | } else { |
1195 | 1195 | if ($type == 'aircraft') { |
1196 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1196 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1197 | 1197 | } elseif ($type == 'marine') { |
1198 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1198 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1199 | 1199 | } elseif ($type == 'tracker') { |
1200 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1200 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | if (!empty($polar)) { |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | unset($polar_data); |
1207 | 1207 | $Spotter = new Spotter(); |
1208 | 1208 | $data = json_decode($eachpolar['source_data']); |
1209 | - foreach($data as $value => $key) { |
|
1209 | + foreach ($data as $value => $key) { |
|
1210 | 1210 | $direction = $Spotter->parseDirection(($value*22.5)); |
1211 | 1211 | $distance = $key; |
1212 | 1212 | $unit = 'km'; |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | ?> |
1227 | 1227 | <div class="col-md-6"> |
1228 | 1228 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1229 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1229 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1230 | 1230 | <script> |
1231 | 1231 | (function() { |
1232 | 1232 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | color: color, |
1251 | 1251 | unit: '<?php echo $unit; ?>' |
1252 | 1252 | }; |
1253 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1253 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1254 | 1254 | })(); |
1255 | 1255 | </script> |
1256 | 1256 | </div> |
@@ -1265,19 +1265,19 @@ discard block |
||
1265 | 1265 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1266 | 1266 | if ($year == '' && $month == '') { |
1267 | 1267 | if ($type == 'aircraft') { |
1268 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1268 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1269 | 1269 | } elseif ($type == 'marine') { |
1270 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1270 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1271 | 1271 | } elseif ($type == 'tracker') { |
1272 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1272 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1273 | 1273 | } |
1274 | 1274 | } else { |
1275 | 1275 | if ($type == 'aircraft') { |
1276 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1276 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1277 | 1277 | } elseif ($type == 'marine') { |
1278 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1278 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1279 | 1279 | } elseif ($type == 'tracker') { |
1280 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1280 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | if (!empty($msg)) { |
@@ -1285,13 +1285,13 @@ discard block |
||
1285 | 1285 | foreach ($msg as $eachmsg) { |
1286 | 1286 | //$eachmsg = $msg[0]; |
1287 | 1287 | $data = $eachmsg['source_data']; |
1288 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1288 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1289 | 1289 | else $max = 500; |
1290 | 1290 | ?> |
1291 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1291 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1292 | 1292 | <script> |
1293 | 1293 | var g = new JustGage({ |
1294 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1294 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1295 | 1295 | value: <?php echo $data; ?>, |
1296 | 1296 | min: 0, |
1297 | 1297 | max: <?php print $max; ?>, |
@@ -1313,19 +1313,19 @@ discard block |
||
1313 | 1313 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1314 | 1314 | if ($year == '' && $month == '') { |
1315 | 1315 | if ($type == 'aircraft') { |
1316 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1316 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1317 | 1317 | } elseif ($type == 'marine') { |
1318 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1318 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1319 | 1319 | } elseif ($type == 'tracker') { |
1320 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1320 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1321 | 1321 | } |
1322 | 1322 | } else { |
1323 | 1323 | if ($type == 'aircraft') { |
1324 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1324 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1325 | 1325 | } elseif ($type == 'marine') { |
1326 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1326 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1327 | 1327 | } elseif ($type == 'tracker') { |
1328 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1328 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | foreach ($hist as $hists) { |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | $source = $hists['source_name']; |
1336 | 1336 | $hist_array = json_decode($hists['source_data']); |
1337 | 1337 | $unit = 'km'; |
1338 | - foreach($hist_array as $distance => $nb) |
|
1338 | + foreach ($hist_array as $distance => $nb) |
|
1339 | 1339 | { |
1340 | 1340 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1341 | 1341 | $distance = round($distance*0.539957); |
@@ -1356,18 +1356,18 @@ discard block |
||
1356 | 1356 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1357 | 1357 | ?> |
1358 | 1358 | <div class="col-md-6"> |
1359 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1359 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1360 | 1360 | <?php |
1361 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1361 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1362 | 1362 | print 'c3.generate({ |
1363 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1363 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1364 | 1364 | data: { x: "x", |
1365 | 1365 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1366 | 1366 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1367 | 1367 | print '</script>'; |
1368 | 1368 | ?> |
1369 | 1369 | </div> |
1370 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1370 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1371 | 1371 | <?php |
1372 | 1372 | } |
1373 | 1373 | ?> |