@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | <p> |
189 | 189 | <label for="siteurl">Site directory</label> |
190 | 190 | <?php |
191 | - // Try to detect site directory |
|
192 | - if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
191 | + // Try to detect site directory |
|
192 | + if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
193 | 193 | if (isset($_SERVER['REQUEST_URI'])) { |
194 | 194 | $URL = $_SERVER['REQUEST_URI']; |
195 | 195 | $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
196 | 196 | } |
197 | - } |
|
197 | + } |
|
198 | 198 | ?> |
199 | 199 | <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
200 | 200 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | </tr> |
374 | 374 | |
375 | 375 | <?php |
376 | - if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
376 | + if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
377 | 377 | ?> |
378 | 378 | <!-- |
379 | 379 | <?php |
380 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | - $Connection = new Connection(); |
|
380 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | + $Connection = new Connection(); |
|
382 | 382 | ?> |
383 | 383 | --> |
384 | 384 | <?php |
385 | 385 | if ($Connection->db != NULL) { |
386 | - if ($Connection->tableExists('source_location')) { |
|
386 | + if ($Connection->tableExists('source_location')) { |
|
387 | 387 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
388 | 388 | $Source = new Source(); |
389 | 389 | //$alllocations = $Source->getAllLocationInfo(); |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | |
404 | 404 | <?php |
405 | 405 | } |
406 | - } |
|
406 | + } |
|
407 | + } |
|
407 | 408 | } |
408 | - } |
|
409 | 409 | ?> |
410 | 410 | |
411 | 411 | <tr> |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | ?> |
516 | 516 | <tr> |
517 | 517 | <?php |
518 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
518 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
519 | 519 | ?> |
520 | 520 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
521 | 521 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
522 | 522 | <?php |
523 | - } else { |
|
523 | + } else { |
|
524 | 524 | $hostport = explode(':',$source['host']); |
525 | 525 | if (isset($hostport[1])) { |
526 | 526 | $host = $hostport[0]; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
534 | 534 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td> |
535 | 535 | <?php |
536 | - } |
|
536 | + } |
|
537 | 537 | ?> |
538 | 538 | <td> |
539 | 539 | <select name="format[]" id="format"> |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | </thead> |
674 | 674 | <tbody> |
675 | 675 | <?php |
676 | - if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
676 | + if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
677 | 677 | foreach ($globalNewsFeeds as $type => $feedslng) { |
678 | - foreach ($feedslng as $lng => $feeds) { |
|
678 | + foreach ($feedslng as $lng => $feeds) { |
|
679 | 679 | foreach ($feeds as $feed) { |
680 | 680 | ?> |
681 | 681 | <tr> |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | |
701 | 701 | <?php |
702 | 702 | } |
703 | - } |
|
703 | + } |
|
704 | + } |
|
704 | 705 | } |
705 | - } |
|
706 | 706 | ?> |
707 | 707 | <tr> |
708 | 708 | <td><input type="url" name="newsurl[]" /></td> |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | <br /> |
1093 | 1093 | <p> |
1094 | 1094 | <?php |
1095 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1095 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1096 | 1096 | ?> |
1097 | 1097 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1098 | 1098 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
1103 | 1103 | <?php |
1104 | 1104 | } |
1105 | - } else { |
|
1105 | + } else { |
|
1106 | 1106 | ?> |
1107 | 1107 | <b>PHP GD is not installed, you can't change color of aircraft icon on map</b> |
1108 | 1108 | <?php |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | ?> |
1111 | 1111 | </p> |
1112 | 1112 | <br /> |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | </p> |
1131 | 1131 | <?php |
1132 | 1132 | require('../footer.php'); |
1133 | - exit; |
|
1133 | + exit; |
|
1134 | 1134 | } |
1135 | 1135 | // ' |
1136 | 1136 | $settings = array(); |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $sources = array(); |
1223 | 1223 | foreach ($source_name as $keys => $name) { |
1224 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1225 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1224 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1225 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1226 | 1226 | } |
1227 | 1227 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1228 | 1228 | |
@@ -1232,13 +1232,13 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $newsfeeds = array(); |
1234 | 1234 | foreach($newsurl as $newskey => $url) { |
1235 | - if ($url != '') { |
|
1235 | + if ($url != '') { |
|
1236 | 1236 | $type = $newstype[$newskey]; |
1237 | 1237 | $lng = $newslng[$newskey]; |
1238 | 1238 | if (isset($newsfeeds[$type][$lng])) { |
1239 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1239 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1240 | 1240 | } else $newsfeeds[$type][$lng] = array($url); |
1241 | - } |
|
1241 | + } |
|
1242 | 1242 | } |
1243 | 1243 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
1244 | 1244 | |
@@ -1681,14 +1681,14 @@ discard block |
||
1681 | 1681 | |
1682 | 1682 | // Set some defaults values... |
1683 | 1683 | if (!isset($globalAircraftImageSources)) { |
1684 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1684 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | if (!isset($globalSchedulesSources)) { |
1689 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | - } |
|
1689 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1694 | 1694 | |
@@ -1736,21 +1736,21 @@ discard block |
||
1736 | 1736 | $popi = false; |
1737 | 1737 | $popw = false; |
1738 | 1738 | foreach ($_SESSION['done'] as $done) { |
1739 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | - if ($done == 'Create database') $pop = true; |
|
1741 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1739 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | + if ($done == 'Create database') $pop = true; |
|
1741 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1744 | 1744 | } |
1745 | 1745 | if ($pop) { |
1746 | - sleep(5); |
|
1747 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1746 | + sleep(5); |
|
1747 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1748 | 1748 | } else if ($popi) { |
1749 | - sleep(5); |
|
1750 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1749 | + sleep(5); |
|
1750 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1751 | 1751 | } else if ($popw) { |
1752 | - sleep(5); |
|
1753 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1752 | + sleep(5); |
|
1753 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1754 | 1754 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1755 | 1755 | print '</div></ul>'; |
1756 | 1756 | print '<div id="error"></div>'; |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | unset($_COOKIE['install']); |
1817 | 1817 | print '<div class="info column"><ul>'; |
1818 | 1818 | foreach ($_SESSION['done'] as $done) { |
1819 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1819 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1820 | 1820 | } |
1821 | 1821 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1822 | 1822 | print '</ul></div>'; |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | require_once(dirname(__FILE__).'/class.Source.php'); |
8 | 8 | |
9 | 9 | class TrackerImport { |
10 | - private $all_tracked = array(); |
|
11 | - private $last_delete_hourly = 0; |
|
12 | - private $last_delete = 0; |
|
13 | - private $stats = array(); |
|
14 | - private $tmd = 0; |
|
15 | - private $source_location = array(); |
|
16 | - public $db = null; |
|
17 | - public $nb = 0; |
|
10 | + private $all_tracked = array(); |
|
11 | + private $last_delete_hourly = 0; |
|
12 | + private $last_delete = 0; |
|
13 | + private $stats = array(); |
|
14 | + private $tmd = 0; |
|
15 | + private $source_location = array(); |
|
16 | + public $db = null; |
|
17 | + public $nb = 0; |
|
18 | 18 | |
19 | - public function __construct($dbc = null) { |
|
19 | + public function __construct($dbc = null) { |
|
20 | 20 | global $globalBeta; |
21 | 21 | $Connection = new Connection($dbc); |
22 | 22 | $this->db = $Connection->db(); |
@@ -38,50 +38,50 @@ discard block |
||
38 | 38 | } |
39 | 39 | } |
40 | 40 | */ |
41 | - } |
|
41 | + } |
|
42 | 42 | |
43 | - public function checkAll() { |
|
43 | + public function checkAll() { |
|
44 | 44 | global $globalDebug; |
45 | 45 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
46 | 46 | foreach ($this->all_tracked as $key => $flight) { |
47 | - if (isset($this->all_tracked[$key]['id'])) { |
|
47 | + if (isset($this->all_tracked[$key]['id'])) { |
|
48 | 48 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
49 | - $Tracker = new Tracker($this->db); |
|
50 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | - } |
|
49 | + $Tracker = new Tracker($this->db); |
|
50 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
51 | + } |
|
52 | + } |
|
52 | 53 | } |
53 | - } |
|
54 | 54 | |
55 | - public function del() { |
|
55 | + public function del() { |
|
56 | 56 | global $globalDebug; |
57 | 57 | // Delete old infos |
58 | 58 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
59 | 59 | foreach ($this->all_tracked as $key => $flight) { |
60 | - if (isset($flight['lastupdate'])) { |
|
61 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | - if (isset($this->all_tracked[$key]['id'])) { |
|
63 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
60 | + if (isset($flight['lastupdate'])) { |
|
61 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
62 | + if (isset($this->all_tracked[$key]['id'])) { |
|
63 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
64 | 64 | /* |
65 | 65 | $TrackerLive = new TrackerLive(); |
66 | 66 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
67 | 67 | $TrackerLive->db = null; |
68 | 68 | */ |
69 | - //$real_arrival = $this->arrival($key); |
|
70 | - $Tracker = new Tracker($this->db); |
|
71 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
69 | + //$real_arrival = $this->arrival($key); |
|
70 | + $Tracker = new Tracker($this->db); |
|
71 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
72 | 72 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
73 | 73 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
74 | 74 | } |
75 | 75 | // Put in archive |
76 | 76 | // $Tracker->db = null; |
77 | - } |
|
78 | - unset($this->all_tracked[$key]); |
|
79 | - } |
|
80 | - } |
|
81 | - } |
|
82 | - } |
|
77 | + } |
|
78 | + unset($this->all_tracked[$key]); |
|
79 | + } |
|
80 | + } |
|
81 | + } |
|
82 | + } |
|
83 | 83 | |
84 | - public function add($line) { |
|
84 | + public function add($line) { |
|
85 | 85 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChangeTracker, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
86 | 86 | if (!isset($globalCoordMinChangeTracker) || $globalCoordMinChangeTracker == '') $globalCoordMinChangeTracker = '0.015'; |
87 | 87 | date_default_timezone_set('UTC'); |
@@ -90,47 +90,47 @@ discard block |
||
90 | 90 | |
91 | 91 | // SBS format is CSV format |
92 | 92 | if(is_array($line) && isset($line['ident'])) { |
93 | - //print_r($line); |
|
94 | - if (isset($line['ident'])) { |
|
93 | + //print_r($line); |
|
94 | + if (isset($line['ident'])) { |
|
95 | 95 | |
96 | 96 | |
97 | 97 | // Increment message number |
98 | 98 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
99 | - $current_date = date('Y-m-d'); |
|
100 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | - else $source = ''; |
|
102 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
99 | + $current_date = date('Y-m-d'); |
|
100 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
101 | + else $source = ''; |
|
102 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
103 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
104 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
105 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
106 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
107 | 107 | } |
108 | 108 | |
109 | 109 | |
110 | 110 | $Common = new Common(); |
111 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | - else $id = trim($line['id']); |
|
111 | + if (!isset($line['id'])) $id = trim($line['ident']); |
|
112 | + else $id = trim($line['id']); |
|
113 | 113 | |
114 | 114 | if (!isset($this->all_tracked[$id])) { |
115 | - $this->all_tracked[$id] = array(); |
|
116 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | - if (!isset($line['id'])) { |
|
115 | + $this->all_tracked[$id] = array(); |
|
116 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
119 | + if (!isset($line['id'])) { |
|
120 | 120 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
121 | 121 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
122 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
122 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
123 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
127 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
127 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
128 | 128 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
129 | - } else { |
|
129 | + } else { |
|
130 | 130 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
131 | 131 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."\n"; |
132 | 132 | return ''; |
133 | - } |
|
133 | + } |
|
134 | 134 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
135 | 135 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['ident']." - format : ".$line['format_source']."!!!\n"; |
136 | 136 | return ''; |
@@ -147,38 +147,38 @@ discard block |
||
147 | 147 | |
148 | 148 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
149 | 149 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
150 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | - if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
150 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | + if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
152 | 152 | $timeelapsed = microtime(true); |
153 | - $Tracker = new Tracker($this->db); |
|
154 | - $fromsource = NULL; |
|
155 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
153 | + $Tracker = new Tracker($this->db); |
|
154 | + $fromsource = NULL; |
|
155 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
156 | 156 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
157 | 157 | $Tracker->db = null; |
158 | 158 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
159 | - } |
|
160 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
159 | + } |
|
160 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | if (isset($line['speed']) && $line['speed'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
166 | 166 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
167 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | - if ($distance > 100 && $distance < 10000) { |
|
167 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | + if ($distance > 100 && $distance < 10000) { |
|
169 | 169 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
170 | 170 | $speed = $speed*3.6; |
171 | 171 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
172 | 172 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
173 | - } |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | - else unset($timediff); |
|
179 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
176 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
177 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | + else unset($timediff); |
|
179 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 90 || ($timediff > 60 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
180 | 180 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
181 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
181 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'],0.08)) { |
|
182 | 182 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
183 | 183 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
184 | 184 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -192,30 +192,30 @@ discard block |
||
192 | 192 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
193 | 193 | $this->tmd = 0; |
194 | 194 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
195 | - } |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
199 | 199 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
200 | 200 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
201 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | - $dataFound = true; |
|
203 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
201 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
202 | + $dataFound = true; |
|
203 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
204 | 204 | } |
205 | 205 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
206 | 206 | } |
207 | 207 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
208 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
208 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
209 | 209 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
210 | 210 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChangeTracker || $this->all_tracked[$id]['format_source'] == 'aprs') { |
211 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | - $dataFound = true; |
|
213 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
211 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
212 | + $dataFound = true; |
|
213 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
214 | 214 | } |
215 | 215 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
216 | 216 | } |
217 | 217 | |
218 | - } else if ($globalDebug && $timediff > 20) { |
|
218 | + } else if ($globalDebug && $timediff > 20) { |
|
219 | 219 | $this->tmd = $this->tmd + 1; |
220 | 220 | if ($line['latitude'] != $this->all_tracked[$id]['latitude'] && $line['longitude'] != $this->all_tracked[$id]['longitude']) { |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
@@ -223,131 +223,131 @@ discard block |
||
223 | 223 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | - } |
|
226 | + } |
|
227 | 227 | } |
228 | 228 | if (isset($line['last_update']) && $line['last_update'] != '') { |
229 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
229 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
230 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
231 | 231 | } |
232 | 232 | if (isset($line['format_source']) && $line['format_source'] != '') { |
233 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
233 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
234 | 234 | } |
235 | 235 | if (isset($line['source_name']) && $line['source_name'] != '') { |
236 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
236 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
237 | 237 | } |
238 | 238 | if (isset($line['comment']) && $line['comment'] != '') { |
239 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | - //$dataFound = true; |
|
239 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
240 | + //$dataFound = true; |
|
241 | 241 | } |
242 | 242 | if (isset($line['type']) && $line['type'] != '') { |
243 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | - //$dataFound = true; |
|
243 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
244 | + //$dataFound = true; |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | if (isset($line['altitude']) && $line['altitude'] != '') { |
248 | - //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
248 | + //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
249 | 249 | if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
250 | 250 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => $line['altitude'])); |
251 | 251 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
252 | 252 | //$dataFound = true; |
253 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
253 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
257 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
257 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
258 | 258 | } |
259 | 259 | |
260 | 260 | if (isset($line['heading']) && $line['heading'] != '') { |
261 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | - //$dataFound = true; |
|
261 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
264 | + //$dataFound = true; |
|
265 | 265 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
266 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
266 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
267 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
268 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
269 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
270 | 270 | } |
271 | 271 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
272 | 272 | |
273 | 273 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
274 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | - if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
274 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
275 | + if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
276 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
277 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
278 | 278 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
279 | 279 | $timeelapsed = microtime(true); |
280 | 280 | $TrackerLive = new TrackerLive($this->db); |
281 | 281 | if (isset($line['id'])) { |
282 | - $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282 | + $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
283 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
284 | 284 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
285 | - $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
285 | + $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
286 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
287 | 287 | } else $recent_ident = ''; |
288 | 288 | $TrackerLive->db=null; |
289 | 289 | |
290 | 290 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
291 | 291 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
292 | - } else { |
|
292 | + } else { |
|
293 | 293 | $recent_ident = ''; |
294 | 294 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
295 | - } |
|
296 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | - if($recent_ident == "") |
|
298 | - { |
|
295 | + } |
|
296 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
297 | + if($recent_ident == "") |
|
298 | + { |
|
299 | 299 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
300 | 300 | //adds the spotter data for the archive |
301 | - $highlight = ''; |
|
302 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | - $timeelapsed = microtime(true); |
|
304 | - $Tracker = new Tracker($this->db); |
|
305 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | - $Tracker->db = null; |
|
307 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
301 | + $highlight = ''; |
|
302 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
303 | + $timeelapsed = microtime(true); |
|
304 | + $Tracker = new Tracker($this->db); |
|
305 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
306 | + $Tracker->db = null; |
|
307 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
308 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
309 | 309 | |
310 | 310 | |
311 | - // Add source stat in DB |
|
312 | - $Stats = new Stats($this->db); |
|
313 | - if (!empty($this->stats)) { |
|
311 | + // Add source stat in DB |
|
312 | + $Stats = new Stats($this->db); |
|
313 | + if (!empty($this->stats)) { |
|
314 | 314 | if ($globalDebug) echo 'Add source stats : '; |
315 | - foreach($this->stats as $date => $data) { |
|
316 | - foreach($data as $source => $sourced) { |
|
317 | - //print_r($sourced); |
|
318 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | - if (isset($sourced['msg'])) { |
|
321 | - if (time() - $sourced['msg']['date'] > 10) { |
|
322 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | - echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | - unset($this->stats[$date][$source]['msg']); |
|
325 | - } |
|
326 | - } |
|
327 | - } |
|
328 | - if ($date != date('Y-m-d')) { |
|
329 | - unset($this->stats[$date]); |
|
330 | - } |
|
331 | - } |
|
332 | - if ($globalDebug) echo 'Done'."\n"; |
|
315 | + foreach($this->stats as $date => $data) { |
|
316 | + foreach($data as $source => $sourced) { |
|
317 | + //print_r($sourced); |
|
318 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_tracker',$date); |
|
319 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_tracker',$date); |
|
320 | + if (isset($sourced['msg'])) { |
|
321 | + if (time() - $sourced['msg']['date'] > 10) { |
|
322 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
323 | + echo $Stats->addStatSource($nbmsg,$source,'msg_tracker',$date); |
|
324 | + unset($this->stats[$date][$source]['msg']); |
|
325 | + } |
|
326 | + } |
|
327 | + } |
|
328 | + if ($date != date('Y-m-d')) { |
|
329 | + unset($this->stats[$date]); |
|
330 | + } |
|
331 | + } |
|
332 | + if ($globalDebug) echo 'Done'."\n"; |
|
333 | 333 | |
334 | - } |
|
335 | - $Stats->db = null; |
|
334 | + } |
|
335 | + $Stats->db = null; |
|
336 | 336 | |
337 | - $this->del(); |
|
337 | + $this->del(); |
|
338 | 338 | //$ignoreImport = false; |
339 | 339 | $this->all_tracked[$id]['addedTracker'] = 1; |
340 | 340 | //print_r($this->all_tracked[$id]); |
341 | 341 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
342 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | - //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | - $TrackerLive = new TrackerLive($this->db); |
|
345 | - $TrackerLive->deleteLiveTrackerData(); |
|
346 | - $TrackerLive->db=null; |
|
347 | - if ($globalDebug) echo " Done\n"; |
|
348 | - $this->last_delete = time(); |
|
342 | + if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
343 | + //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
344 | + $TrackerLive = new TrackerLive($this->db); |
|
345 | + $TrackerLive->deleteLiveTrackerData(); |
|
346 | + $TrackerLive->db=null; |
|
347 | + if ($globalDebug) echo " Done\n"; |
|
348 | + $this->last_delete = time(); |
|
349 | 349 | } |
350 | - } else { |
|
350 | + } else { |
|
351 | 351 | $this->all_tracked[$id]['id'] = $recent_ident; |
352 | 352 | $this->all_tracked[$id]['addedTracker'] = 1; |
353 | 353 | if (isset($globalDaemon) && !$globalDaemon) { |
@@ -356,16 +356,16 @@ discard block |
||
356 | 356 | $Tracker->db = null; |
357 | 357 | } |
358 | 358 | |
359 | - } |
|
359 | + } |
|
360 | 360 | } |
361 | - } |
|
362 | - //adds the spotter LIVE data |
|
363 | - if ($globalDebug) { |
|
361 | + } |
|
362 | + //adds the spotter LIVE data |
|
363 | + if ($globalDebug) { |
|
364 | 364 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
365 | - } |
|
366 | - $ignoreImport = false; |
|
365 | + } |
|
366 | + $ignoreImport = false; |
|
367 | 367 | |
368 | - if (!$ignoreImport) { |
|
368 | + if (!$ignoreImport) { |
|
369 | 369 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
370 | 370 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
371 | 371 | $timeelapsed = microtime(true); |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | if ($stats_heading == 16) $stats_heading = 0; |
404 | 404 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
405 | 405 | for ($i=0;$i<=15;$i++) { |
406 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
406 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
407 | 407 | } |
408 | 408 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
409 | 409 | } else { |
@@ -416,11 +416,11 @@ discard block |
||
416 | 416 | //var_dump($this->stats); |
417 | 417 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
418 | 418 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
419 | - end($this->stats[$current_date][$source]['hist']); |
|
420 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
419 | + end($this->stats[$current_date][$source]['hist']); |
|
420 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
421 | 421 | } else $mini = 0; |
422 | 422 | for ($i=$mini;$i<=$distance;$i+=10) { |
423 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
423 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
424 | 424 | } |
425 | 425 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
426 | 426 | } else { |
@@ -436,22 +436,22 @@ discard block |
||
436 | 436 | |
437 | 437 | |
438 | 438 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | - $TrackerLive = new TrackerLive($this->db); |
|
441 | - $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | - $TrackerLive->db = null; |
|
443 | - //TrackerLive->deleteLiveTrackerData(); |
|
444 | - if ($globalDebug) echo " Done\n"; |
|
445 | - $this->last_delete_hourly = time(); |
|
439 | + if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
440 | + $TrackerLive = new TrackerLive($this->db); |
|
441 | + $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
442 | + $TrackerLive->db = null; |
|
443 | + //TrackerLive->deleteLiveTrackerData(); |
|
444 | + if ($globalDebug) echo " Done\n"; |
|
445 | + $this->last_delete_hourly = time(); |
|
446 | 446 | } |
447 | 447 | |
448 | - } |
|
449 | - //$ignoreImport = false; |
|
448 | + } |
|
449 | + //$ignoreImport = false; |
|
450 | 450 | } |
451 | 451 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
452 | 452 | if ($send) return $this->all_tracked[$id]; |
453 | - } |
|
453 | + } |
|
454 | + } |
|
454 | 455 | } |
455 | - } |
|
456 | 456 | } |
457 | 457 | ?> |
@@ -10,10 +10,10 @@ discard block |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | /** |
13 | - * Get SQL query part for filter used |
|
14 | - * @param Array $filter the filter |
|
15 | - * @return Array the SQL part |
|
16 | - */ |
|
13 | + * Get SQL query part for filter used |
|
14 | + * @param Array $filter the filter |
|
15 | + * @return Array the SQL part |
|
16 | + */ |
|
17 | 17 | public function getFilter($filter = array(),$where = false,$and = false) { |
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
@@ -106,44 +106,44 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | |
109 | - /** |
|
110 | - * Gets all the spotter information based on a particular callsign |
|
111 | - * |
|
112 | - * @return Array the spotter information |
|
113 | - * |
|
114 | - */ |
|
115 | - public function getLastArchiveTrackerDataByIdent($ident) |
|
116 | - { |
|
109 | + /** |
|
110 | + * Gets all the spotter information based on a particular callsign |
|
111 | + * |
|
112 | + * @return Array the spotter information |
|
113 | + * |
|
114 | + */ |
|
115 | + public function getLastArchiveTrackerDataByIdent($ident) |
|
116 | + { |
|
117 | 117 | $Tracker = new Tracker($this->db); |
118 | - date_default_timezone_set('UTC'); |
|
118 | + date_default_timezone_set('UTC'); |
|
119 | 119 | |
120 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
121 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
122 | - $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
120 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
121 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
122 | + $query = "SELECT tracker_archive.* FROM tracker_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | 123 | |
124 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
124 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident)); |
|
125 | 125 | |
126 | - return $spotter_array; |
|
127 | - } |
|
126 | + return $spotter_array; |
|
127 | + } |
|
128 | 128 | |
129 | 129 | |
130 | - /** |
|
131 | - * Gets last the spotter information based on a particular id |
|
132 | - * |
|
133 | - * @return Array the spotter information |
|
134 | - * |
|
135 | - */ |
|
136 | - public function getLastArchiveTrackerDataById($id) |
|
137 | - { |
|
138 | - $Tracker = new Tracker($this->db); |
|
139 | - date_default_timezone_set('UTC'); |
|
140 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
141 | - //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
142 | - //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
143 | - $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
130 | + /** |
|
131 | + * Gets last the spotter information based on a particular id |
|
132 | + * |
|
133 | + * @return Array the spotter information |
|
134 | + * |
|
135 | + */ |
|
136 | + public function getLastArchiveTrackerDataById($id) |
|
137 | + { |
|
138 | + $Tracker = new Tracker($this->db); |
|
139 | + date_default_timezone_set('UTC'); |
|
140 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
141 | + //$query = TrackerArchive->$global_query." WHERE tracker_archive.famtrackid = :id"; |
|
142 | + //$query = "SELECT tracker_archive.* FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
143 | + $query = "SELECT * FROM tracker_archive WHERE famtrackid = :id ORDER BY date DESC LIMIT 1"; |
|
144 | 144 | |
145 | 145 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
146 | - /* |
|
146 | + /* |
|
147 | 147 | try { |
148 | 148 | $Connection = new Connection(); |
149 | 149 | $sth = Connection->$db->prepare($query); |
@@ -153,189 +153,189 @@ discard block |
||
153 | 153 | } |
154 | 154 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
155 | 155 | */ |
156 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
157 | - |
|
158 | - return $spotter_array; |
|
159 | - } |
|
160 | - |
|
161 | - /** |
|
162 | - * Gets all the spotter information based on a particular id |
|
163 | - * |
|
164 | - * @return Array the spotter information |
|
165 | - * |
|
166 | - */ |
|
167 | - public function getAllArchiveTrackerDataById($id,$date = '') |
|
156 | + $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id)); |
|
157 | + |
|
158 | + return $spotter_array; |
|
159 | + } |
|
160 | + |
|
161 | + /** |
|
162 | + * Gets all the spotter information based on a particular id |
|
163 | + * |
|
164 | + * @return Array the spotter information |
|
165 | + * |
|
166 | + */ |
|
167 | + public function getAllArchiveTrackerDataById($id,$date = '') |
|
168 | 168 | { |
169 | - date_default_timezone_set('UTC'); |
|
170 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
171 | - if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | - else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date"; |
|
169 | + date_default_timezone_set('UTC'); |
|
170 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
171 | + if ($date == '') $query = $this->global_query." WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
172 | + else $query = $this->global_query." WHERE tracker_archive.famtrackid = :id AND date < '".date('c',$date)."' ORDER BY date"; |
|
173 | 173 | |
174 | 174 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
175 | 175 | |
176 | - try { |
|
177 | - $sth = $this->db->prepare($query); |
|
178 | - $sth->execute(array(':id' => $id)); |
|
179 | - } catch(PDOException $e) { |
|
180 | - echo $e->getMessage(); |
|
181 | - die; |
|
182 | - } |
|
183 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
184 | - |
|
185 | - return $spotter_array; |
|
186 | - } |
|
187 | - |
|
188 | - /** |
|
189 | - * Gets coordinate & time spotter information based on a particular id |
|
190 | - * |
|
191 | - * @return Array the spotter information |
|
192 | - * |
|
193 | - */ |
|
194 | - public function getCoordArchiveTrackerDataById($id) |
|
195 | - { |
|
196 | - date_default_timezone_set('UTC'); |
|
197 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
198 | - $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
176 | + try { |
|
177 | + $sth = $this->db->prepare($query); |
|
178 | + $sth->execute(array(':id' => $id)); |
|
179 | + } catch(PDOException $e) { |
|
180 | + echo $e->getMessage(); |
|
181 | + die; |
|
182 | + } |
|
183 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
184 | + |
|
185 | + return $spotter_array; |
|
186 | + } |
|
187 | + |
|
188 | + /** |
|
189 | + * Gets coordinate & time spotter information based on a particular id |
|
190 | + * |
|
191 | + * @return Array the spotter information |
|
192 | + * |
|
193 | + */ |
|
194 | + public function getCoordArchiveTrackerDataById($id) |
|
195 | + { |
|
196 | + date_default_timezone_set('UTC'); |
|
197 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
198 | + $query = "SELECT tracker_archive.latitude, tracker_archive.longitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id"; |
|
199 | 199 | |
200 | 200 | // $spotter_array = Tracker->getDataFromDB($query,array(':id' => $id)); |
201 | 201 | |
202 | - try { |
|
203 | - $sth = $this->db->prepare($query); |
|
204 | - $sth->execute(array(':id' => $id)); |
|
205 | - } catch(PDOException $e) { |
|
206 | - echo $e->getMessage(); |
|
207 | - die; |
|
208 | - } |
|
209 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
202 | + try { |
|
203 | + $sth = $this->db->prepare($query); |
|
204 | + $sth->execute(array(':id' => $id)); |
|
205 | + } catch(PDOException $e) { |
|
206 | + echo $e->getMessage(); |
|
207 | + die; |
|
208 | + } |
|
209 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
210 | 210 | |
211 | - return $spotter_array; |
|
212 | - } |
|
211 | + return $spotter_array; |
|
212 | + } |
|
213 | 213 | |
214 | 214 | |
215 | - /** |
|
216 | - * Gets altitude information based on a particular callsign |
|
217 | - * |
|
218 | - * @return Array the spotter information |
|
219 | - * |
|
220 | - */ |
|
221 | - public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
222 | - { |
|
215 | + /** |
|
216 | + * Gets altitude information based on a particular callsign |
|
217 | + * |
|
218 | + * @return Array the spotter information |
|
219 | + * |
|
220 | + */ |
|
221 | + public function getAltitudeArchiveTrackerDataByIdent($ident) |
|
222 | + { |
|
223 | 223 | |
224 | - date_default_timezone_set('UTC'); |
|
224 | + date_default_timezone_set('UTC'); |
|
225 | 225 | |
226 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
227 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
226 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
227 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
228 | 228 | |
229 | - try { |
|
230 | - $sth = $this->db->prepare($query); |
|
231 | - $sth->execute(array(':ident' => $ident)); |
|
232 | - } catch(PDOException $e) { |
|
233 | - echo $e->getMessage(); |
|
234 | - die; |
|
235 | - } |
|
236 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
229 | + try { |
|
230 | + $sth = $this->db->prepare($query); |
|
231 | + $sth->execute(array(':ident' => $ident)); |
|
232 | + } catch(PDOException $e) { |
|
233 | + echo $e->getMessage(); |
|
234 | + die; |
|
235 | + } |
|
236 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
237 | 237 | |
238 | - return $spotter_array; |
|
239 | - } |
|
238 | + return $spotter_array; |
|
239 | + } |
|
240 | 240 | |
241 | - /** |
|
242 | - * Gets altitude information based on a particular id |
|
243 | - * |
|
244 | - * @return Array the spotter information |
|
245 | - * |
|
246 | - */ |
|
247 | - public function getAltitudeArchiveTrackerDataById($id) |
|
248 | - { |
|
241 | + /** |
|
242 | + * Gets altitude information based on a particular id |
|
243 | + * |
|
244 | + * @return Array the spotter information |
|
245 | + * |
|
246 | + */ |
|
247 | + public function getAltitudeArchiveTrackerDataById($id) |
|
248 | + { |
|
249 | 249 | |
250 | - date_default_timezone_set('UTC'); |
|
250 | + date_default_timezone_set('UTC'); |
|
251 | 251 | |
252 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
253 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
252 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
253 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id AND tracker_archive.latitude <> 0 AND tracker_archive.longitude <> 0 ORDER BY date"; |
|
254 | 254 | |
255 | - try { |
|
256 | - $sth = $this->db->prepare($query); |
|
257 | - $sth->execute(array(':id' => $id)); |
|
258 | - } catch(PDOException $e) { |
|
259 | - echo $e->getMessage(); |
|
260 | - die; |
|
261 | - } |
|
262 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
255 | + try { |
|
256 | + $sth = $this->db->prepare($query); |
|
257 | + $sth->execute(array(':id' => $id)); |
|
258 | + } catch(PDOException $e) { |
|
259 | + echo $e->getMessage(); |
|
260 | + die; |
|
261 | + } |
|
262 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
263 | 263 | |
264 | - return $spotter_array; |
|
265 | - } |
|
264 | + return $spotter_array; |
|
265 | + } |
|
266 | 266 | |
267 | - /** |
|
268 | - * Gets altitude & speed information based on a particular id |
|
269 | - * |
|
270 | - * @return Array the spotter information |
|
271 | - * |
|
272 | - */ |
|
273 | - public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
274 | - { |
|
267 | + /** |
|
268 | + * Gets altitude & speed information based on a particular id |
|
269 | + * |
|
270 | + * @return Array the spotter information |
|
271 | + * |
|
272 | + */ |
|
273 | + public function getAltitudeSpeedArchiveTrackerDataById($id) |
|
274 | + { |
|
275 | 275 | |
276 | - date_default_timezone_set('UTC'); |
|
276 | + date_default_timezone_set('UTC'); |
|
277 | 277 | |
278 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
279 | - $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
278 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
279 | + $query = "SELECT tracker_archive.altitude, tracker_archive.ground_speed, tracker_archive.date FROM tracker_archive WHERE tracker_archive.famtrackid = :id ORDER BY date"; |
|
280 | 280 | |
281 | - try { |
|
282 | - $sth = $this->db->prepare($query); |
|
283 | - $sth->execute(array(':id' => $id)); |
|
284 | - } catch(PDOException $e) { |
|
285 | - echo $e->getMessage(); |
|
286 | - die; |
|
287 | - } |
|
288 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
281 | + try { |
|
282 | + $sth = $this->db->prepare($query); |
|
283 | + $sth->execute(array(':id' => $id)); |
|
284 | + } catch(PDOException $e) { |
|
285 | + echo $e->getMessage(); |
|
286 | + die; |
|
287 | + } |
|
288 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
289 | 289 | |
290 | - return $spotter_array; |
|
291 | - } |
|
290 | + return $spotter_array; |
|
291 | + } |
|
292 | 292 | |
293 | 293 | |
294 | - /** |
|
295 | - * Gets altitude information based on a particular callsign |
|
296 | - * |
|
297 | - * @return Array the spotter information |
|
298 | - * |
|
299 | - */ |
|
300 | - public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
301 | - { |
|
294 | + /** |
|
295 | + * Gets altitude information based on a particular callsign |
|
296 | + * |
|
297 | + * @return Array the spotter information |
|
298 | + * |
|
299 | + */ |
|
300 | + public function getLastAltitudeArchiveTrackerDataByIdent($ident) |
|
301 | + { |
|
302 | 302 | |
303 | - date_default_timezone_set('UTC'); |
|
303 | + date_default_timezone_set('UTC'); |
|
304 | 304 | |
305 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
306 | - $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
305 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
306 | + $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate LIMIT 1"; |
|
307 | 307 | // $query = "SELECT tracker_archive.altitude, tracker_archive.date FROM tracker_archive WHERE tracker_archive.ident = :ident"; |
308 | 308 | |
309 | - try { |
|
310 | - $sth = $this->db->prepare($query); |
|
311 | - $sth->execute(array(':ident' => $ident)); |
|
312 | - } catch(PDOException $e) { |
|
313 | - echo $e->getMessage(); |
|
314 | - die; |
|
315 | - } |
|
316 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
309 | + try { |
|
310 | + $sth = $this->db->prepare($query); |
|
311 | + $sth->execute(array(':ident' => $ident)); |
|
312 | + } catch(PDOException $e) { |
|
313 | + echo $e->getMessage(); |
|
314 | + die; |
|
315 | + } |
|
316 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
317 | 317 | |
318 | - return $spotter_array; |
|
319 | - } |
|
318 | + return $spotter_array; |
|
319 | + } |
|
320 | 320 | |
321 | 321 | |
322 | 322 | |
323 | - /** |
|
324 | - * Gets all the archive spotter information |
|
325 | - * |
|
326 | - * @return Array the spotter information |
|
327 | - * |
|
328 | - */ |
|
329 | - public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
330 | - { |
|
331 | - $Tracker = new Tracker($this->db); |
|
332 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
333 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
323 | + /** |
|
324 | + * Gets all the archive spotter information |
|
325 | + * |
|
326 | + * @return Array the spotter information |
|
327 | + * |
|
328 | + */ |
|
329 | + public function getTrackerArchiveData($ident,$famtrackid,$date) |
|
330 | + { |
|
331 | + $Tracker = new Tracker($this->db); |
|
332 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
333 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.famtrackid = :famtrackid AND l.date LIKE :date GROUP BY l.famtrackid) s on spotter_live.famtrackid = s.famtrackid AND spotter_live.date = s.maxdate"; |
|
334 | 334 | |
335 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
335 | + $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':famtrackid' => $famtrackid,':date' => $date.'%')); |
|
336 | 336 | |
337 | - return $spotter_array; |
|
338 | - } |
|
337 | + return $spotter_array; |
|
338 | + } |
|
339 | 339 | |
340 | 340 | public function deleteTrackerArchiveTrackData() |
341 | 341 | { |
@@ -355,34 +355,34 @@ discard block |
||
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
358 | - * Gets Minimal Live Tracker data |
|
359 | - * |
|
360 | - * @return Array the spotter information |
|
361 | - * |
|
362 | - */ |
|
363 | - public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
364 | - { |
|
365 | - global $globalDBdriver, $globalLiveInterval; |
|
366 | - date_default_timezone_set('UTC'); |
|
367 | - |
|
368 | - $filter_query = ''; |
|
369 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
370 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
371 | - } |
|
372 | - // Use spotter_output also ? |
|
373 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
374 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
375 | - } |
|
376 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
377 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
378 | - } |
|
379 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
380 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
381 | - } |
|
358 | + * Gets Minimal Live Tracker data |
|
359 | + * |
|
360 | + * @return Array the spotter information |
|
361 | + * |
|
362 | + */ |
|
363 | + public function getMinLiveTrackerData($begindate,$enddate,$filter = array()) |
|
364 | + { |
|
365 | + global $globalDBdriver, $globalLiveInterval; |
|
366 | + date_default_timezone_set('UTC'); |
|
382 | 367 | |
383 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
384 | - if ($globalDBdriver == 'mysql') { |
|
385 | - /* |
|
368 | + $filter_query = ''; |
|
369 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
370 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
371 | + } |
|
372 | + // Use spotter_output also ? |
|
373 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
374 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
375 | + } |
|
376 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
377 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
378 | + } |
|
379 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
380 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
381 | + } |
|
382 | + |
|
383 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
384 | + if ($globalDBdriver == 'mysql') { |
|
385 | + /* |
|
386 | 386 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
387 | 387 | FROM tracker_archive |
388 | 388 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -401,56 +401,56 @@ discard block |
||
401 | 401 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
402 | 402 | WHERE tracker_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
403 | 403 | '.$filter_query.' ORDER BY famtrackid'; |
404 | - } else { |
|
405 | - //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
406 | - $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
404 | + } else { |
|
405 | + //$query = 'SELECT tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow FROM tracker_archive INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao'; |
|
406 | + $query = 'SELECT tracker_archive.date,tracker_archive.famtrackid, tracker_archive.ident, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
407 | 407 | FROM tracker_archive |
408 | 408 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive.aircraft_icao = a.icao |
409 | 409 | WHERE tracker_archive.date >= '."'".$begindate."'".' AND tracker_archive.date <= '."'".$enddate."'".' |
410 | 410 | '.$filter_query.' ORDER BY famtrackid'; |
411 | - } |
|
412 | - //echo $query; |
|
413 | - try { |
|
414 | - $sth = $this->db->prepare($query); |
|
415 | - $sth->execute(); |
|
416 | - } catch(PDOException $e) { |
|
417 | - echo $e->getMessage(); |
|
418 | - die; |
|
419 | - } |
|
420 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
411 | + } |
|
412 | + //echo $query; |
|
413 | + try { |
|
414 | + $sth = $this->db->prepare($query); |
|
415 | + $sth->execute(); |
|
416 | + } catch(PDOException $e) { |
|
417 | + echo $e->getMessage(); |
|
418 | + die; |
|
419 | + } |
|
420 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
421 | 421 | |
422 | - return $spotter_array; |
|
423 | - } |
|
422 | + return $spotter_array; |
|
423 | + } |
|
424 | 424 | |
425 | 425 | /** |
426 | - * Gets Minimal Live Tracker data |
|
427 | - * |
|
428 | - * @return Array the spotter information |
|
429 | - * |
|
430 | - */ |
|
431 | - public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
432 | - { |
|
433 | - global $globalDBdriver, $globalLiveInterval; |
|
434 | - date_default_timezone_set('UTC'); |
|
435 | - |
|
436 | - $filter_query = ''; |
|
437 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
438 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
439 | - } |
|
440 | - // Should use spotter_output also ? |
|
441 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
442 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
443 | - } |
|
444 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
445 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
446 | - } |
|
447 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
448 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
449 | - } |
|
426 | + * Gets Minimal Live Tracker data |
|
427 | + * |
|
428 | + * @return Array the spotter information |
|
429 | + * |
|
430 | + */ |
|
431 | + public function getMinLiveTrackerDataPlayback($begindate,$enddate,$filter = array()) |
|
432 | + { |
|
433 | + global $globalDBdriver, $globalLiveInterval; |
|
434 | + date_default_timezone_set('UTC'); |
|
435 | + |
|
436 | + $filter_query = ''; |
|
437 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
438 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
439 | + } |
|
440 | + // Should use spotter_output also ? |
|
441 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
442 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
443 | + } |
|
444 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
445 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM tracker_archive_output WHERE tracker_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
446 | + } |
|
447 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
448 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
449 | + } |
|
450 | 450 | |
451 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
452 | - if ($globalDBdriver == 'mysql') { |
|
453 | - /* |
|
451 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
452 | + if ($globalDBdriver == 'mysql') { |
|
453 | + /* |
|
454 | 454 | $query = 'SELECT a.aircraft_shadow, tracker_archive.ident, tracker_archive.famtrackid, tracker_archive.aircraft_icao, tracker_archive.departure_airport_icao as departure_airport, tracker_archive.arrival_airport_icao as arrival_airport, tracker_archive.latitude, tracker_archive.longitude, tracker_archive.altitude, tracker_archive.heading, tracker_archive.ground_speed, tracker_archive.squawk |
455 | 455 | FROM tracker_archive |
456 | 456 | INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.famtrackid) s on tracker_archive.famtrackid = s.famtrackid AND tracker_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON tracker_archive.aircraft_icao = a.icao'; |
@@ -461,95 +461,95 @@ discard block |
||
461 | 461 | WHERE (tracker_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
462 | 462 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
463 | 463 | |
464 | - } else { |
|
465 | - //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
466 | - /* |
|
464 | + } else { |
|
465 | + //$query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow FROM tracker_archive_output INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_archive_output.famtrackid = s.famtrackid AND tracker_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao'; |
|
466 | + /* |
|
467 | 467 | $query = 'SELECT tracker_archive_output.ident, tracker_archive_output.famtrackid, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
468 | 468 | FROM tracker_archive_output |
469 | 469 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
470 | 470 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
471 | 471 | '.$filter_query.' GROUP BY tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao, tracker_archive_output.arrival_airport_icao, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow'; |
472 | 472 | */ |
473 | - $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
473 | + $query = 'SELECT DISTINCT tracker_archive_output.famtrackid, tracker_archive_output.ident, tracker_archive_output.aircraft_icao, tracker_archive_output.departure_airport_icao as departure_airport, tracker_archive_output.arrival_airport_icao as arrival_airport, tracker_archive_output.latitude, tracker_archive_output.longitude, tracker_archive_output.altitude, tracker_archive_output.heading, tracker_archive_output.ground_speed, tracker_archive_output.squawk, a.aircraft_shadow |
|
474 | 474 | FROM tracker_archive_output |
475 | 475 | INNER JOIN (SELECT * FROM aircraft) a on tracker_archive_output.aircraft_icao = a.icao |
476 | 476 | WHERE tracker_archive_output.date >= '."'".$begindate."'".' AND tracker_archive_output.date <= '."'".$enddate."'".' |
477 | 477 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
478 | 478 | // .' GROUP BY spotter_output.famtrackid, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
479 | 479 | |
480 | - } |
|
481 | - //echo $query; |
|
482 | - try { |
|
483 | - $sth = $this->db->prepare($query); |
|
484 | - $sth->execute(); |
|
485 | - } catch(PDOException $e) { |
|
486 | - echo $e->getMessage(); |
|
487 | - die; |
|
488 | - } |
|
489 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
480 | + } |
|
481 | + //echo $query; |
|
482 | + try { |
|
483 | + $sth = $this->db->prepare($query); |
|
484 | + $sth->execute(); |
|
485 | + } catch(PDOException $e) { |
|
486 | + echo $e->getMessage(); |
|
487 | + die; |
|
488 | + } |
|
489 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
490 | 490 | |
491 | - return $spotter_array; |
|
492 | - } |
|
491 | + return $spotter_array; |
|
492 | + } |
|
493 | 493 | |
494 | 494 | /** |
495 | - * Gets count Live Tracker data |
|
496 | - * |
|
497 | - * @return Array the spotter information |
|
498 | - * |
|
499 | - */ |
|
500 | - public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
501 | - { |
|
502 | - global $globalDBdriver, $globalLiveInterval; |
|
503 | - date_default_timezone_set('UTC'); |
|
504 | - |
|
505 | - $filter_query = ''; |
|
506 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
507 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
508 | - } |
|
509 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
510 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
511 | - } |
|
512 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
513 | - $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
514 | - } |
|
515 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
516 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
517 | - } |
|
495 | + * Gets count Live Tracker data |
|
496 | + * |
|
497 | + * @return Array the spotter information |
|
498 | + * |
|
499 | + */ |
|
500 | + public function getLiveTrackerCount($begindate,$enddate,$filter = array()) |
|
501 | + { |
|
502 | + global $globalDBdriver, $globalLiveInterval; |
|
503 | + date_default_timezone_set('UTC'); |
|
518 | 504 | |
519 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
520 | - if ($globalDBdriver == 'mysql') { |
|
505 | + $filter_query = ''; |
|
506 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
507 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
508 | + } |
|
509 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
510 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.famtrackid = tracker_archive.famtrackid "; |
|
511 | + } |
|
512 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
513 | + $filter_query .= " INNER JOIN (SELECT famtrackid FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.famtrackid = tracker_archive.famtrackid "; |
|
514 | + } |
|
515 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
516 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
517 | + } |
|
518 | + |
|
519 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
520 | + if ($globalDBdriver == 'mysql') { |
|
521 | 521 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb |
522 | 522 | FROM tracker_archive l |
523 | 523 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
524 | - } else { |
|
524 | + } else { |
|
525 | 525 | $query = 'SELECT COUNT(DISTINCT famtrackid) as nb FROM tracker_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
526 | - } |
|
527 | - //echo $query; |
|
528 | - try { |
|
529 | - $sth = $this->db->prepare($query); |
|
530 | - $sth->execute(); |
|
531 | - } catch(PDOException $e) { |
|
532 | - echo $e->getMessage(); |
|
533 | - die; |
|
534 | - } |
|
526 | + } |
|
527 | + //echo $query; |
|
528 | + try { |
|
529 | + $sth = $this->db->prepare($query); |
|
530 | + $sth->execute(); |
|
531 | + } catch(PDOException $e) { |
|
532 | + echo $e->getMessage(); |
|
533 | + die; |
|
534 | + } |
|
535 | 535 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
536 | 536 | $sth->closeCursor(); |
537 | - return $result['nb']; |
|
537 | + return $result['nb']; |
|
538 | 538 | |
539 | - } |
|
539 | + } |
|
540 | 540 | |
541 | 541 | |
542 | 542 | |
543 | 543 | // tracker_archive_output |
544 | 544 | |
545 | - /** |
|
546 | - * Gets all the spotter information |
|
547 | - * |
|
548 | - * @return Array the spotter information |
|
549 | - * |
|
550 | - */ |
|
551 | - public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
552 | - { |
|
545 | + /** |
|
546 | + * Gets all the spotter information |
|
547 | + * |
|
548 | + * @return Array the spotter information |
|
549 | + * |
|
550 | + */ |
|
551 | + public function searchTrackerData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
552 | + { |
|
553 | 553 | global $globalTimezone, $globalDBdriver; |
554 | 554 | require_once(dirname(__FILE__).'/class.Translation.php'); |
555 | 555 | $Translation = new Translation($this->db); |
@@ -563,159 +563,159 @@ discard block |
||
563 | 563 | $filter_query = $this->getFilter($filters); |
564 | 564 | if ($q != "") |
565 | 565 | { |
566 | - if (!is_string($q)) |
|
567 | - { |
|
566 | + if (!is_string($q)) |
|
567 | + { |
|
568 | 568 | return false; |
569 | - } else { |
|
569 | + } else { |
|
570 | 570 | |
571 | 571 | $q_array = explode(" ", $q); |
572 | 572 | |
573 | 573 | foreach ($q_array as $q_item){ |
574 | - $additional_query .= " AND ("; |
|
575 | - $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
576 | - $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
577 | - $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
578 | - $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
579 | - $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
580 | - $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
581 | - $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
582 | - $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
583 | - $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
584 | - $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
585 | - $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
586 | - $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
587 | - $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
588 | - $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
589 | - $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
590 | - $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
591 | - $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
592 | - $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
593 | - $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
594 | - $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
595 | - $translate = $Translation->ident2icao($q_item); |
|
596 | - if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
597 | - $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
598 | - $additional_query .= ")"; |
|
574 | + $additional_query .= " AND ("; |
|
575 | + $additional_query .= "(tracker_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
576 | + $additional_query .= "(tracker_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
577 | + $additional_query .= "(tracker_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
578 | + $additional_query .= "(tracker_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
579 | + $additional_query .= "(tracker_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
580 | + $additional_query .= "(tracker_archive_output.airline_name like '%".$q_item."%') OR "; |
|
581 | + $additional_query .= "(tracker_archive_output.airline_country like '%".$q_item."%') OR "; |
|
582 | + $additional_query .= "(tracker_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
583 | + $additional_query .= "(tracker_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
584 | + $additional_query .= "(tracker_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
585 | + $additional_query .= "(tracker_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
586 | + $additional_query .= "(tracker_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
587 | + $additional_query .= "(tracker_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
588 | + $additional_query .= "(tracker_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
589 | + $additional_query .= "(tracker_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
590 | + $additional_query .= "(tracker_archive_output.registration like '%".$q_item."%') OR "; |
|
591 | + $additional_query .= "(tracker_archive_output.owner_name like '%".$q_item."%') OR "; |
|
592 | + $additional_query .= "(tracker_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
593 | + $additional_query .= "(tracker_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
594 | + $additional_query .= "(tracker_archive_output.ident like '%".$q_item."%') OR "; |
|
595 | + $translate = $Translation->ident2icao($q_item); |
|
596 | + if ($translate != $q_item) $additional_query .= "(tracker_archive_output.ident like '%".$translate."%') OR "; |
|
597 | + $additional_query .= "(tracker_archive_output.highlight like '%".$q_item."%')"; |
|
598 | + $additional_query .= ")"; |
|
599 | + } |
|
599 | 600 | } |
600 | - } |
|
601 | 601 | } |
602 | 602 | |
603 | 603 | if ($registration != "") |
604 | 604 | { |
605 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
606 | - if (!is_string($registration)) |
|
607 | - { |
|
605 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
606 | + if (!is_string($registration)) |
|
607 | + { |
|
608 | 608 | return false; |
609 | - } else { |
|
609 | + } else { |
|
610 | 610 | $additional_query .= " AND (tracker_archive_output.registration = '".$registration."')"; |
611 | - } |
|
611 | + } |
|
612 | 612 | } |
613 | 613 | |
614 | 614 | if ($aircraft_icao != "") |
615 | 615 | { |
616 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
617 | - if (!is_string($aircraft_icao)) |
|
618 | - { |
|
616 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
617 | + if (!is_string($aircraft_icao)) |
|
618 | + { |
|
619 | 619 | return false; |
620 | - } else { |
|
620 | + } else { |
|
621 | 621 | $additional_query .= " AND (tracker_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
622 | - } |
|
622 | + } |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | if ($aircraft_manufacturer != "") |
626 | 626 | { |
627 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
628 | - if (!is_string($aircraft_manufacturer)) |
|
629 | - { |
|
627 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
628 | + if (!is_string($aircraft_manufacturer)) |
|
629 | + { |
|
630 | 630 | return false; |
631 | - } else { |
|
631 | + } else { |
|
632 | 632 | $additional_query .= " AND (tracker_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
633 | - } |
|
633 | + } |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | if ($highlights == "true") |
637 | 637 | { |
638 | - if (!is_string($highlights)) |
|
639 | - { |
|
638 | + if (!is_string($highlights)) |
|
639 | + { |
|
640 | 640 | return false; |
641 | - } else { |
|
641 | + } else { |
|
642 | 642 | $additional_query .= " AND (tracker_archive_output.highlight <> '')"; |
643 | - } |
|
643 | + } |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | if ($airline_icao != "") |
647 | 647 | { |
648 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
649 | - if (!is_string($airline_icao)) |
|
650 | - { |
|
648 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
649 | + if (!is_string($airline_icao)) |
|
650 | + { |
|
651 | 651 | return false; |
652 | - } else { |
|
652 | + } else { |
|
653 | 653 | $additional_query .= " AND (tracker_archive_output.airline_icao = '".$airline_icao."')"; |
654 | - } |
|
654 | + } |
|
655 | 655 | } |
656 | 656 | |
657 | 657 | if ($airline_country != "") |
658 | 658 | { |
659 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
660 | - if (!is_string($airline_country)) |
|
661 | - { |
|
659 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
660 | + if (!is_string($airline_country)) |
|
661 | + { |
|
662 | 662 | return false; |
663 | - } else { |
|
663 | + } else { |
|
664 | 664 | $additional_query .= " AND (tracker_archive_output.airline_country = '".$airline_country."')"; |
665 | - } |
|
665 | + } |
|
666 | 666 | } |
667 | 667 | |
668 | 668 | if ($airline_type != "") |
669 | 669 | { |
670 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
671 | - if (!is_string($airline_type)) |
|
672 | - { |
|
670 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
671 | + if (!is_string($airline_type)) |
|
672 | + { |
|
673 | 673 | return false; |
674 | - } else { |
|
674 | + } else { |
|
675 | 675 | if ($airline_type == "passenger") |
676 | 676 | { |
677 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
677 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'passenger')"; |
|
678 | 678 | } |
679 | 679 | if ($airline_type == "cargo") |
680 | 680 | { |
681 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
681 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'cargo')"; |
|
682 | 682 | } |
683 | 683 | if ($airline_type == "military") |
684 | 684 | { |
685 | - $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
685 | + $additional_query .= " AND (tracker_archive_output.airline_type = 'military')"; |
|
686 | + } |
|
686 | 687 | } |
687 | - } |
|
688 | 688 | } |
689 | 689 | |
690 | 690 | if ($airport != "") |
691 | 691 | { |
692 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
693 | - if (!is_string($airport)) |
|
694 | - { |
|
692 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
693 | + if (!is_string($airport)) |
|
694 | + { |
|
695 | 695 | return false; |
696 | - } else { |
|
696 | + } else { |
|
697 | 697 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = '".$airport."') OR (tracker_archive_output.arrival_airport_icao = '".$airport."'))"; |
698 | - } |
|
698 | + } |
|
699 | 699 | } |
700 | 700 | |
701 | 701 | if ($airport_country != "") |
702 | 702 | { |
703 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
704 | - if (!is_string($airport_country)) |
|
705 | - { |
|
703 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
704 | + if (!is_string($airport_country)) |
|
705 | + { |
|
706 | 706 | return false; |
707 | - } else { |
|
707 | + } else { |
|
708 | 708 | $additional_query .= " AND ((tracker_archive_output.departure_airport_country = '".$airport_country."') OR (tracker_archive_output.arrival_airport_country = '".$airport_country."'))"; |
709 | - } |
|
709 | + } |
|
710 | 710 | } |
711 | 711 | |
712 | 712 | if ($callsign != "") |
713 | 713 | { |
714 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
715 | - if (!is_string($callsign)) |
|
716 | - { |
|
714 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
715 | + if (!is_string($callsign)) |
|
716 | + { |
|
717 | 717 | return false; |
718 | - } else { |
|
718 | + } else { |
|
719 | 719 | $translate = $Translation->ident2icao($callsign); |
720 | 720 | if ($translate != $callsign) { |
721 | 721 | $additional_query .= " AND (tracker_archive_output.ident = :callsign OR tracker_archive_output.ident = :translate)"; |
@@ -723,99 +723,99 @@ discard block |
||
723 | 723 | } else { |
724 | 724 | $additional_query .= " AND (tracker_archive_output.ident = '".$callsign."')"; |
725 | 725 | } |
726 | - } |
|
726 | + } |
|
727 | 727 | } |
728 | 728 | |
729 | 729 | if ($owner != "") |
730 | 730 | { |
731 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
732 | - if (!is_string($owner)) |
|
733 | - { |
|
731 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
732 | + if (!is_string($owner)) |
|
733 | + { |
|
734 | 734 | return false; |
735 | - } else { |
|
735 | + } else { |
|
736 | 736 | $additional_query .= " AND (tracker_archive_output.owner_name = '".$owner."')"; |
737 | - } |
|
737 | + } |
|
738 | 738 | } |
739 | 739 | |
740 | 740 | if ($pilot_name != "") |
741 | 741 | { |
742 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
743 | - if (!is_string($pilot_name)) |
|
744 | - { |
|
742 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
743 | + if (!is_string($pilot_name)) |
|
744 | + { |
|
745 | 745 | return false; |
746 | - } else { |
|
746 | + } else { |
|
747 | 747 | $additional_query .= " AND (tracker_archive_output.pilot_name = '".$pilot_name."')"; |
748 | - } |
|
748 | + } |
|
749 | 749 | } |
750 | 750 | |
751 | 751 | if ($pilot_id != "") |
752 | 752 | { |
753 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
754 | - if (!is_string($pilot_id)) |
|
755 | - { |
|
753 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
754 | + if (!is_string($pilot_id)) |
|
755 | + { |
|
756 | 756 | return false; |
757 | - } else { |
|
757 | + } else { |
|
758 | 758 | $additional_query .= " AND (tracker_archive_output.pilot_id = '".$pilot_id."')"; |
759 | - } |
|
759 | + } |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | if ($departure_airport_route != "") |
763 | 763 | { |
764 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
765 | - if (!is_string($departure_airport_route)) |
|
766 | - { |
|
764 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
765 | + if (!is_string($departure_airport_route)) |
|
766 | + { |
|
767 | 767 | return false; |
768 | - } else { |
|
768 | + } else { |
|
769 | 769 | $additional_query .= " AND (tracker_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
770 | - } |
|
770 | + } |
|
771 | 771 | } |
772 | 772 | |
773 | 773 | if ($arrival_airport_route != "") |
774 | 774 | { |
775 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
776 | - if (!is_string($arrival_airport_route)) |
|
777 | - { |
|
775 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
776 | + if (!is_string($arrival_airport_route)) |
|
777 | + { |
|
778 | 778 | return false; |
779 | - } else { |
|
779 | + } else { |
|
780 | 780 | $additional_query .= " AND (tracker_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
781 | - } |
|
781 | + } |
|
782 | 782 | } |
783 | 783 | |
784 | 784 | if ($altitude != "") |
785 | 785 | { |
786 | - $altitude_array = explode(",", $altitude); |
|
786 | + $altitude_array = explode(",", $altitude); |
|
787 | 787 | |
788 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
790 | 790 | |
791 | 791 | |
792 | - if ($altitude_array[1] != "") |
|
793 | - { |
|
792 | + if ($altitude_array[1] != "") |
|
793 | + { |
|
794 | 794 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
795 | 795 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
796 | 796 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
797 | - } else { |
|
797 | + } else { |
|
798 | 798 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
799 | 799 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
800 | - } |
|
800 | + } |
|
801 | 801 | } |
802 | 802 | |
803 | 803 | if ($date_posted != "") |
804 | 804 | { |
805 | - $date_array = explode(",", $date_posted); |
|
805 | + $date_array = explode(",", $date_posted); |
|
806 | 806 | |
807 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
808 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
807 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
808 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
809 | 809 | |
810 | - if ($globalTimezone != '') { |
|
810 | + if ($globalTimezone != '') { |
|
811 | 811 | date_default_timezone_set($globalTimezone); |
812 | 812 | $datetime = new DateTime(); |
813 | 813 | $offset = $datetime->format('P'); |
814 | - } else $offset = '+00:00'; |
|
814 | + } else $offset = '+00:00'; |
|
815 | 815 | |
816 | 816 | |
817 | - if ($date_array[1] != "") |
|
818 | - { |
|
817 | + if ($date_array[1] != "") |
|
818 | + { |
|
819 | 819 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
820 | 820 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
821 | 821 | if ($globalDBdriver == 'mysql') { |
@@ -823,28 +823,28 @@ discard block |
||
823 | 823 | } else { |
824 | 824 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
825 | 825 | } |
826 | - } else { |
|
826 | + } else { |
|
827 | 827 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
828 | - if ($globalDBdriver == 'mysql') { |
|
828 | + if ($globalDBdriver == 'mysql') { |
|
829 | 829 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(tracker_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
830 | 830 | } else { |
831 | 831 | $additional_query .= " AND tracker_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
832 | 832 | } |
833 | - } |
|
833 | + } |
|
834 | 834 | } |
835 | 835 | |
836 | 836 | if ($limit != "") |
837 | 837 | { |
838 | - $limit_array = explode(",", $limit); |
|
838 | + $limit_array = explode(",", $limit); |
|
839 | 839 | |
840 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
841 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
841 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
842 | 842 | |
843 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
844 | - { |
|
843 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
844 | + { |
|
845 | 845 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
846 | 846 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
847 | - } |
|
847 | + } |
|
848 | 848 | } |
849 | 849 | |
850 | 850 | |
@@ -875,33 +875,33 @@ discard block |
||
875 | 875 | $spotter_array = $Tracker->getDataFromDB($query, $query_values,$limit_query); |
876 | 876 | |
877 | 877 | return $spotter_array; |
878 | - } |
|
878 | + } |
|
879 | 879 | |
880 | - public function deleteTrackerArchiveData() |
|
881 | - { |
|
880 | + public function deleteTrackerArchiveData() |
|
881 | + { |
|
882 | 882 | global $globalArchiveKeepMonths, $globalDBdriver; |
883 | - date_default_timezone_set('UTC'); |
|
884 | - if ($globalDBdriver == 'mysql') { |
|
883 | + date_default_timezone_set('UTC'); |
|
884 | + if ($globalDBdriver == 'mysql') { |
|
885 | 885 | $query = 'DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
886 | 886 | } else { |
887 | 887 | $query = "DELETE FROM tracker_archive_output WHERE tracker_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
888 | 888 | } |
889 | - try { |
|
890 | - $sth = $this->db->prepare($query); |
|
891 | - $sth->execute(); |
|
892 | - } catch(PDOException $e) { |
|
893 | - return "error"; |
|
894 | - } |
|
889 | + try { |
|
890 | + $sth = $this->db->prepare($query); |
|
891 | + $sth->execute(); |
|
892 | + } catch(PDOException $e) { |
|
893 | + return "error"; |
|
894 | + } |
|
895 | 895 | } |
896 | 896 | |
897 | - /** |
|
898 | - * Gets all the spotter information based on the callsign |
|
899 | - * |
|
900 | - * @return Array the spotter information |
|
901 | - * |
|
902 | - */ |
|
903 | - public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
904 | - { |
|
897 | + /** |
|
898 | + * Gets all the spotter information based on the callsign |
|
899 | + * |
|
900 | + * @return Array the spotter information |
|
901 | + * |
|
902 | + */ |
|
903 | + public function getTrackerDataByIdent($ident = '', $limit = '', $sort = '') |
|
904 | + { |
|
905 | 905 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
906 | 906 | |
907 | 907 | date_default_timezone_set('UTC'); |
@@ -913,35 +913,35 @@ discard block |
||
913 | 913 | |
914 | 914 | if ($ident != "") |
915 | 915 | { |
916 | - if (!is_string($ident)) |
|
917 | - { |
|
916 | + if (!is_string($ident)) |
|
917 | + { |
|
918 | 918 | return false; |
919 | - } else { |
|
919 | + } else { |
|
920 | 920 | $additional_query = " AND (tracker_archive_output.ident = :ident)"; |
921 | 921 | $query_values = array(':ident' => $ident); |
922 | - } |
|
922 | + } |
|
923 | 923 | } |
924 | 924 | |
925 | 925 | if ($limit != "") |
926 | 926 | { |
927 | - $limit_array = explode(",", $limit); |
|
927 | + $limit_array = explode(",", $limit); |
|
928 | 928 | |
929 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
930 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
929 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
930 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
931 | 931 | |
932 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
933 | - { |
|
932 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
933 | + { |
|
934 | 934 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
935 | 935 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
936 | - } |
|
936 | + } |
|
937 | 937 | } |
938 | 938 | |
939 | 939 | if ($sort != "") |
940 | 940 | { |
941 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
942 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
941 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
942 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
943 | 943 | } else { |
944 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
944 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
945 | 945 | } |
946 | 946 | |
947 | 947 | $query = $global_query." WHERE tracker_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -949,17 +949,17 @@ discard block |
||
949 | 949 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
950 | 950 | |
951 | 951 | return $spotter_array; |
952 | - } |
|
952 | + } |
|
953 | 953 | |
954 | 954 | |
955 | - /** |
|
956 | - * Gets all the spotter information based on the owner |
|
957 | - * |
|
958 | - * @return Array the spotter information |
|
959 | - * |
|
960 | - */ |
|
961 | - public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
962 | - { |
|
955 | + /** |
|
956 | + * Gets all the spotter information based on the owner |
|
957 | + * |
|
958 | + * @return Array the spotter information |
|
959 | + * |
|
960 | + */ |
|
961 | + public function getTrackerDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
|
962 | + { |
|
963 | 963 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
964 | 964 | |
965 | 965 | date_default_timezone_set('UTC'); |
@@ -972,35 +972,35 @@ discard block |
||
972 | 972 | |
973 | 973 | if ($owner != "") |
974 | 974 | { |
975 | - if (!is_string($owner)) |
|
976 | - { |
|
975 | + if (!is_string($owner)) |
|
976 | + { |
|
977 | 977 | return false; |
978 | - } else { |
|
978 | + } else { |
|
979 | 979 | $additional_query = " AND (tracker_archive_output.owner_name = :owner)"; |
980 | 980 | $query_values = array(':owner' => $owner); |
981 | - } |
|
981 | + } |
|
982 | 982 | } |
983 | 983 | |
984 | 984 | if ($limit != "") |
985 | 985 | { |
986 | - $limit_array = explode(",", $limit); |
|
986 | + $limit_array = explode(",", $limit); |
|
987 | 987 | |
988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
988 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
989 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
990 | 990 | |
991 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
992 | - { |
|
991 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
992 | + { |
|
993 | 993 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
994 | 994 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
995 | - } |
|
995 | + } |
|
996 | 996 | } |
997 | 997 | |
998 | 998 | if ($sort != "") |
999 | 999 | { |
1000 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
1001 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1000 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
1001 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1002 | 1002 | } else { |
1003 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1003 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1004 | 1004 | } |
1005 | 1005 | |
1006 | 1006 | $query = $global_query.$filter_query." tracker_archive_output.owner_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1008,16 +1008,16 @@ discard block |
||
1008 | 1008 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1009 | 1009 | |
1010 | 1010 | return $spotter_array; |
1011 | - } |
|
1012 | - |
|
1013 | - /** |
|
1014 | - * Gets all the spotter information based on the pilot |
|
1015 | - * |
|
1016 | - * @return Array the spotter information |
|
1017 | - * |
|
1018 | - */ |
|
1019 | - public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1020 | - { |
|
1011 | + } |
|
1012 | + |
|
1013 | + /** |
|
1014 | + * Gets all the spotter information based on the pilot |
|
1015 | + * |
|
1016 | + * @return Array the spotter information |
|
1017 | + * |
|
1018 | + */ |
|
1019 | + public function getTrackerDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
|
1020 | + { |
|
1021 | 1021 | $global_query = "SELECT tracker_archive_output.* FROM tracker_archive_output"; |
1022 | 1022 | |
1023 | 1023 | date_default_timezone_set('UTC'); |
@@ -1036,24 +1036,24 @@ discard block |
||
1036 | 1036 | |
1037 | 1037 | if ($limit != "") |
1038 | 1038 | { |
1039 | - $limit_array = explode(",", $limit); |
|
1039 | + $limit_array = explode(",", $limit); |
|
1040 | 1040 | |
1041 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1042 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1041 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1042 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1043 | 1043 | |
1044 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1045 | - { |
|
1044 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1045 | + { |
|
1046 | 1046 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1047 | 1047 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1048 | - } |
|
1048 | + } |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | if ($sort != "") |
1052 | 1052 | { |
1053 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
1054 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1053 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
1054 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1055 | 1055 | } else { |
1056 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1056 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1057 | 1057 | } |
1058 | 1058 | |
1059 | 1059 | $query = $global_query.$filter_query." tracker_archive_output.pilot_name <> '' ".$additional_query." ".$orderby_query; |
@@ -1061,16 +1061,16 @@ discard block |
||
1061 | 1061 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1062 | 1062 | |
1063 | 1063 | return $spotter_array; |
1064 | - } |
|
1065 | - |
|
1066 | - /** |
|
1067 | - * Gets all number of flight over countries |
|
1068 | - * |
|
1069 | - * @return Array the airline country list |
|
1070 | - * |
|
1071 | - */ |
|
1072 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1073 | - { |
|
1064 | + } |
|
1065 | + |
|
1066 | + /** |
|
1067 | + * Gets all number of flight over countries |
|
1068 | + * |
|
1069 | + * @return Array the airline country list |
|
1070 | + * |
|
1071 | + */ |
|
1072 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1073 | + { |
|
1074 | 1074 | global $globalDBdriver; |
1075 | 1075 | /* |
1076 | 1076 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1080,14 +1080,14 @@ discard block |
||
1080 | 1080 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
1081 | 1081 | FROM countries c, tracker_archive s |
1082 | 1082 | WHERE c.iso2 = s.over_country "; |
1083 | - if ($olderthanmonths > 0) { |
|
1084 | - if ($globalDBdriver == 'mysql') { |
|
1083 | + if ($olderthanmonths > 0) { |
|
1084 | + if ($globalDBdriver == 'mysql') { |
|
1085 | 1085 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1086 | 1086 | } else { |
1087 | 1087 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1088 | 1088 | } |
1089 | 1089 | } |
1090 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1090 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
1091 | 1091 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1092 | 1092 | if ($limit) $query .= " LIMIT 0,10"; |
1093 | 1093 | |
@@ -1100,23 +1100,23 @@ discard block |
||
1100 | 1100 | |
1101 | 1101 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1102 | 1102 | { |
1103 | - $temp_array['flight_count'] = $row['nb']; |
|
1104 | - $temp_array['flight_country'] = $row['name']; |
|
1105 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1106 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1107 | - $flight_array[] = $temp_array; |
|
1103 | + $temp_array['flight_count'] = $row['nb']; |
|
1104 | + $temp_array['flight_country'] = $row['name']; |
|
1105 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1106 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1107 | + $flight_array[] = $temp_array; |
|
1108 | 1108 | } |
1109 | 1109 | return $flight_array; |
1110 | - } |
|
1111 | - |
|
1112 | - /** |
|
1113 | - * Gets all number of flight over countries |
|
1114 | - * |
|
1115 | - * @return Array the airline country list |
|
1116 | - * |
|
1117 | - */ |
|
1118 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1119 | - { |
|
1110 | + } |
|
1111 | + |
|
1112 | + /** |
|
1113 | + * Gets all number of flight over countries |
|
1114 | + * |
|
1115 | + * @return Array the airline country list |
|
1116 | + * |
|
1117 | + */ |
|
1118 | + public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1119 | + { |
|
1120 | 1120 | global $globalDBdriver; |
1121 | 1121 | /* |
1122 | 1122 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1126,14 +1126,14 @@ discard block |
||
1126 | 1126 | $query = "SELECT o.airline_icao,c.name, c.iso3, c.iso2, count(c.name) as nb |
1127 | 1127 | FROM countries c, tracker_archive s, spotter_output o |
1128 | 1128 | WHERE c.iso2 = s.over_country AND o.airline_icao <> '' AND o.famtrackid = s.famtrackid "; |
1129 | - if ($olderthanmonths > 0) { |
|
1130 | - if ($globalDBdriver == 'mysql') { |
|
1129 | + if ($olderthanmonths > 0) { |
|
1130 | + if ($globalDBdriver == 'mysql') { |
|
1131 | 1131 | $query .= 'AND s.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
1132 | 1132 | } else { |
1133 | 1133 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
1134 | 1134 | } |
1135 | 1135 | } |
1136 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1136 | + if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
1137 | 1137 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
1138 | 1138 | if ($limit) $query .= " LIMIT 0,10"; |
1139 | 1139 | |
@@ -1146,24 +1146,24 @@ discard block |
||
1146 | 1146 | |
1147 | 1147 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
1148 | 1148 | { |
1149 | - $temp_array['airline_icao'] = $row['airline_icao']; |
|
1150 | - $temp_array['flight_count'] = $row['nb']; |
|
1151 | - $temp_array['flight_country'] = $row['name']; |
|
1152 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1153 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1154 | - $flight_array[] = $temp_array; |
|
1149 | + $temp_array['airline_icao'] = $row['airline_icao']; |
|
1150 | + $temp_array['flight_count'] = $row['nb']; |
|
1151 | + $temp_array['flight_country'] = $row['name']; |
|
1152 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
1153 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
1154 | + $flight_array[] = $temp_array; |
|
1155 | 1155 | } |
1156 | 1156 | return $flight_array; |
1157 | - } |
|
1158 | - |
|
1159 | - /** |
|
1160 | - * Gets last spotter information based on a particular callsign |
|
1161 | - * |
|
1162 | - * @return Array the spotter information |
|
1163 | - * |
|
1164 | - */ |
|
1165 | - public function getDateArchiveTrackerDataById($id,$date) |
|
1166 | - { |
|
1157 | + } |
|
1158 | + |
|
1159 | + /** |
|
1160 | + * Gets last spotter information based on a particular callsign |
|
1161 | + * |
|
1162 | + * @return Array the spotter information |
|
1163 | + * |
|
1164 | + */ |
|
1165 | + public function getDateArchiveTrackerDataById($id,$date) |
|
1166 | + { |
|
1167 | 1167 | $Tracker = new Tracker($this->db); |
1168 | 1168 | date_default_timezone_set('UTC'); |
1169 | 1169 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -1171,16 +1171,16 @@ discard block |
||
1171 | 1171 | $date = date('c',$date); |
1172 | 1172 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
1173 | 1173 | return $spotter_array; |
1174 | - } |
|
1175 | - |
|
1176 | - /** |
|
1177 | - * Gets all the spotter information based on a particular callsign |
|
1178 | - * |
|
1179 | - * @return Array the spotter information |
|
1180 | - * |
|
1181 | - */ |
|
1182 | - public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1183 | - { |
|
1174 | + } |
|
1175 | + |
|
1176 | + /** |
|
1177 | + * Gets all the spotter information based on a particular callsign |
|
1178 | + * |
|
1179 | + * @return Array the spotter information |
|
1180 | + * |
|
1181 | + */ |
|
1182 | + public function getDateArchiveTrackerDataByIdent($ident,$date) |
|
1183 | + { |
|
1184 | 1184 | $Tracker = new Tracker($this->db); |
1185 | 1185 | date_default_timezone_set('UTC'); |
1186 | 1186 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -1188,16 +1188,16 @@ discard block |
||
1188 | 1188 | $date = date('c',$date); |
1189 | 1189 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
1190 | 1190 | return $spotter_array; |
1191 | - } |
|
1192 | - |
|
1193 | - /** |
|
1194 | - * Gets all the spotter information based on the airport |
|
1195 | - * |
|
1196 | - * @return Array the spotter information |
|
1197 | - * |
|
1198 | - */ |
|
1199 | - public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1200 | - { |
|
1191 | + } |
|
1192 | + |
|
1193 | + /** |
|
1194 | + * Gets all the spotter information based on the airport |
|
1195 | + * |
|
1196 | + * @return Array the spotter information |
|
1197 | + * |
|
1198 | + */ |
|
1199 | + public function getTrackerDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1200 | + { |
|
1201 | 1201 | global $global_query; |
1202 | 1202 | $Tracker = new Tracker($this->db); |
1203 | 1203 | date_default_timezone_set('UTC'); |
@@ -1208,35 +1208,35 @@ discard block |
||
1208 | 1208 | |
1209 | 1209 | if ($airport != "") |
1210 | 1210 | { |
1211 | - if (!is_string($airport)) |
|
1212 | - { |
|
1211 | + if (!is_string($airport)) |
|
1212 | + { |
|
1213 | 1213 | return false; |
1214 | - } else { |
|
1214 | + } else { |
|
1215 | 1215 | $additional_query .= " AND ((tracker_archive_output.departure_airport_icao = :airport) OR (tracker_archive_output.arrival_airport_icao = :airport))"; |
1216 | 1216 | $query_values = array(':airport' => $airport); |
1217 | - } |
|
1217 | + } |
|
1218 | 1218 | } |
1219 | 1219 | |
1220 | 1220 | if ($limit != "") |
1221 | 1221 | { |
1222 | - $limit_array = explode(",", $limit); |
|
1222 | + $limit_array = explode(",", $limit); |
|
1223 | 1223 | |
1224 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1225 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1224 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1225 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1226 | 1226 | |
1227 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1228 | - { |
|
1227 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1228 | + { |
|
1229 | 1229 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1230 | 1230 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1231 | - } |
|
1231 | + } |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | if ($sort != "") |
1235 | 1235 | { |
1236 | - $search_orderby_array = $Tracker->getOrderBy(); |
|
1237 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1236 | + $search_orderby_array = $Tracker->getOrderBy(); |
|
1237 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1238 | 1238 | } else { |
1239 | - $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1239 | + $orderby_query = " ORDER BY tracker_archive_output.date DESC"; |
|
1240 | 1240 | } |
1241 | 1241 | |
1242 | 1242 | $query = $global_query.$filter_query." tracker_archive_output.ident <> '' ".$additional_query." AND ((tracker_archive_output.departure_airport_icao <> 'NA') AND (tracker_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1244,6 +1244,6 @@ discard block |
||
1244 | 1244 | $spotter_array = $Tracker->getDataFromDB($query, $query_values, $limit_query); |
1245 | 1245 | |
1246 | 1246 | return $spotter_array; |
1247 | - } |
|
1247 | + } |
|
1248 | 1248 | } |
1249 | 1249 | ?> |
1250 | 1250 | \ No newline at end of file |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?> |
48 | 48 | </tr></table></div> |
49 | 49 | <?php |
50 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
50 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
51 | 51 | ?> |
52 | 52 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
53 | 53 | <?php |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
72 | 72 | <?php |
73 | 73 | } |
74 | - } |
|
74 | + } |
|
75 | 75 | ?> |
76 | 76 | |
77 | 77 | <div id="sidebar" class="sidebar collapsed"> |
@@ -82,34 +82,34 @@ discard block |
||
82 | 82 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
83 | 83 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
84 | 84 | <?php |
85 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
85 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
86 | 86 | if (isset($globalArchive) && $globalArchive == TRUE) { |
87 | 87 | ?> |
88 | 88 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
89 | 89 | <?php |
90 | 90 | } |
91 | - } |
|
91 | + } |
|
92 | 92 | ?> |
93 | 93 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
94 | 94 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
95 | 95 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
96 | 96 | <?php |
97 | - if (isset($globalMap3D) && $globalMap3D) { |
|
97 | + if (isset($globalMap3D) && $globalMap3D) { |
|
98 | 98 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
99 | 99 | ?> |
100 | 100 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
101 | 101 | <?php |
102 | 102 | } else { |
103 | - if (isset($globalSatellite) && $globalSatellite) { |
|
103 | + if (isset($globalSatellite) && $globalSatellite) { |
|
104 | 104 | ?> |
105 | 105 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
106 | 106 | <?php |
107 | - } |
|
107 | + } |
|
108 | 108 | ?> |
109 | 109 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
110 | 110 | <?php |
111 | 111 | } |
112 | - } |
|
112 | + } |
|
113 | 113 | ?> |
114 | 114 | </ul> |
115 | 115 | |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ?> |
185 | 185 | </div> |
186 | 186 | <?php |
187 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
187 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
188 | 188 | ?> |
189 | 189 | <div class="sidebar-pane" id="archive"> |
190 | 190 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | </form> |
244 | 244 | </div> |
245 | 245 | <?php |
246 | - } |
|
246 | + } |
|
247 | 247 | ?> |
248 | 248 | <div class="sidebar-pane" id="settings"> |
249 | 249 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -254,72 +254,72 @@ discard block |
||
254 | 254 | <?php |
255 | 255 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
256 | 256 | else $MapType = $_COOKIE['MapType']; |
257 | - ?> |
|
257 | + ?> |
|
258 | 258 | <?php |
259 | 259 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
260 | - ?> |
|
260 | + ?> |
|
261 | 261 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
262 | 262 | <?php |
263 | 263 | } else { |
264 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
265 | - ?> |
|
264 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
265 | + ?> |
|
266 | 266 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
267 | 267 | <?php |
268 | - } |
|
269 | - ?> |
|
268 | + } |
|
269 | + ?> |
|
270 | 270 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
271 | 271 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
272 | 272 | <?php |
273 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
274 | - ?> |
|
273 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
274 | + ?> |
|
275 | 275 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
276 | 276 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
277 | 277 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
278 | 278 | <?php |
279 | - } |
|
280 | - ?> |
|
279 | + } |
|
280 | + ?> |
|
281 | 281 | <?php |
282 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
283 | - ?> |
|
282 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
283 | + ?> |
|
284 | 284 | <?php |
285 | 285 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
286 | - ?> |
|
286 | + ?> |
|
287 | 287 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
288 | 288 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
289 | 289 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
290 | 290 | <?php |
291 | 291 | } |
292 | - ?> |
|
292 | + ?> |
|
293 | 293 | <?php |
294 | 294 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
295 | - ?> |
|
295 | + ?> |
|
296 | 296 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
297 | 297 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
298 | 298 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
299 | 299 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
300 | 300 | <?php |
301 | 301 | } |
302 | - ?> |
|
302 | + ?> |
|
303 | 303 | <?php |
304 | 304 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
305 | - ?> |
|
305 | + ?> |
|
306 | 306 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
307 | 307 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
308 | 308 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
309 | 309 | <?php |
310 | 310 | } |
311 | - ?> |
|
311 | + ?> |
|
312 | 312 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
313 | 313 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
314 | 314 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
315 | 315 | <?php |
316 | - } |
|
317 | - ?> |
|
316 | + } |
|
317 | + ?> |
|
318 | 318 | <?php |
319 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
319 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
320 | 320 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
321 | 321 | else $MapBoxId = $_COOKIE['MapTypeId']; |
322 | - ?> |
|
322 | + ?> |
|
323 | 323 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
324 | 324 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
325 | 325 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -334,16 +334,16 @@ discard block |
||
334 | 334 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
335 | 335 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
336 | 336 | <?php |
337 | - } |
|
338 | - ?> |
|
337 | + } |
|
338 | + ?> |
|
339 | 339 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
340 | 340 | <?php |
341 | 341 | } |
342 | - ?> |
|
342 | + ?> |
|
343 | 343 | </select> |
344 | 344 | </li> |
345 | 345 | <?php |
346 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
346 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
347 | 347 | ?> |
348 | 348 | <li><?php echo _("Type of Terrain:"); ?> |
349 | 349 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -354,10 +354,10 @@ discard block |
||
354 | 354 | </select> |
355 | 355 | </li> |
356 | 356 | <?php |
357 | - } |
|
357 | + } |
|
358 | 358 | ?> |
359 | 359 | <?php |
360 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
360 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
361 | 361 | ?> |
362 | 362 | <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
363 | 363 | |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
381 | 381 | <?php |
382 | 382 | } |
383 | - } |
|
383 | + } |
|
384 | 384 | ?> |
385 | 385 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
386 | 386 | <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
@@ -392,81 +392,81 @@ discard block |
||
392 | 392 | <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
393 | 393 | <?php |
394 | 394 | } |
395 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
395 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
396 | 396 | ?> |
397 | 397 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
398 | 398 | <?php |
399 | - } |
|
400 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
399 | + } |
|
400 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
401 | 401 | ?> |
402 | 402 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
403 | 403 | <?php |
404 | - } |
|
404 | + } |
|
405 | 405 | ?> |
406 | 406 | <?php |
407 | 407 | if (function_exists('array_column')) { |
408 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
409 | - ?> |
|
408 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
409 | + ?> |
|
410 | 410 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
411 | 411 | <?php |
412 | - } |
|
412 | + } |
|
413 | 413 | } elseif (isset($globalSources)) { |
414 | - $dispolar = false; |
|
415 | - foreach ($globalSources as $testsource) { |
|
416 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
417 | - } |
|
418 | - if ($dispolar) { |
|
419 | - ?> |
|
414 | + $dispolar = false; |
|
415 | + foreach ($globalSources as $testsource) { |
|
416 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
417 | + } |
|
418 | + if ($dispolar) { |
|
419 | + ?> |
|
420 | 420 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
421 | 421 | <?php |
422 | - } |
|
423 | - } |
|
424 | - ?> |
|
422 | + } |
|
423 | + } |
|
424 | + ?> |
|
425 | 425 | <?php |
426 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
426 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
427 | 427 | ?> |
428 | 428 | |
429 | 429 | <?php |
430 | 430 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
431 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
432 | - ?> |
|
431 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
432 | + ?> |
|
433 | 433 | <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
434 | 434 | <?php |
435 | 435 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
436 | - ?> |
|
436 | + ?> |
|
437 | 437 | <li><?php echo _("Aircraft icon color:"); ?> |
438 | 438 | <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"> |
439 | 439 | </li> |
440 | 440 | <?php |
441 | 441 | } |
442 | - } |
|
443 | - } |
|
444 | - ?> |
|
442 | + } |
|
443 | + } |
|
444 | + ?> |
|
445 | 445 | <?php |
446 | 446 | if (isset($globalMarine) && $globalMarine === TRUE) { |
447 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
448 | - ?> |
|
447 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
448 | + ?> |
|
449 | 449 | <li><?php echo _("Marine icon color:"); ?> |
450 | 450 | <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
451 | 451 | </li> |
452 | 452 | <?php |
453 | - } |
|
454 | - } |
|
455 | - ?> |
|
453 | + } |
|
454 | + } |
|
455 | + ?> |
|
456 | 456 | <?php |
457 | 457 | if (isset($globalTracker) && $globalTracker === TRUE) { |
458 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
459 | - ?> |
|
458 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
459 | + ?> |
|
460 | 460 | <li><?php echo _("Tracker icon color:"); ?> |
461 | 461 | <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
462 | 462 | </li> |
463 | 463 | <?php |
464 | - } |
|
465 | - } |
|
466 | - ?> |
|
464 | + } |
|
465 | + } |
|
466 | + ?> |
|
467 | 467 | <?php |
468 | 468 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
469 | - ?> |
|
469 | + ?> |
|
470 | 470 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
471 | 471 | <div class="range"> |
472 | 472 | <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
@@ -475,9 +475,9 @@ discard block |
||
475 | 475 | </li> |
476 | 476 | <?php |
477 | 477 | } |
478 | - ?> |
|
478 | + ?> |
|
479 | 479 | <?php |
480 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
480 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
481 | 481 | ?> |
482 | 482 | <?php |
483 | 483 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
@@ -509,7 +509,7 @@ discard block |
||
509 | 509 | </li> |
510 | 510 | <?php |
511 | 511 | } |
512 | - } |
|
512 | + } |
|
513 | 513 | ?> |
514 | 514 | <li><?php echo _("Distance unit:"); ?> |
515 | 515 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -542,19 +542,19 @@ discard block |
||
542 | 542 | <ul> |
543 | 543 | <?php |
544 | 544 | if (!isset($globalAircraft) || $globalAircraft) { |
545 | - ?> |
|
545 | + ?> |
|
546 | 546 | <?php |
547 | 547 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
548 | - ?> |
|
548 | + ?> |
|
549 | 549 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
550 | 550 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
551 | 551 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
552 | 552 | <?php |
553 | 553 | } |
554 | - ?> |
|
554 | + ?> |
|
555 | 555 | <?php |
556 | 556 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
557 | - ?> |
|
557 | + ?> |
|
558 | 558 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
559 | 559 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
560 | 560 | <?php } ?> |
@@ -563,7 +563,7 @@ discard block |
||
563 | 563 | <?php } ?> |
564 | 564 | <?php |
565 | 565 | } |
566 | - ?> |
|
566 | + ?> |
|
567 | 567 | <li><?php echo _("Display airlines:"); ?> |
568 | 568 | <br/> |
569 | 569 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
584 | 584 | } |
585 | 585 | } |
586 | - ?> |
|
586 | + ?> |
|
587 | 587 | </select> |
588 | 588 | </li> |
589 | 589 | <?php |
590 | 590 | $Spotter = new Spotter(); |
591 | 591 | $allalliancenames = $Spotter->getAllAllianceNames(); |
592 | 592 | if (!empty($allalliancenames)) { |
593 | - ?> |
|
593 | + ?> |
|
594 | 594 | <li><?php echo _("Display alliance:"); ?> |
595 | 595 | <br/> |
596 | 596 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -604,18 +604,18 @@ discard block |
||
604 | 604 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
605 | 605 | } |
606 | 606 | } |
607 | - ?> |
|
607 | + ?> |
|
608 | 608 | </select> |
609 | 609 | </li> |
610 | 610 | <?php |
611 | 611 | } |
612 | - ?> |
|
612 | + ?> |
|
613 | 613 | <?php |
614 | 614 | } |
615 | - ?> |
|
615 | + ?> |
|
616 | 616 | <?php |
617 | 617 | if (isset($globalAPRS) && $globalAPRS) { |
618 | - ?> |
|
618 | + ?> |
|
619 | 619 | <li><?php echo _("Display APRS sources name:"); ?> |
620 | 620 | <select class="selectpicker" multiple onchange="sources(this);"> |
621 | 621 | <?php |
@@ -639,18 +639,18 @@ discard block |
||
639 | 639 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
640 | 640 | } |
641 | 641 | } |
642 | - ?> |
|
642 | + ?> |
|
643 | 643 | </select> |
644 | 644 | </li> |
645 | 645 | <?php |
646 | 646 | } |
647 | - ?> |
|
647 | + ?> |
|
648 | 648 | <?php |
649 | 649 | if (!isset($globalAircraft) || $globalAircraft) { |
650 | - ?> |
|
650 | + ?> |
|
651 | 651 | <?php |
652 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
653 | - ?> |
|
652 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
653 | + ?> |
|
654 | 654 | <li><?php echo _("Display airlines of type:"); ?><br/> |
655 | 655 | <select class="selectpicker" onchange="airlinestype(this);"> |
656 | 656 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -660,21 +660,21 @@ discard block |
||
660 | 660 | </select> |
661 | 661 | </li> |
662 | 662 | <?php |
663 | - } |
|
664 | - ?> |
|
663 | + } |
|
664 | + ?> |
|
665 | 665 | <?php |
666 | 666 | } |
667 | - ?> |
|
667 | + ?> |
|
668 | 668 | <?php |
669 | 669 | if (isset($globalMarine) && $globalMarine) { |
670 | - ?> |
|
670 | + ?> |
|
671 | 671 | <li> |
672 | 672 | <?php echo _("Display vessels with MMSI:"); ?> |
673 | 673 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
674 | 674 | </li> |
675 | 675 | <?php |
676 | 676 | } |
677 | - ?> |
|
677 | + ?> |
|
678 | 678 | <li> |
679 | 679 | <?php echo _("Display with ident:"); ?> |
680 | 680 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | </form> |
688 | 688 | </div> |
689 | 689 | <?php |
690 | - if (isset($globalSatellite) && $globalSatellite) { |
|
690 | + if (isset($globalSatellite) && $globalSatellite) { |
|
691 | 691 | ?> |
692 | 692 | <div class="sidebar-pane" id="satellites"> |
693 | 693 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -727,14 +727,14 @@ discard block |
||
727 | 727 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
728 | 728 | } |
729 | 729 | } |
730 | - ?> |
|
730 | + ?> |
|
731 | 731 | </select> |
732 | 732 | </li> |
733 | 733 | </ul> |
734 | 734 | </form> |
735 | 735 | </div> |
736 | 736 | <?php |
737 | - } |
|
737 | + } |
|
738 | 738 | ?> |
739 | 739 | </div> |
740 | 740 | </div> |
@@ -14,23 +14,23 @@ discard block |
||
14 | 14 | $usecoord = false; |
15 | 15 | if (isset($_GET['test'])) exit(); |
16 | 16 | if (isset($_GET['tracker'])) { |
17 | - $tracker = true; |
|
17 | + $tracker = true; |
|
18 | 18 | } |
19 | 19 | if (isset($_GET['marine'])) { |
20 | - $marine = true; |
|
20 | + $marine = true; |
|
21 | 21 | } |
22 | 22 | if ($tracker) { |
23 | - require_once('require/class.Tracker.php'); |
|
24 | - require_once('require/class.TrackerLive.php'); |
|
25 | - require_once('require/class.TrackerArchive.php'); |
|
23 | + require_once('require/class.Tracker.php'); |
|
24 | + require_once('require/class.TrackerLive.php'); |
|
25 | + require_once('require/class.TrackerArchive.php'); |
|
26 | 26 | } elseif ($marine) { |
27 | - require_once('require/class.Marine.php'); |
|
28 | - require_once('require/class.MarineLive.php'); |
|
29 | - require_once('require/class.MarineArchive.php'); |
|
27 | + require_once('require/class.Marine.php'); |
|
28 | + require_once('require/class.MarineLive.php'); |
|
29 | + require_once('require/class.MarineArchive.php'); |
|
30 | 30 | } else { |
31 | - require_once('require/class.Spotter.php'); |
|
32 | - require_once('require/class.SpotterLive.php'); |
|
33 | - require_once('require/class.SpotterArchive.php'); |
|
31 | + require_once('require/class.Spotter.php'); |
|
32 | + require_once('require/class.SpotterLive.php'); |
|
33 | + require_once('require/class.SpotterArchive.php'); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $begintime = microtime(true); |
@@ -50,10 +50,10 @@ discard block |
||
50 | 50 | $Common = new Common(); |
51 | 51 | |
52 | 52 | if (isset($_GET['download'])) { |
53 | - if ($_GET['download'] == "true") |
|
54 | - { |
|
53 | + if ($_GET['download'] == "true") |
|
54 | + { |
|
55 | 55 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
56 | - } |
|
56 | + } |
|
57 | 57 | } |
58 | 58 | header('Content-Type: text/javascript'); |
59 | 59 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $usecoord = true; |
132 | 132 | $coord = explode(',',$_GET['coord']); |
133 | 133 | if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
134 | - && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
134 | + && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
|
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
137 | 137 | } elseif ($marine) { |
@@ -635,17 +635,17 @@ discard block |
||
635 | 635 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
636 | 636 | |
637 | 637 | if ( |
638 | - (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
639 | - || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
638 | + (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
639 | + || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
640 | 640 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
641 | 641 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
642 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
643 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
644 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
645 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
646 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
647 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
648 | - ) { |
|
642 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
643 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
644 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
645 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
646 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
647 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
648 | + ) { |
|
649 | 649 | if ($tracker) { |
650 | 650 | if ($from_archive || $globalArchive) { |
651 | 651 | $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']); |
@@ -653,9 +653,9 @@ discard block |
||
653 | 653 | $spotter_history_array = $TrackerLive->getAllLiveTrackerDataById($spotter_item['famtrackid']); |
654 | 654 | } |
655 | 655 | if (((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || |
656 | - (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && |
|
657 | - isset($_GET['zoom']) && $_GET['zoom'] > 12 && |
|
658 | - isset($spotter_item['type']) && ( |
|
656 | + (!isset($_COOKIE['mapmatching']) && $globalMapMatching === TRUE)) && |
|
657 | + isset($_GET['zoom']) && $_GET['zoom'] > 12 && |
|
658 | + isset($spotter_item['type']) && ( |
|
659 | 659 | $spotter_item['type'] == 'Firetruck' || |
660 | 660 | $spotter_item['type'] == 'Ambulance' || |
661 | 661 | $spotter_item['type'] == 'Truck (18 Wheeler)' || |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | $spotter_item['type'] == 'Jeep' || |
668 | 668 | $spotter_item['type'] == 'Motorcycle' || |
669 | 669 | $spotter_item['type'] == 'Car' |
670 | - ) |
|
670 | + ) |
|
671 | 671 | ) { |
672 | 672 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
673 | 673 | $MapMatching = new MapMatching(); |
@@ -770,65 +770,65 @@ discard block |
||
770 | 770 | } |
771 | 771 | |
772 | 772 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
773 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
774 | - && (isset($spotter_item['departure_airport']) |
|
775 | - && $spotter_item['departure_airport'] != 'NA' |
|
776 | - && isset($spotter_item['arrival_airport']) |
|
777 | - && $spotter_item['arrival_airport'] != 'NA' |
|
778 | - && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
779 | - || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
780 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
782 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
773 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
774 | + && (isset($spotter_item['departure_airport']) |
|
775 | + && $spotter_item['departure_airport'] != 'NA' |
|
776 | + && isset($spotter_item['arrival_airport']) |
|
777 | + && $spotter_item['arrival_airport'] != 'NA' |
|
778 | + && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
779 | + || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
780 | + if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
781 | + else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
782 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
783 | 783 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
784 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
784 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
785 | 785 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
786 | 786 | if (isset($dairport[0]['latitude'])) { |
787 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
787 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
788 | 788 | } |
789 | - } |
|
790 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
789 | + } |
|
790 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
791 | 791 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],'; |
792 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
792 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
793 | 793 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
794 | 794 | if (isset($aairport[0]['latitude'])) { |
795 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
795 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
796 | 796 | } |
797 | - } |
|
798 | - $output_air = substr($output_air, 0, -1); |
|
799 | - $output_air .= ']}},'; |
|
800 | - $output .= $output_air; |
|
801 | - unset($output_air); |
|
797 | + } |
|
798 | + $output_air = substr($output_air, 0, -1); |
|
799 | + $output_air .= ']}},'; |
|
800 | + $output .= $output_air; |
|
801 | + unset($output_air); |
|
802 | 802 | } |
803 | 803 | |
804 | 804 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
805 | 805 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
806 | 806 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
807 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
808 | - && (isset($spotter_item['arrival_airport']) |
|
809 | - && $spotter_item['arrival_airport'] != 'NA' |
|
810 | - && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
811 | - || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
|
812 | - || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
813 | - $havedata = false; |
|
814 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
816 | - $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
807 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
808 | + && (isset($spotter_item['arrival_airport']) |
|
809 | + && $spotter_item['arrival_airport'] != 'NA' |
|
810 | + && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
811 | + || (!isset($_COOKIE['MapRemainingRoute']) && (!isset($globalMapRemainingRoute) |
|
812 | + || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
813 | + $havedata = false; |
|
814 | + if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | + else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
816 | + $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
817 | 817 | |
818 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
818 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
819 | 819 | $output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
820 | 820 | $havedata = true; |
821 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
821 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
822 | 822 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
823 | 823 | if (isset($aairport[0]['latitude'])) { |
824 | - $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
825 | - $havedata = true; |
|
824 | + $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
825 | + $havedata = true; |
|
826 | 826 | } |
827 | - } |
|
828 | - //$output_dest = substr($output_dest, 0, -1); |
|
829 | - $output_dest .= ']}},'; |
|
830 | - if ($havedata) $output .= $output_dest; |
|
831 | - unset($output_dest); |
|
827 | + } |
|
828 | + //$output_dest = substr($output_dest, 0, -1); |
|
829 | + $output_dest .= ']}},'; |
|
830 | + if ($havedata) $output .= $output_dest; |
|
831 | + unset($output_dest); |
|
832 | 832 | } |
833 | 833 | } |
834 | 834 | $output = substr($output, 0, -1); |