@@ -14,7 +14,7 @@ discard block |
||
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; |
@@ -759,10 +759,6 @@ discard block |
||
759 | 759 | * |
760 | 760 | * @param String $famtrackid the ID from flightaware |
761 | 761 | * @param String $ident the flight ident |
762 | - * @param String $aircraft_icao the aircraft type |
|
763 | - * @param String $departure_airport_icao the departure airport |
|
764 | - * @param String $arrival_airport_icao the arrival airport |
|
765 | - * @return String success or false |
|
766 | 762 | * |
767 | 763 | */ |
768 | 764 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Gets all the spotter information based on the latest data entry |
|
90 | - * |
|
91 | - * @return Array the spotter information |
|
92 | - * |
|
93 | - */ |
|
89 | + * Gets all the spotter information based on the latest data entry |
|
90 | + * |
|
91 | + * @return Array the spotter information |
|
92 | + * |
|
93 | + */ |
|
94 | 94 | public function getLiveTrackerData($limit = '', $sort = '', $filter = array()) |
95 | 95 | { |
96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * Gets Minimal Live Spotter data |
|
136 | - * |
|
137 | - * @return Array the spotter information |
|
138 | - * |
|
139 | - */ |
|
135 | + * Gets Minimal Live Spotter data |
|
136 | + * |
|
137 | + * @return Array the spotter information |
|
138 | + * |
|
139 | + */ |
|
140 | 140 | public function getMinLiveTrackerData($filter = array()) |
141 | 141 | { |
142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
173 | - * Gets Minimal Live Spotter data since xx seconds |
|
174 | - * |
|
175 | - * @return Array the spotter information |
|
176 | - * |
|
177 | - */ |
|
173 | + * Gets Minimal Live Spotter data since xx seconds |
|
174 | + * |
|
175 | + * @return Array the spotter information |
|
176 | + * |
|
177 | + */ |
|
178 | 178 | public function getMinLastLiveTrackerData($filter = array()) |
179 | 179 | { |
180 | 180 | global $globalDBdriver, $globalLiveInterval; |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
188 | 188 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
189 | 189 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
190 | - } else { |
|
190 | + } else { |
|
191 | 191 | $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
192 | 192 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
193 | 193 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
194 | 194 | } |
195 | 195 | |
196 | - try { |
|
196 | + try { |
|
197 | 197 | $sth = $this->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | 199 | } catch(PDOException $e) { |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * Gets number of latest data entry |
|
209 | - * |
|
210 | - * @return String number of entry |
|
211 | - * |
|
212 | - */ |
|
208 | + * Gets number of latest data entry |
|
209 | + * |
|
210 | + * @return String number of entry |
|
211 | + * |
|
212 | + */ |
|
213 | 213 | public function getLiveTrackerCount($filter = array()) |
214 | 214 | { |
215 | 215 | global $globalDBdriver, $globalLiveInterval; |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | - * Gets all the spotter information based on the latest data entry and coord |
|
238 | - * |
|
239 | - * @return Array the spotter information |
|
240 | - * |
|
241 | - */ |
|
237 | + * Gets all the spotter information based on the latest data entry and coord |
|
238 | + * |
|
239 | + * @return Array the spotter information |
|
240 | + * |
|
241 | + */ |
|
242 | 242 | public function getLiveTrackerDatabyCoord($coord, $filter = array()) |
243 | 243 | { |
244 | 244 | global $globalDBdriver, $globalLiveInterval; |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
265 | - * Gets all the spotter information based on the latest data entry and coord |
|
266 | - * |
|
267 | - * @return Array the spotter information |
|
268 | - * |
|
269 | - */ |
|
265 | + * Gets all the spotter information based on the latest data entry and coord |
|
266 | + * |
|
267 | + * @return Array the spotter information |
|
268 | + * |
|
269 | + */ |
|
270 | 270 | public function getMinLiveTrackerDatabyCoord($coord, $filter = array()) |
271 | 271 | { |
272 | 272 | global $globalDBdriver, $globalLiveInterval; |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | - * Gets all the spotter information based on a user's latitude and longitude |
|
297 | - * |
|
298 | - * @return Array the spotter information |
|
299 | - * |
|
300 | - */ |
|
296 | + * Gets all the spotter information based on a user's latitude and longitude |
|
297 | + * |
|
298 | + * @return Array the spotter information |
|
299 | + * |
|
300 | + */ |
|
301 | 301 | public function getLatestTrackerForLayar($lat, $lng, $radius, $interval) |
302 | 302 | { |
303 | 303 | $Tracker = new Tracker($this->db); |
@@ -310,142 +310,142 @@ discard block |
||
310 | 310 | if ($lng != '') |
311 | 311 | { |
312 | 312 | if (!is_numeric($lng)) |
313 | - { |
|
314 | - return false; |
|
315 | - } |
|
316 | - } |
|
317 | - |
|
318 | - if ($radius != '') |
|
319 | - { |
|
320 | - if (!is_numeric($radius)) |
|
321 | - { |
|
322 | - return false; |
|
323 | - } |
|
324 | - } |
|
313 | + { |
|
314 | + return false; |
|
315 | + } |
|
316 | + } |
|
317 | + |
|
318 | + if ($radius != '') |
|
319 | + { |
|
320 | + if (!is_numeric($radius)) |
|
321 | + { |
|
322 | + return false; |
|
323 | + } |
|
324 | + } |
|
325 | 325 | $additional_query = ''; |
326 | 326 | if ($interval != '') |
327 | - { |
|
328 | - if (!is_string($interval)) |
|
329 | - { |
|
330 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
331 | - return false; |
|
332 | - } else { |
|
333 | - if ($interval == '1m') |
|
334 | - { |
|
335 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
336 | - } else if ($interval == '15m'){ |
|
337 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
338 | - } |
|
339 | - } |
|
340 | - } else { |
|
341 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
342 | - } |
|
343 | - |
|
344 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
327 | + { |
|
328 | + if (!is_string($interval)) |
|
329 | + { |
|
330 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
331 | + return false; |
|
332 | + } else { |
|
333 | + if ($interval == '1m') |
|
334 | + { |
|
335 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
336 | + } else if ($interval == '15m'){ |
|
337 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
338 | + } |
|
339 | + } |
|
340 | + } else { |
|
341 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
342 | + } |
|
343 | + |
|
344 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
345 | 345 | WHERE tracker_live.latitude <> '' |
346 | 346 | AND tracker_live.longitude <> '' |
347 | 347 | ".$additional_query." |
348 | 348 | HAVING distance < :radius |
349 | 349 | ORDER BY distance"; |
350 | 350 | |
351 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
351 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
352 | 352 | |
353 | - return $spotter_array; |
|
354 | - } |
|
353 | + return $spotter_array; |
|
354 | + } |
|
355 | 355 | |
356 | 356 | |
357 | - /** |
|
358 | - * Gets all the spotter information based on a particular callsign |
|
359 | - * |
|
360 | - * @return Array the spotter information |
|
361 | - * |
|
362 | - */ |
|
357 | + /** |
|
358 | + * Gets all the spotter information based on a particular callsign |
|
359 | + * |
|
360 | + * @return Array the spotter information |
|
361 | + * |
|
362 | + */ |
|
363 | 363 | public function getLastLiveTrackerDataByIdent($ident) |
364 | 364 | { |
365 | 365 | $Tracker = new Tracker($this->db); |
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
369 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
369 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
370 | 370 | |
371 | 371 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
372 | 372 | |
373 | 373 | return $spotter_array; |
374 | 374 | } |
375 | 375 | |
376 | - /** |
|
377 | - * Gets all the spotter information based on a particular callsign |
|
378 | - * |
|
379 | - * @return Array the spotter information |
|
380 | - * |
|
381 | - */ |
|
376 | + /** |
|
377 | + * Gets all the spotter information based on a particular callsign |
|
378 | + * |
|
379 | + * @return Array the spotter information |
|
380 | + * |
|
381 | + */ |
|
382 | 382 | public function getDateLiveTrackerDataByIdent($ident,$date) |
383 | 383 | { |
384 | 384 | $Tracker = new Tracker($this->db); |
385 | 385 | date_default_timezone_set('UTC'); |
386 | 386 | |
387 | 387 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
388 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
388 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
389 | 389 | |
390 | - $date = date('c',$date); |
|
390 | + $date = date('c',$date); |
|
391 | 391 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
392 | 392 | |
393 | 393 | return $spotter_array; |
394 | 394 | } |
395 | 395 | |
396 | - /** |
|
397 | - * Gets last spotter information based on a particular callsign |
|
398 | - * |
|
399 | - * @return Array the spotter information |
|
400 | - * |
|
401 | - */ |
|
396 | + /** |
|
397 | + * Gets last spotter information based on a particular callsign |
|
398 | + * |
|
399 | + * @return Array the spotter information |
|
400 | + * |
|
401 | + */ |
|
402 | 402 | public function getLastLiveTrackerDataById($id) |
403 | 403 | { |
404 | 404 | $Tracker = new Tracker($this->db); |
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
408 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
409 | 409 | |
410 | 410 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
414 | 414 | |
415 | - /** |
|
416 | - * Gets last spotter information based on a particular callsign |
|
417 | - * |
|
418 | - * @return Array the spotter information |
|
419 | - * |
|
420 | - */ |
|
415 | + /** |
|
416 | + * Gets last spotter information based on a particular callsign |
|
417 | + * |
|
418 | + * @return Array the spotter information |
|
419 | + * |
|
420 | + */ |
|
421 | 421 | public function getDateLiveTrackerDataById($id,$date) |
422 | 422 | { |
423 | 423 | $Tracker = new Tracker($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | - $date = date('c',$date); |
|
427 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | + $date = date('c',$date); |
|
429 | 429 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
430 | 430 | |
431 | 431 | return $spotter_array; |
432 | 432 | } |
433 | 433 | |
434 | - /** |
|
435 | - * Gets altitude information based on a particular callsign |
|
436 | - * |
|
437 | - * @return Array the spotter information |
|
438 | - * |
|
439 | - */ |
|
434 | + /** |
|
435 | + * Gets altitude information based on a particular callsign |
|
436 | + * |
|
437 | + * @return Array the spotter information |
|
438 | + * |
|
439 | + */ |
|
440 | 440 | public function getAltitudeLiveTrackerDataByIdent($ident) |
441 | 441 | { |
442 | 442 | |
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
446 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
446 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
447 | 447 | |
448 | - try { |
|
448 | + try { |
|
449 | 449 | |
450 | 450 | $sth = $this->db->prepare($query); |
451 | 451 | $sth->execute(array(':ident' => $ident)); |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | return $spotter_array; |
459 | 459 | } |
460 | 460 | |
461 | - /** |
|
462 | - * Gets all the spotter information based on a particular id |
|
463 | - * |
|
464 | - * @return Array the spotter information |
|
465 | - * |
|
466 | - */ |
|
461 | + /** |
|
462 | + * Gets all the spotter information based on a particular id |
|
463 | + * |
|
464 | + * @return Array the spotter information |
|
465 | + * |
|
466 | + */ |
|
467 | 467 | public function getAllLiveTrackerDataById($id,$liveinterval = false) |
468 | 468 | { |
469 | 469 | global $globalDBdriver, $globalLiveInterval; |
@@ -491,18 +491,18 @@ discard block |
||
491 | 491 | return $spotter_array; |
492 | 492 | } |
493 | 493 | |
494 | - /** |
|
495 | - * Gets all the spotter information based on a particular ident |
|
496 | - * |
|
497 | - * @return Array the spotter information |
|
498 | - * |
|
499 | - */ |
|
494 | + /** |
|
495 | + * Gets all the spotter information based on a particular ident |
|
496 | + * |
|
497 | + * @return Array the spotter information |
|
498 | + * |
|
499 | + */ |
|
500 | 500 | public function getAllLiveTrackerDataByIdent($ident) |
501 | 501 | { |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
504 | 504 | $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
505 | - try { |
|
505 | + try { |
|
506 | 506 | |
507 | 507 | $sth = $this->db->prepare($query); |
508 | 508 | $sth->execute(array(':ident' => $ident)); |
@@ -516,23 +516,23 @@ discard block |
||
516 | 516 | |
517 | 517 | |
518 | 518 | /** |
519 | - * Deletes all info in the table |
|
520 | - * |
|
521 | - * @return String success or false |
|
522 | - * |
|
523 | - */ |
|
519 | + * Deletes all info in the table |
|
520 | + * |
|
521 | + * @return String success or false |
|
522 | + * |
|
523 | + */ |
|
524 | 524 | public function deleteLiveTrackerData() |
525 | 525 | { |
526 | 526 | global $globalDBdriver; |
527 | 527 | if ($globalDBdriver == 'mysql') { |
528 | 528 | //$query = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date"; |
529 | 529 | $query = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date'; |
530 | - //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
530 | + //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
531 | 531 | } else { |
532 | 532 | $query = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date"; |
533 | 533 | } |
534 | 534 | |
535 | - try { |
|
535 | + try { |
|
536 | 536 | |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
@@ -544,18 +544,18 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
547 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
548 | - * |
|
549 | - * @return String success or false |
|
550 | - * |
|
551 | - */ |
|
547 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
548 | + * |
|
549 | + * @return String success or false |
|
550 | + * |
|
551 | + */ |
|
552 | 552 | public function deleteLiveTrackerDataNotUpdated() |
553 | 553 | { |
554 | 554 | global $globalDBdriver, $globalDebug; |
555 | 555 | if ($globalDBdriver == 'mysql') { |
556 | 556 | //$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0'; |
557 | - $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
558 | - try { |
|
557 | + $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
558 | + try { |
|
559 | 559 | |
560 | 560 | $sth = $this->db->prepare($query); |
561 | 561 | $sth->execute(); |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | return "error"; |
564 | 564 | } |
565 | 565 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
566 | - $i = 0; |
|
567 | - $j =0; |
|
566 | + $i = 0; |
|
567 | + $j =0; |
|
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | 569 | foreach($all as $row) |
570 | 570 | { |
@@ -572,20 +572,20 @@ discard block |
||
572 | 572 | $j++; |
573 | 573 | if ($j == 30) { |
574 | 574 | if ($globalDebug) echo "."; |
575 | - try { |
|
575 | + try { |
|
576 | 576 | |
577 | 577 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
578 | 578 | $sth->execute(); |
579 | 579 | } catch(PDOException $e) { |
580 | 580 | return "error"; |
581 | 581 | } |
582 | - $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
583 | - $j = 0; |
|
582 | + $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
583 | + $j = 0; |
|
584 | 584 | } |
585 | 585 | $query_delete .= "'".$row['famtrackid']."',"; |
586 | 586 | } |
587 | 587 | if ($i > 0) { |
588 | - try { |
|
588 | + try { |
|
589 | 589 | |
590 | 590 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
591 | 591 | $sth->execute(); |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | return "success"; |
597 | 597 | } elseif ($globalDBdriver == 'pgsql') { |
598 | 598 | //$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0"; |
599 | - //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
600 | - $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
601 | - try { |
|
599 | + //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
600 | + $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
601 | + try { |
|
602 | 602 | |
603 | 603 | $sth = $this->db->prepare($query); |
604 | 604 | $sth->execute(); |
@@ -642,17 +642,17 @@ discard block |
||
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
645 | - * Deletes all info in the table for an ident |
|
646 | - * |
|
647 | - * @return String success or false |
|
648 | - * |
|
649 | - */ |
|
645 | + * Deletes all info in the table for an ident |
|
646 | + * |
|
647 | + * @return String success or false |
|
648 | + * |
|
649 | + */ |
|
650 | 650 | public function deleteLiveTrackerDataByIdent($ident) |
651 | 651 | { |
652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
653 | 653 | $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
654 | 654 | |
655 | - try { |
|
655 | + try { |
|
656 | 656 | |
657 | 657 | $sth = $this->db->prepare($query); |
658 | 658 | $sth->execute(array(':ident' => $ident)); |
@@ -664,17 +664,17 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
667 | - * Deletes all info in the table for an id |
|
668 | - * |
|
669 | - * @return String success or false |
|
670 | - * |
|
671 | - */ |
|
667 | + * Deletes all info in the table for an id |
|
668 | + * |
|
669 | + * @return String success or false |
|
670 | + * |
|
671 | + */ |
|
672 | 672 | public function deleteLiveTrackerDataById($id) |
673 | 673 | { |
674 | 674 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
675 | 675 | $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
676 | 676 | |
677 | - try { |
|
677 | + try { |
|
678 | 678 | |
679 | 679 | $sth = $this->db->prepare($query); |
680 | 680 | $sth->execute(array(':id' => $id)); |
@@ -687,11 +687,11 @@ discard block |
||
687 | 687 | |
688 | 688 | |
689 | 689 | /** |
690 | - * Gets the aircraft ident within the last hour |
|
691 | - * |
|
692 | - * @return String the ident |
|
693 | - * |
|
694 | - */ |
|
690 | + * Gets the aircraft ident within the last hour |
|
691 | + * |
|
692 | + * @return String the ident |
|
693 | + * |
|
694 | + */ |
|
695 | 695 | public function getIdentFromLastHour($ident) |
696 | 696 | { |
697 | 697 | global $globalDBdriver, $globalTimezone; |
@@ -717,14 +717,14 @@ discard block |
||
717 | 717 | $ident_result = $row['ident']; |
718 | 718 | } |
719 | 719 | return $ident_result; |
720 | - } |
|
720 | + } |
|
721 | 721 | |
722 | 722 | /** |
723 | - * Check recent aircraft |
|
724 | - * |
|
725 | - * @return String the ident |
|
726 | - * |
|
727 | - */ |
|
723 | + * Check recent aircraft |
|
724 | + * |
|
725 | + * @return String the ident |
|
726 | + * |
|
727 | + */ |
|
728 | 728 | public function checkIdentRecent($ident) |
729 | 729 | { |
730 | 730 | global $globalDBdriver, $globalTimezone; |
@@ -750,14 +750,14 @@ discard block |
||
750 | 750 | $ident_result = $row['famtrackid']; |
751 | 751 | } |
752 | 752 | return $ident_result; |
753 | - } |
|
753 | + } |
|
754 | 754 | |
755 | 755 | /** |
756 | - * Check recent aircraft by id |
|
757 | - * |
|
758 | - * @return String the ident |
|
759 | - * |
|
760 | - */ |
|
756 | + * Check recent aircraft by id |
|
757 | + * |
|
758 | + * @return String the ident |
|
759 | + * |
|
760 | + */ |
|
761 | 761 | public function checkIdRecent($id) |
762 | 762 | { |
763 | 763 | global $globalDBdriver, $globalTimezone; |
@@ -783,19 +783,19 @@ discard block |
||
783 | 783 | $ident_result = $row['famtrackid']; |
784 | 784 | } |
785 | 785 | return $ident_result; |
786 | - } |
|
786 | + } |
|
787 | 787 | |
788 | 788 | /** |
789 | - * Adds a new spotter data |
|
790 | - * |
|
791 | - * @param String $famtrackid the ID from flightaware |
|
792 | - * @param String $ident the flight ident |
|
793 | - * @param String $aircraft_icao the aircraft type |
|
794 | - * @param String $departure_airport_icao the departure airport |
|
795 | - * @param String $arrival_airport_icao the arrival airport |
|
796 | - * @return String success or false |
|
797 | - * |
|
798 | - */ |
|
789 | + * Adds a new spotter data |
|
790 | + * |
|
791 | + * @param String $famtrackid the ID from flightaware |
|
792 | + * @param String $ident the flight ident |
|
793 | + * @param String $aircraft_icao the aircraft type |
|
794 | + * @param String $departure_airport_icao the departure airport |
|
795 | + * @param String $arrival_airport_icao the arrival airport |
|
796 | + * @return String success or false |
|
797 | + * |
|
798 | + */ |
|
799 | 799 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
800 | 800 | { |
801 | 801 | global $globalURL, $globalArchive, $globalDebug; |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
869 | 869 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
870 | 870 | |
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
871 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
873 | 873 | |
874 | 874 | $query = ''; |
875 | 875 | if ($globalArchive) { |
@@ -884,18 +884,18 @@ discard block |
||
884 | 884 | |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute($query_values); |
887 | - } catch(PDOException $e) { |
|
888 | - return "error : ".$e->getMessage(); |
|
889 | - } |
|
890 | - /* |
|
887 | + } catch(PDOException $e) { |
|
888 | + return "error : ".$e->getMessage(); |
|
889 | + } |
|
890 | + /* |
|
891 | 891 | echo 'putinarchive : '.$putinarchive."\n"; |
892 | 892 | echo 'noarchive : '.$noarchive."\n"; |
893 | 893 | */ |
894 | 894 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
895 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
896 | - $TrackerArchive = new TrackerArchive($this->db); |
|
897 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
898 | - if ($globalDebug) echo $result.')'; |
|
895 | + if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
896 | + $TrackerArchive = new TrackerArchive($this->db); |
|
897 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
898 | + if ($globalDebug) echo $result.')'; |
|
899 | 899 | } |
900 | 900 | |
901 | 901 | return "success"; |
@@ -16,33 +16,33 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
37 | 37 | if (isset($flt['source'])) { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | 39 | } else { |
40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | if (isset($filter['source']) && !empty($filter['source'])) { |
45 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
45 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
46 | 46 | } |
47 | 47 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
72 | 72 | } |
73 | 73 | } |
74 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
74 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
75 | 75 | } |
76 | 76 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
78 | 78 | } |
79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
80 | 80 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
81 | 81 | if ($filter_query_where != '') { |
82 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
82 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
83 | 83 | } |
84 | 84 | $filter_query = $filter_query_join.$filter_query_where; |
85 | 85 | return $filter_query; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | if ($limit != '') |
103 | 103 | { |
104 | 104 | $limit_array = explode(',', $limit); |
105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
108 | 108 | { |
109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } else { |
127 | 127 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
128 | 128 | } |
129 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
129 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
130 | 130 | |
131 | 131 | return $spotter_array; |
132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | global $globalDBdriver, $globalLiveInterval; |
143 | 143 | date_default_timezone_set('UTC'); |
144 | 144 | |
145 | - $filter_query = $this->getFilter($filter,true,true); |
|
145 | + $filter_query = $this->getFilter($filter, true, true); |
|
146 | 146 | |
147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
148 | 148 | if ($globalDBdriver == 'mysql') { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | try { |
161 | 161 | $sth = $this->db->prepare($query); |
162 | 162 | $sth->execute(); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | echo $e->getMessage(); |
165 | 165 | die; |
166 | 166 | } |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | global $globalDBdriver, $globalLiveInterval; |
181 | 181 | date_default_timezone_set('UTC'); |
182 | 182 | |
183 | - $filter_query = $this->getFilter($filter,true,true); |
|
183 | + $filter_query = $this->getFilter($filter, true, true); |
|
184 | 184 | |
185 | 185 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
186 | 186 | if ($globalDBdriver == 'mysql') { |
187 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
187 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
188 | 188 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
189 | 189 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
190 | 190 | } else { |
191 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
191 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
192 | 192 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
193 | 193 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $sth = $this->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | - } catch(PDOException $e) { |
|
199 | + } catch (PDOException $e) { |
|
200 | 200 | echo $e->getMessage(); |
201 | 201 | die; |
202 | 202 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | public function getLiveTrackerCount($filter = array()) |
214 | 214 | { |
215 | 215 | global $globalDBdriver, $globalLiveInterval; |
216 | - $filter_query = $this->getFilter($filter,true,true); |
|
216 | + $filter_query = $this->getFilter($filter, true, true); |
|
217 | 217 | |
218 | 218 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
219 | 219 | if ($globalDBdriver == 'mysql') { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | $filter_query = $this->getFilter($filter); |
248 | 248 | |
249 | 249 | if (is_array($coord)) { |
250 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
251 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
252 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
253 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
250 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
251 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
252 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
253 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
254 | 254 | } else return array(); |
255 | 255 | if ($globalDBdriver == 'mysql') { |
256 | 256 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -275,17 +275,17 @@ discard block |
||
275 | 275 | $filter_query = $this->getFilter($filter); |
276 | 276 | |
277 | 277 | if (is_array($coord)) { |
278 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
279 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
280 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
281 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
278 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
279 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
280 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
281 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
282 | 282 | } else return array(); |
283 | 283 | if ($globalDBdriver == 'mysql') { |
284 | 284 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
285 | 285 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
286 | 286 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
287 | 287 | } else { |
288 | - $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
288 | + $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
289 | 289 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'"; |
290 | 290 | } |
291 | 291 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if ($interval == '1m') |
334 | 334 | { |
335 | 335 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
336 | - } else if ($interval == '15m'){ |
|
336 | + } else if ($interval == '15m') { |
|
337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
338 | 338 | } |
339 | 339 | } |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
342 | 342 | } |
343 | 343 | |
344 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
344 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
345 | 345 | WHERE tracker_live.latitude <> '' |
346 | 346 | AND tracker_live.longitude <> '' |
347 | 347 | ".$additional_query." |
348 | 348 | HAVING distance < :radius |
349 | 349 | ORDER BY distance"; |
350 | 350 | |
351 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
351 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
352 | 352 | |
353 | 353 | return $spotter_array; |
354 | 354 | } |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
369 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
369 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
370 | 370 | |
371 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
371 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
372 | 372 | |
373 | 373 | return $spotter_array; |
374 | 374 | } |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | * @return Array the spotter information |
380 | 380 | * |
381 | 381 | */ |
382 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
382 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
383 | 383 | { |
384 | 384 | $Tracker = new Tracker($this->db); |
385 | 385 | date_default_timezone_set('UTC'); |
386 | 386 | |
387 | 387 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
388 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
388 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
389 | 389 | |
390 | - $date = date('c',$date); |
|
391 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
390 | + $date = date('c', $date); |
|
391 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
392 | 392 | |
393 | 393 | return $spotter_array; |
394 | 394 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
408 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
409 | 409 | |
410 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
410 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function getDateLiveTrackerDataById($id,$date) |
|
421 | + public function getDateLiveTrackerDataById($id, $date) |
|
422 | 422 | { |
423 | 423 | $Tracker = new Tracker($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | - $date = date('c',$date); |
|
429 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
427 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | + $date = date('c', $date); |
|
429 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
430 | 430 | |
431 | 431 | return $spotter_array; |
432 | 432 | } |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
446 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
446 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
447 | 447 | |
448 | 448 | try { |
449 | 449 | |
450 | 450 | $sth = $this->db->prepare($query); |
451 | 451 | $sth->execute(array(':ident' => $ident)); |
452 | - } catch(PDOException $e) { |
|
452 | + } catch (PDOException $e) { |
|
453 | 453 | echo $e->getMessage(); |
454 | 454 | die; |
455 | 455 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return Array the spotter information |
465 | 465 | * |
466 | 466 | */ |
467 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
467 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
468 | 468 | { |
469 | 469 | global $globalDBdriver, $globalLiveInterval; |
470 | 470 | date_default_timezone_set('UTC'); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | try { |
484 | 484 | $sth = $this->db->prepare($query); |
485 | 485 | $sth->execute(array(':id' => $id)); |
486 | - } catch(PDOException $e) { |
|
486 | + } catch (PDOException $e) { |
|
487 | 487 | echo $e->getMessage(); |
488 | 488 | die; |
489 | 489 | } |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | { |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
504 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
504 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
505 | 505 | try { |
506 | 506 | |
507 | 507 | $sth = $this->db->prepare($query); |
508 | 508 | $sth->execute(array(':ident' => $ident)); |
509 | - } catch(PDOException $e) { |
|
509 | + } catch (PDOException $e) { |
|
510 | 510 | echo $e->getMessage(); |
511 | 511 | die; |
512 | 512 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
539 | - } catch(PDOException $e) { |
|
539 | + } catch (PDOException $e) { |
|
540 | 540 | return "error"; |
541 | 541 | } |
542 | 542 | |
@@ -559,14 +559,14 @@ discard block |
||
559 | 559 | |
560 | 560 | $sth = $this->db->prepare($query); |
561 | 561 | $sth->execute(); |
562 | - } catch(PDOException $e) { |
|
562 | + } catch (PDOException $e) { |
|
563 | 563 | return "error"; |
564 | 564 | } |
565 | 565 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
566 | 566 | $i = 0; |
567 | - $j =0; |
|
567 | + $j = 0; |
|
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | - foreach($all as $row) |
|
569 | + foreach ($all as $row) |
|
570 | 570 | { |
571 | 571 | $i++; |
572 | 572 | $j++; |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | if ($globalDebug) echo "."; |
575 | 575 | try { |
576 | 576 | |
577 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
577 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
578 | 578 | $sth->execute(); |
579 | - } catch(PDOException $e) { |
|
579 | + } catch (PDOException $e) { |
|
580 | 580 | return "error"; |
581 | 581 | } |
582 | 582 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | if ($i > 0) { |
588 | 588 | try { |
589 | 589 | |
590 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
590 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error"; |
594 | 594 | } |
595 | 595 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | $sth = $this->db->prepare($query); |
604 | 604 | $sth->execute(); |
605 | - } catch(PDOException $e) { |
|
605 | + } catch (PDOException $e) { |
|
606 | 606 | return "error"; |
607 | 607 | } |
608 | 608 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -650,13 +650,13 @@ discard block |
||
650 | 650 | public function deleteLiveTrackerDataByIdent($ident) |
651 | 651 | { |
652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
653 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
653 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
654 | 654 | |
655 | 655 | try { |
656 | 656 | |
657 | 657 | $sth = $this->db->prepare($query); |
658 | 658 | $sth->execute(array(':ident' => $ident)); |
659 | - } catch(PDOException $e) { |
|
659 | + } catch (PDOException $e) { |
|
660 | 660 | return "error"; |
661 | 661 | } |
662 | 662 | |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | public function deleteLiveTrackerDataById($id) |
673 | 673 | { |
674 | 674 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
675 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
675 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
676 | 676 | |
677 | 677 | try { |
678 | 678 | |
679 | 679 | $sth = $this->db->prepare($query); |
680 | 680 | $sth->execute(array(':id' => $id)); |
681 | - } catch(PDOException $e) { |
|
681 | + } catch (PDOException $e) { |
|
682 | 682 | return "error"; |
683 | 683 | } |
684 | 684 | |
@@ -696,13 +696,13 @@ discard block |
||
696 | 696 | { |
697 | 697 | global $globalDBdriver, $globalTimezone; |
698 | 698 | if ($globalDBdriver == 'mysql') { |
699 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
699 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
700 | 700 | WHERE tracker_live.ident = :ident |
701 | 701 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
702 | 702 | AND tracker_live.date < UTC_TIMESTAMP()'; |
703 | 703 | $query_data = array(':ident' => $ident); |
704 | 704 | } else { |
705 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
705 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
706 | 706 | WHERE tracker_live.ident = :ident |
707 | 707 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
708 | 708 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | |
712 | 712 | $sth = $this->db->prepare($query); |
713 | 713 | $sth->execute($query_data); |
714 | - $ident_result=''; |
|
715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
714 | + $ident_result = ''; |
|
715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
716 | 716 | { |
717 | 717 | $ident_result = $row['ident']; |
718 | 718 | } |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | { |
730 | 730 | global $globalDBdriver, $globalTimezone; |
731 | 731 | if ($globalDBdriver == 'mysql') { |
732 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
732 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
733 | 733 | WHERE tracker_live.ident = :ident |
734 | 734 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
735 | 735 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
736 | 736 | $query_data = array(':ident' => $ident); |
737 | 737 | } else { |
738 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
738 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
739 | 739 | WHERE tracker_live.ident = :ident |
740 | 740 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
741 | 741 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | |
745 | 745 | $sth = $this->db->prepare($query); |
746 | 746 | $sth->execute($query_data); |
747 | - $ident_result=''; |
|
748 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
747 | + $ident_result = ''; |
|
748 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
749 | 749 | { |
750 | 750 | $ident_result = $row['famtrackid']; |
751 | 751 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | { |
763 | 763 | global $globalDBdriver, $globalTimezone; |
764 | 764 | if ($globalDBdriver == 'mysql') { |
765 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
765 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
766 | 766 | WHERE tracker_live.famtrackid = :id |
767 | 767 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
768 | 768 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
769 | 769 | $query_data = array(':id' => $id); |
770 | 770 | } else { |
771 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
771 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
772 | 772 | WHERE tracker_live.famtrackid = :id |
773 | 773 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
774 | 774 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | |
778 | 778 | $sth = $this->db->prepare($query); |
779 | 779 | $sth->execute($query_data); |
780 | - $ident_result=''; |
|
781 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
780 | + $ident_result = ''; |
|
781 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
782 | 782 | { |
783 | 783 | $ident_result = $row['famtrackid']; |
784 | 784 | } |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return String success or false |
797 | 797 | * |
798 | 798 | */ |
799 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
799 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
800 | 800 | { |
801 | 801 | global $globalURL, $globalArchive, $globalDebug; |
802 | 802 | $Common = new Common(); |
@@ -855,21 +855,21 @@ discard block |
||
855 | 855 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
856 | 856 | |
857 | 857 | |
858 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
859 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
860 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
861 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
862 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
863 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
864 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
865 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
866 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
867 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
868 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
869 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
870 | - |
|
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
858 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
859 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
860 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
861 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
862 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
863 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
864 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
865 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
866 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
867 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
868 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
869 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
870 | + |
|
871 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
872 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
873 | 873 | |
874 | 874 | $query = ''; |
875 | 875 | if ($globalArchive) { |
@@ -879,12 +879,12 @@ discard block |
||
879 | 879 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
880 | 880 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
881 | 881 | |
882 | - $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); |
|
882 | + $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); |
|
883 | 883 | try { |
884 | 884 | |
885 | 885 | $sth = $this->db->prepare($query); |
886 | 886 | $sth->execute($query_values); |
887 | - } catch(PDOException $e) { |
|
887 | + } catch (PDOException $e) { |
|
888 | 888 | return "error : ".$e->getMessage(); |
889 | 889 | } |
890 | 890 | /* |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
895 | 895 | if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
896 | 896 | $TrackerArchive = new TrackerArchive($this->db); |
897 | - $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
|
897 | + $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident, $latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type, $noarchive, $format_source, $source_name, $over_country); |
|
898 | 898 | if ($globalDebug) echo $result.')'; |
899 | 899 | } |
900 | 900 | |
@@ -904,7 +904,7 @@ discard block |
||
904 | 904 | |
905 | 905 | public function getOrderBy() |
906 | 906 | { |
907 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
907 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
908 | 908 | return $orderby; |
909 | 909 | } |
910 | 910 |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | if (isset($filter[0]['source'])) { |
30 | 30 | $filters = array_merge($filters,$filter); |
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
33 | 35 | $filter_query_join = ''; |
34 | 36 | $filter_query_where = ''; |
35 | 37 | foreach($filters as $flt) { |
@@ -76,8 +78,11 @@ discard block |
||
76 | 78 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
77 | 79 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
78 | 80 | } |
79 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
80 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
81 | + if ($filter_query_where == '' && $where) { |
|
82 | + $filter_query_where = ' WHERE'; |
|
83 | + } elseif ($filter_query_where != '' && $and) { |
|
84 | + $filter_query_where .= ' AND'; |
|
85 | + } |
|
81 | 86 | if ($filter_query_where != '') { |
82 | 87 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
83 | 88 | } |
@@ -119,7 +124,9 @@ discard block |
||
119 | 124 | } |
120 | 125 | } |
121 | 126 | |
122 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
127 | + if (!isset($globalLiveInterval)) { |
|
128 | + $globalLiveInterval = '200'; |
|
129 | + } |
|
123 | 130 | if ($globalDBdriver == 'mysql') { |
124 | 131 | //$query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate"; |
125 | 132 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -144,7 +151,9 @@ discard block |
||
144 | 151 | |
145 | 152 | $filter_query = $this->getFilter($filter,true,true); |
146 | 153 | |
147 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
154 | + if (!isset($globalLiveInterval)) { |
|
155 | + $globalLiveInterval = '200'; |
|
156 | + } |
|
148 | 157 | if ($globalDBdriver == 'mysql') { |
149 | 158 | $query = 'SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
150 | 159 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate'.$filter_query." tracker_live.latitude <> 0 AND tracker_live.longitude <> 0"; |
@@ -182,7 +191,9 @@ discard block |
||
182 | 191 | |
183 | 192 | $filter_query = $this->getFilter($filter,true,true); |
184 | 193 | |
185 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
194 | + if (!isset($globalLiveInterval)) { |
|
195 | + $globalLiveInterval = '200'; |
|
196 | + } |
|
186 | 197 | if ($globalDBdriver == 'mysql') { |
187 | 198 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
188 | 199 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
@@ -215,7 +226,9 @@ discard block |
||
215 | 226 | global $globalDBdriver, $globalLiveInterval; |
216 | 227 | $filter_query = $this->getFilter($filter,true,true); |
217 | 228 | |
218 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
229 | + if (!isset($globalLiveInterval)) { |
|
230 | + $globalLiveInterval = '200'; |
|
231 | + } |
|
219 | 232 | if ($globalDBdriver == 'mysql') { |
220 | 233 | $query = 'SELECT COUNT(DISTINCT tracker_live.famtrackid) as nb FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
221 | 234 | } else { |
@@ -243,7 +256,9 @@ discard block |
||
243 | 256 | { |
244 | 257 | global $globalDBdriver, $globalLiveInterval; |
245 | 258 | $Spotter = new Spotter($this->db); |
246 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
259 | + if (!isset($globalLiveInterval)) { |
|
260 | + $globalLiveInterval = '200'; |
|
261 | + } |
|
247 | 262 | $filter_query = $this->getFilter($filter); |
248 | 263 | |
249 | 264 | if (is_array($coord)) { |
@@ -251,7 +266,9 @@ discard block |
||
251 | 266 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
252 | 267 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
253 | 268 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
254 | - } else return array(); |
|
269 | + } else { |
|
270 | + return array(); |
|
271 | + } |
|
255 | 272 | if ($globalDBdriver == 'mysql') { |
256 | 273 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
257 | 274 | } else { |
@@ -271,7 +288,9 @@ discard block |
||
271 | 288 | { |
272 | 289 | global $globalDBdriver, $globalLiveInterval; |
273 | 290 | $Spotter = new Spotter($this->db); |
274 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
291 | + if (!isset($globalLiveInterval)) { |
|
292 | + $globalLiveInterval = '200'; |
|
293 | + } |
|
275 | 294 | $filter_query = $this->getFilter($filter); |
276 | 295 | |
277 | 296 | if (is_array($coord)) { |
@@ -279,7 +298,9 @@ discard block |
||
279 | 298 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
280 | 299 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
281 | 300 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
282 | - } else return array(); |
|
301 | + } else { |
|
302 | + return array(); |
|
303 | + } |
|
283 | 304 | if ($globalDBdriver == 'mysql') { |
284 | 305 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
285 | 306 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
@@ -472,11 +493,15 @@ discard block |
||
472 | 493 | //$query = self::$global_query.' WHERE tracker_live.famtrackid = :id ORDER BY date'; |
473 | 494 | if ($globalDBdriver == 'mysql') { |
474 | 495 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
475 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
496 | + if ($liveinterval) { |
|
497 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
498 | + } |
|
476 | 499 | $query .= ' ORDER BY date'; |
477 | 500 | } else { |
478 | 501 | $query = 'SELECT tracker_live.* FROM tracker_live WHERE tracker_live.famtrackid = :id'; |
479 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
502 | + if ($liveinterval) { |
|
503 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
504 | + } |
|
480 | 505 | $query .= ' ORDER BY date'; |
481 | 506 | } |
482 | 507 | |
@@ -571,7 +596,9 @@ discard block |
||
571 | 596 | $i++; |
572 | 597 | $j++; |
573 | 598 | if ($j == 30) { |
574 | - if ($globalDebug) echo "."; |
|
599 | + if ($globalDebug) { |
|
600 | + echo "."; |
|
601 | + } |
|
575 | 602 | try { |
576 | 603 | |
577 | 604 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -818,7 +845,9 @@ discard block |
||
818 | 845 | { |
819 | 846 | return false; |
820 | 847 | } |
821 | - } else return ''; |
|
848 | + } else { |
|
849 | + return ''; |
|
850 | + } |
|
822 | 851 | |
823 | 852 | if ($longitude != '') |
824 | 853 | { |
@@ -826,7 +855,9 @@ discard block |
||
826 | 855 | { |
827 | 856 | return false; |
828 | 857 | } |
829 | - } else return ''; |
|
858 | + } else { |
|
859 | + return ''; |
|
860 | + } |
|
830 | 861 | |
831 | 862 | if ($altitude != '') |
832 | 863 | { |
@@ -834,7 +865,9 @@ discard block |
||
834 | 865 | { |
835 | 866 | return false; |
836 | 867 | } |
837 | - } else $altitude = 0; |
|
868 | + } else { |
|
869 | + $altitude = 0; |
|
870 | + } |
|
838 | 871 | |
839 | 872 | if ($heading != '') |
840 | 873 | { |
@@ -842,7 +875,9 @@ discard block |
||
842 | 875 | { |
843 | 876 | return false; |
844 | 877 | } |
845 | - } else $heading = 0; |
|
878 | + } else { |
|
879 | + $heading = 0; |
|
880 | + } |
|
846 | 881 | |
847 | 882 | if ($groundspeed != '') |
848 | 883 | { |
@@ -850,9 +885,13 @@ discard block |
||
850 | 885 | { |
851 | 886 | return false; |
852 | 887 | } |
853 | - } else $groundspeed = 0; |
|
888 | + } else { |
|
889 | + $groundspeed = 0; |
|
890 | + } |
|
854 | 891 | date_default_timezone_set('UTC'); |
855 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
892 | + if ($date == '') { |
|
893 | + $date = date("Y-m-d H:i:s", time()); |
|
894 | + } |
|
856 | 895 | |
857 | 896 | |
858 | 897 | $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
@@ -868,12 +907,18 @@ discard block |
||
868 | 907 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
869 | 908 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
870 | 909 | |
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
910 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
911 | + $groundspeed = 0; |
|
912 | + } |
|
913 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
914 | + $heading = 0; |
|
915 | + } |
|
873 | 916 | |
874 | 917 | $query = ''; |
875 | 918 | if ($globalArchive) { |
876 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
919 | + if ($globalDebug) { |
|
920 | + echo '-- Delete previous data -- '; |
|
921 | + } |
|
877 | 922 | $query .= 'DELETE FROM tracker_live WHERE famtrackid = :famtrackid;'; |
878 | 923 | } |
879 | 924 | $query .= 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
@@ -892,10 +937,14 @@ discard block |
||
892 | 937 | echo 'noarchive : '.$noarchive."\n"; |
893 | 938 | */ |
894 | 939 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
895 | - if ($globalDebug) echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
940 | + if ($globalDebug) { |
|
941 | + echo '(Add to Tracker archive '.$famtrackid.' : '; |
|
942 | + } |
|
896 | 943 | $TrackerArchive = new TrackerArchive($this->db); |
897 | 944 | $result = $TrackerArchive->addTrackerArchiveData($famtrackid, $ident,$latitude, $longitude, $altitude, $heading, $groundspeed, $date, $putinarchive, $comment, $type,$noarchive,$format_source, $source_name, $over_country); |
898 | - if ($globalDebug) echo $result.')'; |
|
945 | + if ($globalDebug) { |
|
946 | + echo $result.')'; |
|
947 | + } |
|
899 | 948 | } |
900 | 949 | |
901 | 950 | return "success"; |
@@ -131,5 +131,5 @@ |
||
131 | 131 | } else { |
132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
134 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
134 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
135 | 135 | } |
@@ -53,7 +53,12 @@ discard block |
||
53 | 53 | } else { |
54 | 54 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
55 | 55 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
56 | - if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
56 | + if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
57 | + print $globalMapRefresh*2000; |
|
58 | +} else { |
|
59 | + print '60000'; |
|
60 | +} |
|
61 | +?>)) { |
|
57 | 62 | viewer.dataSources.get(dsn).entities.remove(entity); |
58 | 63 | } else { |
59 | 64 | //console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100)); |
@@ -127,7 +132,12 @@ discard block |
||
127 | 132 | function(){ |
128 | 133 | updateMarineData(); |
129 | 134 | } |
130 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
135 | + ,<?php if (isset($globalMapRefresh)) { |
|
136 | + print $globalMapRefresh*1000; |
|
137 | +} else { |
|
138 | + print '30000'; |
|
139 | +} |
|
140 | +?>); |
|
131 | 141 | } else { |
132 | 142 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 143 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | if (!isset($globalJsonCompress)) $compress = true; |
7 | 7 | else $compress = $globalJsonCompress; |
8 | 8 | |
9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
9 | +if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
10 | +if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
11 | 11 | ?> |
12 | 12 | |
13 | 13 | |
@@ -176,10 +176,10 @@ discard block |
||
176 | 176 | }; |
177 | 177 | archive.update = function (props) { |
178 | 178 | if (typeof props != 'undefined') { |
179 | - //this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
180 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
179 | + //this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
180 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a>'; |
|
181 | 181 | } else { |
182 | - this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
182 | + this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | }; |
@@ -340,7 +340,7 @@ discard block |
||
340 | 340 | <?php |
341 | 341 | } else { |
342 | 342 | ?> |
343 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
343 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
344 | 344 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
345 | 345 | <?php |
346 | 346 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /* |
357 | 357 | shadowUrl: iconURLShadowpath, |
358 | 358 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
359 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
359 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
360 | 360 | */ |
361 | 361 | }) |
362 | 362 | }) |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | <?php |
383 | 383 | } else { |
384 | 384 | ?> |
385 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
385 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
386 | 386 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
387 | 387 | <?php |
388 | 388 | } |
@@ -422,7 +422,7 @@ discard block |
||
422 | 422 | <?php |
423 | 423 | } else { |
424 | 424 | ?> |
425 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
425 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
426 | 426 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
427 | 427 | <?php |
428 | 428 | } |
@@ -3,11 +3,18 @@ discard block |
||
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | 5 | // Compressed GeoJson is used if true |
6 | -if (!isset($globalJsonCompress)) $compress = true; |
|
7 | -else $compress = $globalJsonCompress; |
|
6 | +if (!isset($globalJsonCompress)) { |
|
7 | + $compress = true; |
|
8 | +} else { |
|
9 | + $compress = $globalJsonCompress; |
|
10 | +} |
|
8 | 11 | |
9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
12 | +if (isset($_GET['ident'])) { |
|
13 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
14 | +} |
|
15 | +if (isset($_GET['flightaware_id'])) { |
|
16 | + $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
17 | +} |
|
11 | 18 | ?> |
12 | 19 | |
13 | 20 | |
@@ -72,9 +79,12 @@ discard block |
||
72 | 79 | |
73 | 80 | function update_airportsLayer() { |
74 | 81 | <?php |
75 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
76 | - else $getZoom = '7'; |
|
77 | -?> |
|
82 | + if (isset($_COOKIE['AirportZoom'])) { |
|
83 | + $getZoom = $_COOKIE['AirportZoom']; |
|
84 | + } else { |
|
85 | + $getZoom = '7'; |
|
86 | + } |
|
87 | + ?> |
|
78 | 88 | if (typeof airportsLayer != 'undefined') { |
79 | 89 | if (map.hasLayer(airportsLayer) == true) { |
80 | 90 | map.removeLayer(airportsLayer); |
@@ -290,9 +300,13 @@ discard block |
||
290 | 300 | if (callsign != ""){ markerLabel += callsign; } |
291 | 301 | if (departure_airport_code != "" && arrival_airport_code != "" && departure_airport_code != "NA" && arrival_airport_code != "NA"){ markerLabel += ' ( '+departure_airport_code+' - '+arrival_airport_code+' )'; } |
292 | 302 | <?php |
293 | - if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
294 | - elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
295 | - else $IconColor = '1a3151'; |
|
303 | + if (isset($_COOKIE['IconColor'])) { |
|
304 | + $IconColor = $_COOKIE['IconColor']; |
|
305 | + } elseif (isset($globalAircraftIconColor)) { |
|
306 | + $IconColor = $globalAircraftIconColor; |
|
307 | + } else { |
|
308 | + $IconColor = '1a3151'; |
|
309 | + } |
|
296 | 310 | if (!isset($ident) && !isset($flightaware_id)) { |
297 | 311 | ?> |
298 | 312 | info_update(feature.properties.fc); |
@@ -340,7 +354,12 @@ discard block |
||
340 | 354 | <?php |
341 | 355 | } else { |
342 | 356 | ?> |
343 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
357 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
358 | + print $archiveupdatetime*1000; |
|
359 | +} else { |
|
360 | + print $globalMapRefresh*1000+20000; |
|
361 | +} |
|
362 | +?>+feature.properties.sqt*1000); |
|
344 | 363 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
345 | 364 | <?php |
346 | 365 | } |
@@ -382,7 +401,12 @@ discard block |
||
382 | 401 | <?php |
383 | 402 | } else { |
384 | 403 | ?> |
385 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
404 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
405 | + print $archiveupdatetime*1000; |
|
406 | +} else { |
|
407 | + print $globalMapRefresh*1000+20000; |
|
408 | +} |
|
409 | +?>+feature.properties.sqt*1000); |
|
386 | 410 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
387 | 411 | <?php |
388 | 412 | } |
@@ -422,7 +446,12 @@ discard block |
||
422 | 446 | <?php |
423 | 447 | } else { |
424 | 448 | ?> |
425 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
449 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
450 | + print $archiveupdatetime*1000; |
|
451 | +} else { |
|
452 | + print $globalMapRefresh*1000+20000; |
|
453 | +} |
|
454 | +?>+feature.properties.sqt*1000); |
|
426 | 455 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
427 | 456 | <?php |
428 | 457 | } |
@@ -759,13 +788,23 @@ discard block |
||
759 | 788 | if (isset($archive) && $archive) { |
760 | 789 | ?> |
761 | 790 | //then load it again every 30 seconds |
762 | - // var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
791 | + // var reload = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
792 | + print ($globalMapRefresh*1000)/2; |
|
793 | +} else { |
|
794 | + print '15000'; |
|
795 | +} |
|
796 | +?>); |
|
763 | 797 | reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php print $archiveupdatetime*1000; ?>); |
764 | 798 | <?php |
765 | 799 | } else { |
766 | 800 | ?> |
767 | 801 | //then load it again every 30 seconds |
768 | - reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
802 | + reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
803 | + print $globalMapRefresh*1000; |
|
804 | +} else { |
|
805 | + print '30000'; |
|
806 | +} |
|
807 | +?>); |
|
769 | 808 | var currentdate = new Date(); |
770 | 809 | var currentyear = new Date().getFullYear(); |
771 | 810 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -777,7 +816,12 @@ discard block |
||
777 | 816 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
778 | 817 | ?> |
779 | 818 | update_polarLayer(); |
780 | - setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
819 | + setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
820 | + print $globalMapRefresh*1000*2; |
|
821 | +} else { |
|
822 | + print '60000'; |
|
823 | +} |
|
824 | +?>); |
|
781 | 825 | <?php |
782 | 826 | } |
783 | 827 | ?> |
@@ -792,7 +836,12 @@ discard block |
||
792 | 836 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
793 | 837 | ?> |
794 | 838 | update_atcLayer(); |
795 | - setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
839 | + setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
840 | + print $globalMapRefresh*1000*2; |
|
841 | +} else { |
|
842 | + print '60000'; |
|
843 | +} |
|
844 | +?>); |
|
796 | 845 | <?php |
797 | 846 | } |
798 | 847 | ?> |
@@ -53,7 +53,12 @@ discard block |
||
53 | 53 | } else { |
54 | 54 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
55 | 55 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
56 | - if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
56 | + if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
57 | + print $globalMapRefresh*2000; |
|
58 | +} else { |
|
59 | + print '60000'; |
|
60 | +} |
|
61 | +?>)) { |
|
57 | 62 | viewer.dataSources.get(dsn).entities.remove(entity); |
58 | 63 | } else { |
59 | 64 | //console.log(parseInt(entity.lastupdate)+' > '+Math.floor(Date.now()-100)); |
@@ -127,7 +132,12 @@ discard block |
||
127 | 132 | function(){ |
128 | 133 | updateTrackerData(); |
129 | 134 | } |
130 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
135 | + ,<?php if (isset($globalMapRefresh)) { |
|
136 | + print $globalMapRefresh*1000; |
|
137 | +} else { |
|
138 | + print '30000'; |
|
139 | +} |
|
140 | +?>); |
|
131 | 141 | } else { |
132 | 142 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 143 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
@@ -131,5 +131,5 @@ |
||
131 | 131 | } else { |
132 | 132 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
133 | 133 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
134 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
134 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
135 | 135 | } |
@@ -516,8 +516,8 @@ discard block |
||
516 | 516 | } |
517 | 517 | } |
518 | 518 | <?php |
519 | - } else { |
|
520 | - ?> |
|
519 | + } else { |
|
520 | + ?> |
|
521 | 521 | if (map.getZoom() > 7) { |
522 | 522 | var style = { |
523 | 523 | "color": "#1a3151", |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | layer_marine_data.addLayer(layer); |
537 | 537 | } |
538 | 538 | <?php |
539 | - } |
|
539 | + } |
|
540 | 540 | ?> |
541 | 541 | } |
542 | 542 | } |
@@ -5,8 +5,11 @@ discard block |
||
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
9 | -else $compress = $globalJsonCompress; |
|
8 | +if (!isset($globalJsonCompress)) { |
|
9 | + $compress = true; |
|
10 | +} else { |
|
11 | + $compress = $globalJsonCompress; |
|
12 | +} |
|
10 | 13 | ?> |
11 | 14 | |
12 | 15 | |
@@ -142,9 +145,13 @@ discard block |
||
142 | 145 | if (callsign != ""){ markerMarineLabel += callsign; } |
143 | 146 | if (type != ""){ markerMarineLabel += ' - '+type; } |
144 | 147 | <?php |
145 | - if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
146 | - elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor; |
|
147 | - else $MarineIconColor = '1a3151'; |
|
148 | + if (isset($_COOKIE['MarineIconColor'])) { |
|
149 | + $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
150 | + } elseif (isset($globalMarineIconColor)) { |
|
151 | + $MarineIconColor = $globalMarineIconColor; |
|
152 | + } else { |
|
153 | + $MarineIconColor = '1a3151'; |
|
154 | + } |
|
148 | 155 | if (!isset($ident) && !isset($fammarine_id)) { |
149 | 156 | ?> |
150 | 157 | info_marine_update(feature.properties.fc); |
@@ -179,7 +186,12 @@ discard block |
||
179 | 186 | <?php |
180 | 187 | } else { |
181 | 188 | ?> |
182 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
189 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
190 | + print $archiveupdatetime*1000; |
|
191 | +} else { |
|
192 | + print $globalMapRefresh*1000+20000; |
|
193 | +} |
|
194 | +?>+feature.properties.sqt*1000); |
|
183 | 195 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
184 | 196 | <?php |
185 | 197 | } |
@@ -228,7 +240,12 @@ discard block |
||
228 | 240 | <?php |
229 | 241 | } else { |
230 | 242 | ?> |
231 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
243 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
244 | + print $archiveupdatetime*1000; |
|
245 | +} else { |
|
246 | + print $globalMapRefresh*1000+20000; |
|
247 | +} |
|
248 | +?>+feature.properties.sqt*1000); |
|
232 | 249 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
233 | 250 | <?php |
234 | 251 | } |
@@ -276,7 +293,12 @@ discard block |
||
276 | 293 | <?php |
277 | 294 | } else { |
278 | 295 | ?> |
279 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
296 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
297 | + print $archiveupdatetime*1000; |
|
298 | +} else { |
|
299 | + print $globalMapRefresh*1000+20000; |
|
300 | +} |
|
301 | +?>+feature.properties.sqt*1000); |
|
280 | 302 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
281 | 303 | <?php |
282 | 304 | } |
@@ -559,14 +581,24 @@ discard block |
||
559 | 581 | if (isset($archive) && $archive) { |
560 | 582 | ?> |
561 | 583 | //then load it again every 30 seconds |
562 | -// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
584 | +// var reload = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
585 | + print ($globalMapRefresh*1000)/2; |
|
586 | +} else { |
|
587 | + print '15000'; |
|
588 | +} |
|
589 | +?>); |
|
563 | 590 | reloadMarinePage = setInterval(function(){if (noTimeout) getLiveMarineData(0)},<?php print $archiveupdatetime*1000; ?>); |
564 | 591 | <?php |
565 | 592 | } else { |
566 | 593 | ?> |
567 | 594 | //then load it again every 30 seconds |
568 | 595 | reloadMarinePage = setInterval( |
569 | - function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
596 | + function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
597 | + print $globalMapRefresh*1000; |
|
598 | +} else { |
|
599 | + print '30000'; |
|
600 | +} |
|
601 | +?>); |
|
570 | 602 | <?php |
571 | 603 | } |
572 | 604 | ?> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | -setcookie("MapFormat",'2d'); |
|
5 | +setcookie("MapFormat", '2d'); |
|
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -16,10 +16,10 @@ discard block |
||
16 | 16 | |
17 | 17 | <?php |
18 | 18 | if (isset($_GET['fammarine_id'])) { |
19 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
19 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
20 | 20 | } |
21 | 21 | if (isset($_GET['ident'])) { |
22 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
22 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
23 | 23 | } |
24 | 24 | if (!isset($ident) && !isset($fammarine_id)) { |
25 | 25 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | <?php |
183 | 183 | } else { |
184 | 184 | ?> |
185 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
185 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
186 | 186 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
187 | 187 | <?php |
188 | 188 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | /* |
199 | 199 | shadowUrl: iconURLShadowpath, |
200 | 200 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
201 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
201 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
202 | 202 | */ |
203 | 203 | }) |
204 | 204 | }) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | <?php |
232 | 232 | } else { |
233 | 233 | ?> |
234 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
234 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
235 | 235 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
236 | 236 | <?php |
237 | 237 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | <?php |
280 | 280 | } else { |
281 | 281 | ?> |
282 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
282 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
283 | 283 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
284 | 284 | <?php |
285 | 285 | } |
@@ -517,8 +517,8 @@ discard block |
||
517 | 517 | } |
518 | 518 | } |
519 | 519 | <?php |
520 | - } else { |
|
521 | - ?> |
|
520 | + } else { |
|
521 | + ?> |
|
522 | 522 | if (map.getZoom() > 7) { |
523 | 523 | var style = { |
524 | 524 | "color": "#1a3151", |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | layer_tracker_data.addLayer(layer); |
538 | 538 | } |
539 | 539 | <?php |
540 | - } |
|
540 | + } |
|
541 | 541 | ?> |
542 | 542 | } |
543 | 543 | } |
@@ -5,8 +5,11 @@ discard block |
||
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
9 | -else $compress = $globalJsonCompress; |
|
8 | +if (!isset($globalJsonCompress)) { |
|
9 | + $compress = true; |
|
10 | +} else { |
|
11 | + $compress = $globalJsonCompress; |
|
12 | +} |
|
10 | 13 | ?> |
11 | 14 | |
12 | 15 | |
@@ -143,9 +146,13 @@ discard block |
||
143 | 146 | if (callsign != ""){ markerTrackerLabel += callsign; } |
144 | 147 | if (type != ""){ markerTrackerLabel += ' - '+type; } |
145 | 148 | <?php |
146 | - if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
147 | - elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
148 | - else $IconColor = '1a3151'; |
|
149 | + if (isset($_COOKIE['IconColor'])) { |
|
150 | + $IconColor = $_COOKIE['IconColor']; |
|
151 | + } elseif (isset($globalAircraftIconColor)) { |
|
152 | + $IconColor = $globalAircraftIconColor; |
|
153 | + } else { |
|
154 | + $IconColor = '1a3151'; |
|
155 | + } |
|
149 | 156 | if (!isset($ident) && !isset($famtrackid)) { |
150 | 157 | ?> |
151 | 158 | info_tracker_update(feature.properties.fc); |
@@ -179,7 +186,12 @@ discard block |
||
179 | 186 | <?php |
180 | 187 | } else { |
181 | 188 | ?> |
182 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
189 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
190 | + print $archiveupdatetime*1000; |
|
191 | +} else { |
|
192 | + print $globalMapRefresh*1000+20000; |
|
193 | +} |
|
194 | +?>+feature.properties.sqt*1000); |
|
183 | 195 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
184 | 196 | <?php |
185 | 197 | } |
@@ -228,7 +240,12 @@ discard block |
||
228 | 240 | <?php |
229 | 241 | } else { |
230 | 242 | ?> |
231 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
243 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
244 | + print $archiveupdatetime*1000; |
|
245 | +} else { |
|
246 | + print $globalMapRefresh*1000+20000; |
|
247 | +} |
|
248 | +?>+feature.properties.sqt*1000); |
|
232 | 249 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
233 | 250 | <?php |
234 | 251 | } |
@@ -276,7 +293,12 @@ discard block |
||
276 | 293 | <?php |
277 | 294 | } else { |
278 | 295 | ?> |
279 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
296 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
297 | + print $archiveupdatetime*1000; |
|
298 | +} else { |
|
299 | + print $globalMapRefresh*1000+20000; |
|
300 | +} |
|
301 | +?>+feature.properties.sqt*1000); |
|
280 | 302 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
281 | 303 | <?php |
282 | 304 | } |
@@ -559,14 +581,24 @@ discard block |
||
559 | 581 | if (isset($archive) && $archive) { |
560 | 582 | ?> |
561 | 583 | //then load it again every 30 seconds |
562 | -// var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print ($globalMapRefresh*1000)/2; else print '15000'; ?>); |
|
584 | +// var reload = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { |
|
585 | + print ($globalMapRefresh*1000)/2; |
|
586 | +} else { |
|
587 | + print '15000'; |
|
588 | +} |
|
589 | +?>); |
|
563 | 590 | reloadTrackerPage = setInterval(function(){if (noTimeout) getLiveTrackerData(0)},<?php print $archiveupdatetime*1000; ?>); |
564 | 591 | <?php |
565 | 592 | } else { |
566 | 593 | ?> |
567 | 594 | //then load it again every 30 seconds |
568 | 595 | reloadTrackerPage = setInterval( |
569 | - function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
596 | + function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { |
|
597 | + print $globalMapRefresh*1000; |
|
598 | +} else { |
|
599 | + print '30000'; |
|
600 | +} |
|
601 | +?>); |
|
570 | 602 | <?php |
571 | 603 | } |
572 | 604 | ?> |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | -setcookie("MapFormat",'2d'); |
|
5 | +setcookie("MapFormat", '2d'); |
|
6 | 6 | |
7 | 7 | // Compressed GeoJson is used if true |
8 | 8 | if (!isset($globalJsonCompress)) $compress = true; |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | |
18 | 18 | <?php |
19 | 19 | if (isset($_GET['famtrackid'])) { |
20 | - $famtrackid = filter_input(INPUT_GET,'famtrackid',FILTER_SANITIZE_STRING); |
|
20 | + $famtrackid = filter_input(INPUT_GET, 'famtrackid', FILTER_SANITIZE_STRING); |
|
21 | 21 | } |
22 | 22 | if (isset($_GET['ident'])) { |
23 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
23 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
24 | 24 | } |
25 | 25 | if (!isset($ident) && !isset($famtrackid)) { |
26 | 26 | ?> |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | <?php |
183 | 183 | } else { |
184 | 184 | ?> |
185 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
185 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
186 | 186 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
187 | 187 | <?php |
188 | 188 | } |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | /* |
199 | 199 | shadowUrl: iconURLShadowpath, |
200 | 200 | shadowSize: [<?php print $globalAircraftSize; ?>, <?php print $globalAircraftSize; ?>], |
201 | - shadowAnchor: [<?php print ($globalAircraftSize/2)+1; ?>, <?php print $globalAircraftSize; ?>] |
|
201 | + shadowAnchor: [<?php print ($globalAircraftSize/2) + 1; ?>, <?php print $globalAircraftSize; ?>] |
|
202 | 202 | */ |
203 | 203 | }) |
204 | 204 | }) |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | <?php |
232 | 232 | } else { |
233 | 233 | ?> |
234 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
234 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
235 | 235 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
236 | 236 | <?php |
237 | 237 | } |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | <?php |
280 | 280 | } else { |
281 | 281 | ?> |
282 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
282 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000 + 20000; ?>+feature.properties.sqt*1000); |
|
283 | 283 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
284 | 284 | <?php |
285 | 285 | } |
@@ -662,9 +662,9 @@ |
||
662 | 662 | // var timeline = new Cesium.Timeline(viewer); |
663 | 663 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
664 | 664 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
665 | - //this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
666 | - $(".archivebox").html('<h4><?php echo str_replace("'","\'",_("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
667 | - // this._div.innerHTML = '<h4><?php echo str_replace("'","\'",_("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
665 | + //this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b>' + props.archive_date + ' UTC </b>' + '<br/><i class="fa fa-fast-backward" aria-hidden="true"></i> <i class="fa fa-backward" aria-hidden="true"></i> <a href="#" onClick="archivePause();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="archivePlay();"><i class="fa fa-play" aria-hidden="true"></i></a> <i class="fa fa-forward" aria-hidden="true"></i> <i class="fa fa-fast-forward" aria-hidden="true"></i>'; |
|
666 | + $(".archivebox").html('<h4><?php echo str_replace("'", "\'", _("Archive")); ?></h4>' + '<br/><form id="noarchive" method="post"><input type="hidden" name="noarchive" /></form><a href="#" onClick="animationViewModel.playReverseViewModel.command();"><i class="fa fa-play fa-flip-horizontal" aria-hidden="true"></i></a> <a href="#" onClick="'+"document.getElementById('noarchive').submit();"+'"><i class="fa fa-eject" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.pauseViewModel.command();"><i class="fa fa-pause" aria-hidden="true"></i></a> <a href="#" onClick="animationViewModel.playForwardViewModel.command();"><i class="fa fa-play" aria-hidden="true"></i></a>'); |
|
667 | + // this._div.innerHTML = '<h4><?php echo str_replace("'", "\'", _("Archive Date & Time")); ?></h4>' + '<b><i class="fa fa-spinner fa-pulse fa-2x fa-fw margin-bottom"></i></b>'; |
|
668 | 668 | |
669 | 669 | } |
670 | 670 |
@@ -720,12 +720,12 @@ |
||
720 | 720 | update_airportsLayer(); |
721 | 721 | } |
722 | 722 | <?php |
723 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
|
723 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
|
724 | 724 | ?> |
725 | 725 | update_atcLayer(); |
726 | 726 | setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
727 | 727 | <?php |
728 | - } |
|
728 | + } |
|
729 | 729 | ?> |
730 | 730 | |
731 | 731 | function iconColor(color) { |
@@ -202,7 +202,12 @@ discard block |
||
202 | 202 | // viewer.dataSources.get(dsn).entities.remove(entity); |
203 | 203 | // } |
204 | 204 | //console.log(entity.lastupdate); |
205 | - if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
205 | + if (parseInt(entity.lastupdate) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
206 | + print $globalMapRefresh*2000; |
|
207 | +} else { |
|
208 | + print '60000'; |
|
209 | +} |
|
210 | +?>)) { |
|
206 | 211 | // console.log('Remove an entity date'); |
207 | 212 | viewer.dataSources.get(dsn).entities.remove(entity); |
208 | 213 | } else { |
@@ -276,7 +281,12 @@ discard block |
||
276 | 281 | } else { |
277 | 282 | for (var i = 0; i < viewer.dataSources.get(dsn).entities.values.length; i++) { |
278 | 283 | var entity = viewer.dataSources.get(dsn).entities.values[i]; |
279 | - if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
284 | + if (parseInt(entity.lastupdatesat) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
285 | + print $globalMapRefresh*2000; |
|
286 | +} else { |
|
287 | + print '60000'; |
|
288 | +} |
|
289 | +?>)) { |
|
280 | 290 | viewer.dataSources.get(dsn).entities.remove(entity); |
281 | 291 | } |
282 | 292 | } |
@@ -606,7 +616,12 @@ discard block |
||
606 | 616 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
607 | 617 | ?> |
608 | 618 | update_polarLayer(); |
609 | -setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
619 | +setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
620 | + print $globalMapRefresh*1000*2; |
|
621 | +} else { |
|
622 | + print '60000'; |
|
623 | +} |
|
624 | +?>); |
|
610 | 625 | <?php |
611 | 626 | } |
612 | 627 | ?> |
@@ -704,7 +719,12 @@ discard block |
||
704 | 719 | } |
705 | 720 | } |
706 | 721 | } |
707 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
722 | + ,<?php if (isset($globalMapRefresh)) { |
|
723 | + print $globalMapRefresh*1000; |
|
724 | +} else { |
|
725 | + print '30000'; |
|
726 | +} |
|
727 | +?>); |
|
708 | 728 | } else { |
709 | 729 | //var widget = new Cesium.CesiumWidget('archivebox'); |
710 | 730 | // var timeline = new Cesium.Timeline(viewer); |
@@ -723,7 +743,12 @@ discard block |
||
723 | 743 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
724 | 744 | ?> |
725 | 745 | update_atcLayer(); |
726 | -setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
746 | +setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
747 | + print $globalMapRefresh*1000*2; |
|
748 | +} else { |
|
749 | + print '60000'; |
|
750 | +} |
|
751 | +?>); |
|
727 | 752 | <?php |
728 | 753 | } |
729 | 754 | ?> |
@@ -352,10 +352,10 @@ discard block |
||
352 | 352 | }); |
353 | 353 | update_locationsLayer(); |
354 | 354 | <?php |
355 | - // Add support for custom json via $globalMapJson |
|
356 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
355 | + // Add support for custom json via $globalMapJson |
|
356 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
357 | 357 | foreach ($globalMapJson as $json) { |
358 | - if (isset($json['url'])) { |
|
358 | + if (isset($json['url'])) { |
|
359 | 359 | ?> |
360 | 360 | update_genLayer('<?php print $json['url']; ?>'); |
361 | 361 | <?php |
@@ -364,9 +364,9 @@ discard block |
||
364 | 364 | setInterval(function(){update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
365 | 365 | <?php |
366 | 366 | } |
367 | - } |
|
367 | + } |
|
368 | + } |
|
368 | 369 | } |
369 | - } |
|
370 | 370 | |
371 | 371 | ?> |
372 | 372 | //adds the bootstrap tooltip to the map icons |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | require_once('../require/settings.php'); |
3 | 3 | require_once('../require/class.Language.php'); |
4 | 4 | |
5 | -setcookie("MapFormat",'2d'); |
|
5 | +setcookie("MapFormat", '2d'); |
|
6 | 6 | |
7 | 7 | if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
8 | 8 | // Compressed GeoJson is used if true |
@@ -20,10 +20,10 @@ discard block |
||
20 | 20 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | 21 | if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
22 | 22 | else $enddate = time(); |
23 | - setcookie("archive_begin",$begindate); |
|
24 | - setcookie("archive_end",$enddate); |
|
25 | - setcookie("archive_update",$lastupd); |
|
26 | - setcookie("archive_speed",$archivespeed); |
|
23 | + setcookie("archive_begin", $begindate); |
|
24 | + setcookie("archive_end", $enddate); |
|
25 | + setcookie("archive_update", $lastupd); |
|
26 | + setcookie("archive_speed", $archivespeed); |
|
27 | 27 | ?> |
28 | 28 | document.cookie = 'archive_begin=<?php print $begindate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
29 | 29 | document.cookie = 'archive_end=<?php print $enddate; ?>; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/'; |
@@ -74,16 +74,16 @@ discard block |
||
74 | 74 | <?php |
75 | 75 | } |
76 | 76 | if (isset($_GET['ident'])) { |
77 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
77 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
78 | 78 | } |
79 | 79 | if (isset($_GET['flightaware_id'])) { |
80 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
80 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
81 | 81 | } |
82 | 82 | if (isset($_GET['latitude'])) { |
83 | - $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_STRING); |
|
83 | + $latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_STRING); |
|
84 | 84 | } |
85 | 85 | if (isset($_GET['longitude'])) { |
86 | - $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_STRING); |
|
86 | + $longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_STRING); |
|
87 | 87 | } |
88 | 88 | ?> |
89 | 89 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | || navigator.userAgent.match(/BlackBerry/i) |
120 | 120 | || navigator.userAgent.match(/Windows Phone/i)) |
121 | 121 | { |
122 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
122 | + var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom - 1; else print '8'; ?>; |
|
123 | 123 | } else { |
124 | 124 | var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
125 | 125 | } |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | map.addLayer(yandexLayer); |
214 | 214 | <?php |
215 | 215 | } elseif ($MapType == 'Bing-Aerial') { |
216 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
216 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
217 | 217 | ?> |
218 | 218 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
219 | 219 | map.addLayer(bingLayer); |
220 | 220 | <?php |
221 | 221 | } elseif ($MapType == 'Bing-Hybrid') { |
222 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
222 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
223 | 223 | ?> |
224 | 224 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
225 | 225 | map.addLayer(bingLayer); |
226 | 226 | <?php |
227 | 227 | } elseif ($MapType == 'Bing-Road') { |
228 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
228 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType', 'OpenStreetMap'); |
|
229 | 229 | ?> |
230 | 230 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
231 | 231 | map.addLayer(bingLayer); |
@@ -4,10 +4,15 @@ discard block |
||
4 | 4 | |
5 | 5 | setcookie("MapFormat",'2d'); |
6 | 6 | |
7 | -if (!isset($globalOpenWeatherMapKey)) $globalOpenWeatherMapKey = ''; |
|
7 | +if (!isset($globalOpenWeatherMapKey)) { |
|
8 | + $globalOpenWeatherMapKey = ''; |
|
9 | +} |
|
8 | 10 | // Compressed GeoJson is used if true |
9 | -if (!isset($globalJsonCompress)) $compress = true; |
|
10 | -else $compress = $globalJsonCompress; |
|
11 | +if (!isset($globalJsonCompress)) { |
|
12 | + $compress = true; |
|
13 | +} else { |
|
14 | + $compress = $globalJsonCompress; |
|
15 | +} |
|
11 | 16 | if (isset($_GET['archive'])) { |
12 | 17 | $archive = true; |
13 | 18 | //$archiveupdatetime = 50; |
@@ -18,8 +23,11 @@ discard block |
||
18 | 23 | //$lastupd = round(($_GET['enddate']-$_GET['begindate'])/(($_GET['during']*60)/10)); |
19 | 24 | //$lastupd = 20; |
20 | 25 | $lastupd = $_GET['archivespeed']*$archiveupdatetime; |
21 | - if (isset($_GET['enddate']) && $_GET['enddate'] != '') $enddate = $_GET['enddate']; |
|
22 | - else $enddate = time(); |
|
26 | + if (isset($_GET['enddate']) && $_GET['enddate'] != '') { |
|
27 | + $enddate = $_GET['enddate']; |
|
28 | + } else { |
|
29 | + $enddate = time(); |
|
30 | + } |
|
23 | 31 | setcookie("archive_begin",$begindate); |
24 | 32 | setcookie("archive_end",$enddate); |
25 | 33 | setcookie("archive_update",$lastupd); |
@@ -106,7 +114,17 @@ discard block |
||
106 | 114 | } |
107 | 115 | |
108 | 116 | //create the map |
109 | - map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) print $latitude; else print $globalCenterLatitude; ?>,<?php if (isset($longitude)) print $longitude; else print $globalCenterLongitude; ?>], zoom); |
|
117 | + map = L.map('archive-map', { zoomControl:false }).setView([<?php if (isset($latitude)) { |
|
118 | + print $latitude; |
|
119 | +} else { |
|
120 | + print $globalCenterLatitude; |
|
121 | +} |
|
122 | +?>,<?php if (isset($longitude)) { |
|
123 | + print $longitude; |
|
124 | +} else { |
|
125 | + print $globalCenterLongitude; |
|
126 | +} |
|
127 | +?>], zoom); |
|
110 | 128 | <?php |
111 | 129 | } else { |
112 | 130 | ?> |
@@ -119,9 +137,19 @@ discard block |
||
119 | 137 | || navigator.userAgent.match(/BlackBerry/i) |
120 | 138 | || navigator.userAgent.match(/Windows Phone/i)) |
121 | 139 | { |
122 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom-1; else print '8'; ?>; |
|
140 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
141 | + print $globalLiveZoom-1; |
|
142 | +} else { |
|
143 | + print '8'; |
|
144 | +} |
|
145 | +?>; |
|
123 | 146 | } else { |
124 | - var zoom = <?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>; |
|
147 | + var zoom = <?php if (isset($globalLiveZoom)) { |
|
148 | + print $globalLiveZoom; |
|
149 | +} else { |
|
150 | + print '9'; |
|
151 | +} |
|
152 | +?>; |
|
125 | 153 | } |
126 | 154 | |
127 | 155 | //create the map |
@@ -146,16 +174,27 @@ discard block |
||
146 | 174 | bounds = L.latLngBounds(southWest,northEast); |
147 | 175 | //a few title layers |
148 | 176 | <?php |
149 | - if (isset($_COOKIE['MapType'])) $MapType = $_COOKIE['MapType']; |
|
150 | - else $MapType = $globalMapProvider; |
|
177 | + if (isset($_COOKIE['MapType'])) { |
|
178 | + $MapType = $_COOKIE['MapType']; |
|
179 | + } else { |
|
180 | + $MapType = $globalMapProvider; |
|
181 | + } |
|
151 | 182 | |
152 | 183 | if ($MapType == 'Mapbox') { |
153 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
154 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
155 | -?> |
|
184 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
185 | + $MapBoxId = $globalMapboxId; |
|
186 | + } else { |
|
187 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
188 | + } |
|
189 | + ?> |
|
156 | 190 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
157 | 191 | maxZoom: 18, |
158 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
192 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
193 | + print 'false'; |
|
194 | +} else { |
|
195 | + print 'true'; |
|
196 | +} |
|
197 | +?>, |
|
159 | 198 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
160 | 199 | '<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' + |
161 | 200 | 'Imagery © <a href="http://mapbox.com">Mapbox</a>', |
@@ -167,7 +206,12 @@ discard block |
||
167 | 206 | ?> |
168 | 207 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
169 | 208 | maxZoom: 18, |
170 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
209 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
210 | + print 'false'; |
|
211 | +} else { |
|
212 | + print 'true'; |
|
213 | +} |
|
214 | +?>, |
|
171 | 215 | attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' + |
172 | 216 | '<a href="www.openstreetmap.org/copyright">Open Database Licence</a>' |
173 | 217 | }).addTo(map); |
@@ -213,20 +257,26 @@ discard block |
||
213 | 257 | map.addLayer(yandexLayer); |
214 | 258 | <?php |
215 | 259 | } elseif ($MapType == 'Bing-Aerial') { |
216 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
217 | -?> |
|
260 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
261 | + setcookie('MapType','OpenStreetMap'); |
|
262 | + } |
|
263 | + ?> |
|
218 | 264 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Aerial'}); |
219 | 265 | map.addLayer(bingLayer); |
220 | 266 | <?php |
221 | 267 | } elseif ($MapType == 'Bing-Hybrid') { |
222 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
223 | -?> |
|
268 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
269 | + setcookie('MapType','OpenStreetMap'); |
|
270 | + } |
|
271 | + ?> |
|
224 | 272 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'AerialWithLabels'}); |
225 | 273 | map.addLayer(bingLayer); |
226 | 274 | <?php |
227 | 275 | } elseif ($MapType == 'Bing-Road') { |
228 | - if (!isset($globalBingMapKey) || $globalBingMapKey == '') setcookie('MapType','OpenStreetMap'); |
|
229 | -?> |
|
276 | + if (!isset($globalBingMapKey) || $globalBingMapKey == '') { |
|
277 | + setcookie('MapType','OpenStreetMap'); |
|
278 | + } |
|
279 | + ?> |
|
230 | 280 | var bingLayer = new L.tileLayer.bing({bingMapsKey: '<?php print $globalBingMapKey; ?>',imagerySet: 'Road'}); |
231 | 281 | map.addLayer(bingLayer); |
232 | 282 | <?php |
@@ -249,9 +299,24 @@ discard block |
||
249 | 299 | $customid = $MapType; |
250 | 300 | ?> |
251 | 301 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
252 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
253 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
254 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
302 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
303 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
304 | +} else { |
|
305 | + print '18'; |
|
306 | +} |
|
307 | +?>, |
|
308 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
309 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
310 | +} else { |
|
311 | + print '0'; |
|
312 | +} |
|
313 | +?>, |
|
314 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
315 | + print 'false'; |
|
316 | +} else { |
|
317 | + print 'true'; |
|
318 | +} |
|
319 | +?>, |
|
255 | 320 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
256 | 321 | }).addTo(map); |
257 | 322 | |
@@ -285,7 +350,12 @@ discard block |
||
285 | 350 | } |
286 | 351 | } elseif ($globalBounding == 'circle') { |
287 | 352 | ?> |
288 | - var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) print $globalBoundingCircleSize; else print '70000'; ?>,{ |
|
353 | + var circle = L.circle([<?php print $globalCenterLatitude; ?>, <?php print $globalCenterLongitude; ?>],<?php if (isset($globalBoundingCircleSize)) { |
|
354 | + print $globalBoundingCircleSize; |
|
355 | +} else { |
|
356 | + print '70000'; |
|
357 | +} |
|
358 | +?>,{ |
|
289 | 359 | color: '#92C7D1', |
290 | 360 | fillColor: '#92C7D1', |
291 | 361 | fillOpacity: 0.3, |
@@ -9,11 +9,11 @@ discard block |
||
9 | 9 | |
10 | 10 | $from_archive = false; |
11 | 11 | if (isset($_GET['ident'])) { |
12 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
13 | 13 | if (isset($_GET['currenttime'])) { |
14 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
14 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | $currenttime = round($currenttime/1000); |
16 | - $spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident,$currenttime); |
|
16 | + $spotter_array = $MarineLive->getDateLiveMarineDataByIdent($ident, $currenttime); |
|
17 | 17 | /* |
18 | 18 | if (empty($spotter_array)) { |
19 | 19 | $from_archive = true; |
@@ -31,11 +31,11 @@ discard block |
||
31 | 31 | } |
32 | 32 | } |
33 | 33 | if (isset($_GET['fammarine_id'])) { |
34 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
34 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
35 | 35 | if (isset($_GET['currenttime'])) { |
36 | - $currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
36 | + $currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
37 | 37 | $currenttime = round($currenttime/1000); |
38 | - $spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id,$currenttime); |
|
38 | + $spotter_array = $MarineLive->getDateLiveMarineDataById($fammarine_id, $currenttime); |
|
39 | 39 | /* |
40 | 40 | if (empty($spotter_array)) { |
41 | 41 | $from_archive = true; |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | if (isset($spotter_item['image_thumbnail']) && $spotter_item['image_thumbnail'] != "") |
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | - $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
65 | + $image = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
66 | 66 | } else $image = $spotter_item['image_thumbnail']; |
67 | 67 | |
68 | 68 | } |
@@ -63,7 +63,9 @@ |
||
63 | 63 | { |
64 | 64 | if ($spotter_item['image_source'] == 'flickr' || $spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart') { |
65 | 65 | $image = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
66 | - } else $image = $spotter_item['image_thumbnail']; |
|
66 | + } else { |
|
67 | + $image = $spotter_item['image_thumbnail']; |
|
68 | + } |
|
67 | 69 | |
68 | 70 | } |
69 | 71 | /* else { |