@@ -10,100 +10,100 @@ |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | |
13 | - /** |
|
14 | - * Get SQL query part for filter used |
|
15 | - * @param Array $filter the filter |
|
16 | - * @return Array the SQL part |
|
17 | - */ |
|
18 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
13 | + /** |
|
14 | + * Get SQL query part for filter used |
|
15 | + * @param Array $filter the filter |
|
16 | + * @return Array the SQL part |
|
17 | + */ |
|
18 | + public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | 19 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | - if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
21 | + if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
|
22 | 22 | foreach($globalStatsFilters[$globalFilterName] as $source) { |
23 | 23 | $filter['source'][] = $source; |
24 | 24 | } |
25 | - } else { |
|
25 | + } else { |
|
26 | 26 | $filter = $globalStatsFilters[$globalFilterName]; |
27 | - } |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | 32 | if (isset($filter['source']) && !empty($filter['source'])) { |
33 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
33 | + $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
34 | 34 | } |
35 | 35 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
36 | 36 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
37 | 37 | $filter_query = $filter_query_join.$filter_query_where; |
38 | 38 | return $filter_query; |
39 | - } |
|
39 | + } |
|
40 | 40 | |
41 | - public function getAll() { |
|
42 | - $filter_query = $this->getFilter(array(),true); |
|
43 | - $query = "SELECT * FROM atc".$filter_query; |
|
44 | - $query_values = array(); |
|
45 | - try { |
|
46 | - $sth = $this->db->prepare($query); |
|
47 | - $sth->execute($query_values); |
|
48 | - } catch(PDOException $e) { |
|
49 | - return "error : ".$e->getMessage(); |
|
50 | - } |
|
51 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
52 | - return $all; |
|
53 | - } |
|
41 | + public function getAll() { |
|
42 | + $filter_query = $this->getFilter(array(),true); |
|
43 | + $query = "SELECT * FROM atc".$filter_query; |
|
44 | + $query_values = array(); |
|
45 | + try { |
|
46 | + $sth = $this->db->prepare($query); |
|
47 | + $sth->execute($query_values); |
|
48 | + } catch(PDOException $e) { |
|
49 | + return "error : ".$e->getMessage(); |
|
50 | + } |
|
51 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
52 | + return $all; |
|
53 | + } |
|
54 | 54 | |
55 | - public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
56 | - $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
57 | - $info = str_replace('^','<br />',$info); |
|
58 | - $info = str_replace('&sect;','',$info); |
|
59 | - $info = str_replace('"','',$info); |
|
60 | - if ($type == '') $type = NULL; |
|
61 | - $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
|
62 | - $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
63 | - try { |
|
64 | - $sth = $this->db->prepare($query); |
|
65 | - $sth->execute($query_values); |
|
66 | - } catch(PDOException $e) { |
|
67 | - return "error : ".$e->getMessage(); |
|
68 | - } |
|
69 | - } |
|
55 | + public function add($ident,$frequency,$latitude,$longitude,$range,$info,$date,$type = '',$ivao_id = '',$ivao_name = '',$format_source = '',$source_name = '') { |
|
56 | + $info = preg_replace('/[^(\x20-\x7F)]*/','',$info); |
|
57 | + $info = str_replace('^','<br />',$info); |
|
58 | + $info = str_replace('&sect;','',$info); |
|
59 | + $info = str_replace('"','',$info); |
|
60 | + if ($type == '') $type = NULL; |
|
61 | + $query = "INSERT INTO atc (ident,frequency,latitude,longitude,atc_range,info,atc_lastseen,type,ivao_id,ivao_name,format_source,source_name) VALUES (:ident,:frequency,:latitude,:longitude,:range,:info,:date,:type,:ivao_id,:ivao_name,:format_source,:source_name)"; |
|
62 | + $query_values = array(':ident' => $ident,':frequency' => $frequency,':latitude' => $latitude,':longitude' => $longitude,':range' => $range,':info' => $info,':date' => $date,':ivao_id' => $ivao_id,':ivao_name' => $ivao_name, ':type' => $type,':format_source' => $format_source,':source_name' => $source_name); |
|
63 | + try { |
|
64 | + $sth = $this->db->prepare($query); |
|
65 | + $sth->execute($query_values); |
|
66 | + } catch(PDOException $e) { |
|
67 | + return "error : ".$e->getMessage(); |
|
68 | + } |
|
69 | + } |
|
70 | 70 | |
71 | - public function deleteById($id) { |
|
72 | - $query = "DELETE FROM atc WHERE atc_id = :id"; |
|
73 | - $query_values = array(':id' => $id); |
|
74 | - try { |
|
75 | - $sth = $this->db->prepare($query); |
|
76 | - $sth->execute($query_values); |
|
77 | - } catch(PDOException $e) { |
|
78 | - return "error : ".$e->getMessage(); |
|
79 | - } |
|
80 | - } |
|
71 | + public function deleteById($id) { |
|
72 | + $query = "DELETE FROM atc WHERE atc_id = :id"; |
|
73 | + $query_values = array(':id' => $id); |
|
74 | + try { |
|
75 | + $sth = $this->db->prepare($query); |
|
76 | + $sth->execute($query_values); |
|
77 | + } catch(PDOException $e) { |
|
78 | + return "error : ".$e->getMessage(); |
|
79 | + } |
|
80 | + } |
|
81 | 81 | |
82 | - public function deleteAll() { |
|
83 | - $query = "DELETE FROM atc"; |
|
84 | - $query_values = array(); |
|
85 | - try { |
|
86 | - $sth = $this->db->prepare($query); |
|
87 | - $sth->execute($query_values); |
|
88 | - } catch(PDOException $e) { |
|
89 | - return "error : ".$e->getMessage(); |
|
90 | - } |
|
91 | - } |
|
82 | + public function deleteAll() { |
|
83 | + $query = "DELETE FROM atc"; |
|
84 | + $query_values = array(); |
|
85 | + try { |
|
86 | + $sth = $this->db->prepare($query); |
|
87 | + $sth->execute($query_values); |
|
88 | + } catch(PDOException $e) { |
|
89 | + return "error : ".$e->getMessage(); |
|
90 | + } |
|
91 | + } |
|
92 | 92 | |
93 | 93 | public function deleteOldATC() { |
94 | - global $globalDBdriver; |
|
95 | - if ($globalDBdriver == 'mysql') { |
|
96 | - $query = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen"; |
|
97 | - } else { |
|
98 | - $query = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen"; |
|
99 | - } |
|
100 | - try { |
|
101 | - $sth = $this->db->prepare($query); |
|
102 | - $sth->execute(); |
|
103 | - } catch(PDOException $e) { |
|
104 | - return "error"; |
|
105 | - } |
|
106 | - return "success"; |
|
107 | - } |
|
94 | + global $globalDBdriver; |
|
95 | + if ($globalDBdriver == 'mysql') { |
|
96 | + $query = "DELETE FROM atc WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= atc.atc_lastseen"; |
|
97 | + } else { |
|
98 | + $query = "DELETE FROM atc WHERE NOW() AT TIME ZONE 'UTC' - '1 HOUR'->INTERVAL >= atc.atc_lastseen"; |
|
99 | + } |
|
100 | + try { |
|
101 | + $sth = $this->db->prepare($query); |
|
102 | + $sth->execute(); |
|
103 | + } catch(PDOException $e) { |
|
104 | + return "error"; |
|
105 | + } |
|
106 | + return "success"; |
|
107 | + } |
|
108 | 108 | } |
109 | 109 | ?> |
110 | 110 | \ No newline at end of file |
@@ -8,12 +8,12 @@ discard block |
||
8 | 8 | $this->db = $Connection->db; |
9 | 9 | } |
10 | 10 | |
11 | - /** |
|
12 | - * Get SQL query part for filter used |
|
13 | - * @param Array $filter the filter |
|
14 | - * @return Array the SQL part |
|
15 | - */ |
|
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
11 | + /** |
|
12 | + * Get SQL query part for filter used |
|
13 | + * @param Array $filter the filter |
|
14 | + * @return Array the SQL part |
|
15 | + */ |
|
16 | + public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
@@ -27,58 +27,58 @@ discard block |
||
27 | 27 | $filter_query_join = ''; |
28 | 28 | $filter_query_where = ''; |
29 | 29 | foreach($filters as $flt) { |
30 | - if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
|
30 | + if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
|
31 | 31 | if ($flt['airlines'][0] != '') { |
32 | - if (isset($flt['source'])) { |
|
32 | + if (isset($flt['source'])) { |
|
33 | 33 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
34 | - } else { |
|
34 | + } else { |
|
35 | 35 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
36 | - } |
|
36 | + } |
|
37 | 37 | } |
38 | - } |
|
39 | - if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
|
38 | + } |
|
39 | + if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
|
40 | 40 | if (isset($flt['source'])) { |
41 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
42 | 42 | } else { |
43 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
43 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + } |
|
44 | 45 | } |
45 | - } |
|
46 | - if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
|
46 | + if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
|
47 | 47 | if (isset($flt['source'])) { |
48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
49 | + } |
|
49 | 50 | } |
50 | - } |
|
51 | 51 | } |
52 | 52 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
53 | - if ($filter['airlines'][0] != '') { |
|
53 | + if ($filter['airlines'][0] != '') { |
|
54 | 54 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
55 | - } |
|
55 | + } |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
|
60 | 60 | } |
61 | 61 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_archive_output.flightaware_id"; |
|
63 | 63 | } |
64 | 64 | if (isset($filter['source']) && !empty($filter['source'])) { |
65 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
65 | + $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
66 | 66 | } |
67 | 67 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
68 | - $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
|
68 | + $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
|
69 | 69 | } |
70 | 70 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
71 | - if ($filter_query_where == '') { |
|
71 | + if ($filter_query_where == '') { |
|
72 | 72 | $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
73 | - } else { |
|
73 | + } else { |
|
74 | 74 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
75 | - } |
|
75 | + } |
|
76 | 76 | } |
77 | 77 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
78 | 78 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
79 | 79 | $filter_query = $filter_query_join.$filter_query_where; |
80 | 80 | return $filter_query; |
81 | - } |
|
81 | + } |
|
82 | 82 | |
83 | 83 | // Spotter_archive |
84 | 84 | public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
@@ -109,44 +109,44 @@ discard block |
||
109 | 109 | } |
110 | 110 | |
111 | 111 | |
112 | - /** |
|
113 | - * Gets all the spotter information based on a particular callsign |
|
114 | - * |
|
115 | - * @return Array the spotter information |
|
116 | - * |
|
117 | - */ |
|
118 | - public function getLastArchiveSpotterDataByIdent($ident) |
|
119 | - { |
|
112 | + /** |
|
113 | + * Gets all the spotter information based on a particular callsign |
|
114 | + * |
|
115 | + * @return Array the spotter information |
|
116 | + * |
|
117 | + */ |
|
118 | + public function getLastArchiveSpotterDataByIdent($ident) |
|
119 | + { |
|
120 | 120 | $Spotter = new Spotter($this->db); |
121 | - date_default_timezone_set('UTC'); |
|
121 | + date_default_timezone_set('UTC'); |
|
122 | 122 | |
123 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
124 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
125 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
123 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
124 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
125 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
126 | 126 | |
127 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
127 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
128 | 128 | |
129 | - return $spotter_array; |
|
130 | - } |
|
129 | + return $spotter_array; |
|
130 | + } |
|
131 | 131 | |
132 | 132 | |
133 | - /** |
|
134 | - * Gets last the spotter information based on a particular id |
|
135 | - * |
|
136 | - * @return Array the spotter information |
|
137 | - * |
|
138 | - */ |
|
139 | - public function getLastArchiveSpotterDataById($id) |
|
140 | - { |
|
141 | - $Spotter = new Spotter($this->db); |
|
142 | - date_default_timezone_set('UTC'); |
|
143 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
144 | - //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
145 | - //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
146 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
133 | + /** |
|
134 | + * Gets last the spotter information based on a particular id |
|
135 | + * |
|
136 | + * @return Array the spotter information |
|
137 | + * |
|
138 | + */ |
|
139 | + public function getLastArchiveSpotterDataById($id) |
|
140 | + { |
|
141 | + $Spotter = new Spotter($this->db); |
|
142 | + date_default_timezone_set('UTC'); |
|
143 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
144 | + //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
145 | + //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
146 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
147 | 147 | |
148 | 148 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
149 | - /* |
|
149 | + /* |
|
150 | 150 | try { |
151 | 151 | $Connection = new Connection(); |
152 | 152 | $sth = Connection->$db->prepare($query); |
@@ -156,232 +156,232 @@ discard block |
||
156 | 156 | } |
157 | 157 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
158 | 158 | */ |
159 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
160 | - |
|
161 | - return $spotter_array; |
|
162 | - } |
|
163 | - |
|
164 | - /** |
|
165 | - * Gets all the spotter information based on a particular id |
|
166 | - * |
|
167 | - * @return Array the spotter information |
|
168 | - * |
|
169 | - */ |
|
170 | - public function getAllArchiveSpotterDataById($id) |
|
171 | - { |
|
172 | - date_default_timezone_set('UTC'); |
|
173 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
174 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
159 | + $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
160 | + |
|
161 | + return $spotter_array; |
|
162 | + } |
|
163 | + |
|
164 | + /** |
|
165 | + * Gets all the spotter information based on a particular id |
|
166 | + * |
|
167 | + * @return Array the spotter information |
|
168 | + * |
|
169 | + */ |
|
170 | + public function getAllArchiveSpotterDataById($id) |
|
171 | + { |
|
172 | + date_default_timezone_set('UTC'); |
|
173 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
174 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id"; |
|
175 | 175 | |
176 | 176 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
177 | 177 | |
178 | - try { |
|
179 | - $sth = $this->db->prepare($query); |
|
180 | - $sth->execute(array(':id' => $id)); |
|
181 | - } catch(PDOException $e) { |
|
182 | - echo $e->getMessage(); |
|
183 | - die; |
|
184 | - } |
|
185 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
186 | - |
|
187 | - return $spotter_array; |
|
188 | - } |
|
189 | - |
|
190 | - /** |
|
191 | - * Gets coordinate & time spotter information based on a particular id |
|
192 | - * |
|
193 | - * @return Array the spotter information |
|
194 | - * |
|
195 | - */ |
|
196 | - public function getCoordArchiveSpotterDataById($id) |
|
197 | - { |
|
198 | - date_default_timezone_set('UTC'); |
|
199 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
200 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
178 | + try { |
|
179 | + $sth = $this->db->prepare($query); |
|
180 | + $sth->execute(array(':id' => $id)); |
|
181 | + } catch(PDOException $e) { |
|
182 | + echo $e->getMessage(); |
|
183 | + die; |
|
184 | + } |
|
185 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
186 | + |
|
187 | + return $spotter_array; |
|
188 | + } |
|
189 | + |
|
190 | + /** |
|
191 | + * Gets coordinate & time spotter information based on a particular id |
|
192 | + * |
|
193 | + * @return Array the spotter information |
|
194 | + * |
|
195 | + */ |
|
196 | + public function getCoordArchiveSpotterDataById($id) |
|
197 | + { |
|
198 | + date_default_timezone_set('UTC'); |
|
199 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
200 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
201 | 201 | |
202 | 202 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
203 | 203 | |
204 | - try { |
|
205 | - $sth = $this->db->prepare($query); |
|
206 | - $sth->execute(array(':id' => $id)); |
|
207 | - } catch(PDOException $e) { |
|
208 | - echo $e->getMessage(); |
|
209 | - die; |
|
210 | - } |
|
211 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
204 | + try { |
|
205 | + $sth = $this->db->prepare($query); |
|
206 | + $sth->execute(array(':id' => $id)); |
|
207 | + } catch(PDOException $e) { |
|
208 | + echo $e->getMessage(); |
|
209 | + die; |
|
210 | + } |
|
211 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
212 | 212 | |
213 | - return $spotter_array; |
|
214 | - } |
|
213 | + return $spotter_array; |
|
214 | + } |
|
215 | 215 | |
216 | 216 | |
217 | - /** |
|
218 | - * Gets altitude information based on a particular callsign |
|
219 | - * |
|
220 | - * @return Array the spotter information |
|
221 | - * |
|
222 | - */ |
|
223 | - public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
224 | - { |
|
217 | + /** |
|
218 | + * Gets altitude information based on a particular callsign |
|
219 | + * |
|
220 | + * @return Array the spotter information |
|
221 | + * |
|
222 | + */ |
|
223 | + public function getAltitudeArchiveSpotterDataByIdent($ident) |
|
224 | + { |
|
225 | 225 | |
226 | - date_default_timezone_set('UTC'); |
|
226 | + date_default_timezone_set('UTC'); |
|
227 | 227 | |
228 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
229 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
228 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
229 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
230 | 230 | |
231 | - try { |
|
232 | - $sth = $this->db->prepare($query); |
|
233 | - $sth->execute(array(':ident' => $ident)); |
|
234 | - } catch(PDOException $e) { |
|
235 | - echo $e->getMessage(); |
|
236 | - die; |
|
237 | - } |
|
238 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
231 | + try { |
|
232 | + $sth = $this->db->prepare($query); |
|
233 | + $sth->execute(array(':ident' => $ident)); |
|
234 | + } catch(PDOException $e) { |
|
235 | + echo $e->getMessage(); |
|
236 | + die; |
|
237 | + } |
|
238 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
239 | 239 | |
240 | - return $spotter_array; |
|
241 | - } |
|
240 | + return $spotter_array; |
|
241 | + } |
|
242 | 242 | |
243 | - /** |
|
244 | - * Gets altitude information based on a particular id |
|
245 | - * |
|
246 | - * @return Array the spotter information |
|
247 | - * |
|
248 | - */ |
|
249 | - public function getAltitudeArchiveSpotterDataById($id) |
|
250 | - { |
|
243 | + /** |
|
244 | + * Gets altitude information based on a particular id |
|
245 | + * |
|
246 | + * @return Array the spotter information |
|
247 | + * |
|
248 | + */ |
|
249 | + public function getAltitudeArchiveSpotterDataById($id) |
|
250 | + { |
|
251 | 251 | |
252 | - date_default_timezone_set('UTC'); |
|
252 | + date_default_timezone_set('UTC'); |
|
253 | 253 | |
254 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
255 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
254 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
255 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
256 | 256 | |
257 | - try { |
|
258 | - $sth = $this->db->prepare($query); |
|
259 | - $sth->execute(array(':id' => $id)); |
|
260 | - } catch(PDOException $e) { |
|
261 | - echo $e->getMessage(); |
|
262 | - die; |
|
263 | - } |
|
264 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
257 | + try { |
|
258 | + $sth = $this->db->prepare($query); |
|
259 | + $sth->execute(array(':id' => $id)); |
|
260 | + } catch(PDOException $e) { |
|
261 | + echo $e->getMessage(); |
|
262 | + die; |
|
263 | + } |
|
264 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
265 | 265 | |
266 | - return $spotter_array; |
|
267 | - } |
|
266 | + return $spotter_array; |
|
267 | + } |
|
268 | 268 | |
269 | - /** |
|
270 | - * Gets altitude & speed information based on a particular id |
|
271 | - * |
|
272 | - * @return Array the spotter information |
|
273 | - * |
|
274 | - */ |
|
275 | - public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
276 | - { |
|
269 | + /** |
|
270 | + * Gets altitude & speed information based on a particular id |
|
271 | + * |
|
272 | + * @return Array the spotter information |
|
273 | + * |
|
274 | + */ |
|
275 | + public function getAltitudeSpeedArchiveSpotterDataById($id) |
|
276 | + { |
|
277 | 277 | |
278 | - date_default_timezone_set('UTC'); |
|
278 | + date_default_timezone_set('UTC'); |
|
279 | 279 | |
280 | - $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
281 | - $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
280 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
281 | + $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
282 | 282 | |
283 | - try { |
|
284 | - $sth = $this->db->prepare($query); |
|
285 | - $sth->execute(array(':id' => $id)); |
|
286 | - } catch(PDOException $e) { |
|
287 | - echo $e->getMessage(); |
|
288 | - die; |
|
289 | - } |
|
290 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
283 | + try { |
|
284 | + $sth = $this->db->prepare($query); |
|
285 | + $sth->execute(array(':id' => $id)); |
|
286 | + } catch(PDOException $e) { |
|
287 | + echo $e->getMessage(); |
|
288 | + die; |
|
289 | + } |
|
290 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
291 | 291 | |
292 | - return $spotter_array; |
|
293 | - } |
|
292 | + return $spotter_array; |
|
293 | + } |
|
294 | 294 | |
295 | 295 | |
296 | - /** |
|
297 | - * Gets altitude information based on a particular callsign |
|
298 | - * |
|
299 | - * @return Array the spotter information |
|
300 | - * |
|
301 | - */ |
|
302 | - public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
303 | - { |
|
296 | + /** |
|
297 | + * Gets altitude information based on a particular callsign |
|
298 | + * |
|
299 | + * @return Array the spotter information |
|
300 | + * |
|
301 | + */ |
|
302 | + public function getLastAltitudeArchiveSpotterDataByIdent($ident) |
|
303 | + { |
|
304 | 304 | |
305 | - date_default_timezone_set('UTC'); |
|
305 | + date_default_timezone_set('UTC'); |
|
306 | 306 | |
307 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
308 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
307 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
308 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
309 | 309 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
310 | 310 | |
311 | - try { |
|
312 | - $sth = $this->db->prepare($query); |
|
313 | - $sth->execute(array(':ident' => $ident)); |
|
314 | - } catch(PDOException $e) { |
|
315 | - echo $e->getMessage(); |
|
316 | - die; |
|
317 | - } |
|
318 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
311 | + try { |
|
312 | + $sth = $this->db->prepare($query); |
|
313 | + $sth->execute(array(':ident' => $ident)); |
|
314 | + } catch(PDOException $e) { |
|
315 | + echo $e->getMessage(); |
|
316 | + die; |
|
317 | + } |
|
318 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
319 | 319 | |
320 | - return $spotter_array; |
|
321 | - } |
|
320 | + return $spotter_array; |
|
321 | + } |
|
322 | 322 | |
323 | 323 | |
324 | 324 | |
325 | - /** |
|
326 | - * Gets all the archive spotter information |
|
327 | - * |
|
328 | - * @return Array the spotter information |
|
329 | - * |
|
330 | - */ |
|
331 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
332 | - { |
|
333 | - $Spotter = new Spotter($this->db); |
|
334 | - $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
335 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
325 | + /** |
|
326 | + * Gets all the archive spotter information |
|
327 | + * |
|
328 | + * @return Array the spotter information |
|
329 | + * |
|
330 | + */ |
|
331 | + public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
332 | + { |
|
333 | + $Spotter = new Spotter($this->db); |
|
334 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
335 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
336 | 336 | |
337 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
337 | + $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
338 | 338 | |
339 | - return $spotter_array; |
|
340 | - } |
|
339 | + return $spotter_array; |
|
340 | + } |
|
341 | 341 | |
342 | - public function deleteSpotterArchiveTrackData() |
|
343 | - { |
|
342 | + public function deleteSpotterArchiveTrackData() |
|
343 | + { |
|
344 | 344 | global $globalArchiveKeepTrackMonths; |
345 | - date_default_timezone_set('UTC'); |
|
345 | + date_default_timezone_set('UTC'); |
|
346 | 346 | $query = 'DELETE FROM spotter_archive WHERE spotter_archive.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepTrackMonths.' MONTH)'; |
347 | - try { |
|
348 | - $sth = $this->db->prepare($query); |
|
349 | - $sth->execute(); |
|
350 | - } catch(PDOException $e) { |
|
351 | - echo $e->getMessage(); |
|
352 | - die; |
|
353 | - } |
|
347 | + try { |
|
348 | + $sth = $this->db->prepare($query); |
|
349 | + $sth->execute(); |
|
350 | + } catch(PDOException $e) { |
|
351 | + echo $e->getMessage(); |
|
352 | + die; |
|
353 | + } |
|
354 | 354 | } |
355 | 355 | |
356 | 356 | /** |
357 | - * Gets Minimal Live Spotter data |
|
358 | - * |
|
359 | - * @return Array the spotter information |
|
360 | - * |
|
361 | - */ |
|
362 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
363 | - { |
|
364 | - global $globalDBdriver, $globalLiveInterval; |
|
365 | - date_default_timezone_set('UTC'); |
|
366 | - |
|
367 | - $filter_query = ''; |
|
368 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
369 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
370 | - } |
|
371 | - // Use spotter_output also ? |
|
372 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
373 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
374 | - } |
|
375 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
376 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
377 | - } |
|
378 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
379 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
380 | - } |
|
381 | - |
|
382 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
383 | - if ($globalDBdriver == 'mysql') { |
|
384 | - /* |
|
357 | + * Gets Minimal Live Spotter data |
|
358 | + * |
|
359 | + * @return Array the spotter information |
|
360 | + * |
|
361 | + */ |
|
362 | + public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
363 | + { |
|
364 | + global $globalDBdriver, $globalLiveInterval; |
|
365 | + date_default_timezone_set('UTC'); |
|
366 | + |
|
367 | + $filter_query = ''; |
|
368 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
369 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
370 | + } |
|
371 | + // Use spotter_output also ? |
|
372 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
373 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
374 | + } |
|
375 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
376 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
377 | + } |
|
378 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
379 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
380 | + } |
|
381 | + |
|
382 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
383 | + if ($globalDBdriver == 'mysql') { |
|
384 | + /* |
|
385 | 385 | $query = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk |
386 | 386 | FROM spotter_archive |
387 | 387 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -400,56 +400,56 @@ discard block |
||
400 | 400 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
401 | 401 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
402 | 402 | '.$filter_query.' ORDER BY flightaware_id'; |
403 | - } else { |
|
404 | - //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
405 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
403 | + } else { |
|
404 | + //$query = 'SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao'; |
|
405 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
406 | 406 | FROM spotter_archive |
407 | 407 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
408 | 408 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
409 | 409 | '.$filter_query.' ORDER BY flightaware_id'; |
410 | - } |
|
411 | - //echo $query; |
|
412 | - try { |
|
413 | - $sth = $this->db->prepare($query); |
|
414 | - $sth->execute(); |
|
415 | - } catch(PDOException $e) { |
|
416 | - echo $e->getMessage(); |
|
417 | - die; |
|
418 | - } |
|
419 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
420 | - |
|
421 | - return $spotter_array; |
|
422 | - } |
|
410 | + } |
|
411 | + //echo $query; |
|
412 | + try { |
|
413 | + $sth = $this->db->prepare($query); |
|
414 | + $sth->execute(); |
|
415 | + } catch(PDOException $e) { |
|
416 | + echo $e->getMessage(); |
|
417 | + die; |
|
418 | + } |
|
419 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
420 | + |
|
421 | + return $spotter_array; |
|
422 | + } |
|
423 | 423 | |
424 | 424 | /** |
425 | - * Gets Minimal Live Spotter data |
|
426 | - * |
|
427 | - * @return Array the spotter information |
|
428 | - * |
|
429 | - */ |
|
430 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
431 | - { |
|
432 | - global $globalDBdriver, $globalLiveInterval; |
|
433 | - date_default_timezone_set('UTC'); |
|
434 | - |
|
435 | - $filter_query = ''; |
|
436 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
437 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
438 | - } |
|
439 | - // Should use spotter_output also ? |
|
440 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
441 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
442 | - } |
|
443 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
444 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
445 | - } |
|
446 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
447 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
448 | - } |
|
449 | - |
|
450 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
451 | - if ($globalDBdriver == 'mysql') { |
|
452 | - /* |
|
425 | + * Gets Minimal Live Spotter data |
|
426 | + * |
|
427 | + * @return Array the spotter information |
|
428 | + * |
|
429 | + */ |
|
430 | + public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
431 | + { |
|
432 | + global $globalDBdriver, $globalLiveInterval; |
|
433 | + date_default_timezone_set('UTC'); |
|
434 | + |
|
435 | + $filter_query = ''; |
|
436 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
437 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
438 | + } |
|
439 | + // Should use spotter_output also ? |
|
440 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
441 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
442 | + } |
|
443 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
444 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
445 | + } |
|
446 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
447 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
448 | + } |
|
449 | + |
|
450 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
451 | + if ($globalDBdriver == 'mysql') { |
|
452 | + /* |
|
453 | 453 | $query = 'SELECT a.aircraft_shadow, spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk |
454 | 454 | FROM spotter_archive |
455 | 455 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
@@ -460,95 +460,95 @@ discard block |
||
460 | 460 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
461 | 461 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
462 | 462 | |
463 | - } else { |
|
464 | - //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
465 | - /* |
|
463 | + } else { |
|
464 | + //$query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow FROM spotter_archive_output INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive_output l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_archive_output.flightaware_id = s.flightaware_id AND spotter_archive_output.date = s.maxdate '.$filter_query.'INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao'; |
|
465 | + /* |
|
466 | 466 | $query = 'SELECT spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
467 | 467 | FROM spotter_archive_output |
468 | 468 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
469 | 469 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
470 | 470 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
471 | 471 | */ |
472 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
472 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
473 | 473 | FROM spotter_archive_output |
474 | 474 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
475 | 475 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
476 | 476 | '.$filter_query.' LIMIT 200 OFFSET 0'; |
477 | 477 | // .' GROUP BY spotter_output.flightaware_id, spotter_output.ident, spotter_output.aircraft_icao, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao, spotter_output.latitude, spotter_output.longitude, spotter_output.altitude, spotter_output.heading, spotter_output.ground_speed, spotter_output.squawk, a.aircraft_shadow'; |
478 | 478 | |
479 | - } |
|
480 | - //echo $query; |
|
481 | - try { |
|
482 | - $sth = $this->db->prepare($query); |
|
483 | - $sth->execute(); |
|
484 | - } catch(PDOException $e) { |
|
485 | - echo $e->getMessage(); |
|
486 | - die; |
|
487 | - } |
|
488 | - $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
489 | - |
|
490 | - return $spotter_array; |
|
491 | - } |
|
479 | + } |
|
480 | + //echo $query; |
|
481 | + try { |
|
482 | + $sth = $this->db->prepare($query); |
|
483 | + $sth->execute(); |
|
484 | + } catch(PDOException $e) { |
|
485 | + echo $e->getMessage(); |
|
486 | + die; |
|
487 | + } |
|
488 | + $spotter_array = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
489 | + |
|
490 | + return $spotter_array; |
|
491 | + } |
|
492 | 492 | |
493 | 493 | /** |
494 | - * Gets count Live Spotter data |
|
495 | - * |
|
496 | - * @return Array the spotter information |
|
497 | - * |
|
498 | - */ |
|
499 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
500 | - { |
|
501 | - global $globalDBdriver, $globalLiveInterval; |
|
502 | - date_default_timezone_set('UTC'); |
|
503 | - |
|
504 | - $filter_query = ''; |
|
505 | - if (isset($filter['source']) && !empty($filter['source'])) { |
|
506 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
507 | - } |
|
508 | - if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
509 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
510 | - } |
|
511 | - if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
512 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
513 | - } |
|
514 | - if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
515 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
516 | - } |
|
517 | - |
|
518 | - //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
519 | - if ($globalDBdriver == 'mysql') { |
|
494 | + * Gets count Live Spotter data |
|
495 | + * |
|
496 | + * @return Array the spotter information |
|
497 | + * |
|
498 | + */ |
|
499 | + public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
500 | + { |
|
501 | + global $globalDBdriver, $globalLiveInterval; |
|
502 | + date_default_timezone_set('UTC'); |
|
503 | + |
|
504 | + $filter_query = ''; |
|
505 | + if (isset($filter['source']) && !empty($filter['source'])) { |
|
506 | + $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
507 | + } |
|
508 | + if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
|
509 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
510 | + } |
|
511 | + if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
|
512 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
|
513 | + } |
|
514 | + if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
|
515 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
516 | + } |
|
517 | + |
|
518 | + //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
519 | + if ($globalDBdriver == 'mysql') { |
|
520 | 520 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb |
521 | 521 | FROM spotter_archive l |
522 | 522 | WHERE (l.date BETWEEN DATE_SUB('."'".$begindate."'".',INTERVAL '.$globalLiveInterval.' SECOND) AND '."'".$begindate."'".')'.$filter_query; |
523 | - } else { |
|
523 | + } else { |
|
524 | 524 | $query = 'SELECT COUNT(DISTINCT flightaware_id) as nb FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."' - INTERVAL '".$globalLiveInterval." SECONDS' AND "."'".$enddate."'".')'.$filter_query; |
525 | - } |
|
526 | - //echo $query; |
|
527 | - try { |
|
528 | - $sth = $this->db->prepare($query); |
|
529 | - $sth->execute(); |
|
530 | - } catch(PDOException $e) { |
|
531 | - echo $e->getMessage(); |
|
532 | - die; |
|
533 | - } |
|
525 | + } |
|
526 | + //echo $query; |
|
527 | + try { |
|
528 | + $sth = $this->db->prepare($query); |
|
529 | + $sth->execute(); |
|
530 | + } catch(PDOException $e) { |
|
531 | + echo $e->getMessage(); |
|
532 | + die; |
|
533 | + } |
|
534 | 534 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
535 | 535 | $sth->closeCursor(); |
536 | - return $result['nb']; |
|
536 | + return $result['nb']; |
|
537 | 537 | |
538 | - } |
|
538 | + } |
|
539 | 539 | |
540 | 540 | |
541 | 541 | |
542 | 542 | // Spotter_Archive_output |
543 | 543 | |
544 | - /** |
|
545 | - * Gets all the spotter information |
|
546 | - * |
|
547 | - * @return Array the spotter information |
|
548 | - * |
|
549 | - */ |
|
550 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
551 | - { |
|
544 | + /** |
|
545 | + * Gets all the spotter information |
|
546 | + * |
|
547 | + * @return Array the spotter information |
|
548 | + * |
|
549 | + */ |
|
550 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '', $filters=array()) |
|
551 | + { |
|
552 | 552 | global $globalTimezone, $globalDBdriver; |
553 | 553 | require_once(dirname(__FILE__).'/class.Translation.php'); |
554 | 554 | $Translation = new Translation(); |
@@ -562,159 +562,159 @@ discard block |
||
562 | 562 | $filter_query = $this->getFilter($filters); |
563 | 563 | if ($q != "") |
564 | 564 | { |
565 | - if (!is_string($q)) |
|
566 | - { |
|
565 | + if (!is_string($q)) |
|
566 | + { |
|
567 | 567 | return false; |
568 | - } else { |
|
568 | + } else { |
|
569 | 569 | |
570 | 570 | $q_array = explode(" ", $q); |
571 | 571 | |
572 | 572 | foreach ($q_array as $q_item){ |
573 | - $additional_query .= " AND ("; |
|
574 | - $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
575 | - $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
576 | - $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
577 | - $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
578 | - $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
579 | - $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
580 | - $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
581 | - $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
582 | - $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
583 | - $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
584 | - $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
585 | - $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
586 | - $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
587 | - $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
588 | - $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
589 | - $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
590 | - $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
591 | - $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
592 | - $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
593 | - $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
594 | - $translate = $Translation->ident2icao($q_item); |
|
595 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
596 | - $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
597 | - $additional_query .= ")"; |
|
573 | + $additional_query .= " AND ("; |
|
574 | + $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
|
575 | + $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
|
576 | + $additional_query .= "(spotter_archive_output.aircraft_name like '%".$q_item."%') OR "; |
|
577 | + $additional_query .= "(spotter_archive_output.aircraft_manufacturer like '%".$q_item."%') OR "; |
|
578 | + $additional_query .= "(spotter_archive_output.airline_icao like '%".$q_item."%') OR "; |
|
579 | + $additional_query .= "(spotter_archive_output.airline_name like '%".$q_item."%') OR "; |
|
580 | + $additional_query .= "(spotter_archive_output.airline_country like '%".$q_item."%') OR "; |
|
581 | + $additional_query .= "(spotter_archive_output.departure_airport_icao like '%".$q_item."%') OR "; |
|
582 | + $additional_query .= "(spotter_archive_output.departure_airport_name like '%".$q_item."%') OR "; |
|
583 | + $additional_query .= "(spotter_archive_output.departure_airport_city like '%".$q_item."%') OR "; |
|
584 | + $additional_query .= "(spotter_archive_output.departure_airport_country like '%".$q_item."%') OR "; |
|
585 | + $additional_query .= "(spotter_archive_output.arrival_airport_icao like '%".$q_item."%') OR "; |
|
586 | + $additional_query .= "(spotter_archive_output.arrival_airport_name like '%".$q_item."%') OR "; |
|
587 | + $additional_query .= "(spotter_archive_output.arrival_airport_city like '%".$q_item."%') OR "; |
|
588 | + $additional_query .= "(spotter_archive_output.arrival_airport_country like '%".$q_item."%') OR "; |
|
589 | + $additional_query .= "(spotter_archive_output.registration like '%".$q_item."%') OR "; |
|
590 | + $additional_query .= "(spotter_archive_output.owner_name like '%".$q_item."%') OR "; |
|
591 | + $additional_query .= "(spotter_archive_output.pilot_id like '%".$q_item."%') OR "; |
|
592 | + $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
|
593 | + $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
|
594 | + $translate = $Translation->ident2icao($q_item); |
|
595 | + if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
596 | + $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
|
597 | + $additional_query .= ")"; |
|
598 | + } |
|
598 | 599 | } |
599 | - } |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | if ($registration != "") |
603 | 603 | { |
604 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
605 | - if (!is_string($registration)) |
|
606 | - { |
|
604 | + $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
605 | + if (!is_string($registration)) |
|
606 | + { |
|
607 | 607 | return false; |
608 | - } else { |
|
608 | + } else { |
|
609 | 609 | $additional_query .= " AND (spotter_archive_output.registration = '".$registration."')"; |
610 | - } |
|
610 | + } |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | if ($aircraft_icao != "") |
614 | 614 | { |
615 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
616 | - if (!is_string($aircraft_icao)) |
|
617 | - { |
|
615 | + $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
616 | + if (!is_string($aircraft_icao)) |
|
617 | + { |
|
618 | 618 | return false; |
619 | - } else { |
|
619 | + } else { |
|
620 | 620 | $additional_query .= " AND (spotter_archive_output.aircraft_icao = '".$aircraft_icao."')"; |
621 | - } |
|
621 | + } |
|
622 | 622 | } |
623 | 623 | |
624 | 624 | if ($aircraft_manufacturer != "") |
625 | 625 | { |
626 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | - if (!is_string($aircraft_manufacturer)) |
|
628 | - { |
|
626 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
627 | + if (!is_string($aircraft_manufacturer)) |
|
628 | + { |
|
629 | 629 | return false; |
630 | - } else { |
|
630 | + } else { |
|
631 | 631 | $additional_query .= " AND (spotter_archive_output.aircraft_manufacturer = '".$aircraft_manufacturer."')"; |
632 | - } |
|
632 | + } |
|
633 | 633 | } |
634 | 634 | |
635 | 635 | if ($highlights == "true") |
636 | 636 | { |
637 | - if (!is_string($highlights)) |
|
638 | - { |
|
637 | + if (!is_string($highlights)) |
|
638 | + { |
|
639 | 639 | return false; |
640 | - } else { |
|
640 | + } else { |
|
641 | 641 | $additional_query .= " AND (spotter_archive_output.highlight <> '')"; |
642 | - } |
|
642 | + } |
|
643 | 643 | } |
644 | 644 | |
645 | 645 | if ($airline_icao != "") |
646 | 646 | { |
647 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
648 | - if (!is_string($airline_icao)) |
|
649 | - { |
|
647 | + $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
648 | + if (!is_string($airline_icao)) |
|
649 | + { |
|
650 | 650 | return false; |
651 | - } else { |
|
651 | + } else { |
|
652 | 652 | $additional_query .= " AND (spotter_archive_output.airline_icao = '".$airline_icao."')"; |
653 | - } |
|
653 | + } |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | if ($airline_country != "") |
657 | 657 | { |
658 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
659 | - if (!is_string($airline_country)) |
|
660 | - { |
|
658 | + $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
659 | + if (!is_string($airline_country)) |
|
660 | + { |
|
661 | 661 | return false; |
662 | - } else { |
|
662 | + } else { |
|
663 | 663 | $additional_query .= " AND (spotter_archive_output.airline_country = '".$airline_country."')"; |
664 | - } |
|
664 | + } |
|
665 | 665 | } |
666 | 666 | |
667 | 667 | if ($airline_type != "") |
668 | 668 | { |
669 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
670 | - if (!is_string($airline_type)) |
|
671 | - { |
|
669 | + $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
670 | + if (!is_string($airline_type)) |
|
671 | + { |
|
672 | 672 | return false; |
673 | - } else { |
|
673 | + } else { |
|
674 | 674 | if ($airline_type == "passenger") |
675 | 675 | { |
676 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
676 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'passenger')"; |
|
677 | 677 | } |
678 | 678 | if ($airline_type == "cargo") |
679 | 679 | { |
680 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
680 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'cargo')"; |
|
681 | 681 | } |
682 | 682 | if ($airline_type == "military") |
683 | 683 | { |
684 | - $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
684 | + $additional_query .= " AND (spotter_archive_output.airline_type = 'military')"; |
|
685 | + } |
|
685 | 686 | } |
686 | - } |
|
687 | 687 | } |
688 | 688 | |
689 | 689 | if ($airport != "") |
690 | 690 | { |
691 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
692 | - if (!is_string($airport)) |
|
693 | - { |
|
691 | + $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
692 | + if (!is_string($airport)) |
|
693 | + { |
|
694 | 694 | return false; |
695 | - } else { |
|
695 | + } else { |
|
696 | 696 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = '".$airport."') OR (spotter_archive_output.arrival_airport_icao = '".$airport."'))"; |
697 | - } |
|
697 | + } |
|
698 | 698 | } |
699 | 699 | |
700 | 700 | if ($airport_country != "") |
701 | 701 | { |
702 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
703 | - if (!is_string($airport_country)) |
|
704 | - { |
|
702 | + $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
703 | + if (!is_string($airport_country)) |
|
704 | + { |
|
705 | 705 | return false; |
706 | - } else { |
|
706 | + } else { |
|
707 | 707 | $additional_query .= " AND ((spotter_archive_output.departure_airport_country = '".$airport_country."') OR (spotter_archive_output.arrival_airport_country = '".$airport_country."'))"; |
708 | - } |
|
708 | + } |
|
709 | 709 | } |
710 | 710 | |
711 | 711 | if ($callsign != "") |
712 | 712 | { |
713 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | - if (!is_string($callsign)) |
|
715 | - { |
|
713 | + $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
714 | + if (!is_string($callsign)) |
|
715 | + { |
|
716 | 716 | return false; |
717 | - } else { |
|
717 | + } else { |
|
718 | 718 | $translate = $Translation->ident2icao($callsign); |
719 | 719 | if ($translate != $callsign) { |
720 | 720 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
@@ -722,99 +722,99 @@ discard block |
||
722 | 722 | } else { |
723 | 723 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
724 | 724 | } |
725 | - } |
|
725 | + } |
|
726 | 726 | } |
727 | 727 | |
728 | 728 | if ($owner != "") |
729 | 729 | { |
730 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
731 | - if (!is_string($owner)) |
|
732 | - { |
|
730 | + $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
731 | + if (!is_string($owner)) |
|
732 | + { |
|
733 | 733 | return false; |
734 | - } else { |
|
734 | + } else { |
|
735 | 735 | $additional_query .= " AND (spotter_archive_output.owner_name = '".$owner."')"; |
736 | - } |
|
736 | + } |
|
737 | 737 | } |
738 | 738 | |
739 | 739 | if ($pilot_name != "") |
740 | 740 | { |
741 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
742 | - if (!is_string($pilot_name)) |
|
743 | - { |
|
741 | + $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
742 | + if (!is_string($pilot_name)) |
|
743 | + { |
|
744 | 744 | return false; |
745 | - } else { |
|
745 | + } else { |
|
746 | 746 | $additional_query .= " AND (spotter_archive_output.pilot_name = '".$pilot_name."')"; |
747 | - } |
|
747 | + } |
|
748 | 748 | } |
749 | 749 | |
750 | 750 | if ($pilot_id != "") |
751 | 751 | { |
752 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
753 | - if (!is_string($pilot_id)) |
|
754 | - { |
|
752 | + $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
753 | + if (!is_string($pilot_id)) |
|
754 | + { |
|
755 | 755 | return false; |
756 | - } else { |
|
756 | + } else { |
|
757 | 757 | $additional_query .= " AND (spotter_archive_output.pilot_id = '".$pilot_id."')"; |
758 | - } |
|
758 | + } |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | if ($departure_airport_route != "") |
762 | 762 | { |
763 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
764 | - if (!is_string($departure_airport_route)) |
|
765 | - { |
|
763 | + $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
764 | + if (!is_string($departure_airport_route)) |
|
765 | + { |
|
766 | 766 | return false; |
767 | - } else { |
|
767 | + } else { |
|
768 | 768 | $additional_query .= " AND (spotter_archive_output.departure_airport_icao = '".$departure_airport_route."')"; |
769 | - } |
|
769 | + } |
|
770 | 770 | } |
771 | 771 | |
772 | 772 | if ($arrival_airport_route != "") |
773 | 773 | { |
774 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
775 | - if (!is_string($arrival_airport_route)) |
|
776 | - { |
|
774 | + $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
775 | + if (!is_string($arrival_airport_route)) |
|
776 | + { |
|
777 | 777 | return false; |
778 | - } else { |
|
778 | + } else { |
|
779 | 779 | $additional_query .= " AND (spotter_archive_output.arrival_airport_icao = '".$arrival_airport_route."')"; |
780 | - } |
|
780 | + } |
|
781 | 781 | } |
782 | 782 | |
783 | 783 | if ($altitude != "") |
784 | 784 | { |
785 | - $altitude_array = explode(",", $altitude); |
|
785 | + $altitude_array = explode(",", $altitude); |
|
786 | 786 | |
787 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
787 | + $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
788 | + $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
789 | 789 | |
790 | 790 | |
791 | - if ($altitude_array[1] != "") |
|
792 | - { |
|
791 | + if ($altitude_array[1] != "") |
|
792 | + { |
|
793 | 793 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
794 | 794 | $altitude_array[1] = substr($altitude_array[1], 0, -2); |
795 | 795 | $additional_query .= " AND altitude BETWEEN '".$altitude_array[0]."' AND '".$altitude_array[1]."' "; |
796 | - } else { |
|
796 | + } else { |
|
797 | 797 | $altitude_array[0] = substr($altitude_array[0], 0, -2); |
798 | 798 | $additional_query .= " AND altitude <= '".$altitude_array[0]."' "; |
799 | - } |
|
799 | + } |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | if ($date_posted != "") |
803 | 803 | { |
804 | - $date_array = explode(",", $date_posted); |
|
804 | + $date_array = explode(",", $date_posted); |
|
805 | 805 | |
806 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
807 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
806 | + $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
807 | + $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
808 | 808 | |
809 | - if ($globalTimezone != '') { |
|
809 | + if ($globalTimezone != '') { |
|
810 | 810 | date_default_timezone_set($globalTimezone); |
811 | 811 | $datetime = new DateTime(); |
812 | 812 | $offset = $datetime->format('P'); |
813 | - } else $offset = '+00:00'; |
|
813 | + } else $offset = '+00:00'; |
|
814 | 814 | |
815 | 815 | |
816 | - if ($date_array[1] != "") |
|
817 | - { |
|
816 | + if ($date_array[1] != "") |
|
817 | + { |
|
818 | 818 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
819 | 819 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
820 | 820 | if ($globalDBdriver == 'mysql') { |
@@ -822,28 +822,28 @@ discard block |
||
822 | 822 | } else { |
823 | 823 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." <= CAST('".$date_array[1]."' AS TIMESTAMP) "; |
824 | 824 | } |
825 | - } else { |
|
825 | + } else { |
|
826 | 826 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
827 | - if ($globalDBdriver == 'mysql') { |
|
827 | + if ($globalDBdriver == 'mysql') { |
|
828 | 828 | $additional_query .= " AND TIMESTAMP(CONVERT_TZ(spotter_archive_output.date,'+00:00', '".$offset."')) >= '".$date_array[0]."' "; |
829 | 829 | } else { |
830 | 830 | $additional_query .= " AND spotter_archive_output.date::timestamp AT TIME ZONE INTERVAL ".$offset." >= CAST('".$date_array[0]."' AS TIMESTAMP) "; |
831 | 831 | } |
832 | - } |
|
832 | + } |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | if ($limit != "") |
836 | 836 | { |
837 | - $limit_array = explode(",", $limit); |
|
837 | + $limit_array = explode(",", $limit); |
|
838 | 838 | |
839 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
840 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
839 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
840 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
841 | 841 | |
842 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
843 | - { |
|
842 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
843 | + { |
|
844 | 844 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
845 | 845 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
846 | - } |
|
846 | + } |
|
847 | 847 | } |
848 | 848 | |
849 | 849 | |
@@ -874,33 +874,33 @@ discard block |
||
874 | 874 | $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
875 | 875 | |
876 | 876 | return $spotter_array; |
877 | - } |
|
877 | + } |
|
878 | 878 | |
879 | - public function deleteSpotterArchiveData() |
|
880 | - { |
|
879 | + public function deleteSpotterArchiveData() |
|
880 | + { |
|
881 | 881 | global $globalArchiveKeepMonths, $globalDBdriver; |
882 | - date_default_timezone_set('UTC'); |
|
883 | - if ($globalDBdriver == 'mysql') { |
|
882 | + date_default_timezone_set('UTC'); |
|
883 | + if ($globalDBdriver == 'mysql') { |
|
884 | 884 | $query = 'DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$globalArchiveKeepMonths.' MONTH)'; |
885 | 885 | } else { |
886 | 886 | $query = "DELETE FROM spotter_archive_output WHERE spotter_archive_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalArchiveKeepMonths." MONTH'"; |
887 | 887 | } |
888 | - try { |
|
889 | - $sth = $this->db->prepare($query); |
|
890 | - $sth->execute(); |
|
891 | - } catch(PDOException $e) { |
|
892 | - return "error"; |
|
893 | - } |
|
888 | + try { |
|
889 | + $sth = $this->db->prepare($query); |
|
890 | + $sth->execute(); |
|
891 | + } catch(PDOException $e) { |
|
892 | + return "error"; |
|
893 | + } |
|
894 | 894 | } |
895 | 895 | |
896 | - /** |
|
897 | - * Gets all the spotter information based on the callsign |
|
898 | - * |
|
899 | - * @return Array the spotter information |
|
900 | - * |
|
901 | - */ |
|
902 | - public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
903 | - { |
|
896 | + /** |
|
897 | + * Gets all the spotter information based on the callsign |
|
898 | + * |
|
899 | + * @return Array the spotter information |
|
900 | + * |
|
901 | + */ |
|
902 | + public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
|
903 | + { |
|
904 | 904 | $global_query = "SELECT spotter_archive_output.* FROM spotter_archive_output"; |
905 | 905 | |
906 | 906 | date_default_timezone_set('UTC'); |
@@ -912,35 +912,35 @@ discard block |
||
912 | 912 | |
913 | 913 | if ($ident != "") |
914 | 914 | { |
915 | - if (!is_string($ident)) |
|
916 | - { |
|
915 | + if (!is_string($ident)) |
|
916 | + { |
|
917 | 917 | return false; |
918 | - } else { |
|
918 | + } else { |
|
919 | 919 | $additional_query = " AND (spotter_archive_output.ident = :ident)"; |
920 | 920 | $query_values = array(':ident' => $ident); |
921 | - } |
|
921 | + } |
|
922 | 922 | } |
923 | 923 | |
924 | 924 | if ($limit != "") |
925 | 925 | { |
926 | - $limit_array = explode(",", $limit); |
|
926 | + $limit_array = explode(",", $limit); |
|
927 | 927 | |
928 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
929 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
928 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
929 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
930 | 930 | |
931 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
932 | - { |
|
931 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
932 | + { |
|
933 | 933 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
934 | 934 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
935 | - } |
|
935 | + } |
|
936 | 936 | } |
937 | 937 | |
938 | 938 | if ($sort != "") |
939 | 939 | { |
940 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
941 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
940 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
941 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
942 | 942 | } else { |
943 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
943 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
944 | 944 | } |
945 | 945 | |
946 | 946 | $query = $global_query." WHERE spotter_archive_output.ident <> '' ".$additional_query." ".$orderby_query; |
@@ -948,16 +948,16 @@ discard block |
||
948 | 948 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
949 | 949 | |
950 | 950 | return $spotter_array; |
951 | - } |
|
952 | - |
|
953 | - /** |
|
954 | - * Gets all number of flight over countries |
|
955 | - * |
|
956 | - * @return Array the airline country list |
|
957 | - * |
|
958 | - */ |
|
959 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
960 | - { |
|
951 | + } |
|
952 | + |
|
953 | + /** |
|
954 | + * Gets all number of flight over countries |
|
955 | + * |
|
956 | + * @return Array the airline country list |
|
957 | + * |
|
958 | + */ |
|
959 | + public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
960 | + { |
|
961 | 961 | global $globalDBdriver; |
962 | 962 | /* |
963 | 963 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -967,14 +967,14 @@ discard block |
||
967 | 967 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
968 | 968 | FROM countries c, spotter_archive s |
969 | 969 | WHERE c.iso2 = s.over_country "; |
970 | - if ($olderthanmonths > 0) { |
|
971 | - if ($globalDBdriver == 'mysql') { |
|
970 | + if ($olderthanmonths > 0) { |
|
971 | + if ($globalDBdriver == 'mysql') { |
|
972 | 972 | $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
973 | 973 | } else { |
974 | 974 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
975 | 975 | } |
976 | 976 | } |
977 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
977 | + if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
978 | 978 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
979 | 979 | if ($limit) $query .= " LIMIT 0,10"; |
980 | 980 | |
@@ -987,23 +987,23 @@ discard block |
||
987 | 987 | |
988 | 988 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
989 | 989 | { |
990 | - $temp_array['flight_count'] = $row['nb']; |
|
991 | - $temp_array['flight_country'] = $row['name']; |
|
992 | - $temp_array['flight_country_iso3'] = $row['iso3']; |
|
993 | - $temp_array['flight_country_iso2'] = $row['iso2']; |
|
994 | - $flight_array[] = $temp_array; |
|
990 | + $temp_array['flight_count'] = $row['nb']; |
|
991 | + $temp_array['flight_country'] = $row['name']; |
|
992 | + $temp_array['flight_country_iso3'] = $row['iso3']; |
|
993 | + $temp_array['flight_country_iso2'] = $row['iso2']; |
|
994 | + $flight_array[] = $temp_array; |
|
995 | 995 | } |
996 | 996 | return $flight_array; |
997 | - } |
|
998 | - |
|
999 | - /** |
|
1000 | - * Gets last spotter information based on a particular callsign |
|
1001 | - * |
|
1002 | - * @return Array the spotter information |
|
1003 | - * |
|
1004 | - */ |
|
1005 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1006 | - { |
|
997 | + } |
|
998 | + |
|
999 | + /** |
|
1000 | + * Gets last spotter information based on a particular callsign |
|
1001 | + * |
|
1002 | + * @return Array the spotter information |
|
1003 | + * |
|
1004 | + */ |
|
1005 | + public function getDateArchiveSpotterDataById($id,$date) |
|
1006 | + { |
|
1007 | 1007 | $Spotter = new Spotter($this->db); |
1008 | 1008 | date_default_timezone_set('UTC'); |
1009 | 1009 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
@@ -1011,16 +1011,16 @@ discard block |
||
1011 | 1011 | $date = date('c',$date); |
1012 | 1012 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
1013 | 1013 | return $spotter_array; |
1014 | - } |
|
1015 | - |
|
1016 | - /** |
|
1017 | - * Gets all the spotter information based on a particular callsign |
|
1018 | - * |
|
1019 | - * @return Array the spotter information |
|
1020 | - * |
|
1021 | - */ |
|
1022 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1023 | - { |
|
1014 | + } |
|
1015 | + |
|
1016 | + /** |
|
1017 | + * Gets all the spotter information based on a particular callsign |
|
1018 | + * |
|
1019 | + * @return Array the spotter information |
|
1020 | + * |
|
1021 | + */ |
|
1022 | + public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1023 | + { |
|
1024 | 1024 | $Spotter = new Spotter($this->db); |
1025 | 1025 | date_default_timezone_set('UTC'); |
1026 | 1026 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
@@ -1028,16 +1028,16 @@ discard block |
||
1028 | 1028 | $date = date('c',$date); |
1029 | 1029 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
1030 | 1030 | return $spotter_array; |
1031 | - } |
|
1032 | - |
|
1033 | - /** |
|
1034 | - * Gets all the spotter information based on the airport |
|
1035 | - * |
|
1036 | - * @return Array the spotter information |
|
1037 | - * |
|
1038 | - */ |
|
1039 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1040 | - { |
|
1031 | + } |
|
1032 | + |
|
1033 | + /** |
|
1034 | + * Gets all the spotter information based on the airport |
|
1035 | + * |
|
1036 | + * @return Array the spotter information |
|
1037 | + * |
|
1038 | + */ |
|
1039 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1040 | + { |
|
1041 | 1041 | global $global_query; |
1042 | 1042 | $Spotter = new Spotter(); |
1043 | 1043 | date_default_timezone_set('UTC'); |
@@ -1048,35 +1048,35 @@ discard block |
||
1048 | 1048 | |
1049 | 1049 | if ($airport != "") |
1050 | 1050 | { |
1051 | - if (!is_string($airport)) |
|
1052 | - { |
|
1051 | + if (!is_string($airport)) |
|
1052 | + { |
|
1053 | 1053 | return false; |
1054 | - } else { |
|
1054 | + } else { |
|
1055 | 1055 | $additional_query .= " AND ((spotter_archive_output.departure_airport_icao = :airport) OR (spotter_archive_output.arrival_airport_icao = :airport))"; |
1056 | 1056 | $query_values = array(':airport' => $airport); |
1057 | - } |
|
1057 | + } |
|
1058 | 1058 | } |
1059 | 1059 | |
1060 | 1060 | if ($limit != "") |
1061 | 1061 | { |
1062 | - $limit_array = explode(",", $limit); |
|
1062 | + $limit_array = explode(",", $limit); |
|
1063 | 1063 | |
1064 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1065 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1064 | + $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1065 | + $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1066 | 1066 | |
1067 | - if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1068 | - { |
|
1067 | + if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
|
1068 | + { |
|
1069 | 1069 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
1070 | 1070 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
1071 | - } |
|
1071 | + } |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | if ($sort != "") |
1075 | 1075 | { |
1076 | - $search_orderby_array = $Spotter->getOrderBy(); |
|
1077 | - $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1076 | + $search_orderby_array = $Spotter->getOrderBy(); |
|
1077 | + $orderby_query = $search_orderby_array[$sort]['sql']; |
|
1078 | 1078 | } else { |
1079 | - $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1079 | + $orderby_query = " ORDER BY spotter_archive_output.date DESC"; |
|
1080 | 1080 | } |
1081 | 1081 | |
1082 | 1082 | $query = $global_query.$filter_query." spotter_archive_output.ident <> '' ".$additional_query." AND ((spotter_archive_output.departure_airport_icao <> 'NA') AND (spotter_archive_output.arrival_airport_icao <> 'NA')) ".$orderby_query; |
@@ -1084,6 +1084,6 @@ discard block |
||
1084 | 1084 | $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
1085 | 1085 | |
1086 | 1086 | return $spotter_array; |
1087 | - } |
|
1087 | + } |
|
1088 | 1088 | } |
1089 | 1089 | ?> |
1090 | 1090 | \ No newline at end of file |
@@ -8,18 +8,18 @@ discard block |
||
8 | 8 | class update_schema { |
9 | 9 | |
10 | 10 | public static function update_schedule() { |
11 | - $Connection = new Connection(); |
|
12 | - $Schedule = new Schedule(); |
|
13 | - $query = "SELECT * FROM schedule"; |
|
14 | - try { |
|
15 | - $sth = $Connection->db->prepare($query); |
|
11 | + $Connection = new Connection(); |
|
12 | + $Schedule = new Schedule(); |
|
13 | + $query = "SELECT * FROM schedule"; |
|
14 | + try { |
|
15 | + $sth = $Connection->db->prepare($query); |
|
16 | 16 | $sth->execute(); |
17 | - } catch(PDOException $e) { |
|
17 | + } catch(PDOException $e) { |
|
18 | 18 | return "error : ".$e->getMessage()."\n"; |
19 | - } |
|
20 | - while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
22 | - } |
|
19 | + } |
|
20 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
21 | + $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | } |
25 | 25 | /* |
@@ -43,198 +43,198 @@ discard block |
||
43 | 43 | } |
44 | 44 | */ |
45 | 45 | private static function update_from_1() { |
46 | - $Connection = new Connection(); |
|
47 | - // Add new column to routes table |
|
48 | - //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
46 | + $Connection = new Connection(); |
|
47 | + // Add new column to routes table |
|
48 | + //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
49 | 49 | $query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL"; |
50 | - try { |
|
51 | - $sth = $Connection->db->prepare($query); |
|
52 | - $sth->execute(); |
|
53 | - } catch(PDOException $e) { |
|
54 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
55 | - } |
|
56 | - // Copy schedules data to routes table |
|
57 | - self::update_schedule(); |
|
58 | - // Delete schedule table |
|
50 | + try { |
|
51 | + $sth = $Connection->db->prepare($query); |
|
52 | + $sth->execute(); |
|
53 | + } catch(PDOException $e) { |
|
54 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
55 | + } |
|
56 | + // Copy schedules data to routes table |
|
57 | + self::update_schedule(); |
|
58 | + // Delete schedule table |
|
59 | 59 | $query = "DROP TABLE `schedule`"; |
60 | - try { |
|
61 | - $sth = $Connection->db->prepare($query); |
|
62 | - $sth->execute(); |
|
63 | - } catch(PDOException $e) { |
|
64 | - return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
65 | - } |
|
66 | - // Add source column |
|
67 | - $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
68 | - try { |
|
69 | - $sth = $Connection->db->prepare($query); |
|
70 | - $sth->execute(); |
|
71 | - } catch(PDOException $e) { |
|
72 | - return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
73 | - } |
|
60 | + try { |
|
61 | + $sth = $Connection->db->prepare($query); |
|
62 | + $sth->execute(); |
|
63 | + } catch(PDOException $e) { |
|
64 | + return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
65 | + } |
|
66 | + // Add source column |
|
67 | + $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
68 | + try { |
|
69 | + $sth = $Connection->db->prepare($query); |
|
70 | + $sth->execute(); |
|
71 | + } catch(PDOException $e) { |
|
72 | + return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
73 | + } |
|
74 | 74 | // Delete unused column |
75 | 75 | $query = "ALTER TABLE `aircraft_modes` DROP `SerialNo`, DROP `OperatorFlagCode`, DROP `Manufacturer`, DROP `Type`, DROP `FirstRegDate`, DROP `CurrentRegDate`, DROP `Country`, DROP `PreviousID`, DROP `DeRegDate`, DROP `Status`, DROP `PopularName`, DROP `GenericName`, DROP `AircraftClass`, DROP `Engines`, DROP `OwnershipStatus`, DROP `RegisteredOwners`, DROP `MTOW`, DROP `TotalHours`, DROP `YearBuilt`, DROP `CofACategory`, DROP `CofAExpiry`, DROP `UserNotes`, DROP `Interested`, DROP `UserTag`, DROP `InfoUrl`, DROP `PictureUrl1`, DROP `PictureUrl2`, DROP `PictureUrl3`, DROP `UserBool1`, DROP `UserBool2`, DROP `UserBool3`, DROP `UserBool4`, DROP `UserBool5`, DROP `UserString1`, DROP `UserString2`, DROP `UserString3`, DROP `UserString4`, DROP `UserString5`, DROP `UserInt1`, DROP `UserInt2`, DROP `UserInt3`, DROP `UserInt4`, DROP `UserInt5`"; |
76 | - try { |
|
77 | - $sth = $Connection->db->prepare($query); |
|
78 | - $sth->execute(); |
|
79 | - } catch(PDOException $e) { |
|
80 | - return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
81 | - } |
|
76 | + try { |
|
77 | + $sth = $Connection->db->prepare($query); |
|
78 | + $sth->execute(); |
|
79 | + } catch(PDOException $e) { |
|
80 | + return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
81 | + } |
|
82 | 82 | // Add ModeS column |
83 | 83 | $query = "ALTER TABLE `spotter_output` ADD `ModeS` VARCHAR(255) NULL"; |
84 | - try { |
|
85 | - $sth = $Connection->db->prepare($query); |
|
86 | - $sth->execute(); |
|
87 | - } catch(PDOException $e) { |
|
88 | - return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
89 | - } |
|
84 | + try { |
|
85 | + $sth = $Connection->db->prepare($query); |
|
86 | + $sth->execute(); |
|
87 | + } catch(PDOException $e) { |
|
88 | + return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
89 | + } |
|
90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
91 | - try { |
|
92 | - $sth = $Connection->db->prepare($query); |
|
93 | - $sth->execute(); |
|
94 | - } catch(PDOException $e) { |
|
95 | - return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
96 | - } |
|
97 | - // Add auto_increment for aircraft_modes |
|
98 | - $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
99 | - try { |
|
100 | - $sth = $Connection->db->prepare($query); |
|
101 | - $sth->execute(); |
|
102 | - } catch(PDOException $e) { |
|
103 | - return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
104 | - } |
|
105 | - $error = ''; |
|
91 | + try { |
|
92 | + $sth = $Connection->db->prepare($query); |
|
93 | + $sth->execute(); |
|
94 | + } catch(PDOException $e) { |
|
95 | + return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
96 | + } |
|
97 | + // Add auto_increment for aircraft_modes |
|
98 | + $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
99 | + try { |
|
100 | + $sth = $Connection->db->prepare($query); |
|
101 | + $sth->execute(); |
|
102 | + } catch(PDOException $e) { |
|
103 | + return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
104 | + } |
|
105 | + $error = ''; |
|
106 | 106 | $error .= create_db::import_file('../db/acars_live.sql'); |
107 | 107 | $error .= create_db::import_file('../db/config.sql'); |
108 | 108 | // Update schema_version to 2 |
109 | 109 | $query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'"; |
110 | - try { |
|
111 | - $sth = $Connection->db->prepare($query); |
|
112 | - $sth->execute(); |
|
113 | - } catch(PDOException $e) { |
|
114 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
115 | - } |
|
110 | + try { |
|
111 | + $sth = $Connection->db->prepare($query); |
|
112 | + $sth->execute(); |
|
113 | + } catch(PDOException $e) { |
|
114 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
115 | + } |
|
116 | 116 | return $error; |
117 | - } |
|
117 | + } |
|
118 | 118 | |
119 | 119 | private static function update_from_2() { |
120 | - $Connection = new Connection(); |
|
121 | - // Add new column decode to acars_live table |
|
120 | + $Connection = new Connection(); |
|
121 | + // Add new column decode to acars_live table |
|
122 | 122 | $query = "ALTER TABLE `acars_live` ADD `decode` TEXT"; |
123 | - try { |
|
124 | - $sth = $Connection->db->prepare($query); |
|
125 | - $sth->execute(); |
|
126 | - } catch(PDOException $e) { |
|
127 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
128 | - } |
|
129 | - $error = ''; |
|
130 | - // Create table acars_archive |
|
123 | + try { |
|
124 | + $sth = $Connection->db->prepare($query); |
|
125 | + $sth->execute(); |
|
126 | + } catch(PDOException $e) { |
|
127 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
128 | + } |
|
129 | + $error = ''; |
|
130 | + // Create table acars_archive |
|
131 | 131 | $error .= create_db::import_file('../db/acars_archive.sql'); |
132 | 132 | // Update schema_version to 3 |
133 | 133 | $query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'"; |
134 | - try { |
|
135 | - $sth = $Connection->db->prepare($query); |
|
136 | - $sth->execute(); |
|
137 | - } catch(PDOException $e) { |
|
138 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
139 | - } |
|
134 | + try { |
|
135 | + $sth = $Connection->db->prepare($query); |
|
136 | + $sth->execute(); |
|
137 | + } catch(PDOException $e) { |
|
138 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
139 | + } |
|
140 | 140 | return $error; |
141 | 141 | } |
142 | 142 | |
143 | 143 | private static function update_from_3() { |
144 | - $Connection = new Connection(); |
|
145 | - // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
144 | + $Connection = new Connection(); |
|
145 | + // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
146 | 146 | $query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP"; |
147 | - try { |
|
148 | - $sth = $Connection->db->prepare($query); |
|
149 | - $sth->execute(); |
|
150 | - } catch(PDOException $e) { |
|
151 | - return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
152 | - } |
|
153 | - // Add image_source_website column to spotter_image |
|
147 | + try { |
|
148 | + $sth = $Connection->db->prepare($query); |
|
149 | + $sth->execute(); |
|
150 | + } catch(PDOException $e) { |
|
151 | + return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
152 | + } |
|
153 | + // Add image_source_website column to spotter_image |
|
154 | 154 | $query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL"; |
155 | - try { |
|
156 | - $sth = $Connection->db->prepare($query); |
|
157 | - $sth->execute(); |
|
158 | - } catch(PDOException $e) { |
|
159 | - return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
160 | - } |
|
161 | - $error = ''; |
|
155 | + try { |
|
156 | + $sth = $Connection->db->prepare($query); |
|
157 | + $sth->execute(); |
|
158 | + } catch(PDOException $e) { |
|
159 | + return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
160 | + } |
|
161 | + $error = ''; |
|
162 | 162 | // Update schema_version to 4 |
163 | 163 | $query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'"; |
164 | - try { |
|
165 | - $sth = $Connection->db->prepare($query); |
|
166 | - $sth->execute(); |
|
167 | - } catch(PDOException $e) { |
|
168 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
169 | - } |
|
164 | + try { |
|
165 | + $sth = $Connection->db->prepare($query); |
|
166 | + $sth->execute(); |
|
167 | + } catch(PDOException $e) { |
|
168 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
169 | + } |
|
170 | 170 | return $error; |
171 | 171 | } |
172 | 172 | |
173 | 173 | private static function update_from_4() { |
174 | - $Connection = new Connection(); |
|
174 | + $Connection = new Connection(); |
|
175 | 175 | |
176 | - $error = ''; |
|
177 | - // Create table acars_label |
|
176 | + $error = ''; |
|
177 | + // Create table acars_label |
|
178 | 178 | $error .= create_db::import_file('../db/acars_label.sql'); |
179 | 179 | if ($error == '') { |
180 | - // Update schema_version to 5 |
|
181 | - $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
182 | - try { |
|
183 | - $sth = $Connection->db->prepare($query); |
|
180 | + // Update schema_version to 5 |
|
181 | + $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
182 | + try { |
|
183 | + $sth = $Connection->db->prepare($query); |
|
184 | 184 | $sth->execute(); |
185 | - } catch(PDOException $e) { |
|
185 | + } catch(PDOException $e) { |
|
186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
187 | - } |
|
188 | - } |
|
187 | + } |
|
188 | + } |
|
189 | 189 | return $error; |
190 | 190 | } |
191 | 191 | |
192 | 192 | private static function update_from_5() { |
193 | - $Connection = new Connection(); |
|
194 | - // Add columns to translation |
|
193 | + $Connection = new Connection(); |
|
194 | + // Add columns to translation |
|
195 | 195 | $query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;"; |
196 | - try { |
|
197 | - $sth = $Connection->db->prepare($query); |
|
198 | - $sth->execute(); |
|
199 | - } catch(PDOException $e) { |
|
200 | - return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
201 | - } |
|
202 | - // Add aircraft_shadow column to aircraft |
|
203 | - $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
204 | - try { |
|
205 | - $sth = $Connection->db->prepare($query); |
|
206 | - $sth->execute(); |
|
207 | - } catch(PDOException $e) { |
|
208 | - return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
209 | - } |
|
210 | - // Add aircraft_shadow column to spotter_live |
|
211 | - $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
212 | - try { |
|
213 | - $sth = $Connection->db->prepare($query); |
|
214 | - $sth->execute(); |
|
215 | - } catch(PDOException $e) { |
|
216 | - return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
217 | - } |
|
218 | - $error = ''; |
|
219 | - // Update table aircraft |
|
196 | + try { |
|
197 | + $sth = $Connection->db->prepare($query); |
|
198 | + $sth->execute(); |
|
199 | + } catch(PDOException $e) { |
|
200 | + return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
201 | + } |
|
202 | + // Add aircraft_shadow column to aircraft |
|
203 | + $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
204 | + try { |
|
205 | + $sth = $Connection->db->prepare($query); |
|
206 | + $sth->execute(); |
|
207 | + } catch(PDOException $e) { |
|
208 | + return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
209 | + } |
|
210 | + // Add aircraft_shadow column to spotter_live |
|
211 | + $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
212 | + try { |
|
213 | + $sth = $Connection->db->prepare($query); |
|
214 | + $sth->execute(); |
|
215 | + } catch(PDOException $e) { |
|
216 | + return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
217 | + } |
|
218 | + $error = ''; |
|
219 | + // Update table aircraft |
|
220 | 220 | $error .= create_db::import_file('../db/aircraft.sql'); |
221 | 221 | $error .= create_db::import_file('../db/spotter_archive.sql'); |
222 | 222 | |
223 | 223 | // Update schema_version to 6 |
224 | 224 | $query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'"; |
225 | - try { |
|
226 | - $sth = $Connection->db->prepare($query); |
|
227 | - $sth->execute(); |
|
228 | - } catch(PDOException $e) { |
|
229 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
230 | - } |
|
225 | + try { |
|
226 | + $sth = $Connection->db->prepare($query); |
|
227 | + $sth->execute(); |
|
228 | + } catch(PDOException $e) { |
|
229 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
230 | + } |
|
231 | 231 | return $error; |
232 | 232 | } |
233 | 233 | |
234 | 234 | private static function update_from_6() { |
235 | - $Connection = new Connection(); |
|
236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
237 | - $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
235 | + $Connection = new Connection(); |
|
236 | + if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
237 | + $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
240 | 240 | ALTER TABLE spotter_live ADD INDEX(flightaware_id); |
@@ -247,147 +247,147 @@ discard block |
||
247 | 247 | ALTER TABLE aircraft ADD INDEX(icao); |
248 | 248 | ALTER TABLE airport ADD INDEX(icao); |
249 | 249 | ALTER TABLE translation ADD INDEX(Operator);"; |
250 | - try { |
|
251 | - $sth = $Connection->db->prepare($query); |
|
250 | + try { |
|
251 | + $sth = $Connection->db->prepare($query); |
|
252 | 252 | $sth->execute(); |
253 | - } catch(PDOException $e) { |
|
253 | + } catch(PDOException $e) { |
|
254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
255 | - } |
|
256 | - } |
|
257 | - $error = ''; |
|
258 | - // Update table countries |
|
259 | - if ($Connection->tableExists('airspace')) { |
|
260 | - $error .= update_db::update_countries(); |
|
261 | - if ($error != '') return $error; |
|
255 | + } |
|
256 | + } |
|
257 | + $error = ''; |
|
258 | + // Update table countries |
|
259 | + if ($Connection->tableExists('airspace')) { |
|
260 | + $error .= update_db::update_countries(); |
|
261 | + if ($error != '') return $error; |
|
262 | 262 | } |
263 | 263 | // Update schema_version to 7 |
264 | 264 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
265 | - try { |
|
266 | - $sth = $Connection->db->prepare($query); |
|
267 | - $sth->execute(); |
|
268 | - } catch(PDOException $e) { |
|
269 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
270 | - } |
|
265 | + try { |
|
266 | + $sth = $Connection->db->prepare($query); |
|
267 | + $sth->execute(); |
|
268 | + } catch(PDOException $e) { |
|
269 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
270 | + } |
|
271 | 271 | return $error; |
272 | - } |
|
272 | + } |
|
273 | 273 | |
274 | 274 | private static function update_from_7() { |
275 | 275 | global $globalDBname, $globalDBdriver; |
276 | - $Connection = new Connection(); |
|
277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
276 | + $Connection = new Connection(); |
|
277 | + $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
279 | - try { |
|
280 | - $sth = $Connection->db->prepare($query); |
|
281 | - $sth->execute(); |
|
282 | - } catch(PDOException $e) { |
|
283 | - return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
284 | - } |
|
285 | - if ($globalDBdriver == 'mysql') { |
|
286 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
287 | - try { |
|
288 | - $sth = $Connection->db->prepare($query); |
|
279 | + try { |
|
280 | + $sth = $Connection->db->prepare($query); |
|
281 | + $sth->execute(); |
|
282 | + } catch(PDOException $e) { |
|
283 | + return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
284 | + } |
|
285 | + if ($globalDBdriver == 'mysql') { |
|
286 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
287 | + try { |
|
288 | + $sth = $Connection->db->prepare($query); |
|
289 | 289 | $sth->execute(); |
290 | - } catch(PDOException $e) { |
|
290 | + } catch(PDOException $e) { |
|
291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
292 | - } |
|
293 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
294 | - if ($row['engine'] == 'ARCHIVE') { |
|
292 | + } |
|
293 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
294 | + if ($row['engine'] == 'ARCHIVE') { |
|
295 | 295 | $query = "CREATE TABLE copy LIKE spotter_archive; |
296 | 296 | ALTER TABLE copy ENGINE=ARCHIVE; |
297 | 297 | ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
298 | 298 | INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`; |
299 | 299 | DROP TABLE spotter_archive; |
300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
301 | - } else { |
|
302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
303 | - } |
|
304 | - } else { |
|
305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
306 | - } |
|
307 | - try { |
|
308 | - $sth = $Connection->db->prepare($query); |
|
309 | - $sth->execute(); |
|
310 | - } catch(PDOException $e) { |
|
311 | - return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
312 | - } |
|
301 | + } else { |
|
302 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
303 | + } |
|
304 | + } else { |
|
305 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
306 | + } |
|
307 | + try { |
|
308 | + $sth = $Connection->db->prepare($query); |
|
309 | + $sth->execute(); |
|
310 | + } catch(PDOException $e) { |
|
311 | + return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
312 | + } |
|
313 | 313 | |
314 | - $error = ''; |
|
315 | - // Update table aircraft |
|
314 | + $error = ''; |
|
315 | + // Update table aircraft |
|
316 | 316 | $error .= create_db::import_file('../db/source_location.sql'); |
317 | 317 | if ($error != '') return $error; |
318 | 318 | // Update schema_version to 6 |
319 | 319 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
320 | - try { |
|
321 | - $sth = $Connection->db->prepare($query); |
|
322 | - $sth->execute(); |
|
323 | - } catch(PDOException $e) { |
|
324 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
325 | - } |
|
320 | + try { |
|
321 | + $sth = $Connection->db->prepare($query); |
|
322 | + $sth->execute(); |
|
323 | + } catch(PDOException $e) { |
|
324 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
325 | + } |
|
326 | 326 | return $error; |
327 | 327 | } |
328 | 328 | |
329 | 329 | private static function update_from_8() { |
330 | - $Connection = new Connection(); |
|
331 | - $error = ''; |
|
332 | - // Update table aircraft |
|
330 | + $Connection = new Connection(); |
|
331 | + $error = ''; |
|
332 | + // Update table aircraft |
|
333 | 333 | $error .= create_db::import_file('../db/notam.sql'); |
334 | 334 | if ($error != '') return $error; |
335 | 335 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
336 | 336 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
337 | 337 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
338 | 338 | INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());"; |
339 | - try { |
|
340 | - $sth = $Connection->db->prepare($query); |
|
341 | - $sth->execute(); |
|
342 | - } catch(PDOException $e) { |
|
343 | - return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
344 | - } |
|
339 | + try { |
|
340 | + $sth = $Connection->db->prepare($query); |
|
341 | + $sth->execute(); |
|
342 | + } catch(PDOException $e) { |
|
343 | + return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
344 | + } |
|
345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
346 | - try { |
|
347 | - $sth = $Connection->db->prepare($query); |
|
348 | - $sth->execute(); |
|
349 | - } catch(PDOException $e) { |
|
350 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
351 | - } |
|
346 | + try { |
|
347 | + $sth = $Connection->db->prepare($query); |
|
348 | + $sth->execute(); |
|
349 | + } catch(PDOException $e) { |
|
350 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
351 | + } |
|
352 | 352 | return $error; |
353 | 353 | } |
354 | 354 | |
355 | 355 | private static function update_from_9() { |
356 | - $Connection = new Connection(); |
|
357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
356 | + $Connection = new Connection(); |
|
357 | + $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
359 | - try { |
|
360 | - $sth = $Connection->db->prepare($query); |
|
361 | - $sth->execute(); |
|
362 | - } catch(PDOException $e) { |
|
363 | - return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
364 | - } |
|
359 | + try { |
|
360 | + $sth = $Connection->db->prepare($query); |
|
361 | + $sth->execute(); |
|
362 | + } catch(PDOException $e) { |
|
363 | + return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
364 | + } |
|
365 | 365 | $error = ''; |
366 | - // Update table atc |
|
366 | + // Update table atc |
|
367 | 367 | $error .= create_db::import_file('../db/atc.sql'); |
368 | 368 | if ($error != '') return $error; |
369 | 369 | |
370 | 370 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
371 | - try { |
|
372 | - $sth = $Connection->db->prepare($query); |
|
373 | - $sth->execute(); |
|
374 | - } catch(PDOException $e) { |
|
375 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
376 | - } |
|
371 | + try { |
|
372 | + $sth = $Connection->db->prepare($query); |
|
373 | + $sth->execute(); |
|
374 | + } catch(PDOException $e) { |
|
375 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
376 | + } |
|
377 | 377 | return $error; |
378 | 378 | } |
379 | 379 | |
380 | 380 | private static function update_from_10() { |
381 | - $Connection = new Connection(); |
|
382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
383 | - try { |
|
384 | - $sth = $Connection->db->prepare($query); |
|
385 | - $sth->execute(); |
|
386 | - } catch(PDOException $e) { |
|
387 | - return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
388 | - } |
|
381 | + $Connection = new Connection(); |
|
382 | + $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
383 | + try { |
|
384 | + $sth = $Connection->db->prepare($query); |
|
385 | + $sth->execute(); |
|
386 | + } catch(PDOException $e) { |
|
387 | + return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
388 | + } |
|
389 | 389 | $error = ''; |
390 | - // Add tables |
|
390 | + // Add tables |
|
391 | 391 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
392 | 392 | if ($error != '') return $error; |
393 | 393 | $error .= create_db::import_file('../db/metar.sql'); |
@@ -398,76 +398,76 @@ discard block |
||
398 | 398 | if ($error != '') return $error; |
399 | 399 | |
400 | 400 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
401 | - try { |
|
402 | - $sth = $Connection->db->prepare($query); |
|
403 | - $sth->execute(); |
|
404 | - } catch(PDOException $e) { |
|
405 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
406 | - } |
|
401 | + try { |
|
402 | + $sth = $Connection->db->prepare($query); |
|
403 | + $sth->execute(); |
|
404 | + } catch(PDOException $e) { |
|
405 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
406 | + } |
|
407 | 407 | return $error; |
408 | 408 | } |
409 | 409 | |
410 | 410 | private static function update_from_11() { |
411 | 411 | global $globalDBdriver, $globalDBname; |
412 | - $Connection = new Connection(); |
|
413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
414 | - try { |
|
415 | - $sth = $Connection->db->prepare($query); |
|
416 | - $sth->execute(); |
|
417 | - } catch(PDOException $e) { |
|
418 | - return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
419 | - } |
|
420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
421 | - try { |
|
422 | - $sth = $Connection->db->prepare($query); |
|
423 | - $sth->execute(); |
|
424 | - } catch(PDOException $e) { |
|
425 | - return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
426 | - } |
|
427 | - if ($globalDBdriver == 'mysql') { |
|
428 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
429 | - try { |
|
430 | - $sth = $Connection->db->prepare($query); |
|
412 | + $Connection = new Connection(); |
|
413 | + $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
414 | + try { |
|
415 | + $sth = $Connection->db->prepare($query); |
|
416 | + $sth->execute(); |
|
417 | + } catch(PDOException $e) { |
|
418 | + return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
419 | + } |
|
420 | + $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
421 | + try { |
|
422 | + $sth = $Connection->db->prepare($query); |
|
423 | + $sth->execute(); |
|
424 | + } catch(PDOException $e) { |
|
425 | + return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
426 | + } |
|
427 | + if ($globalDBdriver == 'mysql') { |
|
428 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
429 | + try { |
|
430 | + $sth = $Connection->db->prepare($query); |
|
431 | 431 | $sth->execute(); |
432 | - } catch(PDOException $e) { |
|
432 | + } catch(PDOException $e) { |
|
433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
434 | - } |
|
435 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
436 | - if ($row['engine'] == 'ARCHIVE') { |
|
434 | + } |
|
435 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
436 | + if ($row['engine'] == 'ARCHIVE') { |
|
437 | 437 | $query = "CREATE TABLE copy LIKE spotter_archive; |
438 | 438 | ALTER TABLE copy ENGINE=ARCHIVE; |
439 | 439 | ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE; |
440 | 440 | INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`; |
441 | 441 | DROP TABLE spotter_archive; |
442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
443 | - } else { |
|
444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
445 | - } |
|
446 | - } else { |
|
447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
448 | - } |
|
449 | - try { |
|
450 | - $sth = $Connection->db->prepare($query); |
|
451 | - $sth->execute(); |
|
452 | - } catch(PDOException $e) { |
|
453 | - return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
454 | - } |
|
443 | + } else { |
|
444 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
445 | + } |
|
446 | + } else { |
|
447 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
448 | + } |
|
449 | + try { |
|
450 | + $sth = $Connection->db->prepare($query); |
|
451 | + $sth->execute(); |
|
452 | + } catch(PDOException $e) { |
|
453 | + return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
454 | + } |
|
455 | 455 | |
456 | 456 | $error = ''; |
457 | 457 | |
458 | 458 | $query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'"; |
459 | - try { |
|
460 | - $sth = $Connection->db->prepare($query); |
|
461 | - $sth->execute(); |
|
462 | - } catch(PDOException $e) { |
|
463 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
464 | - } |
|
459 | + try { |
|
460 | + $sth = $Connection->db->prepare($query); |
|
461 | + $sth->execute(); |
|
462 | + } catch(PDOException $e) { |
|
463 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
464 | + } |
|
465 | 465 | return $error; |
466 | 466 | } |
467 | 467 | private static function update_from_12() { |
468 | - $Connection = new Connection(); |
|
468 | + $Connection = new Connection(); |
|
469 | 469 | $error = ''; |
470 | - // Add tables |
|
470 | + // Add tables |
|
471 | 471 | $error .= create_db::import_file('../db/stats.sql'); |
472 | 472 | if ($error != '') return $error; |
473 | 473 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
@@ -484,166 +484,166 @@ discard block |
||
484 | 484 | if ($error != '') return $error; |
485 | 485 | |
486 | 486 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
487 | - try { |
|
488 | - $sth = $Connection->db->prepare($query); |
|
489 | - $sth->execute(); |
|
490 | - } catch(PDOException $e) { |
|
491 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
492 | - } |
|
487 | + try { |
|
488 | + $sth = $Connection->db->prepare($query); |
|
489 | + $sth->execute(); |
|
490 | + } catch(PDOException $e) { |
|
491 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
492 | + } |
|
493 | 493 | return $error; |
494 | 494 | } |
495 | 495 | |
496 | 496 | private static function update_from_13() { |
497 | - $Connection = new Connection(); |
|
498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
497 | + $Connection = new Connection(); |
|
498 | + if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
499 | + $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
500 | 500 | try { |
501 | 501 | $sth = $Connection->db->prepare($query); |
502 | 502 | $sth->execute(); |
503 | - } catch(PDOException $e) { |
|
503 | + } catch(PDOException $e) { |
|
504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
505 | - } |
|
505 | + } |
|
506 | 506 | } |
507 | - $error = ''; |
|
507 | + $error = ''; |
|
508 | 508 | $query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'"; |
509 | - try { |
|
510 | - $sth = $Connection->db->prepare($query); |
|
511 | - $sth->execute(); |
|
512 | - } catch(PDOException $e) { |
|
513 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
514 | - } |
|
509 | + try { |
|
510 | + $sth = $Connection->db->prepare($query); |
|
511 | + $sth->execute(); |
|
512 | + } catch(PDOException $e) { |
|
513 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
514 | + } |
|
515 | 515 | return $error; |
516 | 516 | } |
517 | 517 | |
518 | 518 | private static function update_from_14() { |
519 | - $Connection = new Connection(); |
|
519 | + $Connection = new Connection(); |
|
520 | 520 | $error = ''; |
521 | - // Add tables |
|
522 | - if (!$Connection->tableExists('stats_flight')) { |
|
521 | + // Add tables |
|
522 | + if (!$Connection->tableExists('stats_flight')) { |
|
523 | 523 | $error .= create_db::import_file('../db/stats_flight.sql'); |
524 | 524 | if ($error != '') return $error; |
525 | 525 | } |
526 | 526 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
527 | - try { |
|
528 | - $sth = $Connection->db->prepare($query); |
|
529 | - $sth->execute(); |
|
530 | - } catch(PDOException $e) { |
|
531 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
532 | - } |
|
527 | + try { |
|
528 | + $sth = $Connection->db->prepare($query); |
|
529 | + $sth->execute(); |
|
530 | + } catch(PDOException $e) { |
|
531 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
532 | + } |
|
533 | 533 | return $error; |
534 | 534 | } |
535 | 535 | |
536 | 536 | |
537 | 537 | private static function update_from_15() { |
538 | - $Connection = new Connection(); |
|
538 | + $Connection = new Connection(); |
|
539 | 539 | $error = ''; |
540 | - // Add tables |
|
541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
542 | - try { |
|
543 | - $sth = $Connection->db->prepare($query); |
|
544 | - $sth->execute(); |
|
545 | - } catch(PDOException $e) { |
|
546 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
547 | - } |
|
540 | + // Add tables |
|
541 | + $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
542 | + try { |
|
543 | + $sth = $Connection->db->prepare($query); |
|
544 | + $sth->execute(); |
|
545 | + } catch(PDOException $e) { |
|
546 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
547 | + } |
|
548 | 548 | if ($error != '') return $error; |
549 | 549 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
550 | - try { |
|
551 | - $sth = $Connection->db->prepare($query); |
|
552 | - $sth->execute(); |
|
553 | - } catch(PDOException $e) { |
|
554 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
555 | - } |
|
550 | + try { |
|
551 | + $sth = $Connection->db->prepare($query); |
|
552 | + $sth->execute(); |
|
553 | + } catch(PDOException $e) { |
|
554 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
555 | + } |
|
556 | 556 | return $error; |
557 | 557 | } |
558 | 558 | |
559 | 559 | private static function update_from_16() { |
560 | - $Connection = new Connection(); |
|
560 | + $Connection = new Connection(); |
|
561 | 561 | $error = ''; |
562 | - // Add tables |
|
563 | - if (!$Connection->tableExists('stats_registration')) { |
|
562 | + // Add tables |
|
563 | + if (!$Connection->tableExists('stats_registration')) { |
|
564 | 564 | $error .= create_db::import_file('../db/stats_registration.sql'); |
565 | 565 | } |
566 | - if (!$Connection->tableExists('stats_callsign')) { |
|
566 | + if (!$Connection->tableExists('stats_callsign')) { |
|
567 | 567 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
568 | 568 | } |
569 | 569 | if ($error != '') return $error; |
570 | 570 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
571 | - try { |
|
572 | - $sth = $Connection->db->prepare($query); |
|
573 | - $sth->execute(); |
|
574 | - } catch(PDOException $e) { |
|
575 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
576 | - } |
|
571 | + try { |
|
572 | + $sth = $Connection->db->prepare($query); |
|
573 | + $sth->execute(); |
|
574 | + } catch(PDOException $e) { |
|
575 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
576 | + } |
|
577 | 577 | return $error; |
578 | 578 | } |
579 | 579 | |
580 | 580 | private static function update_from_17() { |
581 | - $Connection = new Connection(); |
|
581 | + $Connection = new Connection(); |
|
582 | 582 | $error = ''; |
583 | - // Add tables |
|
584 | - if (!$Connection->tableExists('stats_country')) { |
|
583 | + // Add tables |
|
584 | + if (!$Connection->tableExists('stats_country')) { |
|
585 | 585 | $error .= create_db::import_file('../db/stats_country.sql'); |
586 | 586 | } |
587 | 587 | if ($error != '') return $error; |
588 | 588 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
589 | - try { |
|
590 | - $sth = $Connection->db->prepare($query); |
|
591 | - $sth->execute(); |
|
592 | - } catch(PDOException $e) { |
|
593 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
594 | - } |
|
589 | + try { |
|
590 | + $sth = $Connection->db->prepare($query); |
|
591 | + $sth->execute(); |
|
592 | + } catch(PDOException $e) { |
|
593 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
594 | + } |
|
595 | 595 | return $error; |
596 | 596 | } |
597 | 597 | private static function update_from_18() { |
598 | - $Connection = new Connection(); |
|
598 | + $Connection = new Connection(); |
|
599 | 599 | $error = ''; |
600 | - // Modify stats_airport table |
|
601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
602 | - $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
603 | - try { |
|
604 | - $sth = $Connection->db->prepare($query); |
|
605 | - $sth->execute(); |
|
606 | - } catch(PDOException $e) { |
|
607 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
608 | - } |
|
609 | - } |
|
600 | + // Modify stats_airport table |
|
601 | + if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
602 | + $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
603 | + try { |
|
604 | + $sth = $Connection->db->prepare($query); |
|
605 | + $sth->execute(); |
|
606 | + } catch(PDOException $e) { |
|
607 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
608 | + } |
|
609 | + } |
|
610 | 610 | if ($error != '') return $error; |
611 | 611 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
612 | - try { |
|
613 | - $sth = $Connection->db->prepare($query); |
|
614 | - $sth->execute(); |
|
615 | - } catch(PDOException $e) { |
|
616 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
617 | - } |
|
612 | + try { |
|
613 | + $sth = $Connection->db->prepare($query); |
|
614 | + $sth->execute(); |
|
615 | + } catch(PDOException $e) { |
|
616 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
617 | + } |
|
618 | 618 | return $error; |
619 | 619 | } |
620 | 620 | |
621 | 621 | private static function update_from_19() { |
622 | - $Connection = new Connection(); |
|
622 | + $Connection = new Connection(); |
|
623 | 623 | $error = ''; |
624 | - // Update airport table |
|
624 | + // Update airport table |
|
625 | 625 | $error .= create_db::import_file('../db/airport.sql'); |
626 | 626 | if ($error != '') return 'Import airport.sql : '.$error; |
627 | 627 | // Remove primary key on Spotter_Archive |
628 | 628 | $query = "alter table spotter_archive drop spotter_archive_id"; |
629 | - try { |
|
630 | - $sth = $Connection->db->prepare($query); |
|
631 | - $sth->execute(); |
|
632 | - } catch(PDOException $e) { |
|
633 | - return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
634 | - } |
|
629 | + try { |
|
630 | + $sth = $Connection->db->prepare($query); |
|
631 | + $sth->execute(); |
|
632 | + } catch(PDOException $e) { |
|
633 | + return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
634 | + } |
|
635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
636 | - try { |
|
637 | - $sth = $Connection->db->prepare($query); |
|
638 | - $sth->execute(); |
|
639 | - } catch(PDOException $e) { |
|
640 | - return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
641 | - } |
|
636 | + try { |
|
637 | + $sth = $Connection->db->prepare($query); |
|
638 | + $sth->execute(); |
|
639 | + } catch(PDOException $e) { |
|
640 | + return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
641 | + } |
|
642 | 642 | if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
643 | 643 | // Add column over_country |
644 | - $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
644 | + $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
645 | 645 | try { |
646 | - $sth = $Connection->db->prepare($query); |
|
646 | + $sth = $Connection->db->prepare($query); |
|
647 | 647 | $sth->execute(); |
648 | 648 | } catch(PDOException $e) { |
649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | } |
652 | 652 | if (!$Connection->checkColumnName('spotter_live','over_country')) { |
653 | 653 | // Add column over_country |
654 | - $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
654 | + $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
655 | 655 | try { |
656 | - $sth = $Connection->db->prepare($query); |
|
656 | + $sth = $Connection->db->prepare($query); |
|
657 | 657 | $sth->execute(); |
658 | 658 | } catch(PDOException $e) { |
659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -661,74 +661,74 @@ discard block |
||
661 | 661 | } |
662 | 662 | if (!$Connection->checkColumnName('spotter_output','source_name')) { |
663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
664 | - $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
664 | + $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
665 | 665 | try { |
666 | 666 | $sth = $Connection->db->prepare($query); |
667 | 667 | $sth->execute(); |
668 | 668 | } catch(PDOException $e) { |
669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
670 | - } |
|
671 | - } |
|
670 | + } |
|
671 | + } |
|
672 | 672 | if (!$Connection->checkColumnName('spotter_live','source_name')) { |
673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
674 | - $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
674 | + $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
675 | 675 | try { |
676 | 676 | $sth = $Connection->db->prepare($query); |
677 | 677 | $sth->execute(); |
678 | 678 | } catch(PDOException $e) { |
679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
680 | - } |
|
681 | - } |
|
680 | + } |
|
681 | + } |
|
682 | 682 | if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
684 | - $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
684 | + $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
685 | 685 | try { |
686 | 686 | $sth = $Connection->db->prepare($query); |
687 | 687 | $sth->execute(); |
688 | 688 | } catch(PDOException $e) { |
689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
690 | - } |
|
691 | - } |
|
690 | + } |
|
691 | + } |
|
692 | 692 | if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
694 | - $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
694 | + $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
695 | 695 | try { |
696 | 696 | $sth = $Connection->db->prepare($query); |
697 | 697 | $sth->execute(); |
698 | 698 | } catch(PDOException $e) { |
699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
700 | - } |
|
701 | - } |
|
700 | + } |
|
701 | + } |
|
702 | 702 | if ($error != '') return $error; |
703 | 703 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
704 | - try { |
|
705 | - $sth = $Connection->db->prepare($query); |
|
706 | - $sth->execute(); |
|
707 | - } catch(PDOException $e) { |
|
708 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
709 | - } |
|
704 | + try { |
|
705 | + $sth = $Connection->db->prepare($query); |
|
706 | + $sth->execute(); |
|
707 | + } catch(PDOException $e) { |
|
708 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
709 | + } |
|
710 | 710 | return $error; |
711 | 711 | } |
712 | 712 | |
713 | 713 | private static function update_from_20() { |
714 | 714 | global $globalIVAO, $globalVATSIM, $globalphpVMS; |
715 | - $Connection = new Connection(); |
|
715 | + $Connection = new Connection(); |
|
716 | 716 | $error = ''; |
717 | - // Update airline table |
|
718 | - if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
717 | + // Update airline table |
|
718 | + if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
721 | 721 | } |
722 | 722 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
723 | 723 | // Add column over_country |
724 | - $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
725 | - try { |
|
724 | + $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
725 | + try { |
|
726 | 726 | $sth = $Connection->db->prepare($query); |
727 | 727 | $sth->execute(); |
728 | 728 | } catch(PDOException $e) { |
729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
730 | - } |
|
731 | - } |
|
730 | + } |
|
731 | + } |
|
732 | 732 | if ($error != '') return $error; |
733 | 733 | /* |
734 | 734 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
@@ -738,12 +738,12 @@ discard block |
||
738 | 738 | } |
739 | 739 | */ |
740 | 740 | $query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'"; |
741 | - try { |
|
742 | - $sth = $Connection->db->prepare($query); |
|
743 | - $sth->execute(); |
|
744 | - } catch(PDOException $e) { |
|
745 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
746 | - } |
|
741 | + try { |
|
742 | + $sth = $Connection->db->prepare($query); |
|
743 | + $sth->execute(); |
|
744 | + } catch(PDOException $e) { |
|
745 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
746 | + } |
|
747 | 747 | return $error; |
748 | 748 | } |
749 | 749 | |
@@ -762,35 +762,35 @@ discard block |
||
762 | 762 | if ($error != '') return $error; |
763 | 763 | } |
764 | 764 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
765 | - try { |
|
766 | - $sth = $Connection->db->prepare($query); |
|
767 | - $sth->execute(); |
|
768 | - } catch(PDOException $e) { |
|
769 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
770 | - } |
|
765 | + try { |
|
766 | + $sth = $Connection->db->prepare($query); |
|
767 | + $sth->execute(); |
|
768 | + } catch(PDOException $e) { |
|
769 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
770 | + } |
|
771 | 771 | return $error; |
772 | 772 | } |
773 | 773 | |
774 | 774 | private static function update_from_22() { |
775 | 775 | global $globalDBdriver; |
776 | - $Connection = new Connection(); |
|
776 | + $Connection = new Connection(); |
|
777 | 777 | $error = ''; |
778 | 778 | // Add table stats polar |
779 | - if (!$Connection->tableExists('stats_source')) { |
|
779 | + if (!$Connection->tableExists('stats_source')) { |
|
780 | 780 | if ($globalDBdriver == 'mysql') { |
781 | - $error .= create_db::import_file('../db/stats_source.sql'); |
|
781 | + $error .= create_db::import_file('../db/stats_source.sql'); |
|
782 | 782 | } else { |
783 | 783 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
784 | 784 | } |
785 | 785 | if ($error != '') return $error; |
786 | 786 | } |
787 | 787 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
788 | - try { |
|
789 | - $sth = $Connection->db->prepare($query); |
|
790 | - $sth->execute(); |
|
791 | - } catch(PDOException $e) { |
|
792 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
793 | - } |
|
788 | + try { |
|
789 | + $sth = $Connection->db->prepare($query); |
|
790 | + $sth->execute(); |
|
791 | + } catch(PDOException $e) { |
|
792 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
793 | + } |
|
794 | 794 | return $error; |
795 | 795 | } |
796 | 796 | |
@@ -821,14 +821,14 @@ discard block |
||
821 | 821 | } |
822 | 822 | if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
824 | - $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
824 | + $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
825 | 825 | try { |
826 | 826 | $sth = $Connection->db->prepare($query); |
827 | 827 | $sth->execute(); |
828 | 828 | } catch(PDOException $e) { |
829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
830 | - } |
|
831 | - } |
|
830 | + } |
|
831 | + } |
|
832 | 832 | |
833 | 833 | $query = "UPDATE config SET value = '24' WHERE name = 'schema_version'"; |
834 | 834 | try { |
@@ -1164,137 +1164,137 @@ discard block |
||
1164 | 1164 | } |
1165 | 1165 | |
1166 | 1166 | |
1167 | - public static function check_version($update = false) { |
|
1168 | - global $globalDBname; |
|
1169 | - $version = 0; |
|
1170 | - $Connection = new Connection(); |
|
1171 | - if ($Connection->tableExists('aircraft')) { |
|
1172 | - if (!$Connection->tableExists('config')) { |
|
1173 | - $version = '1'; |
|
1174 | - if ($update) return self::update_from_1(); |
|
1175 | - else return $version; |
|
1167 | + public static function check_version($update = false) { |
|
1168 | + global $globalDBname; |
|
1169 | + $version = 0; |
|
1170 | + $Connection = new Connection(); |
|
1171 | + if ($Connection->tableExists('aircraft')) { |
|
1172 | + if (!$Connection->tableExists('config')) { |
|
1173 | + $version = '1'; |
|
1174 | + if ($update) return self::update_from_1(); |
|
1175 | + else return $version; |
|
1176 | 1176 | } else { |
1177 | - $Connection = new Connection(); |
|
1178 | - $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
1179 | - try { |
|
1180 | - $sth = $Connection->db->prepare($query); |
|
1181 | - $sth->execute(); |
|
1182 | - } catch(PDOException $e) { |
|
1177 | + $Connection = new Connection(); |
|
1178 | + $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
1179 | + try { |
|
1180 | + $sth = $Connection->db->prepare($query); |
|
1181 | + $sth->execute(); |
|
1182 | + } catch(PDOException $e) { |
|
1183 | 1183 | return "error : ".$e->getMessage()."\n"; |
1184 | - } |
|
1185 | - $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
1186 | - if ($update) { |
|
1187 | - if ($result['value'] == '2') { |
|
1188 | - $error = self::update_from_2(); |
|
1189 | - if ($error != '') return $error; |
|
1190 | - else return self::check_version(true); |
|
1191 | - } elseif ($result['value'] == '3') { |
|
1192 | - $error = self::update_from_3(); |
|
1193 | - if ($error != '') return $error; |
|
1194 | - else return self::check_version(true); |
|
1195 | - } elseif ($result['value'] == '4') { |
|
1196 | - $error = self::update_from_4(); |
|
1197 | - if ($error != '') return $error; |
|
1198 | - else return self::check_version(true); |
|
1199 | - } elseif ($result['value'] == '5') { |
|
1200 | - $error = self::update_from_5(); |
|
1201 | - if ($error != '') return $error; |
|
1202 | - else return self::check_version(true); |
|
1203 | - } elseif ($result['value'] == '6') { |
|
1204 | - $error = self::update_from_6(); |
|
1205 | - if ($error != '') return $error; |
|
1206 | - else return self::check_version(true); |
|
1207 | - } elseif ($result['value'] == '7') { |
|
1208 | - $error = self::update_from_7(); |
|
1209 | - if ($error != '') return $error; |
|
1210 | - else return self::check_version(true); |
|
1211 | - } elseif ($result['value'] == '8') { |
|
1212 | - $error = self::update_from_8(); |
|
1213 | - if ($error != '') return $error; |
|
1214 | - else return self::check_version(true); |
|
1215 | - } elseif ($result['value'] == '9') { |
|
1216 | - $error = self::update_from_9(); |
|
1217 | - if ($error != '') return $error; |
|
1218 | - else return self::check_version(true); |
|
1219 | - } elseif ($result['value'] == '10') { |
|
1220 | - $error = self::update_from_10(); |
|
1221 | - if ($error != '') return $error; |
|
1222 | - else return self::check_version(true); |
|
1223 | - } elseif ($result['value'] == '11') { |
|
1224 | - $error = self::update_from_11(); |
|
1225 | - if ($error != '') return $error; |
|
1226 | - else return self::check_version(true); |
|
1227 | - } elseif ($result['value'] == '12') { |
|
1228 | - $error = self::update_from_12(); |
|
1229 | - if ($error != '') return $error; |
|
1230 | - else return self::check_version(true); |
|
1231 | - } elseif ($result['value'] == '13') { |
|
1232 | - $error = self::update_from_13(); |
|
1233 | - if ($error != '') return $error; |
|
1234 | - else return self::check_version(true); |
|
1235 | - } elseif ($result['value'] == '14') { |
|
1236 | - $error = self::update_from_14(); |
|
1237 | - if ($error != '') return $error; |
|
1238 | - else return self::check_version(true); |
|
1239 | - } elseif ($result['value'] == '15') { |
|
1240 | - $error = self::update_from_15(); |
|
1241 | - if ($error != '') return $error; |
|
1242 | - else return self::check_version(true); |
|
1243 | - } elseif ($result['value'] == '16') { |
|
1244 | - $error = self::update_from_16(); |
|
1245 | - if ($error != '') return $error; |
|
1246 | - else return self::check_version(true); |
|
1247 | - } elseif ($result['value'] == '17') { |
|
1248 | - $error = self::update_from_17(); |
|
1249 | - if ($error != '') return $error; |
|
1250 | - else return self::check_version(true); |
|
1251 | - } elseif ($result['value'] == '18') { |
|
1252 | - $error = self::update_from_18(); |
|
1253 | - if ($error != '') return $error; |
|
1254 | - else return self::check_version(true); |
|
1255 | - } elseif ($result['value'] == '19') { |
|
1256 | - $error = self::update_from_19(); |
|
1257 | - if ($error != '') return $error; |
|
1258 | - else return self::check_version(true); |
|
1259 | - } elseif ($result['value'] == '20') { |
|
1260 | - $error = self::update_from_20(); |
|
1261 | - if ($error != '') return $error; |
|
1262 | - else return self::check_version(true); |
|
1263 | - } elseif ($result['value'] == '21') { |
|
1264 | - $error = self::update_from_21(); |
|
1265 | - if ($error != '') return $error; |
|
1266 | - else return self::check_version(true); |
|
1267 | - } elseif ($result['value'] == '22') { |
|
1268 | - $error = self::update_from_22(); |
|
1269 | - if ($error != '') return $error; |
|
1270 | - else return self::check_version(true); |
|
1271 | - } elseif ($result['value'] == '23') { |
|
1272 | - $error = self::update_from_23(); |
|
1273 | - if ($error != '') return $error; |
|
1274 | - else return self::check_version(true); |
|
1275 | - } elseif ($result['value'] == '24') { |
|
1276 | - $error = self::update_from_24(); |
|
1277 | - if ($error != '') return $error; |
|
1278 | - else return self::check_version(true); |
|
1279 | - } elseif ($result['value'] == '25') { |
|
1280 | - $error = self::update_from_25(); |
|
1281 | - if ($error != '') return $error; |
|
1282 | - else return self::check_version(true); |
|
1283 | - } elseif ($result['value'] == '26') { |
|
1284 | - $error = self::update_from_26(); |
|
1285 | - if ($error != '') return $error; |
|
1286 | - else return self::check_version(true); |
|
1287 | - } elseif ($result['value'] == '27') { |
|
1288 | - $error = self::update_from_27(); |
|
1289 | - if ($error != '') return $error; |
|
1290 | - else return self::check_version(true); |
|
1291 | - } else return ''; |
|
1292 | - } |
|
1293 | - else return $result['value']; |
|
1184 | + } |
|
1185 | + $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
1186 | + if ($update) { |
|
1187 | + if ($result['value'] == '2') { |
|
1188 | + $error = self::update_from_2(); |
|
1189 | + if ($error != '') return $error; |
|
1190 | + else return self::check_version(true); |
|
1191 | + } elseif ($result['value'] == '3') { |
|
1192 | + $error = self::update_from_3(); |
|
1193 | + if ($error != '') return $error; |
|
1194 | + else return self::check_version(true); |
|
1195 | + } elseif ($result['value'] == '4') { |
|
1196 | + $error = self::update_from_4(); |
|
1197 | + if ($error != '') return $error; |
|
1198 | + else return self::check_version(true); |
|
1199 | + } elseif ($result['value'] == '5') { |
|
1200 | + $error = self::update_from_5(); |
|
1201 | + if ($error != '') return $error; |
|
1202 | + else return self::check_version(true); |
|
1203 | + } elseif ($result['value'] == '6') { |
|
1204 | + $error = self::update_from_6(); |
|
1205 | + if ($error != '') return $error; |
|
1206 | + else return self::check_version(true); |
|
1207 | + } elseif ($result['value'] == '7') { |
|
1208 | + $error = self::update_from_7(); |
|
1209 | + if ($error != '') return $error; |
|
1210 | + else return self::check_version(true); |
|
1211 | + } elseif ($result['value'] == '8') { |
|
1212 | + $error = self::update_from_8(); |
|
1213 | + if ($error != '') return $error; |
|
1214 | + else return self::check_version(true); |
|
1215 | + } elseif ($result['value'] == '9') { |
|
1216 | + $error = self::update_from_9(); |
|
1217 | + if ($error != '') return $error; |
|
1218 | + else return self::check_version(true); |
|
1219 | + } elseif ($result['value'] == '10') { |
|
1220 | + $error = self::update_from_10(); |
|
1221 | + if ($error != '') return $error; |
|
1222 | + else return self::check_version(true); |
|
1223 | + } elseif ($result['value'] == '11') { |
|
1224 | + $error = self::update_from_11(); |
|
1225 | + if ($error != '') return $error; |
|
1226 | + else return self::check_version(true); |
|
1227 | + } elseif ($result['value'] == '12') { |
|
1228 | + $error = self::update_from_12(); |
|
1229 | + if ($error != '') return $error; |
|
1230 | + else return self::check_version(true); |
|
1231 | + } elseif ($result['value'] == '13') { |
|
1232 | + $error = self::update_from_13(); |
|
1233 | + if ($error != '') return $error; |
|
1234 | + else return self::check_version(true); |
|
1235 | + } elseif ($result['value'] == '14') { |
|
1236 | + $error = self::update_from_14(); |
|
1237 | + if ($error != '') return $error; |
|
1238 | + else return self::check_version(true); |
|
1239 | + } elseif ($result['value'] == '15') { |
|
1240 | + $error = self::update_from_15(); |
|
1241 | + if ($error != '') return $error; |
|
1242 | + else return self::check_version(true); |
|
1243 | + } elseif ($result['value'] == '16') { |
|
1244 | + $error = self::update_from_16(); |
|
1245 | + if ($error != '') return $error; |
|
1246 | + else return self::check_version(true); |
|
1247 | + } elseif ($result['value'] == '17') { |
|
1248 | + $error = self::update_from_17(); |
|
1249 | + if ($error != '') return $error; |
|
1250 | + else return self::check_version(true); |
|
1251 | + } elseif ($result['value'] == '18') { |
|
1252 | + $error = self::update_from_18(); |
|
1253 | + if ($error != '') return $error; |
|
1254 | + else return self::check_version(true); |
|
1255 | + } elseif ($result['value'] == '19') { |
|
1256 | + $error = self::update_from_19(); |
|
1257 | + if ($error != '') return $error; |
|
1258 | + else return self::check_version(true); |
|
1259 | + } elseif ($result['value'] == '20') { |
|
1260 | + $error = self::update_from_20(); |
|
1261 | + if ($error != '') return $error; |
|
1262 | + else return self::check_version(true); |
|
1263 | + } elseif ($result['value'] == '21') { |
|
1264 | + $error = self::update_from_21(); |
|
1265 | + if ($error != '') return $error; |
|
1266 | + else return self::check_version(true); |
|
1267 | + } elseif ($result['value'] == '22') { |
|
1268 | + $error = self::update_from_22(); |
|
1269 | + if ($error != '') return $error; |
|
1270 | + else return self::check_version(true); |
|
1271 | + } elseif ($result['value'] == '23') { |
|
1272 | + $error = self::update_from_23(); |
|
1273 | + if ($error != '') return $error; |
|
1274 | + else return self::check_version(true); |
|
1275 | + } elseif ($result['value'] == '24') { |
|
1276 | + $error = self::update_from_24(); |
|
1277 | + if ($error != '') return $error; |
|
1278 | + else return self::check_version(true); |
|
1279 | + } elseif ($result['value'] == '25') { |
|
1280 | + $error = self::update_from_25(); |
|
1281 | + if ($error != '') return $error; |
|
1282 | + else return self::check_version(true); |
|
1283 | + } elseif ($result['value'] == '26') { |
|
1284 | + $error = self::update_from_26(); |
|
1285 | + if ($error != '') return $error; |
|
1286 | + else return self::check_version(true); |
|
1287 | + } elseif ($result['value'] == '27') { |
|
1288 | + $error = self::update_from_27(); |
|
1289 | + if ($error != '') return $error; |
|
1290 | + else return self::check_version(true); |
|
1291 | + } else return ''; |
|
1292 | + } |
|
1293 | + else return $result['value']; |
|
1294 | 1294 | } |
1295 | 1295 | |
1296 | - } else return $version; |
|
1297 | - } |
|
1296 | + } else return $version; |
|
1297 | + } |
|
1298 | 1298 | |
1299 | 1299 | } |
1300 | 1300 | //echo update_schema::check_version(); |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | <div id="showdetails" class="showdetails"></div> |
37 | 37 | <div id="infobox" class="infobox"><h4><?php echo _("Aircrafts detected"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div> |
38 | 38 | <?php |
39 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
39 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
40 | 40 | |
41 | 41 | ?> |
42 | 42 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php"></script> |
43 | 43 | <?php |
44 | - } |
|
44 | + } |
|
45 | 45 | ?> |
46 | 46 | <div id="dialog" title="<?php echo _("Session has timed-out"); ?>"> |
47 | 47 | <p><?php echo _("In order to save data consumption web page times out after 30 minutes. Close this dialog to continue."); ?></p> |
@@ -55,34 +55,34 @@ discard block |
||
55 | 55 | <li><a href="#" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
56 | 56 | <li><a href="#" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
57 | 57 | <?php |
58 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
58 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
59 | 59 | if (isset($globalArchive) && $globalArchive == TRUE) { |
60 | 60 | ?> |
61 | 61 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
62 | 62 | <?php |
63 | 63 | } |
64 | - } |
|
64 | + } |
|
65 | 65 | ?> |
66 | 66 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
67 | 67 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
68 | 68 | <li><a href="#settings" role="tab" title="<?php echo _("Settings"); ?>"><i class="fa fa-gears"></i></a></li> |
69 | 69 | <?php |
70 | - if (isset($globalMap3D) && $globalMap3D) { |
|
70 | + if (isset($globalMap3D) && $globalMap3D) { |
|
71 | 71 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
72 | 72 | ?> |
73 | 73 | <li><a href="#" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
74 | 74 | <?php |
75 | - } else { |
|
76 | - if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
75 | + } else { |
|
76 | + if (isset($globalMapSatellites) && $globalMapSatellites) { |
|
77 | 77 | ?> |
78 | 78 | <li><a href="#satellites" role="tab" title="<?php echo _("Satellites"); ?>"><i class="satellite"></i></a></li> |
79 | 79 | <?php |
80 | - } |
|
80 | + } |
|
81 | 81 | ?> |
82 | 82 | <li><a href="#" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
83 | 83 | <?php |
84 | 84 | } |
85 | - } |
|
85 | + } |
|
86 | 86 | ?> |
87 | 87 | </ul> |
88 | 88 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | ?> |
157 | 157 | </div> |
158 | 158 | <?php |
159 | - if (isset($globalArchive) && $globalArchive == TRUE) { |
|
159 | + if (isset($globalArchive) && $globalArchive == TRUE) { |
|
160 | 160 | ?> |
161 | 161 | <div class="sidebar-pane" id="archive"> |
162 | 162 | <h1 class="sidebar-header"><?php echo _("Playback"); ?> <i>Bêta</i><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | </form> |
217 | 217 | </div> |
218 | 218 | <?php |
219 | - } |
|
219 | + } |
|
220 | 220 | ?> |
221 | 221 | <div class="sidebar-pane" id="settings"> |
222 | 222 | <h1 class="sidebar-header"><?php echo _("Settings"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -227,56 +227,56 @@ discard block |
||
227 | 227 | <?php |
228 | 228 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
229 | 229 | else $MapType = $_COOKIE['MapType']; |
230 | - ?> |
|
230 | + ?> |
|
231 | 231 | <?php |
232 | 232 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
233 | - ?> |
|
233 | + ?> |
|
234 | 234 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
235 | 235 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
236 | 236 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
237 | 237 | <?php |
238 | 238 | } |
239 | - ?> |
|
239 | + ?> |
|
240 | 240 | <?php |
241 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
242 | - ?> |
|
241 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
242 | + ?> |
|
243 | 243 | <?php |
244 | - if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
245 | - ?> |
|
244 | + if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
|
245 | + ?> |
|
246 | 246 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
247 | 247 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
248 | 248 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
249 | 249 | <?php |
250 | - } |
|
251 | - ?> |
|
250 | + } |
|
251 | + ?> |
|
252 | 252 | <?php |
253 | - if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
254 | - ?> |
|
253 | + if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
|
254 | + ?> |
|
255 | 255 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
256 | 256 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
257 | 257 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
258 | 258 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
259 | 259 | <?php |
260 | - } |
|
261 | - ?> |
|
260 | + } |
|
261 | + ?> |
|
262 | 262 | <?php |
263 | - if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
264 | - ?> |
|
263 | + if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
|
264 | + ?> |
|
265 | 265 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
266 | 266 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
267 | 267 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
268 | 268 | <?php |
269 | - } |
|
270 | - ?> |
|
269 | + } |
|
270 | + ?> |
|
271 | 271 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
272 | 272 | <?php |
273 | 273 | } |
274 | - ?> |
|
274 | + ?> |
|
275 | 275 | <?php |
276 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
276 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
277 | 277 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
278 | 278 | else $MapBoxId = $_COOKIE['MapTypeId']; |
279 | - ?> |
|
279 | + ?> |
|
280 | 280 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
281 | 281 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
282 | 282 | <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
291 | 291 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
292 | 292 | <?php |
293 | - } |
|
294 | - ?> |
|
293 | + } |
|
294 | + ?> |
|
295 | 295 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
296 | 296 | </select> |
297 | 297 | </li> |
298 | 298 | <?php |
299 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
299 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
300 | 300 | ?> |
301 | 301 | <li><?php echo _("Type of Terrain:"); ?> |
302 | 302 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | </select> |
307 | 307 | </li> |
308 | 308 | <?php |
309 | - } |
|
309 | + } |
|
310 | 310 | ?> |
311 | 311 | <?php |
312 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
312 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
313 | 313 | ?> |
314 | 314 | |
315 | 315 | <li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li> |
@@ -317,59 +317,59 @@ discard block |
||
317 | 317 | <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || !isset($_COOKIE['MapRoute'])) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
318 | 318 | <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
319 | 319 | <?php |
320 | - } |
|
320 | + } |
|
321 | 321 | ?> |
322 | 322 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true') print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
323 | 323 | <?php |
324 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
324 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
325 | 325 | ?> |
326 | 326 | <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> |
327 | 327 | <?php |
328 | - } |
|
329 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
328 | + } |
|
329 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
330 | 330 | ?> |
331 | 331 | <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> |
332 | 332 | <?php |
333 | - } |
|
333 | + } |
|
334 | 334 | ?> |
335 | 335 | |
336 | 336 | <?php |
337 | 337 | if (function_exists('array_column')) { |
338 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
339 | - ?> |
|
338 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
339 | + ?> |
|
340 | 340 | <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> |
341 | 341 | <?php |
342 | - } |
|
342 | + } |
|
343 | 343 | } elseif (isset($globalSources)) { |
344 | - $dispolar = false; |
|
345 | - foreach ($globalSources as $testsource) { |
|
346 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
347 | - } |
|
348 | - if ($dispolar) { |
|
349 | - ?> |
|
344 | + $dispolar = false; |
|
345 | + foreach ($globalSources as $testsource) { |
|
346 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
347 | + } |
|
348 | + if ($dispolar) { |
|
349 | + ?> |
|
350 | 350 | <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> |
351 | 351 | <?php |
352 | - } |
|
353 | - } |
|
354 | - ?> |
|
352 | + } |
|
353 | + } |
|
354 | + ?> |
|
355 | 355 | <?php |
356 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
356 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
357 | 357 | ?> |
358 | 358 | |
359 | 359 | <?php |
360 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
361 | - ?> |
|
360 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
361 | + ?> |
|
362 | 362 | <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> |
363 | 363 | <?php |
364 | 364 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
365 | - ?> |
|
365 | + ?> |
|
366 | 366 | <li><?php echo _("Aircraft icon color:"); ?> |
367 | 367 | <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'; ?>"> |
368 | 368 | </li> |
369 | 369 | <?php |
370 | - } |
|
371 | - } |
|
372 | - ?> |
|
370 | + } |
|
371 | + } |
|
372 | + ?> |
|
373 | 373 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
374 | 374 | <div class="range"> |
375 | 375 | <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'; ?>"> |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | </div> |
378 | 378 | </li> |
379 | 379 | <?php |
380 | - } |
|
380 | + } |
|
381 | 381 | ?> |
382 | 382 | <li><?php echo _("Distance unit:"); ?> |
383 | 383 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -410,16 +410,16 @@ discard block |
||
410 | 410 | <ul> |
411 | 411 | <?php |
412 | 412 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
413 | - ?> |
|
413 | + ?> |
|
414 | 414 | <?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 } ?> |
415 | 415 | <?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 } ?> |
416 | 416 | <?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 } ?> |
417 | 417 | <?php |
418 | 418 | } |
419 | - ?> |
|
419 | + ?> |
|
420 | 420 | <?php |
421 | 421 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
422 | - ?> |
|
422 | + ?> |
|
423 | 423 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
424 | 424 | <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> |
425 | 425 | <?php } ?> |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | <?php } ?> |
429 | 429 | <?php |
430 | 430 | } |
431 | - ?> |
|
431 | + ?> |
|
432 | 432 | <li><?php echo _("Display airlines:"); ?> |
433 | 433 | <br/> |
434 | 434 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -448,12 +448,12 @@ discard block |
||
448 | 448 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
449 | 449 | } |
450 | 450 | } |
451 | - ?> |
|
451 | + ?> |
|
452 | 452 | </select> |
453 | 453 | </li> |
454 | 454 | <?php |
455 | 455 | if (isset($globalAPRS) && $globalAPRS) { |
456 | - ?> |
|
456 | + ?> |
|
457 | 457 | <li><?php echo _("Display APRS sources name:"); ?> |
458 | 458 | <select class="selectpicker" multiple onchange="sources(this);"> |
459 | 459 | <?php |
@@ -465,15 +465,15 @@ discard block |
||
465 | 465 | echo '<option value="'.$source['source_name'].'">'.$source['source_name'].'</option>'; |
466 | 466 | } |
467 | 467 | } |
468 | - ?> |
|
468 | + ?> |
|
469 | 469 | </select> |
470 | 470 | </li> |
471 | 471 | <?php |
472 | 472 | } |
473 | - ?> |
|
473 | + ?> |
|
474 | 474 | <?php |
475 | 475 | if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
476 | - ?> |
|
476 | + ?> |
|
477 | 477 | <li><?php echo _("Display airlines of type:"); ?><br/> |
478 | 478 | <select class="selectpicker" onchange="airlinestype(this);"> |
479 | 479 | <option value="all"<?php if (!isset($_COOKIE['airlinestype']) || $_COOKIE['airlinestype'] == 'all' || $_COOKIE['airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | </li> |
485 | 485 | <?php |
486 | 486 | } |
487 | - ?> |
|
487 | + ?> |
|
488 | 488 | <li> |
489 | 489 | <?php echo _("Display flight with ident:"); ?> |
490 | 490 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['identfilter'])) print $_COOKIE['identfilter']; ?>" /> |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | </form> |
498 | 498 | </div> |
499 | 499 | <?php |
500 | - if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
500 | + if (isset($globalMapSatellites) && $globalMapSatellites && isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
501 | 501 | ?> |
502 | 502 | <div class="sidebar-pane" id="satellites"> |
503 | 503 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -537,14 +537,14 @@ discard block |
||
537 | 537 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
538 | 538 | } |
539 | 539 | } |
540 | - ?> |
|
540 | + ?> |
|
541 | 541 | </select> |
542 | 542 | </li> |
543 | 543 | </ul> |
544 | 544 | </form> |
545 | 545 | </div> |
546 | 546 | <?php |
547 | - } |
|
547 | + } |
|
548 | 548 | ?> |
549 | 549 | </div> |
550 | 550 | </div> |
@@ -8,29 +8,29 @@ discard block |
||
8 | 8 | |
9 | 9 | class Schedule { |
10 | 10 | protected $cookies = array(); |
11 | - public $db; |
|
11 | + public $db; |
|
12 | 12 | public function __construct($dbc = null) { |
13 | 13 | $Connection = new Connection($dbc); |
14 | 14 | $this->db = $Connection->db(); |
15 | - } |
|
15 | + } |
|
16 | 16 | |
17 | 17 | /** |
18 | - * Add schedule data to database |
|
19 | - * @param String $ident aircraft ident |
|
20 | - * @param String $departure_airport_icao departure airport icao |
|
21 | - * @param String $departure_airport_time departure airport time |
|
22 | - * @param String $arrival_airport_icao arrival airport icao |
|
23 | - * @param String $arrival_airport_time arrival airport time |
|
18 | + * Add schedule data to database |
|
19 | + * @param String $ident aircraft ident |
|
20 | + * @param String $departure_airport_icao departure airport icao |
|
21 | + * @param String $departure_airport_time departure airport time |
|
22 | + * @param String $arrival_airport_icao arrival airport icao |
|
23 | + * @param String $arrival_airport_time arrival airport time |
|
24 | 24 | / @param String $source source of data |
25 | - */ |
|
25 | + */ |
|
26 | 26 | |
27 | 27 | public function addSchedule($ident,$departure_airport_icao,$departure_airport_time,$arrival_airport_icao,$arrival_airport_time,$source = 'website') { |
28 | 28 | date_default_timezone_set('UTC'); |
29 | 29 | $date = date("Y-m-d H:i:s",time()); |
30 | - //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
|
31 | - //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
|
32 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
|
33 | - $query_values = array(':ident' => $ident); |
|
30 | + //if ($departure_airport_time == '' && $arrival_airport_time == '') exit; |
|
31 | + //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident"; |
|
32 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident"; |
|
33 | + $query_values = array(':ident' => $ident); |
|
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute($query_values); |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($sth->fetchColumn() > 0) { |
41 | 41 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
42 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
|
43 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
42 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao"; |
|
43 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao); |
|
44 | 44 | } elseif ($arrival_airport_time == '') { |
45 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
|
46 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
45 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao"; |
|
46 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao); |
|
47 | 47 | } elseif ($departure_airport_time == '') { |
48 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
|
49 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
48 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
|
49 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
50 | 50 | } else { |
51 | - //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
|
52 | - $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
|
53 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
51 | + //$query = "SELECT COUNT(*) FROM schedule WHERE ident = :ident AND departure_airport_icao = :departure_airport_icao AND departure_airport_time = :departure_airport_time AND arrival_airport_icao = :arrival_airport_icao AND arrival_airport_time = :arrival_airport_time"; |
|
52 | + $query = "SELECT COUNT(*) FROM routes WHERE CallSign = :ident AND FromAirport_ICAO = :departure_airport_icao AND FromAirport_Time = :departure_airport_time AND ToAirport_ICAO = :arrival_airport_icao AND ToAirport_Time = :arrival_airport_time"; |
|
53 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time); |
|
54 | 54 | } |
55 | 55 | try { |
56 | 56 | $sth = $this->db->prepare($query); |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | if ($sth->fetchColumn() == 0) { |
62 | 62 | //$query = 'UPDATE schedule SET departure_airport_icao = :departure_airport_icao, departure_airport_time = :departure_airport_time, arrival_airport_icao = :arrival_airport_icao, arrival_airport_time = :arrival_airport_time, date_modified = :date, source = :source WHERE ident = :ident'; |
63 | 63 | if ($departure_airport_time == '' && $arrival_airport_time == '') { |
64 | - $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
65 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
64 | + $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
65 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
66 | 66 | } elseif ($arrival_airport_time == '') { |
67 | - $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
68 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
67 | + $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
68 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':date' => $date, ':source' => $source); |
|
69 | 69 | } elseif ($departure_airport_time == '') { |
70 | - $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
71 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
70 | + $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
71 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
72 | 72 | } else { |
73 | - $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
74 | - $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
73 | + $query = 'UPDATE routes SET FromAirport_ICAO = :departure_airport_icao, FromAiport_Time = :departure_airport_time, ToAirport_ICAO = :arrival_airport_icao, ToAirport_Time = :arrival_airport_time, date_modified = :date, Source = :source WHERE CallSign = :ident'; |
|
74 | + $query_values = array(':ident' => $ident,':departure_airport_icao' => $departure_airport_icao,':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_time' => $arrival_airport_time, ':date' => $date, ':source' => $source); |
|
75 | 75 | } |
76 | 76 | try { |
77 | 77 | $sth = $this->db->prepare($query); |
@@ -104,15 +104,15 @@ discard block |
||
104 | 104 | } |
105 | 105 | |
106 | 106 | public function getSchedule($ident) { |
107 | - $Translation = new Translation($this->db); |
|
108 | - $operator = $Translation->checkTranslation($ident,false); |
|
109 | - if ($ident != $operator) { |
|
110 | - $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1"; |
|
111 | - $query_values = array(':ident' => $ident,'operator' => $operator); |
|
112 | - } else { |
|
113 | - $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1"; |
|
114 | - $query_values = array(':ident' => $ident); |
|
115 | - } |
|
107 | + $Translation = new Translation($this->db); |
|
108 | + $operator = $Translation->checkTranslation($ident,false); |
|
109 | + if ($ident != $operator) { |
|
110 | + $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :operator OR CallSign = :ident LIMIT 1"; |
|
111 | + $query_values = array(':ident' => $ident,'operator' => $operator); |
|
112 | + } else { |
|
113 | + $query = "SELECT FromAirport_ICAO as departure_airport_icao, ToAirport_ICAO as arrival_airport_icao, FromAirport_Time as departure_airport_time, ToAirport_Time as arrival_airport_time FROM routes WHERE CallSign = :ident LIMIT 1"; |
|
114 | + $query_values = array(':ident' => $ident); |
|
115 | + } |
|
116 | 116 | try { |
117 | 117 | $sth = $this->db->prepare($query); |
118 | 118 | $sth->execute($query_values); |
@@ -128,15 +128,15 @@ discard block |
||
128 | 128 | |
129 | 129 | public function checkSchedule($ident) { |
130 | 130 | global $globalDBdriver; |
131 | - //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1"; |
|
132 | - if ($globalDBdriver == 'mysql') { |
|
131 | + //$query = "SELECT COUNT(*) as nb FROM schedule WHERE ident = :ident AND date_added > DATE_SUB(CURDATE(), INTERVAL 8 DAY) - 8 LIMIT 1"; |
|
132 | + if ($globalDBdriver == 'mysql') { |
|
133 | 133 | $query = "SELECT COUNT(*) as nb FROM routes WHERE CallSign = :ident AND ((date_added BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 1 MONTH)) AND DATE(NOW()) and date_modified IS NULL) OR (date_modified BETWEEN DATE(DATE_SUB(CURDATE(), INTERVAL 15 DAY)) AND DATE(NOW()))) LIMIT 1"; |
134 | 134 | } else { |
135 | 135 | $query = "SELECT COUNT(*) as nb FROM routes WHERE CallSign = :ident |
136 | 136 | AND ((date_added::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) and date_modified::timestamp IS NULL) |
137 | 137 | OR (date_modified::timestamp BETWEEN CURRENT_TIMESTAMP - INTERVAL '1 MONTH' AND CURRENT_TIMESTAMP) LIMIT 1"; |
138 | 138 | } |
139 | - $query_values = array(':ident' => $ident); |
|
139 | + $query_values = array(':ident' => $ident); |
|
140 | 140 | try { |
141 | 141 | $sth = $this->db->prepare($query); |
142 | 142 | $sth->execute($query_values); |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | } |
150 | 150 | |
151 | 151 | /** |
152 | - * Get flight info from Air France |
|
153 | - * @param String $callsign The callsign |
|
154 | - * @param String $date date we want flight number info |
|
155 | - * @param String $carrier IATA code |
|
156 | - * @return Flight departure and arrival airports and time |
|
157 | - */ |
|
152 | + * Get flight info from Air France |
|
153 | + * @param String $callsign The callsign |
|
154 | + * @param String $date date we want flight number info |
|
155 | + * @param String $carrier IATA code |
|
156 | + * @return Flight departure and arrival airports and time |
|
157 | + */ |
|
158 | 158 | private function getAirFrance($callsign, $date = 'NOW',$carrier = 'AF') { |
159 | 159 | $Common = new Common(); |
160 | 160 | $check_date = new Datetime($date); |
@@ -190,11 +190,11 @@ discard block |
||
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
193 | - * Get flight info from EasyJet |
|
194 | - * @param String $callsign The callsign |
|
195 | - * @param String $date date we want flight number info |
|
196 | - * @return Flight departure and arrival airports and time |
|
197 | - */ |
|
193 | + * Get flight info from EasyJet |
|
194 | + * @param String $callsign The callsign |
|
195 | + * @param String $date date we want flight number info |
|
196 | + * @return Flight departure and arrival airports and time |
|
197 | + */ |
|
198 | 198 | private function getEasyJet($callsign, $date = 'NOW') { |
199 | 199 | global $globalTimezone; |
200 | 200 | $Common = new Common(); |
@@ -218,10 +218,10 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | /** |
221 | - * Get flight info from Ryanair |
|
222 | - * @param String $callsign The callsign |
|
223 | - * @return Flight departure and arrival airports and time |
|
224 | - */ |
|
221 | + * Get flight info from Ryanair |
|
222 | + * @param String $callsign The callsign |
|
223 | + * @return Flight departure and arrival airports and time |
|
224 | + */ |
|
225 | 225 | private function getRyanair($callsign) { |
226 | 226 | $Common = new Common(); |
227 | 227 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -244,10 +244,10 @@ discard block |
||
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
247 | - * Get flight info from Swiss |
|
248 | - * @param String $callsign The callsign |
|
249 | - * @return Flight departure and arrival airports and time |
|
250 | - */ |
|
247 | + * Get flight info from Swiss |
|
248 | + * @param String $callsign The callsign |
|
249 | + * @return Flight departure and arrival airports and time |
|
250 | + */ |
|
251 | 251 | private function getSwiss($callsign) { |
252 | 252 | $Common = new Common(); |
253 | 253 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | } |
277 | 277 | |
278 | 278 | /** |
279 | - * Get flight info from British Airways API |
|
280 | - * @param String $callsign The callsign |
|
281 | - * @param String $date date we want flight number info |
|
282 | - * @return Flight departure and arrival airports and time |
|
283 | - */ |
|
279 | + * Get flight info from British Airways API |
|
280 | + * @param String $callsign The callsign |
|
281 | + * @param String $date date we want flight number info |
|
282 | + * @return Flight departure and arrival airports and time |
|
283 | + */ |
|
284 | 284 | public function getBritishAirways($callsign, $date = 'NOW') { |
285 | 285 | global $globalBritishAirwaysKey; |
286 | 286 | $Common = new Common(); |
@@ -304,11 +304,11 @@ discard block |
||
304 | 304 | } |
305 | 305 | |
306 | 306 | /** |
307 | - * Get flight info from Lutfhansa API |
|
308 | - * @param String $callsign The callsign |
|
309 | - * @param String $date date we want flight number info |
|
310 | - * @return Flight departure and arrival airports and time |
|
311 | - */ |
|
307 | + * Get flight info from Lutfhansa API |
|
308 | + * @param String $callsign The callsign |
|
309 | + * @param String $date date we want flight number info |
|
310 | + * @return Flight departure and arrival airports and time |
|
311 | + */ |
|
312 | 312 | public function getLufthansa($callsign, $date = 'NOW') { |
313 | 313 | global $globalLufthansaKey; |
314 | 314 | $Common = new Common(); |
@@ -338,11 +338,11 @@ discard block |
||
338 | 338 | } |
339 | 339 | |
340 | 340 | /** |
341 | - * Get flight info from Transavia API |
|
342 | - * @param String $callsign The callsign |
|
343 | - * @param String $date date we want flight number info |
|
344 | - * @return Flight departure and arrival airports and time |
|
345 | - */ |
|
341 | + * Get flight info from Transavia API |
|
342 | + * @param String $callsign The callsign |
|
343 | + * @param String $date date we want flight number info |
|
344 | + * @return Flight departure and arrival airports and time |
|
345 | + */ |
|
346 | 346 | public function getTransavia($callsign, $date = 'NOW') { |
347 | 347 | global $globalTransaviaKey; |
348 | 348 | $Common = new Common(); |
@@ -368,10 +368,10 @@ discard block |
||
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
371 | - * Get flight info from Tunisair |
|
372 | - * @param String $callsign The callsign |
|
373 | - * @return Flight departure and arrival airports and time |
|
374 | - */ |
|
371 | + * Get flight info from Tunisair |
|
372 | + * @param String $callsign The callsign |
|
373 | + * @return Flight departure and arrival airports and time |
|
374 | + */ |
|
375 | 375 | public function getTunisair($callsign) { |
376 | 376 | $Common = new Common(); |
377 | 377 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -388,10 +388,10 @@ discard block |
||
388 | 388 | } |
389 | 389 | |
390 | 390 | /** |
391 | - * Get flight info from Vueling |
|
392 | - * @param String $callsign The callsign |
|
393 | - * @return Flight departure and arrival airports and time |
|
394 | - */ |
|
391 | + * Get flight info from Vueling |
|
392 | + * @param String $callsign The callsign |
|
393 | + * @return Flight departure and arrival airports and time |
|
394 | + */ |
|
395 | 395 | public function getVueling($callsign,$date = 'NOW') { |
396 | 396 | $Common = new Common(); |
397 | 397 | $check_date = new Datetime($date); |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
416 | - * Get flight info from Iberia |
|
417 | - * @param String $callsign The callsign |
|
418 | - * @param String $date date we want flight number info |
|
419 | - * @return Flight departure and arrival airports and time |
|
420 | - */ |
|
416 | + * Get flight info from Iberia |
|
417 | + * @param String $callsign The callsign |
|
418 | + * @param String $date date we want flight number info |
|
419 | + * @return Flight departure and arrival airports and time |
|
420 | + */ |
|
421 | 421 | public function getIberia($callsign, $date = 'NOW') { |
422 | 422 | $Common = new Common(); |
423 | 423 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -447,11 +447,11 @@ discard block |
||
447 | 447 | } |
448 | 448 | |
449 | 449 | /** |
450 | - * Get flight info from Star Alliance |
|
451 | - * @param String $callsign The callsign |
|
452 | - * @param String $date date we want flight number info |
|
453 | - * @return Flight departure and arrival airports and time |
|
454 | - */ |
|
450 | + * Get flight info from Star Alliance |
|
451 | + * @param String $callsign The callsign |
|
452 | + * @param String $date date we want flight number info |
|
453 | + * @return Flight departure and arrival airports and time |
|
454 | + */ |
|
455 | 455 | |
456 | 456 | private function getStarAlliance($callsign, $date = 'NOW',$carrier = '') { |
457 | 457 | $Common = new Common(); |
@@ -483,11 +483,11 @@ discard block |
||
483 | 483 | |
484 | 484 | |
485 | 485 | /** |
486 | - * Get flight info from Alitalia |
|
487 | - * @param String $callsign The callsign |
|
488 | - * @param String $date date we want flight number info |
|
489 | - * @return Flight departure and arrival airports and time |
|
490 | - */ |
|
486 | + * Get flight info from Alitalia |
|
487 | + * @param String $callsign The callsign |
|
488 | + * @param String $date date we want flight number info |
|
489 | + * @return Flight departure and arrival airports and time |
|
490 | + */ |
|
491 | 491 | private function getAlitalia($callsign, $date = 'NOW') { |
492 | 492 | $Common = new Common(); |
493 | 493 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -506,11 +506,11 @@ discard block |
||
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
509 | - * Get flight info from Brussels airlines |
|
510 | - * @param String $callsign The callsign |
|
511 | - * @param String $date date we want flight number info |
|
512 | - * @return Flight departure and arrival airports and time |
|
513 | - */ |
|
509 | + * Get flight info from Brussels airlines |
|
510 | + * @param String $callsign The callsign |
|
511 | + * @param String $date date we want flight number info |
|
512 | + * @return Flight departure and arrival airports and time |
|
513 | + */ |
|
514 | 514 | private function getBrussels($callsign, $date = 'NOW') { |
515 | 515 | $Common = new Common(); |
516 | 516 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -520,24 +520,24 @@ discard block |
||
520 | 520 | if (!filter_var($numvol,FILTER_VALIDATE_INT)) return array(); |
521 | 521 | $data = $Common->getData($url); |
522 | 522 | if ($data != '') { |
523 | - //echo $data; |
|
524 | - $parsed_json = json_decode($data,true); |
|
525 | - if (isset($parsed_json[0]['FromAirportCode'])) { |
|
523 | + //echo $data; |
|
524 | + $parsed_json = json_decode($data,true); |
|
525 | + if (isset($parsed_json[0]['FromAirportCode'])) { |
|
526 | 526 | $DepartureAirportIata = $parsed_json[0]['FromAirportCode']; |
527 | 527 | $ArrivalAirportIata = $parsed_json[0]['ToAirportCode']; |
528 | 528 | $departureTime = date('H:i',strtotime($parsed_json[0]['ScheduledDepatureDate'])); |
529 | 529 | $arrivalTime = date('H:i',strtotime($parsed_json[0]['ScheduledArrivalDate'])); |
530 | 530 | return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_brussels'); |
531 | - } |
|
531 | + } |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | 535 | /** |
536 | - * Get flight info from FlightRadar24 |
|
537 | - * @param String $callsign The callsign |
|
538 | - * @param String $date date we want flight number info |
|
539 | - * @return Flight departure and arrival airports and time |
|
540 | - */ |
|
536 | + * Get flight info from FlightRadar24 |
|
537 | + * @param String $callsign The callsign |
|
538 | + * @param String $date date we want flight number info |
|
539 | + * @return Flight departure and arrival airports and time |
|
540 | + */ |
|
541 | 541 | /* |
542 | 542 | public function getFlightRadar24($callsign, $date = 'NOW') { |
543 | 543 | $Common = new Common(); |
@@ -566,11 +566,11 @@ discard block |
||
566 | 566 | } |
567 | 567 | */ |
568 | 568 | /** |
569 | - * Get flight info from Lufthansa |
|
570 | - * @param String $callsign The callsign |
|
571 | - * @param String $date date we want flight number info |
|
572 | - * @return Flight departure and arrival airports and time |
|
573 | - */ |
|
569 | + * Get flight info from Lufthansa |
|
570 | + * @param String $callsign The callsign |
|
571 | + * @param String $date date we want flight number info |
|
572 | + * @return Flight departure and arrival airports and time |
|
573 | + */ |
|
574 | 574 | |
575 | 575 | /* private function getLufthansa($callsign, $date = 'NOW') { |
576 | 576 | $Common = new Common(); |
@@ -598,10 +598,10 @@ discard block |
||
598 | 598 | } |
599 | 599 | */ |
600 | 600 | /** |
601 | - * Get flight info from flytap |
|
602 | - * @param String $callsign The callsign |
|
603 | - * @return Flight departure and arrival airports and time |
|
604 | - */ |
|
601 | + * Get flight info from flytap |
|
602 | + * @param String $callsign The callsign |
|
603 | + * @return Flight departure and arrival airports and time |
|
604 | + */ |
|
605 | 605 | private function getFlyTap($callsign) { |
606 | 606 | $Common = new Common(); |
607 | 607 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -624,10 +624,10 @@ discard block |
||
624 | 624 | } |
625 | 625 | |
626 | 626 | /** |
627 | - * Get flight info from flightmapper |
|
628 | - * @param String $callsign The callsign |
|
629 | - * @return Flight departure and arrival airports and time |
|
630 | - */ |
|
627 | + * Get flight info from flightmapper |
|
628 | + * @param String $callsign The callsign |
|
629 | + * @return Flight departure and arrival airports and time |
|
630 | + */ |
|
631 | 631 | public function getFlightMapper($callsign) { |
632 | 632 | $Common = new Common(); |
633 | 633 | $airline_icao = ''; |
@@ -655,11 +655,11 @@ discard block |
||
655 | 655 | $aarr = ''; |
656 | 656 | $n = sscanf($sched,'%*s %5[0-9:] %*[^()] (%3[A-Z]) %5[0-9:] %*[^()] (%3[A-Z])',$dhour,$darr,$ahour,$aarr); |
657 | 657 | if ($n == 7) { |
658 | - $departureTime = $dhour; |
|
659 | - $arrivalTime = $ahour; |
|
660 | - $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
661 | - $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
662 | - return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
658 | + $departureTime = $dhour; |
|
659 | + $arrivalTime = $ahour; |
|
660 | + $DepartureAirportIata = str_replace(array('(',')'),'',$darr); |
|
661 | + $ArrivalAirportIata = str_replace(array('(',')'),'',$aarr); |
|
662 | + return array('DepartureAirportIATA' => $DepartureAirportIata,'DepartureTime' => $departureTime,'ArrivalAirportIATA' => $ArrivalAirportIata,'ArrivalTime' => $arrivalTime,'Source' => 'website_flightmapper'); |
|
663 | 663 | } |
664 | 664 | } |
665 | 665 | } |
@@ -667,10 +667,10 @@ discard block |
||
667 | 667 | } |
668 | 668 | |
669 | 669 | /** |
670 | - * Get flight info from flightaware |
|
671 | - * @param String $callsign The callsign |
|
672 | - * @return Flight departure and arrival airports and time |
|
673 | - */ |
|
670 | + * Get flight info from flightaware |
|
671 | + * @param String $callsign The callsign |
|
672 | + * @return Flight departure and arrival airports and time |
|
673 | + */ |
|
674 | 674 | public function getFlightAware($callsign) { |
675 | 675 | $Common = new Common(); |
676 | 676 | /* |
@@ -703,10 +703,10 @@ discard block |
||
703 | 703 | } |
704 | 704 | |
705 | 705 | /** |
706 | - * Get flight info from CostToTravel |
|
707 | - * @param String $callsign The callsign |
|
708 | - * @return Flight departure and arrival airports and time |
|
709 | - */ |
|
706 | + * Get flight info from CostToTravel |
|
707 | + * @param String $callsign The callsign |
|
708 | + * @return Flight departure and arrival airports and time |
|
709 | + */ |
|
710 | 710 | public function getCostToTravel($callsign) { |
711 | 711 | $Common = new Common(); |
712 | 712 | $url= "http://www.costtotravel.com/flight-number/".$callsign; |
@@ -728,11 +728,11 @@ discard block |
||
728 | 728 | } |
729 | 729 | |
730 | 730 | /** |
731 | - * Get flight info from Air Canada |
|
732 | - * @param String $callsign The callsign |
|
733 | - * @param String $date date we want flight number info |
|
734 | - * @return Flight departure and arrival airports and time |
|
735 | - */ |
|
731 | + * Get flight info from Air Canada |
|
732 | + * @param String $callsign The callsign |
|
733 | + * @param String $date date we want flight number info |
|
734 | + * @return Flight departure and arrival airports and time |
|
735 | + */ |
|
736 | 736 | private function getAirCanada($callsign,$date = 'NOW') { |
737 | 737 | $Common = new Common(); |
738 | 738 | date_default_timezone_set('UTC'); |
@@ -756,11 +756,11 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | /** |
759 | - * Get flight info from Vietnam Airlines |
|
760 | - * @param String $callsign The callsign |
|
761 | - * @param String $date date we want flight number info |
|
762 | - * @return Flight departure and arrival airports and time |
|
763 | - */ |
|
759 | + * Get flight info from Vietnam Airlines |
|
760 | + * @param String $callsign The callsign |
|
761 | + * @param String $date date we want flight number info |
|
762 | + * @return Flight departure and arrival airports and time |
|
763 | + */ |
|
764 | 764 | private function getVietnamAirlines($callsign, $date = 'NOW') { |
765 | 765 | $Common = new Common(); |
766 | 766 | $numvol = preg_replace('/^[A-Z]*/','',$callsign); |
@@ -782,12 +782,12 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * Get flight info from Air Berlin |
|
786 | - * @param String $callsign The callsign |
|
787 | - * @param String $date date we want flight number info |
|
788 | - * @param String $carrier airline code |
|
789 | - * @return Flight departure and arrival airports and time |
|
790 | - */ |
|
785 | + * Get flight info from Air Berlin |
|
786 | + * @param String $callsign The callsign |
|
787 | + * @param String $date date we want flight number info |
|
788 | + * @param String $carrier airline code |
|
789 | + * @return Flight departure and arrival airports and time |
|
790 | + */ |
|
791 | 791 | private function getAirBerlin($callsign, $date = 'NOW',$carrier = 'AB') { |
792 | 792 | $Common = new Common(); |
793 | 793 | date_default_timezone_set('UTC'); |
@@ -816,11 +816,11 @@ discard block |
||
816 | 816 | $table = $Common->table2array($data); |
817 | 817 | $flight = $table; |
818 | 818 | if (isset($flight[5][4])) { |
819 | - $arrivalTime = $flight[5][4]; |
|
820 | - $arrivalAirport = $flight[5][3]; |
|
819 | + $arrivalTime = $flight[5][4]; |
|
820 | + $arrivalAirport = $flight[5][3]; |
|
821 | 821 | } else { |
822 | - $arrivalTime = ''; |
|
823 | - $arrivalAirport = ''; |
|
822 | + $arrivalTime = ''; |
|
823 | + $arrivalAirport = ''; |
|
824 | 824 | } |
825 | 825 | } else return array(); |
826 | 826 | $url = 'http://www.airberlin.com/en-US/site/json/suggestAirport.php?searchfor=departures&searchflightid=0&departures%5B%5D=&suggestsource%5B0%5D=activeairports&withcountries=0&withoutroutings=0&promotion%5Bid%5D=&promotion%5Btype%5D=&routesource%5B0%5D=airberlin&routesource%5B1%5D=partner'; |
@@ -1088,7 +1088,7 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | } |
1091 | - return array(); |
|
1091 | + return array(); |
|
1092 | 1092 | } |
1093 | 1093 | } |
1094 | 1094 |
@@ -9,16 +9,16 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
10 | 10 | |
11 | 11 | class SpotterImport { |
12 | - private $all_flights = array(); |
|
13 | - private $last_delete_hourly = 0; |
|
14 | - private $last_delete = 0; |
|
15 | - private $stats = array(); |
|
16 | - private $tmd = 0; |
|
17 | - private $source_location = array(); |
|
18 | - public $db = null; |
|
19 | - public $nb = 0; |
|
20 | - |
|
21 | - public function __construct($dbc = null) { |
|
12 | + private $all_flights = array(); |
|
13 | + private $last_delete_hourly = 0; |
|
14 | + private $last_delete = 0; |
|
15 | + private $stats = array(); |
|
16 | + private $tmd = 0; |
|
17 | + private $source_location = array(); |
|
18 | + public $db = null; |
|
19 | + public $nb = 0; |
|
20 | + |
|
21 | + public function __construct($dbc = null) { |
|
22 | 22 | global $globalBeta; |
23 | 23 | $Connection = new Connection($dbc); |
24 | 24 | $this->db = $Connection->db(); |
@@ -29,18 +29,18 @@ discard block |
||
29 | 29 | $currentdate = date('Y-m-d'); |
30 | 30 | $sourcestat = $Stats->getStatsSource($currentdate); |
31 | 31 | if (!empty($sourcestat)) { |
32 | - foreach($sourcestat as $srcst) { |
|
33 | - $type = $srcst['stats_type']; |
|
32 | + foreach($sourcestat as $srcst) { |
|
33 | + $type = $srcst['stats_type']; |
|
34 | 34 | if ($type == 'polar' || $type == 'hist') { |
35 | - $source = $srcst['source_name']; |
|
36 | - $data = $srcst['source_data']; |
|
37 | - $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
38 | - } |
|
39 | - } |
|
35 | + $source = $srcst['source_name']; |
|
36 | + $data = $srcst['source_data']; |
|
37 | + $this->stats[$currentdate][$source][$type] = json_decode($data,true); |
|
38 | + } |
|
39 | + } |
|
40 | + } |
|
40 | 41 | } |
41 | - } |
|
42 | 42 | |
43 | - public function get_Schedule($id,$ident) { |
|
43 | + public function get_Schedule($id,$ident) { |
|
44 | 44 | global $globalDebug, $globalFork, $globalSchedulesFetch; |
45 | 45 | // Get schedule here, so it's done only one time |
46 | 46 | |
@@ -59,35 +59,35 @@ discard block |
||
59 | 59 | $Translation = new Translation($dbc); |
60 | 60 | $operator = $Spotter->getOperator($ident); |
61 | 61 | if ($Schedule->checkSchedule($operator) == 0) { |
62 | - $operator = $Translation->checkTranslation($ident); |
|
63 | - if ($Schedule->checkSchedule($operator) == 0) { |
|
62 | + $operator = $Translation->checkTranslation($ident); |
|
63 | + if ($Schedule->checkSchedule($operator) == 0) { |
|
64 | 64 | $schedule = $Schedule->fetchSchedule($operator); |
65 | 65 | if (count($schedule) > 0 && isset($schedule['DepartureTime']) && isset($schedule['ArrivalTime'])) { |
66 | - if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
67 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
69 | - // Should also check if route schedule = route from DB |
|
70 | - if ($schedule['DepartureAirportIATA'] != '') { |
|
66 | + if ($globalDebug) echo "-> Schedule info for ".$operator." (".$ident.")\n"; |
|
67 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $schedule['DepartureTime'])); |
|
68 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $schedule['ArrivalTime'])); |
|
69 | + // Should also check if route schedule = route from DB |
|
70 | + if ($schedule['DepartureAirportIATA'] != '') { |
|
71 | 71 | if ($this->all_flights[$id]['departure_airport'] != $Spotter->getAirportIcao($schedule['DepartureAirportIATA'])) { |
72 | - $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
73 | - if ($airport_icao != '') { |
|
72 | + $airport_icao = $Spotter->getAirportIcao($schedule['DepartureAirportIATA']); |
|
73 | + if ($airport_icao != '') { |
|
74 | 74 | $this->all_flights[$id]['departure_airport'] = $airport_icao; |
75 | 75 | if ($globalDebug) echo "-> Change departure airport to ".$airport_icao." for ".$ident."\n"; |
76 | - } |
|
76 | + } |
|
77 | + } |
|
77 | 78 | } |
78 | - } |
|
79 | - if ($schedule['ArrivalAirportIATA'] != '') { |
|
79 | + if ($schedule['ArrivalAirportIATA'] != '') { |
|
80 | 80 | if ($this->all_flights[$id]['arrival_airport'] != $Spotter->getAirportIcao($schedule['ArrivalAirportIATA'])) { |
81 | - $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
82 | - if ($airport_icao != '') { |
|
81 | + $airport_icao = $Spotter->getAirportIcao($schedule['ArrivalAirportIATA']); |
|
82 | + if ($airport_icao != '') { |
|
83 | 83 | $this->all_flights[$id]['arrival_airport'] = $airport_icao; |
84 | 84 | if ($globalDebug) echo "-> Change arrival airport to ".$airport_icao." for ".$ident."\n"; |
85 | - } |
|
85 | + } |
|
86 | + } |
|
86 | 87 | } |
87 | - } |
|
88 | - $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
88 | + $Schedule->addSchedule($operator,$this->all_flights[$id]['departure_airport'],$this->all_flights[$id]['departure_airport_time'],$this->all_flights[$id]['arrival_airport'],$this->all_flights[$id]['arrival_airport_time'],$schedule['Source']); |
|
89 | + } |
|
89 | 90 | } |
90 | - } |
|
91 | 91 | } |
92 | 92 | // close connection, at least one way will work ? |
93 | 93 | |
@@ -105,92 +105,92 @@ discard block |
||
105 | 105 | } |
106 | 106 | */ |
107 | 107 | } |
108 | - } |
|
108 | + } |
|
109 | 109 | |
110 | - public function checkAll() { |
|
110 | + public function checkAll() { |
|
111 | 111 | global $globalDebug; |
112 | 112 | if ($globalDebug) echo "Update last seen flights data...\n"; |
113 | 113 | foreach ($this->all_flights as $key => $flight) { |
114 | - if (isset($this->all_flights[$key]['id'])) { |
|
114 | + if (isset($this->all_flights[$key]['id'])) { |
|
115 | 115 | //echo $this->all_flights[$key]['id'].' - '.$this->all_flights[$key]['latitude'].' '.$this->all_flights[$key]['longitude']."\n"; |
116 | - $Spotter = new Spotter($this->db); |
|
117 | - $real_arrival = $this->arrival($key); |
|
118 | - $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
119 | - } |
|
116 | + $Spotter = new Spotter($this->db); |
|
117 | + $real_arrival = $this->arrival($key); |
|
118 | + $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
|
119 | + } |
|
120 | + } |
|
120 | 121 | } |
121 | - } |
|
122 | 122 | |
123 | - public function arrival($key) { |
|
123 | + public function arrival($key) { |
|
124 | 124 | global $globalClosestMinDist, $globalDebug; |
125 | 125 | if ($globalDebug) echo 'Update arrival...'."\n"; |
126 | 126 | $Spotter = new Spotter($this->db); |
127 | - $airport_icao = ''; |
|
128 | - $airport_time = ''; |
|
129 | - if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
127 | + $airport_icao = ''; |
|
128 | + $airport_time = ''; |
|
129 | + if (!isset($globalClosestMinDist) || $globalClosestMinDist == '') $globalClosestMinDist = 50; |
|
130 | 130 | if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
131 | - $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
132 | - if (isset($closestAirports[0])) { |
|
133 | - if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
134 | - $airport_icao = $closestAirports[0]['icao']; |
|
135 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
136 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
137 | - } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
138 | - foreach ($closestAirports as $airport) { |
|
139 | - if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
140 | - $airport_icao = $airport['icao']; |
|
141 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
142 | - if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
143 | - break; |
|
144 | - } |
|
145 | - } |
|
146 | - } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
147 | - $airport_icao = $closestAirports[0]['icao']; |
|
148 | - $airport_time = $this->all_flights[$key]['datetime']; |
|
149 | - } else { |
|
150 | - if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
151 | - } |
|
152 | - } else { |
|
153 | - if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
154 | - } |
|
155 | - |
|
156 | - } else { |
|
157 | - if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
158 | - } |
|
159 | - return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
160 | - } |
|
161 | - |
|
162 | - |
|
163 | - |
|
164 | - public function del() { |
|
131 | + $closestAirports = $Spotter->closestAirports($this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$globalClosestMinDist); |
|
132 | + if (isset($closestAirports[0])) { |
|
133 | + if (isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] == $closestAirports[0]['icao']) { |
|
134 | + $airport_icao = $closestAirports[0]['icao']; |
|
135 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
136 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
137 | + } elseif (count($closestAirports > 1) && isset($this->all_flights[$key]['arrival_airport']) && $this->all_flights[$key]['arrival_airport'] != '') { |
|
138 | + foreach ($closestAirports as $airport) { |
|
139 | + if ($this->all_flights[$key]['arrival_airport'] == $airport['icao']) { |
|
140 | + $airport_icao = $airport['icao']; |
|
141 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
142 | + if ($globalDebug) echo "---++ Find arrival airport. airport_icao : ".$airport_icao."\n"; |
|
143 | + break; |
|
144 | + } |
|
145 | + } |
|
146 | + } elseif ($this->all_flights[$key]['altitude'] == 0 || ($this->all_flights[$key]['altitude_real'] != '' && ($closestAirports[0]['altitude'] < $this->all_flights[$key]['altitude_real'] && $this->all_flights[$key]['altitude_real'] < $closestAirports[0]['altitude']+5000))) { |
|
147 | + $airport_icao = $closestAirports[0]['icao']; |
|
148 | + $airport_time = $this->all_flights[$key]['datetime']; |
|
149 | + } else { |
|
150 | + if ($globalDebug) echo "----- Can't find arrival airport. Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.$this->all_flights[$key]['altitude_real']."\n"; |
|
151 | + } |
|
152 | + } else { |
|
153 | + if ($globalDebug) echo "----- No Airport near last coord. Latitude : ".$this->all_flights[$key]['latitude'].' - Longitude : '.$this->all_flights[$key]['longitude'].' - MinDist : '.$globalClosestMinDist."\n"; |
|
154 | + } |
|
155 | + |
|
156 | + } else { |
|
157 | + if ($globalDebug) echo "---- No latitude or longitude. Ident : ".$this->all_flights[$key]['ident']."\n"; |
|
158 | + } |
|
159 | + return array('airport_icao' => $airport_icao,'airport_time' => $airport_time); |
|
160 | + } |
|
161 | + |
|
162 | + |
|
163 | + |
|
164 | + public function del() { |
|
165 | 165 | global $globalDebug; |
166 | 166 | // Delete old infos |
167 | 167 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
168 | 168 | foreach ($this->all_flights as $key => $flight) { |
169 | - if (isset($flight['lastupdate'])) { |
|
170 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
171 | - if (isset($this->all_flights[$key]['id'])) { |
|
172 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
169 | + if (isset($flight['lastupdate'])) { |
|
170 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
171 | + if (isset($this->all_flights[$key]['id'])) { |
|
172 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_flights[$key]['id']."\n"; |
|
173 | 173 | /* |
174 | 174 | $SpotterLive = new SpotterLive(); |
175 | 175 | $SpotterLive->deleteLiveSpotterDataById($this->all_flights[$key]['id']); |
176 | 176 | $SpotterLive->db = null; |
177 | 177 | */ |
178 | - $real_arrival = $this->arrival($key); |
|
179 | - $Spotter = new Spotter($this->db); |
|
180 | - if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
178 | + $real_arrival = $this->arrival($key); |
|
179 | + $Spotter = new Spotter($this->db); |
|
180 | + if ($this->all_flights[$key]['latitude'] != '' && $this->all_flights[$key]['longitude'] != '') { |
|
181 | 181 | $result = $Spotter->updateLatestSpotterData($this->all_flights[$key]['id'],$this->all_flights[$key]['ident'],$this->all_flights[$key]['latitude'],$this->all_flights[$key]['longitude'],$this->all_flights[$key]['altitude'],$this->all_flights[$key]['ground'],$this->all_flights[$key]['speed'],$this->all_flights[$key]['datetime'],$real_arrival['airport_icao'],$real_arrival['airport_time']); |
182 | 182 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
183 | 183 | } |
184 | 184 | // Put in archive |
185 | 185 | // $Spotter->db = null; |
186 | - } |
|
187 | - unset($this->all_flights[$key]); |
|
188 | - } |
|
189 | - } |
|
190 | - } |
|
191 | - } |
|
192 | - |
|
193 | - public function add($line) { |
|
186 | + } |
|
187 | + unset($this->all_flights[$key]); |
|
188 | + } |
|
189 | + } |
|
190 | + } |
|
191 | + } |
|
192 | + |
|
193 | + public function add($line) { |
|
194 | 194 | global $globalPilotIdAccept, $globalAirportAccept, $globalAirlineAccept, $globalAirlineIgnore, $globalAirportIgnore, $globalFork, $globalDistanceIgnore, $globalDaemon, $globalSBS1update, $globalDebug, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAirlinesSource, $globalVAM, $globalAllFlights; |
195 | 195 | //if (!isset($globalDebugTimeElapsed) || $globalDebugTimeElapsed == '') $globalDebugTimeElapsed = FALSE; |
196 | 196 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
@@ -215,18 +215,18 @@ discard block |
||
215 | 215 | |
216 | 216 | // SBS format is CSV format |
217 | 217 | if(is_array($line) && isset($line['hex'])) { |
218 | - //print_r($line); |
|
219 | - if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
218 | + //print_r($line); |
|
219 | + if ($line['hex'] != '' && $line['hex'] != '00000' && $line['hex'] != '000000' && $line['hex'] != '111111' && ctype_xdigit($line['hex']) && strlen($line['hex']) === 6) { |
|
220 | 220 | |
221 | 221 | // Increment message number |
222 | 222 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
223 | - $current_date = date('Y-m-d'); |
|
224 | - $source = $line['source_name']; |
|
225 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
226 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
227 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
228 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
229 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
223 | + $current_date = date('Y-m-d'); |
|
224 | + $source = $line['source_name']; |
|
225 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
226 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
227 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
228 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
229 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /* |
@@ -242,17 +242,17 @@ discard block |
||
242 | 242 | //$this->db = $dbc; |
243 | 243 | |
244 | 244 | $hex = trim($line['hex']); |
245 | - if (!isset($line['id'])) $id = trim($line['hex']); |
|
246 | - else $id = trim($line['id']); |
|
245 | + if (!isset($line['id'])) $id = trim($line['hex']); |
|
246 | + else $id = trim($line['id']); |
|
247 | 247 | |
248 | 248 | //print_r($this->all_flights); |
249 | 249 | if (!isset($this->all_flights[$id]['hex']) && ctype_xdigit($hex)) { |
250 | - $this->all_flights[$id] = array('hex' => $hex); |
|
251 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
252 | - //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
250 | + $this->all_flights[$id] = array('hex' => $hex); |
|
251 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
|
252 | + //if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
|
253 | 253 | //$this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
254 | - //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
255 | - if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
254 | + //} else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
255 | + if (!isset($line['aircraft_name']) && (!isset($line['aircraft_icao']) || $line['aircraft_icao'] == '????')) { |
|
256 | 256 | |
257 | 257 | $timeelapsed = microtime(true); |
258 | 258 | $Spotter = new Spotter($this->db); |
@@ -261,38 +261,38 @@ discard block |
||
261 | 261 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getallaircrattype : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
262 | 262 | |
263 | 263 | if ($aircraft_icao == '' && isset($line['aircraft_type'])) { |
264 | - if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
265 | - elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
266 | - elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
267 | - elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
264 | + if ($line['aircraft_type'] == 'PARA_GLIDER') $aircraft_icao = 'GLID'; |
|
265 | + elseif ($line['aircraft_type'] == 'HELICOPTER_ROTORCRAFT') $aircraft_icao = 'UHEL'; |
|
266 | + elseif ($line['aircraft_type'] == 'TOW_PLANE') $aircraft_icao = 'TOWPLANE'; |
|
267 | + elseif ($line['aircraft_type'] == 'POWERED_AIRCRAFT') $aircraft_icao = 'POWAIRC'; |
|
268 | 268 | } |
269 | 269 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
270 | - } else if (isset($line['aircraft_name'])) { |
|
270 | + } else if (isset($line['aircraft_name'])) { |
|
271 | 271 | // Get aircraft ICAO from aircraft name |
272 | 272 | $Spotter = new Spotter($this->db); |
273 | 273 | $aircraft_icao = $Spotter->getAircraftIcao($line['aircraft_name']); |
274 | 274 | $Spotter->db = null; |
275 | 275 | if ($aircraft_icao != '') $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $aircraft_icao)); |
276 | 276 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => 'NA')); |
277 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
279 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
280 | - if (!isset($line['id'])) { |
|
277 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('aircraft_icao' => $line['aircraft_icao'])); |
|
278 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => '','departure_airport' => '', 'arrival_airport' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '','altitude_real' => '', 'heading' => '','departure_airport_time' => '','arrival_airport_time' => '','squawk' => '','route_stop' => '','registration' => '','pilot_id' => '','pilot_name' => '','waypoints' => '','ground' => '0', 'format_source' => '','source_name' => '','over_country' => '','verticalrate' => '','noarchive' => false,'putinarchive' => true)); |
|
279 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('lastupdate' => time())); |
|
280 | + if (!isset($line['id'])) { |
|
281 | 281 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
282 | 282 | // if (isset($line['format_source']) && ($line['format_source'] == 'sbs' || $line['format_source'] == 'tsv' || $line['format_source'] == 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'].'-'.date('YmdGi'))); |
283 | 283 | // if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
284 | 284 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
285 | - //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
286 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
285 | + //else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
286 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
287 | 287 | |
288 | - if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
289 | - if ($globalAllFlights !== FALSE) $dataFound = true; |
|
288 | + if ($globalDebug) echo "*********** New aircraft hex : ".$hex." ***********\n"; |
|
289 | + if ($globalAllFlights !== FALSE) $dataFound = true; |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | if (isset($line['datetime']) && preg_match('/^(\d{4}(?:\-\d{2}){2} \d{2}(?:\:\d{2}){2})$/',$line['datetime'])) { |
293 | - if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
293 | + if (!isset($this->all_flights[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_flights[$id]['datetime'])) { |
|
294 | 294 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => $line['datetime'])); |
295 | - } else { |
|
295 | + } else { |
|
296 | 296 | if (strtotime($line['datetime']) == strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
297 | 297 | elseif (strtotime($line['datetime']) > strtotime($this->all_flights[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_flights[$id]['datetime'].") !!! for ".$this->all_flights[$id]['hex']." - format : ".$line['format_source']."\n"; |
298 | 298 | /* |
@@ -301,38 +301,38 @@ discard block |
||
301 | 301 | print_r($line); |
302 | 302 | */ |
303 | 303 | return ''; |
304 | - } |
|
304 | + } |
|
305 | 305 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('datetime' => date('Y-m-d H:i:s'))); |
306 | 306 | |
307 | 307 | if (isset($line['registration']) && $line['registration'] != '' && $line['registration'] != 'z.NO-REG') { |
308 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
308 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('registration' => $line['registration'])); |
|
309 | 309 | } |
310 | 310 | if (isset($line['waypoints']) && $line['waypoints'] != '') { |
311 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
311 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('waypoints' => $line['waypoints'])); |
|
312 | 312 | } |
313 | 313 | if (isset($line['pilot_id']) && $line['pilot_id'] != '') { |
314 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
314 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_id' => $line['pilot_id'])); |
|
315 | 315 | } |
316 | 316 | if (isset($line['pilot_name']) && $line['pilot_name'] != '') { |
317 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
317 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('pilot_name' => $line['pilot_name'])); |
|
318 | 318 | } |
319 | 319 | |
320 | 320 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_flights[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9]+$/', $line['ident'])) { |
321 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
322 | - if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
321 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ident' => trim($line['ident']))); |
|
322 | + if ($this->all_flights[$id]['addedSpotter'] == 1) { |
|
323 | 323 | $timeelapsed = microtime(true); |
324 | - $Spotter = new Spotter($this->db); |
|
325 | - $fromsource = NULL; |
|
326 | - if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
327 | - elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
324 | + $Spotter = new Spotter($this->db); |
|
325 | + $fromsource = NULL; |
|
326 | + if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
|
327 | + elseif (isset($line['format_source']) && $line['format_source'] == 'vatsimtxt') $fromsource = 'vatsim'; |
|
328 | 328 | elseif (isset($line['format_source']) && $line['format_source'] == 'whazzup') $fromsource = 'ivao'; |
329 | 329 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
330 | 330 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
331 | - $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
331 | + $result = $Spotter->updateIdentSpotterData($this->all_flights[$id]['id'],$this->all_flights[$id]['ident'],$fromsource); |
|
332 | 332 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
333 | 333 | $Spotter->db = null; |
334 | 334 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
335 | - } |
|
335 | + } |
|
336 | 336 | |
337 | 337 | /* |
338 | 338 | if (!isset($line['id'])) { |
@@ -342,26 +342,26 @@ discard block |
||
342 | 342 | else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
343 | 343 | } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
344 | 344 | */ |
345 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
345 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
|
346 | 346 | |
347 | - //$putinarchive = true; |
|
348 | - if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
347 | + //$putinarchive = true; |
|
348 | + if (isset($line['departure_airport_time']) && $line['departure_airport_time'] != 0) { |
|
349 | 349 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport_time' => $line['departure_airport_time'])); |
350 | - } |
|
351 | - if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
350 | + } |
|
351 | + if (isset($line['arrival_airport_time']) && $line['arrival_airport_time'] != 0) { |
|
352 | 352 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('arrival_airport_time' => $line['arrival_airport_time'])); |
353 | - } |
|
354 | - if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
355 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
356 | - } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
353 | + } |
|
354 | + if (isset($line['departure_airport_icao']) && isset($line['arrival_airport_icao'])) { |
|
355 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
356 | + } elseif (isset($line['departure_airport_iata']) && isset($line['arrival_airport_iata'])) { |
|
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | $Spotter = new Spotter($this->db); |
359 | 359 | $line['departure_airport_icao'] = $Spotter->getAirportIcao($line['departure_airport_iata']); |
360 | 360 | $line['arrival_airport_icao'] = $Spotter->getAirportIcao($line['arrival_airport_iata']); |
361 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
361 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $line['departure_airport_icao'],'arrival_airport' => $line['arrival_airport_icao'],'route_stop' => '')); |
|
362 | 362 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getAirportICAO : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
363 | 363 | |
364 | - } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
364 | + } elseif (!isset($line['format_source']) || $line['format_source'] != 'aprs') { |
|
365 | 365 | $timeelapsed = microtime(true); |
366 | 366 | $Spotter = new Spotter($this->db); |
367 | 367 | $route = $Spotter->getRouteInfo(trim($line['ident'])); |
@@ -375,43 +375,43 @@ discard block |
||
375 | 375 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getrouteinfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
376 | 376 | |
377 | 377 | if (isset($route['fromairport_icao']) && isset($route['toairport_icao'])) { |
378 | - //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
379 | - if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
378 | + //if ($route['FromAirport_ICAO'] != $route['ToAirport_ICAO']) { |
|
379 | + if ($route['fromairport_icao'] != $route['toairport_icao']) { |
|
380 | 380 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['FromAirport_ICAO'],'arrival_airport' => $route['ToAirport_ICAO'],'route_stop' => $route['RouteStop'])); |
381 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
382 | - } |
|
381 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('departure_airport' => $route['fromairport_icao'],'arrival_airport' => $route['toairport_icao'],'route_stop' => $route['routestop'])); |
|
382 | + } |
|
383 | 383 | } |
384 | 384 | if (!isset($globalFork)) $globalFork = TRUE; |
385 | 385 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS && !$globalVAM && (!isset($line['format_source']) || $line['format_source'] != 'aprs')) { |
386 | 386 | if (!isset($this->all_flights[$id]['schedule_check']) || $this->all_flights[$id]['schedule_check'] === false) $this->get_Schedule($id,trim($line['ident'])); |
387 | 387 | } |
388 | - } |
|
388 | + } |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | if (isset($line['speed']) && $line['speed'] != '') { |
392 | 392 | // $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => $line[12])); |
393 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
394 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
395 | - //$dataFound = true; |
|
393 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($line['speed']))); |
|
394 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed_fromsrc' => true)); |
|
395 | + //$dataFound = true; |
|
396 | 396 | } else if (!isset($this->all_flights[$id]['speed_fromsrc']) && isset($this->all_flights[$id]['time_last_coord']) && $this->all_flights[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
397 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
398 | - if ($distance > 1000 && $distance < 10000) { |
|
399 | - // use datetime |
|
397 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m'); |
|
398 | + if ($distance > 1000 && $distance < 10000) { |
|
399 | + // use datetime |
|
400 | 400 | $speed = $distance/(time() - $this->all_flights[$id]['time_last_coord']); |
401 | 401 | $speed = $speed*3.6; |
402 | 402 | if ($speed < 1000) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('speed' => round($speed))); |
403 | 403 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_flights[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
404 | - } |
|
404 | + } |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | |
408 | 408 | |
409 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
410 | - if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
411 | - else unset($timediff); |
|
412 | - if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
409 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
410 | + if (isset($this->all_flights[$id]['time_last_coord'])) $timediff = round(time()-$this->all_flights[$id]['time_last_coord']); |
|
411 | + else unset($timediff); |
|
412 | + if ($this->tmd > 5 || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM) || !isset($timediff) || $timediff > 800 || ($timediff > 10 && isset($this->all_flights[$id]['latitude']) && isset($this->all_flights[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')))) { |
|
413 | 413 | if (isset($this->all_flights[$id]['archive_latitude']) && isset($this->all_flights[$id]['archive_longitude']) && isset($this->all_flights[$id]['livedb_latitude']) && isset($this->all_flights[$id]['livedb_longitude'])) { |
414 | - if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
414 | + if (!$Common->checkLine($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['livedb_latitude'],$this->all_flights[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
415 | 415 | $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
416 | 416 | $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
417 | 417 | $this->all_flights[$id]['putinarchive'] = true; |
@@ -425,16 +425,16 @@ discard block |
||
425 | 425 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
426 | 426 | $this->tmd = 0; |
427 | 427 | if ($globalDebug) echo 'FOUND : '.$this->all_flights[$id]['over_country'].' ---------------'."\n"; |
428 | - } |
|
428 | + } |
|
429 | 429 | } |
430 | 430 | |
431 | 431 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
432 | - //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
432 | + //if (!isset($this->all_flights[$id]['latitude']) || $this->all_flights[$id]['latitude'] == '' || abs($this->all_flights[$id]['latitude']-$line['latitude']) < 3 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
433 | 433 | if (!isset($this->all_flights[$id]['archive_latitude'])) $this->all_flights[$id]['archive_latitude'] = $line['latitude']; |
434 | 434 | if (!isset($this->all_flights[$id]['livedb_latitude']) || abs($this->all_flights[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
435 | - $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
436 | - $dataFound = true; |
|
437 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
435 | + $this->all_flights[$id]['livedb_latitude'] = $line['latitude']; |
|
436 | + $dataFound = true; |
|
437 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
438 | 438 | } |
439 | 439 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
440 | 440 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('latitude' => $line['latitude'])); |
@@ -445,20 +445,20 @@ discard block |
||
445 | 445 | //$putinarchive = true; |
446 | 446 | } |
447 | 447 | */ |
448 | - /* |
|
448 | + /* |
|
449 | 449 | } elseif (isset($this->all_flights[$id]['latitude'])) { |
450 | 450 | if ($globalDebug) echo '!!! Strange latitude value - diff : '.abs($this->all_flights[$id]['latitude']-$line['latitude']).'- previous lat : '.$this->all_flights[$id]['latitude'].'- new lat : '.$line['latitude']."\n"; |
451 | 451 | } |
452 | 452 | */ |
453 | 453 | } |
454 | 454 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
455 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
456 | - //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
455 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
456 | + //if (!isset($this->all_flights[$id]['longitude']) || $this->all_flights[$id]['longitude'] == '' || abs($this->all_flights[$id]['longitude']-$line['longitude']) < 2 || $line['format_source'] != 'sbs' || time() - $this->all_flights[$id]['lastupdate'] > 30) { |
|
457 | 457 | if (!isset($this->all_flights[$id]['archive_longitude'])) $this->all_flights[$id]['archive_longitude'] = $line['longitude']; |
458 | 458 | if (!isset($this->all_flights[$id]['livedb_longitude']) || abs($this->all_flights[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_flights[$id]['format_source'] == 'aprs') { |
459 | - $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
460 | - $dataFound = true; |
|
461 | - $this->all_flights[$id]['time_last_coord'] = time(); |
|
459 | + $this->all_flights[$id]['livedb_longitude'] = $line['longitude']; |
|
460 | + $dataFound = true; |
|
461 | + $this->all_flights[$id]['time_last_coord'] = time(); |
|
462 | 462 | } |
463 | 463 | // elseif ($globalDebug) echo '!*!*! Ignore data, too close to previous one'."\n"; |
464 | 464 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('longitude' => $line['longitude'])); |
@@ -476,53 +476,53 @@ discard block |
||
476 | 476 | */ |
477 | 477 | } |
478 | 478 | |
479 | - } else if ($globalDebug && $timediff > 20) { |
|
479 | + } else if ($globalDebug && $timediff > 20) { |
|
480 | 480 | $this->tmd = $this->tmd + 1; |
481 | 481 | echo '!!! Too much distance in short time... for '.$this->all_flights[$id]['ident']."\n"; |
482 | 482 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')."m -"; |
483 | 483 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
484 | 484 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_flights[$id]['latitude'].' - prev long : '.$this->all_flights[$id]['longitude']." \n"; |
485 | - } |
|
485 | + } |
|
486 | 486 | } |
487 | 487 | if (isset($line['last_update']) && $line['last_update'] != '') { |
488 | - if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
489 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
488 | + if (isset($this->all_flights[$id]['last_update']) && $this->all_flights[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
489 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('last_update' => $line['last_update'])); |
|
490 | 490 | } |
491 | 491 | if (isset($line['verticalrate']) && $line['verticalrate'] != '') { |
492 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
493 | - //$dataFound = true; |
|
492 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('verticalrate' => $line['verticalrate'])); |
|
493 | + //$dataFound = true; |
|
494 | 494 | } |
495 | 495 | if (isset($line['format_source']) && $line['format_source'] != '') { |
496 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
496 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('format_source' => $line['format_source'])); |
|
497 | 497 | } |
498 | 498 | if (isset($line['source_name']) && $line['source_name'] != '') { |
499 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
499 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('source_name' => $line['source_name'])); |
|
500 | 500 | } |
501 | 501 | if (isset($line['emergency']) && $line['emergency'] != '') { |
502 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
503 | - //$dataFound = true; |
|
502 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('emergency' => $line['emergency'])); |
|
503 | + //$dataFound = true; |
|
504 | 504 | } |
505 | 505 | if (isset($line['ground']) && $line['ground'] != '') { |
506 | - if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
506 | + if (isset($this->all_flights[$id]['ground']) && $this->all_flights[$id]['ground'] == 1 && $line['ground'] == 0) { |
|
507 | 507 | // Here we force archive of flight because after ground it's a new one (or should be) |
508 | 508 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('addedSpotter' => 0)); |
509 | 509 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 1)); |
510 | 510 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw') && $globalDaemon) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdGi'))); |
511 | - elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
511 | + elseif (isset($line['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $line['id'])); |
|
512 | 512 | elseif (isset($this->all_flights[$id]['ident'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.$this->all_flights[$id]['ident'])); |
513 | - } |
|
514 | - if ($line['ground'] != 1) $line['ground'] = 0; |
|
515 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
516 | - //$dataFound = true; |
|
513 | + } |
|
514 | + if ($line['ground'] != 1) $line['ground'] = 0; |
|
515 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('ground' => $line['ground'])); |
|
516 | + //$dataFound = true; |
|
517 | 517 | } |
518 | 518 | if (isset($line['squawk']) && $line['squawk'] != '') { |
519 | - if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
520 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
521 | - $highlight = ''; |
|
522 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
523 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
524 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
525 | - if ($highlight != '') { |
|
519 | + if (isset($this->all_flights[$id]['squawk']) && $this->all_flights[$id]['squawk'] != '7500' && $this->all_flights[$id]['squawk'] != '7600' && $this->all_flights[$id]['squawk'] != '7700' && isset($this->all_flights[$id]['id'])) { |
|
520 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
521 | + $highlight = ''; |
|
522 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack at '.date('Y-m-d G:i').' UTC'; |
|
523 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure) at '.date('Y-m-d G:i').' UTC'; |
|
524 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency at '.date('Y-m-d G:i').' UTC'; |
|
525 | + if ($highlight != '') { |
|
526 | 526 | $timeelapsed = microtime(true); |
527 | 527 | $Spotter = new Spotter($this->db); |
528 | 528 | $Spotter->setHighlightFlight($this->all_flights[$id]['id'],$highlight); |
@@ -532,38 +532,38 @@ discard block |
||
532 | 532 | $this->all_flights[$id]['putinarchive'] = true; |
533 | 533 | //$putinarchive = true; |
534 | 534 | //$highlight = ''; |
535 | - } |
|
535 | + } |
|
536 | 536 | |
537 | - } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
538 | - //$dataFound = true; |
|
537 | + } else $this->all_flights[$id] = array_merge($this->all_flights[$id],array('squawk' => $line['squawk'])); |
|
538 | + //$dataFound = true; |
|
539 | 539 | } |
540 | 540 | |
541 | 541 | if (isset($line['altitude']) && $line['altitude'] != '') { |
542 | - //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
542 | + //if (!isset($this->all_flights[$id]['altitude']) || $this->all_flights[$id]['altitude'] == '' || ($this->all_flights[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
543 | 543 | if (is_int($this->all_flights[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_flights[$id]['altitude']) > 2) $this->all_flights[$id]['putinarchive'] = true; |
544 | 544 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude' => round($line['altitude']/100))); |
545 | 545 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('altitude_real' => $line['altitude'])); |
546 | 546 | //$dataFound = true; |
547 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
547 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
548 | 548 | } |
549 | 549 | |
550 | 550 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
551 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
551 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('noarchive' => true)); |
|
552 | 552 | } |
553 | 553 | |
554 | 554 | if (isset($line['heading']) && $line['heading'] != '') { |
555 | - if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
557 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
558 | - //$dataFound = true; |
|
555 | + if (is_int($this->all_flights[$id]['heading']) && abs($this->all_flights[$id]['heading']-round($line['heading'])) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
556 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($line['heading']))); |
|
557 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading_fromsrc' => true)); |
|
558 | + //$dataFound = true; |
|
559 | 559 | } elseif (!isset($this->all_flights[$id]['heading_fromsrc']) && isset($this->all_flights[$id]['archive_latitude']) && $this->all_flights[$id]['archive_latitude'] != $this->all_flights[$id]['latitude'] && isset($this->all_flights[$id]['archive_longitude']) && $this->all_flights[$id]['archive_longitude'] != $this->all_flights[$id]['longitude']) { |
560 | - $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
561 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
562 | - if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
563 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
560 | + $heading = $Common->getHeading($this->all_flights[$id]['archive_latitude'],$this->all_flights[$id]['archive_longitude'],$this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude']); |
|
561 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => round($heading))); |
|
562 | + if (abs($this->all_flights[$id]['heading']-round($heading)) > 2) $this->all_flights[$id]['putinarchive'] = true; |
|
563 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_flights[$id]['hex']." : ".$heading."\n"; |
|
564 | 564 | } elseif (isset($this->all_flights[$id]['format_source']) && $this->all_flights[$id]['format_source'] == 'ACARS') { |
565 | - // If not enough messages and ACARS set heading to 0 |
|
566 | - $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
565 | + // If not enough messages and ACARS set heading to 0 |
|
566 | + $this->all_flights[$id] = array_merge($this->all_flights[$id],array('heading' => 0)); |
|
567 | 567 | } |
568 | 568 | if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
569 | 569 | elseif (isset($globalSBS1update) && $globalSBS1update != '' && isset($this->all_flights[$id]['lastupdate']) && time()-$this->all_flights[$id]['lastupdate'] < $globalSBS1update) $dataFound = false; |
@@ -574,119 +574,119 @@ discard block |
||
574 | 574 | //if ($dataFound == true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['ident'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
575 | 575 | //if ($dataFound === true && isset($this->all_flights[$id]['hex']) && $this->all_flights[$id]['heading'] != '' && $this->all_flights[$id]['latitude'] != '' && $this->all_flights[$id]['longitude'] != '') { |
576 | 576 | if ($dataFound === true && isset($this->all_flights[$id]['hex'])) { |
577 | - $this->all_flights[$id]['lastupdate'] = time(); |
|
578 | - if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
579 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
580 | - //print_r($this->all_flights); |
|
581 | - //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
582 | - //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
583 | - if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
577 | + $this->all_flights[$id]['lastupdate'] = time(); |
|
578 | + if ($this->all_flights[$id]['addedSpotter'] == 0) { |
|
579 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_flights[$id]['longitude'] == '' || $this->all_flights[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
580 | + //print_r($this->all_flights); |
|
581 | + //echo $this->all_flights[$id]['id'].' - '.$this->all_flights[$id]['addedSpotter']."\n"; |
|
582 | + //$last_hour_ident = Spotter->getIdentFromLastHour($this->all_flights[$id]['ident']); |
|
583 | + if (!isset($this->all_flights[$id]['forcenew']) || $this->all_flights[$id]['forcenew'] == 0) { |
|
584 | 584 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
585 | 585 | $timeelapsed = microtime(true); |
586 | 586 | $SpotterLive = new SpotterLive($this->db); |
587 | 587 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt' || $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson' || $line['format_source'] === 'radarvirtueljson')) { |
588 | - $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
589 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
588 | + $recent_ident = $SpotterLive->checkModeSRecent($this->all_flights[$id]['hex']); |
|
589 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkModeSRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
590 | 590 | } elseif (isset($line['id'])) { |
591 | - $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
592 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
591 | + $recent_ident = $SpotterLive->checkIdRecent($line['id']); |
|
592 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
593 | 593 | } elseif (isset($this->all_flights[$id]['ident']) && $this->all_flights[$id]['ident'] != '') { |
594 | - $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
595 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
594 | + $recent_ident = $SpotterLive->checkIdentRecent($this->all_flights[$id]['ident']); |
|
595 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
596 | 596 | } else $recent_ident = ''; |
597 | 597 | $SpotterLive->db=null; |
598 | 598 | |
599 | 599 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
600 | 600 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
601 | - } else { |
|
601 | + } else { |
|
602 | 602 | $recent_ident = ''; |
603 | 603 | $this->all_flights[$id] = array_merge($this->all_flights[$id],array('forcenew' => 0)); |
604 | - } |
|
605 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
606 | - if($recent_ident == "") |
|
607 | - { |
|
604 | + } |
|
605 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
606 | + if($recent_ident == "") |
|
607 | + { |
|
608 | 608 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." in archive DB : "; |
609 | 609 | if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
610 | 610 | if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
611 | 611 | //adds the spotter data for the archive |
612 | 612 | $ignoreImport = false; |
613 | 613 | foreach($globalAirportIgnore as $airportIgnore) { |
614 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
614 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
615 | 615 | $ignoreImport = true; |
616 | - } |
|
616 | + } |
|
617 | 617 | } |
618 | 618 | if (count($globalAirportAccept) > 0) { |
619 | - $ignoreImport = true; |
|
620 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
619 | + $ignoreImport = true; |
|
620 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
621 | 621 | if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
622 | - $ignoreImport = false; |
|
622 | + $ignoreImport = false; |
|
623 | + } |
|
623 | 624 | } |
624 | - } |
|
625 | 625 | } |
626 | 626 | if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
627 | - foreach($globalAirlineIgnore as $airlineIgnore) { |
|
627 | + foreach($globalAirlineIgnore as $airlineIgnore) { |
|
628 | 628 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
629 | - $ignoreImport = true; |
|
629 | + $ignoreImport = true; |
|
630 | + } |
|
630 | 631 | } |
631 | - } |
|
632 | 632 | } |
633 | 633 | if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
634 | - $ignoreImport = true; |
|
635 | - foreach($globalAirlineAccept as $airlineAccept) { |
|
634 | + $ignoreImport = true; |
|
635 | + foreach($globalAirlineAccept as $airlineAccept) { |
|
636 | 636 | if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
637 | - $ignoreImport = false; |
|
637 | + $ignoreImport = false; |
|
638 | + } |
|
638 | 639 | } |
639 | - } |
|
640 | 640 | } |
641 | 641 | if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
642 | - $ignoreImport = true; |
|
643 | - foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
642 | + $ignoreImport = true; |
|
643 | + foreach($globalPilotIdAccept as $pilotIdAccept) { |
|
644 | 644 | if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
645 | - $ignoreImport = false; |
|
645 | + $ignoreImport = false; |
|
646 | + } |
|
646 | 647 | } |
647 | - } |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | if (!$ignoreImport) { |
651 | - $highlight = ''; |
|
652 | - if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
653 | - if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
654 | - if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
655 | - if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
656 | - $timeelapsed = microtime(true); |
|
657 | - $Spotter = new Spotter($this->db); |
|
658 | - $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
659 | - $Spotter->db = null; |
|
660 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
661 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
651 | + $highlight = ''; |
|
652 | + if ($this->all_flights[$id]['squawk'] == '7500') $highlight = 'Squawk 7500 : Hijack'; |
|
653 | + if ($this->all_flights[$id]['squawk'] == '7600') $highlight = 'Squawk 7600 : Lost Comm (radio failure)'; |
|
654 | + if ($this->all_flights[$id]['squawk'] == '7700') $highlight = 'Squawk 7700 : Emergency'; |
|
655 | + if (!isset($this->all_flights[$id]['id'])) $this->all_flights[$id] = array_merge($this->all_flights[$id],array('id' => $this->all_flights[$id]['hex'].'-'.date('YmdHi'))); |
|
656 | + $timeelapsed = microtime(true); |
|
657 | + $Spotter = new Spotter($this->db); |
|
658 | + $result = $Spotter->addSpotterData($this->all_flights[$id]['id'], $this->all_flights[$id]['ident'], $this->all_flights[$id]['aircraft_icao'], $this->all_flights[$id]['departure_airport'], $this->all_flights[$id]['arrival_airport'], $this->all_flights[$id]['latitude'], $this->all_flights[$id]['longitude'], $this->all_flights[$id]['waypoints'], $this->all_flights[$id]['altitude'], $this->all_flights[$id]['heading'], $this->all_flights[$id]['speed'], $this->all_flights[$id]['datetime'], $this->all_flights[$id]['departure_airport_time'], $this->all_flights[$id]['arrival_airport_time'],$this->all_flights[$id]['squawk'],$this->all_flights[$id]['route_stop'],$highlight,$this->all_flights[$id]['hex'],$this->all_flights[$id]['registration'],$this->all_flights[$id]['pilot_id'],$this->all_flights[$id]['pilot_name'],$this->all_flights[$id]['verticalrate'],$this->all_flights[$id]['ground'],$this->all_flights[$id]['format_source'],$this->all_flights[$id]['source_name']); |
|
659 | + $Spotter->db = null; |
|
660 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
661 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
662 | 662 | |
663 | - // Add source stat in DB |
|
664 | - $Stats = new Stats($this->db); |
|
665 | - if (!empty($this->stats)) { |
|
663 | + // Add source stat in DB |
|
664 | + $Stats = new Stats($this->db); |
|
665 | + if (!empty($this->stats)) { |
|
666 | 666 | if ($globalDebug) echo 'Add source stats : '; |
667 | - foreach($this->stats as $date => $data) { |
|
668 | - foreach($data as $source => $sourced) { |
|
669 | - //print_r($sourced); |
|
670 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
671 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
672 | - if (isset($sourced['msg'])) { |
|
673 | - if (time() - $sourced['msg']['date'] > 10) { |
|
674 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
675 | - echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
676 | - unset($this->stats[$date][$source]['msg']); |
|
677 | - } |
|
678 | - } |
|
679 | - } |
|
680 | - if ($date != date('Y-m-d')) { |
|
681 | - unset($this->stats[$date]); |
|
682 | - } |
|
683 | - } |
|
684 | - if ($globalDebug) echo 'Done'."\n"; |
|
685 | - |
|
686 | - } |
|
687 | - $Stats->db = null; |
|
667 | + foreach($this->stats as $date => $data) { |
|
668 | + foreach($data as $source => $sourced) { |
|
669 | + //print_r($sourced); |
|
670 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar',$date); |
|
671 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist',$date); |
|
672 | + if (isset($sourced['msg'])) { |
|
673 | + if (time() - $sourced['msg']['date'] > 10) { |
|
674 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
675 | + echo $Stats->addStatSource($nbmsg,$source,'msg',$date); |
|
676 | + unset($this->stats[$date][$source]['msg']); |
|
677 | + } |
|
678 | + } |
|
679 | + } |
|
680 | + if ($date != date('Y-m-d')) { |
|
681 | + unset($this->stats[$date]); |
|
682 | + } |
|
683 | + } |
|
684 | + if ($globalDebug) echo 'Done'."\n"; |
|
685 | + |
|
686 | + } |
|
687 | + $Stats->db = null; |
|
688 | 688 | |
689 | - $this->del(); |
|
689 | + $this->del(); |
|
690 | 690 | } elseif ($globalDebug) echo 'Ignore data'."\n"; |
691 | 691 | //$ignoreImport = false; |
692 | 692 | $this->all_flights[$id]['addedSpotter'] = 1; |
@@ -704,18 +704,18 @@ discard block |
||
704 | 704 | */ |
705 | 705 | //SpotterLive->deleteLiveSpotterDataByIdent($this->all_flights[$id]['ident']); |
706 | 706 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
707 | - if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
708 | - //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
709 | - $SpotterLive = new SpotterLive($this->db); |
|
710 | - $SpotterLive->deleteLiveSpotterData(); |
|
711 | - $SpotterLive->db=null; |
|
712 | - if ($globalDebug) echo " Done\n"; |
|
713 | - $this->last_delete = time(); |
|
707 | + if ($globalDebug) echo "---- Deleting Live Spotter data older than 9 hours..."; |
|
708 | + //SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
709 | + $SpotterLive = new SpotterLive($this->db); |
|
710 | + $SpotterLive->deleteLiveSpotterData(); |
|
711 | + $SpotterLive->db=null; |
|
712 | + if ($globalDebug) echo " Done\n"; |
|
713 | + $this->last_delete = time(); |
|
714 | 714 | } |
715 | - } else { |
|
715 | + } else { |
|
716 | 716 | if (isset($line['format_source']) && ($line['format_source'] === 'sbs' || $line['format_source'] === 'tsv' || $line['format_source'] === 'raw' || $line['format_source'] === 'deltadbtxt'|| $line['format_source'] === 'planeupdatefaa' || $line['format_source'] === 'aprs' || $line['format_source'] === 'aircraftlistjson')) { |
717 | - $this->all_flights[$id]['id'] = $recent_ident; |
|
718 | - $this->all_flights[$id]['addedSpotter'] = 1; |
|
717 | + $this->all_flights[$id]['id'] = $recent_ident; |
|
718 | + $this->all_flights[$id]['addedSpotter'] = 1; |
|
719 | 719 | } |
720 | 720 | if (isset($globalDaemon) && !$globalDaemon) { |
721 | 721 | $Spotter = new Spotter($this->db); |
@@ -723,14 +723,14 @@ discard block |
||
723 | 723 | $Spotter->db = null; |
724 | 724 | } |
725 | 725 | |
726 | - } |
|
726 | + } |
|
727 | + } |
|
727 | 728 | } |
728 | - } |
|
729 | - //adds the spotter LIVE data |
|
730 | - //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
731 | - //echo "\nAdd in Live !! \n"; |
|
732 | - //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
733 | - if ($globalDebug) { |
|
729 | + //adds the spotter LIVE data |
|
730 | + //SpotterLive->addLiveSpotterData($flightaware_id, $ident, $aircraft_type, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed); |
|
731 | + //echo "\nAdd in Live !! \n"; |
|
732 | + //echo "{$line[8]} {$line[7]} - MODES:{$line[4]} CALLSIGN:{$line[10]} ALT:{$line[11]} VEL:{$line[12]} HDG:{$line[13]} LAT:{$line[14]} LON:{$line[15]} VR:{$line[16]} SQUAWK:{$line[17]}\n"; |
|
733 | + if ($globalDebug) { |
|
734 | 734 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM)) { |
735 | 735 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name'].' - Source name : '.$this->all_flights[$id]['source_name']."\n"; |
736 | 736 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Pilot : '.$this->all_flights[$id]['pilot_name']."\n"; |
@@ -738,49 +738,49 @@ discard block |
||
738 | 738 | if (isset($this->all_flights[$id]['source_name'])) echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time'].' - Source Name : '.$this->all_flights[$id]['source_name']."\n"; |
739 | 739 | else echo 'DATA : hex : '.$this->all_flights[$id]['hex'].' - ident : '.$this->all_flights[$id]['ident'].' - ICAO : '.$this->all_flights[$id]['aircraft_icao'].' - Departure Airport : '.$this->all_flights[$id]['departure_airport'].' - Arrival Airport : '.$this->all_flights[$id]['arrival_airport'].' - Latitude : '.$this->all_flights[$id]['latitude'].' - Longitude : '.$this->all_flights[$id]['longitude'].' - waypoints : '.$this->all_flights[$id]['waypoints'].' - Altitude : '.$this->all_flights[$id]['altitude'].' - Heading : '.$this->all_flights[$id]['heading'].' - Speed : '.$this->all_flights[$id]['speed'].' - Departure Airport Time : '.$this->all_flights[$id]['departure_airport_time'].' - Arrival Airport time : '.$this->all_flights[$id]['arrival_airport_time']."\n"; |
740 | 740 | } |
741 | - } |
|
742 | - $ignoreImport = false; |
|
743 | - if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
744 | - if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
741 | + } |
|
742 | + $ignoreImport = false; |
|
743 | + if ($this->all_flights[$id]['departure_airport'] == "") { $this->all_flights[$id]['departure_airport'] = "NA"; } |
|
744 | + if ($this->all_flights[$id]['arrival_airport'] == "") { $this->all_flights[$id]['arrival_airport'] = "NA"; } |
|
745 | 745 | |
746 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
747 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
748 | - $ignoreImport = true; |
|
746 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
747 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
748 | + $ignoreImport = true; |
|
749 | + } |
|
749 | 750 | } |
750 | - } |
|
751 | - if (count($globalAirportAccept) > 0) { |
|
752 | - $ignoreImport = true; |
|
753 | - foreach($globalAirportIgnore as $airportIgnore) { |
|
754 | - if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
751 | + if (count($globalAirportAccept) > 0) { |
|
752 | + $ignoreImport = true; |
|
753 | + foreach($globalAirportIgnore as $airportIgnore) { |
|
754 | + if (($this->all_flights[$id]['departure_airport'] == $airportIgnore) || ($this->all_flights[$id]['arrival_airport'] == $airportIgnore)) { |
|
755 | 755 | $ignoreImport = false; |
756 | - } |
|
756 | + } |
|
757 | 757 | } |
758 | - } |
|
759 | - if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
758 | + } |
|
759 | + if (isset($globalAirlineIgnore) && is_array($globalAirlineIgnore)) { |
|
760 | 760 | foreach($globalAirlineIgnore as $airlineIgnore) { |
761 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
761 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineIgnore) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineIgnore)) { |
|
762 | 762 | $ignoreImport = true; |
763 | - } |
|
763 | + } |
|
764 | 764 | } |
765 | - } |
|
766 | - if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
765 | + } |
|
766 | + if (isset($globalAirlineAccept) && count($globalAirlineAccept) > 0) { |
|
767 | 767 | $ignoreImport = true; |
768 | 768 | foreach($globalAirlineAccept as $airlineAccept) { |
769 | - if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
769 | + if ((is_numeric(substr(substr($this->all_flights[$id]['ident'],0,4),-1,1)) && substr($this->all_flights[$id]['ident'],0,3) == $airlineAccept) || (is_numeric(substr(substr($this->all_flights[$id]['ident'],0,3),-1,1)) && substr($this->all_flights[$id]['ident'],0,2) == $airlineAccept)) { |
|
770 | 770 | $ignoreImport = false; |
771 | - } |
|
771 | + } |
|
772 | 772 | } |
773 | - } |
|
774 | - if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
773 | + } |
|
774 | + if (isset($globalPilotIdAccept) && count($globalPilotIdAccept) > 0) { |
|
775 | 775 | $ignoreImport = true; |
776 | 776 | foreach($globalPilotIdAccept as $pilotIdAccept) { |
777 | - if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
778 | - $ignoreImport = false; |
|
779 | - } |
|
777 | + if ($this->all_flights[$id]['pilot_id'] == $pilotIdAccept) { |
|
778 | + $ignoreImport = false; |
|
779 | + } |
|
780 | + } |
|
780 | 781 | } |
781 | - } |
|
782 | 782 | |
783 | - if (!$ignoreImport) { |
|
783 | + if (!$ignoreImport) { |
|
784 | 784 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_flights[$id]['latitude'],$this->all_flights[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
785 | 785 | if ($globalDebug) echo "\o/ Add ".$this->all_flights[$id]['ident']." from ".$this->all_flights[$id]['format_source']." in Live DB : "; |
786 | 786 | $timeelapsed = microtime(true); |
@@ -818,7 +818,7 @@ discard block |
||
818 | 818 | if ($stats_heading == 16) $stats_heading = 0; |
819 | 819 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
820 | 820 | for ($i=0;$i<=15;$i++) { |
821 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
821 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
822 | 822 | } |
823 | 823 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
824 | 824 | } else { |
@@ -831,11 +831,11 @@ discard block |
||
831 | 831 | //var_dump($this->stats); |
832 | 832 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
833 | 833 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
834 | - end($this->stats[$current_date][$source]['hist']); |
|
835 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
834 | + end($this->stats[$current_date][$source]['hist']); |
|
835 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
836 | 836 | } else $mini = 0; |
837 | 837 | for ($i=$mini;$i<=$distance;$i+=10) { |
838 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
838 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
839 | 839 | } |
840 | 840 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
841 | 841 | } else { |
@@ -852,22 +852,22 @@ discard block |
||
852 | 852 | |
853 | 853 | |
854 | 854 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
855 | - if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
856 | - $SpotterLive = new SpotterLive($this->db); |
|
857 | - $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
858 | - $SpotterLive->db = null; |
|
859 | - //SpotterLive->deleteLiveSpotterData(); |
|
860 | - if ($globalDebug) echo " Done\n"; |
|
861 | - $this->last_delete_hourly = time(); |
|
855 | + if ($globalDebug) echo "---- Deleting Live Spotter data Not updated since 2 hour..."; |
|
856 | + $SpotterLive = new SpotterLive($this->db); |
|
857 | + $SpotterLive->deleteLiveSpotterDataNotUpdated(); |
|
858 | + $SpotterLive->db = null; |
|
859 | + //SpotterLive->deleteLiveSpotterData(); |
|
860 | + if ($globalDebug) echo " Done\n"; |
|
861 | + $this->last_delete_hourly = time(); |
|
862 | 862 | } |
863 | 863 | |
864 | - } |
|
865 | - //$ignoreImport = false; |
|
864 | + } |
|
865 | + //$ignoreImport = false; |
|
866 | 866 | } |
867 | 867 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
868 | 868 | if ($send) return $this->all_flights[$id]; |
869 | - } |
|
869 | + } |
|
870 | + } |
|
870 | 871 | } |
871 | - } |
|
872 | 872 | } |
873 | 873 | ?> |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | } |
14 | 14 | |
15 | 15 | /** |
16 | - * Get SQL query part for filter used |
|
17 | - * @param Array $filter the filter |
|
18 | - * @return Array the SQL part |
|
19 | - */ |
|
16 | + * Get SQL query part for filter used |
|
17 | + * @param Array $filter the filter |
|
18 | + * @return Array the SQL part |
|
19 | + */ |
|
20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
22 | 22 | $filters = array(); |
@@ -84,14 +84,14 @@ discard block |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * Executes the SQL statements to get the spotter information |
|
88 | - * |
|
89 | - * @param String $query the SQL query |
|
90 | - * @param Array $params parameter of the query |
|
91 | - * @param String $limitQuery the limit query |
|
92 | - * @return Array the spotter information |
|
93 | - * |
|
94 | - */ |
|
87 | + * Executes the SQL statements to get the spotter information |
|
88 | + * |
|
89 | + * @param String $query the SQL query |
|
90 | + * @param Array $params parameter of the query |
|
91 | + * @param String $limitQuery the limit query |
|
92 | + * @return Array the spotter information |
|
93 | + * |
|
94 | + */ |
|
95 | 95 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
96 | 96 | { |
97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -255,11 +255,11 @@ discard block |
||
255 | 255 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
256 | 256 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
257 | 257 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
258 | - } else { |
|
259 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
258 | + } else { |
|
259 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
260 | 260 | $temp_array['aircraft_name'] = 'N/A'; |
261 | 261 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
262 | - } |
|
262 | + } |
|
263 | 263 | } |
264 | 264 | $fromsource = NULL; |
265 | 265 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -454,11 +454,11 @@ discard block |
||
454 | 454 | |
455 | 455 | |
456 | 456 | /** |
457 | - * Gets all the spotter information |
|
458 | - * |
|
459 | - * @return Array the spotter information |
|
460 | - * |
|
461 | - */ |
|
457 | + * Gets all the spotter information |
|
458 | + * |
|
459 | + * @return Array the spotter information |
|
460 | + * |
|
461 | + */ |
|
462 | 462 | public function searchSpotterData($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()) |
463 | 463 | { |
464 | 464 | global $globalTimezone, $globalDBdriver; |
@@ -805,11 +805,11 @@ discard block |
||
805 | 805 | |
806 | 806 | |
807 | 807 | /** |
808 | - * Gets all the spotter information based on the latest data entry |
|
809 | - * |
|
810 | - * @return Array the spotter information |
|
811 | - * |
|
812 | - */ |
|
808 | + * Gets all the spotter information based on the latest data entry |
|
809 | + * |
|
810 | + * @return Array the spotter information |
|
811 | + * |
|
812 | + */ |
|
813 | 813 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
814 | 814 | { |
815 | 815 | global $global_query; |
@@ -848,12 +848,12 @@ discard block |
||
848 | 848 | } |
849 | 849 | |
850 | 850 | |
851 | - /** |
|
852 | - * Gets all the spotter information based on a user's latitude and longitude |
|
853 | - * |
|
854 | - * @return Array the spotter information |
|
855 | - * |
|
856 | - */ |
|
851 | + /** |
|
852 | + * Gets all the spotter information based on a user's latitude and longitude |
|
853 | + * |
|
854 | + * @return Array the spotter information |
|
855 | + * |
|
856 | + */ |
|
857 | 857 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
858 | 858 | { |
859 | 859 | date_default_timezone_set('UTC'); |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | return false; |
882 | 882 | } |
883 | 883 | } |
884 | - $additional_query = ''; |
|
884 | + $additional_query = ''; |
|
885 | 885 | if ($interval != "") |
886 | 886 | { |
887 | 887 | if (!is_string($interval)) |
@@ -921,12 +921,12 @@ discard block |
||
921 | 921 | } |
922 | 922 | |
923 | 923 | |
924 | - /** |
|
925 | - * Gets all the spotter information sorted by the newest aircraft type |
|
926 | - * |
|
927 | - * @return Array the spotter information |
|
928 | - * |
|
929 | - */ |
|
924 | + /** |
|
925 | + * Gets all the spotter information sorted by the newest aircraft type |
|
926 | + * |
|
927 | + * @return Array the spotter information |
|
928 | + * |
|
929 | + */ |
|
930 | 930 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
931 | 931 | { |
932 | 932 | global $global_query; |
@@ -967,11 +967,11 @@ discard block |
||
967 | 967 | |
968 | 968 | |
969 | 969 | /** |
970 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
971 | - * |
|
972 | - * @return Array the spotter information |
|
973 | - * |
|
974 | - */ |
|
970 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
971 | + * |
|
972 | + * @return Array the spotter information |
|
973 | + * |
|
974 | + */ |
|
975 | 975 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
976 | 976 | { |
977 | 977 | global $global_query; |
@@ -1011,11 +1011,11 @@ discard block |
||
1011 | 1011 | |
1012 | 1012 | |
1013 | 1013 | /** |
1014 | - * Gets all the spotter information sorted by the newest airline |
|
1015 | - * |
|
1016 | - * @return Array the spotter information |
|
1017 | - * |
|
1018 | - */ |
|
1014 | + * Gets all the spotter information sorted by the newest airline |
|
1015 | + * |
|
1016 | + * @return Array the spotter information |
|
1017 | + * |
|
1018 | + */ |
|
1019 | 1019 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
1020 | 1020 | { |
1021 | 1021 | global $global_query; |
@@ -1054,12 +1054,12 @@ discard block |
||
1054 | 1054 | } |
1055 | 1055 | |
1056 | 1056 | |
1057 | - /** |
|
1058 | - * Gets all the spotter information sorted by the newest departure airport |
|
1059 | - * |
|
1060 | - * @return Array the spotter information |
|
1061 | - * |
|
1062 | - */ |
|
1057 | + /** |
|
1058 | + * Gets all the spotter information sorted by the newest departure airport |
|
1059 | + * |
|
1060 | + * @return Array the spotter information |
|
1061 | + * |
|
1062 | + */ |
|
1063 | 1063 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
1064 | 1064 | { |
1065 | 1065 | global $global_query; |
@@ -1101,11 +1101,11 @@ discard block |
||
1101 | 1101 | |
1102 | 1102 | |
1103 | 1103 | /** |
1104 | - * Gets all the spotter information sorted by the newest arrival airport |
|
1105 | - * |
|
1106 | - * @return Array the spotter information |
|
1107 | - * |
|
1108 | - */ |
|
1104 | + * Gets all the spotter information sorted by the newest arrival airport |
|
1105 | + * |
|
1106 | + * @return Array the spotter information |
|
1107 | + * |
|
1108 | + */ |
|
1109 | 1109 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
1110 | 1110 | { |
1111 | 1111 | global $global_query; |
@@ -1144,11 +1144,11 @@ discard block |
||
1144 | 1144 | |
1145 | 1145 | |
1146 | 1146 | /** |
1147 | - * Gets all the spotter information based on the spotter id |
|
1148 | - * |
|
1149 | - * @return Array the spotter information |
|
1150 | - * |
|
1151 | - */ |
|
1147 | + * Gets all the spotter information based on the spotter id |
|
1148 | + * |
|
1149 | + * @return Array the spotter information |
|
1150 | + * |
|
1151 | + */ |
|
1152 | 1152 | public function getSpotterDataByID($id = '') |
1153 | 1153 | { |
1154 | 1154 | global $global_query; |
@@ -1170,11 +1170,11 @@ discard block |
||
1170 | 1170 | |
1171 | 1171 | |
1172 | 1172 | /** |
1173 | - * Gets all the spotter information based on the callsign |
|
1174 | - * |
|
1175 | - * @return Array the spotter information |
|
1176 | - * |
|
1177 | - */ |
|
1173 | + * Gets all the spotter information based on the callsign |
|
1174 | + * |
|
1175 | + * @return Array the spotter information |
|
1176 | + * |
|
1177 | + */ |
|
1178 | 1178 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
1179 | 1179 | { |
1180 | 1180 | global $global_query; |
@@ -1227,11 +1227,11 @@ discard block |
||
1227 | 1227 | |
1228 | 1228 | |
1229 | 1229 | /** |
1230 | - * Gets all the spotter information based on the aircraft type |
|
1231 | - * |
|
1232 | - * @return Array the spotter information |
|
1233 | - * |
|
1234 | - */ |
|
1230 | + * Gets all the spotter information based on the aircraft type |
|
1231 | + * |
|
1232 | + * @return Array the spotter information |
|
1233 | + * |
|
1234 | + */ |
|
1235 | 1235 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
1236 | 1236 | { |
1237 | 1237 | global $global_query; |
@@ -1285,11 +1285,11 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | |
1287 | 1287 | /** |
1288 | - * Gets all the spotter information based on the aircraft registration |
|
1289 | - * |
|
1290 | - * @return Array the spotter information |
|
1291 | - * |
|
1292 | - */ |
|
1288 | + * Gets all the spotter information based on the aircraft registration |
|
1289 | + * |
|
1290 | + * @return Array the spotter information |
|
1291 | + * |
|
1292 | + */ |
|
1293 | 1293 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
1294 | 1294 | { |
1295 | 1295 | global $global_query; |
@@ -1346,11 +1346,11 @@ discard block |
||
1346 | 1346 | |
1347 | 1347 | |
1348 | 1348 | /** |
1349 | - * Gets all the spotter information based on the airline |
|
1350 | - * |
|
1351 | - * @return Array the spotter information |
|
1352 | - * |
|
1353 | - */ |
|
1349 | + * Gets all the spotter information based on the airline |
|
1350 | + * |
|
1351 | + * @return Array the spotter information |
|
1352 | + * |
|
1353 | + */ |
|
1354 | 1354 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
1355 | 1355 | { |
1356 | 1356 | global $global_query; |
@@ -1403,11 +1403,11 @@ discard block |
||
1403 | 1403 | |
1404 | 1404 | |
1405 | 1405 | /** |
1406 | - * Gets all the spotter information based on the airport |
|
1407 | - * |
|
1408 | - * @return Array the spotter information |
|
1409 | - * |
|
1410 | - */ |
|
1406 | + * Gets all the spotter information based on the airport |
|
1407 | + * |
|
1408 | + * @return Array the spotter information |
|
1409 | + * |
|
1410 | + */ |
|
1411 | 1411 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
1412 | 1412 | { |
1413 | 1413 | global $global_query; |
@@ -1461,11 +1461,11 @@ discard block |
||
1461 | 1461 | |
1462 | 1462 | |
1463 | 1463 | /** |
1464 | - * Gets all the spotter information based on the date |
|
1465 | - * |
|
1466 | - * @return Array the spotter information |
|
1467 | - * |
|
1468 | - */ |
|
1464 | + * Gets all the spotter information based on the date |
|
1465 | + * |
|
1466 | + * @return Array the spotter information |
|
1467 | + * |
|
1468 | + */ |
|
1469 | 1469 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
1470 | 1470 | { |
1471 | 1471 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1526,11 +1526,11 @@ discard block |
||
1526 | 1526 | |
1527 | 1527 | |
1528 | 1528 | /** |
1529 | - * Gets all the spotter information based on the country name |
|
1530 | - * |
|
1531 | - * @return Array the spotter information |
|
1532 | - * |
|
1533 | - */ |
|
1529 | + * Gets all the spotter information based on the country name |
|
1530 | + * |
|
1531 | + * @return Array the spotter information |
|
1532 | + * |
|
1533 | + */ |
|
1534 | 1534 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
1535 | 1535 | { |
1536 | 1536 | global $global_query; |
@@ -1584,11 +1584,11 @@ discard block |
||
1584 | 1584 | |
1585 | 1585 | |
1586 | 1586 | /** |
1587 | - * Gets all the spotter information based on the manufacturer name |
|
1588 | - * |
|
1589 | - * @return Array the spotter information |
|
1590 | - * |
|
1591 | - */ |
|
1587 | + * Gets all the spotter information based on the manufacturer name |
|
1588 | + * |
|
1589 | + * @return Array the spotter information |
|
1590 | + * |
|
1591 | + */ |
|
1592 | 1592 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
1593 | 1593 | { |
1594 | 1594 | global $global_query; |
@@ -1644,13 +1644,13 @@ discard block |
||
1644 | 1644 | |
1645 | 1645 | |
1646 | 1646 | /** |
1647 | - * Gets a list of all aircraft that take a route |
|
1648 | - * |
|
1649 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
1650 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1651 | - * @return Array the spotter information |
|
1652 | - * |
|
1653 | - */ |
|
1647 | + * Gets a list of all aircraft that take a route |
|
1648 | + * |
|
1649 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
1650 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1651 | + * @return Array the spotter information |
|
1652 | + * |
|
1653 | + */ |
|
1654 | 1654 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
1655 | 1655 | { |
1656 | 1656 | global $global_query; |
@@ -1717,11 +1717,11 @@ discard block |
||
1717 | 1717 | |
1718 | 1718 | |
1719 | 1719 | /** |
1720 | - * Gets all the spotter information based on the special column in the table |
|
1721 | - * |
|
1722 | - * @return Array the spotter information |
|
1723 | - * |
|
1724 | - */ |
|
1720 | + * Gets all the spotter information based on the special column in the table |
|
1721 | + * |
|
1722 | + * @return Array the spotter information |
|
1723 | + * |
|
1724 | + */ |
|
1725 | 1725 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
1726 | 1726 | { |
1727 | 1727 | global $global_query; |
@@ -1760,11 +1760,11 @@ discard block |
||
1760 | 1760 | } |
1761 | 1761 | |
1762 | 1762 | /** |
1763 | - * Gets all the highlight based on a aircraft registration |
|
1764 | - * |
|
1765 | - * @return String the highlight text |
|
1766 | - * |
|
1767 | - */ |
|
1763 | + * Gets all the highlight based on a aircraft registration |
|
1764 | + * |
|
1765 | + * @return String the highlight text |
|
1766 | + * |
|
1767 | + */ |
|
1768 | 1768 | public function getHighlightByRegistration($registration,$filter = array()) |
1769 | 1769 | { |
1770 | 1770 | global $global_query; |
@@ -1786,13 +1786,13 @@ discard block |
||
1786 | 1786 | |
1787 | 1787 | |
1788 | 1788 | /** |
1789 | - * Gets the squawk usage from squawk code |
|
1790 | - * |
|
1791 | - * @param String $squawk squawk code |
|
1792 | - * @param String $country country |
|
1793 | - * @return String usage |
|
1794 | - * |
|
1795 | - */ |
|
1789 | + * Gets the squawk usage from squawk code |
|
1790 | + * |
|
1791 | + * @param String $squawk squawk code |
|
1792 | + * @param String $country country |
|
1793 | + * @return String usage |
|
1794 | + * |
|
1795 | + */ |
|
1796 | 1796 | public function getSquawkUsage($squawk = '',$country = 'FR') |
1797 | 1797 | { |
1798 | 1798 | |
@@ -1813,12 +1813,12 @@ discard block |
||
1813 | 1813 | } |
1814 | 1814 | |
1815 | 1815 | /** |
1816 | - * Gets the airport icao from the iata |
|
1817 | - * |
|
1818 | - * @param String $airport_iata the iata code of the airport |
|
1819 | - * @return String airport iata |
|
1820 | - * |
|
1821 | - */ |
|
1816 | + * Gets the airport icao from the iata |
|
1817 | + * |
|
1818 | + * @param String $airport_iata the iata code of the airport |
|
1819 | + * @return String airport iata |
|
1820 | + * |
|
1821 | + */ |
|
1822 | 1822 | public function getAirportIcao($airport_iata = '') |
1823 | 1823 | { |
1824 | 1824 | |
@@ -1838,14 +1838,14 @@ discard block |
||
1838 | 1838 | } |
1839 | 1839 | |
1840 | 1840 | /** |
1841 | - * Gets the airport distance |
|
1842 | - * |
|
1843 | - * @param String $airport_icao the icao code of the airport |
|
1844 | - * @param Float $latitude the latitude |
|
1845 | - * @param Float $longitude the longitude |
|
1846 | - * @return Float distance to the airport |
|
1847 | - * |
|
1848 | - */ |
|
1841 | + * Gets the airport distance |
|
1842 | + * |
|
1843 | + * @param String $airport_icao the icao code of the airport |
|
1844 | + * @param Float $latitude the latitude |
|
1845 | + * @param Float $longitude the longitude |
|
1846 | + * @return Float distance to the airport |
|
1847 | + * |
|
1848 | + */ |
|
1849 | 1849 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
1850 | 1850 | { |
1851 | 1851 | |
@@ -1866,12 +1866,12 @@ discard block |
||
1866 | 1866 | } |
1867 | 1867 | |
1868 | 1868 | /** |
1869 | - * Gets the airport info based on the icao |
|
1870 | - * |
|
1871 | - * @param String $airport the icao code of the airport |
|
1872 | - * @return Array airport information |
|
1873 | - * |
|
1874 | - */ |
|
1869 | + * Gets the airport info based on the icao |
|
1870 | + * |
|
1871 | + * @param String $airport the icao code of the airport |
|
1872 | + * @return Array airport information |
|
1873 | + * |
|
1874 | + */ |
|
1875 | 1875 | public function getAllAirportInfo($airport = '') |
1876 | 1876 | { |
1877 | 1877 | |
@@ -1917,12 +1917,12 @@ discard block |
||
1917 | 1917 | } |
1918 | 1918 | |
1919 | 1919 | /** |
1920 | - * Gets the airport info based on the country |
|
1921 | - * |
|
1922 | - * @param Array $countries Airports countries |
|
1923 | - * @return Array airport information |
|
1924 | - * |
|
1925 | - */ |
|
1920 | + * Gets the airport info based on the country |
|
1921 | + * |
|
1922 | + * @param Array $countries Airports countries |
|
1923 | + * @return Array airport information |
|
1924 | + * |
|
1925 | + */ |
|
1926 | 1926 | public function getAllAirportInfobyCountry($countries) |
1927 | 1927 | { |
1928 | 1928 | $lst_countries = ''; |
@@ -1960,12 +1960,12 @@ discard block |
||
1960 | 1960 | } |
1961 | 1961 | |
1962 | 1962 | /** |
1963 | - * Gets airports info based on the coord |
|
1964 | - * |
|
1965 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1966 | - * @return Array airport information |
|
1967 | - * |
|
1968 | - */ |
|
1963 | + * Gets airports info based on the coord |
|
1964 | + * |
|
1965 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1966 | + * @return Array airport information |
|
1967 | + * |
|
1968 | + */ |
|
1969 | 1969 | public function getAllAirportInfobyCoord($coord) |
1970 | 1970 | { |
1971 | 1971 | global $globalDBdriver; |
@@ -1996,12 +1996,12 @@ discard block |
||
1996 | 1996 | } |
1997 | 1997 | |
1998 | 1998 | /** |
1999 | - * Gets waypoints info based on the coord |
|
2000 | - * |
|
2001 | - * @param Array $coord waypoints coord |
|
2002 | - * @return Array airport information |
|
2003 | - * |
|
2004 | - */ |
|
1999 | + * Gets waypoints info based on the coord |
|
2000 | + * |
|
2001 | + * @param Array $coord waypoints coord |
|
2002 | + * @return Array airport information |
|
2003 | + * |
|
2004 | + */ |
|
2005 | 2005 | public function getAllWaypointsInfobyCoord($coord) |
2006 | 2006 | { |
2007 | 2007 | if (is_array($coord)) { |
@@ -2035,12 +2035,12 @@ discard block |
||
2035 | 2035 | |
2036 | 2036 | |
2037 | 2037 | /** |
2038 | - * Gets the airline info based on the icao code or iata code |
|
2039 | - * |
|
2040 | - * @param String $airline_icao the iata code of the airport |
|
2041 | - * @return Array airport information |
|
2042 | - * |
|
2043 | - */ |
|
2038 | + * Gets the airline info based on the icao code or iata code |
|
2039 | + * |
|
2040 | + * @param String $airline_icao the iata code of the airport |
|
2041 | + * @return Array airport information |
|
2042 | + * |
|
2043 | + */ |
|
2044 | 2044 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2045 | 2045 | { |
2046 | 2046 | global $globalUseRealAirlines; |
@@ -2071,7 +2071,7 @@ discard block |
||
2071 | 2071 | } else { |
2072 | 2072 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
2073 | 2073 | } |
2074 | - /* |
|
2074 | + /* |
|
2075 | 2075 | $airline_array = array(); |
2076 | 2076 | $temp_array = array(); |
2077 | 2077 | |
@@ -2103,12 +2103,12 @@ discard block |
||
2103 | 2103 | |
2104 | 2104 | |
2105 | 2105 | /** |
2106 | - * Gets the aircraft info based on the aircraft type |
|
2107 | - * |
|
2108 | - * @param String $aircraft_type the aircraft type |
|
2109 | - * @return Array aircraft information |
|
2110 | - * |
|
2111 | - */ |
|
2106 | + * Gets the aircraft info based on the aircraft type |
|
2107 | + * |
|
2108 | + * @param String $aircraft_type the aircraft type |
|
2109 | + * @return Array aircraft information |
|
2110 | + * |
|
2111 | + */ |
|
2112 | 2112 | public function getAllAircraftInfo($aircraft_type) |
2113 | 2113 | { |
2114 | 2114 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2140,12 +2140,12 @@ discard block |
||
2140 | 2140 | } |
2141 | 2141 | |
2142 | 2142 | /** |
2143 | - * Gets the aircraft icao based on the aircraft name/type |
|
2144 | - * |
|
2145 | - * @param String $aircraft_type the aircraft type |
|
2146 | - * @return String aircraft information |
|
2147 | - * |
|
2148 | - */ |
|
2143 | + * Gets the aircraft icao based on the aircraft name/type |
|
2144 | + * |
|
2145 | + * @param String $aircraft_type the aircraft type |
|
2146 | + * @return String aircraft information |
|
2147 | + * |
|
2148 | + */ |
|
2149 | 2149 | public function getAircraftIcao($aircraft_type) |
2150 | 2150 | { |
2151 | 2151 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2170,12 +2170,12 @@ discard block |
||
2170 | 2170 | } |
2171 | 2171 | |
2172 | 2172 | /** |
2173 | - * Gets the aircraft info based on the aircraft ident |
|
2174 | - * |
|
2175 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
2176 | - * @return String aircraft type |
|
2177 | - * |
|
2178 | - */ |
|
2173 | + * Gets the aircraft info based on the aircraft ident |
|
2174 | + * |
|
2175 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
2176 | + * @return String aircraft type |
|
2177 | + * |
|
2178 | + */ |
|
2179 | 2179 | public function getAllAircraftType($aircraft_modes) |
2180 | 2180 | { |
2181 | 2181 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2193,12 +2193,12 @@ discard block |
||
2193 | 2193 | } |
2194 | 2194 | |
2195 | 2195 | /** |
2196 | - * Gets correct aircraft operator corde |
|
2197 | - * |
|
2198 | - * @param String $operator the aircraft operator code (callsign) |
|
2199 | - * @return String aircraft operator code |
|
2200 | - * |
|
2201 | - */ |
|
2196 | + * Gets correct aircraft operator corde |
|
2197 | + * |
|
2198 | + * @param String $operator the aircraft operator code (callsign) |
|
2199 | + * @return String aircraft operator code |
|
2200 | + * |
|
2201 | + */ |
|
2202 | 2202 | public function getOperator($operator) |
2203 | 2203 | { |
2204 | 2204 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2215,16 +2215,16 @@ discard block |
||
2215 | 2215 | } |
2216 | 2216 | |
2217 | 2217 | /** |
2218 | - * Gets the aircraft route based on the aircraft callsign |
|
2219 | - * |
|
2220 | - * @param String $callsign the aircraft callsign |
|
2221 | - * @return Array aircraft type |
|
2222 | - * |
|
2223 | - */ |
|
2218 | + * Gets the aircraft route based on the aircraft callsign |
|
2219 | + * |
|
2220 | + * @param String $callsign the aircraft callsign |
|
2221 | + * @return Array aircraft type |
|
2222 | + * |
|
2223 | + */ |
|
2224 | 2224 | public function getRouteInfo($callsign) |
2225 | 2225 | { |
2226 | 2226 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2227 | - if ($callsign == '') return array(); |
|
2227 | + if ($callsign == '') return array(); |
|
2228 | 2228 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
2229 | 2229 | |
2230 | 2230 | $sth = $this->db->prepare($query); |
@@ -2238,12 +2238,12 @@ discard block |
||
2238 | 2238 | } |
2239 | 2239 | |
2240 | 2240 | /** |
2241 | - * Gets the aircraft info based on the aircraft registration |
|
2242 | - * |
|
2243 | - * @param String $registration the aircraft registration |
|
2244 | - * @return Array aircraft information |
|
2245 | - * |
|
2246 | - */ |
|
2241 | + * Gets the aircraft info based on the aircraft registration |
|
2242 | + * |
|
2243 | + * @param String $registration the aircraft registration |
|
2244 | + * @return Array aircraft information |
|
2245 | + * |
|
2246 | + */ |
|
2247 | 2247 | public function getAircraftInfoByRegistration($registration) |
2248 | 2248 | { |
2249 | 2249 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2270,12 +2270,12 @@ discard block |
||
2270 | 2270 | } |
2271 | 2271 | |
2272 | 2272 | /** |
2273 | - * Gets the aircraft owner & base based on the aircraft registration |
|
2274 | - * |
|
2275 | - * @param String $registration the aircraft registration |
|
2276 | - * @return Array aircraft information |
|
2277 | - * |
|
2278 | - */ |
|
2273 | + * Gets the aircraft owner & base based on the aircraft registration |
|
2274 | + * |
|
2275 | + * @param String $registration the aircraft registration |
|
2276 | + * @return Array aircraft information |
|
2277 | + * |
|
2278 | + */ |
|
2279 | 2279 | public function getAircraftOwnerByRegistration($registration) |
2280 | 2280 | { |
2281 | 2281 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2292,11 +2292,11 @@ discard block |
||
2292 | 2292 | |
2293 | 2293 | |
2294 | 2294 | /** |
2295 | - * Gets all flights (but with only little info) |
|
2296 | - * |
|
2297 | - * @return Array basic flight information |
|
2298 | - * |
|
2299 | - */ |
|
2295 | + * Gets all flights (but with only little info) |
|
2296 | + * |
|
2297 | + * @return Array basic flight information |
|
2298 | + * |
|
2299 | + */ |
|
2300 | 2300 | public function getAllFlightsforSitemap() |
2301 | 2301 | { |
2302 | 2302 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
@@ -2304,7 +2304,7 @@ discard block |
||
2304 | 2304 | |
2305 | 2305 | $sth = $this->db->prepare($query); |
2306 | 2306 | $sth->execute(); |
2307 | - /* |
|
2307 | + /* |
|
2308 | 2308 | $flight_array = array(); |
2309 | 2309 | $temp_array = array(); |
2310 | 2310 | |
@@ -2326,11 +2326,11 @@ discard block |
||
2326 | 2326 | } |
2327 | 2327 | |
2328 | 2328 | /** |
2329 | - * Gets a list of all aircraft manufacturers |
|
2330 | - * |
|
2331 | - * @return Array list of aircraft types |
|
2332 | - * |
|
2333 | - */ |
|
2329 | + * Gets a list of all aircraft manufacturers |
|
2330 | + * |
|
2331 | + * @return Array list of aircraft types |
|
2332 | + * |
|
2333 | + */ |
|
2334 | 2334 | public function getAllManufacturers() |
2335 | 2335 | { |
2336 | 2336 | /* |
@@ -2359,11 +2359,11 @@ discard block |
||
2359 | 2359 | |
2360 | 2360 | |
2361 | 2361 | /** |
2362 | - * Gets a list of all aircraft types |
|
2363 | - * |
|
2364 | - * @return Array list of aircraft types |
|
2365 | - * |
|
2366 | - */ |
|
2362 | + * Gets a list of all aircraft types |
|
2363 | + * |
|
2364 | + * @return Array list of aircraft types |
|
2365 | + * |
|
2366 | + */ |
|
2367 | 2367 | public function getAllAircraftTypes($filters = array()) |
2368 | 2368 | { |
2369 | 2369 | /* |
@@ -2396,11 +2396,11 @@ discard block |
||
2396 | 2396 | |
2397 | 2397 | |
2398 | 2398 | /** |
2399 | - * Gets a list of all aircraft registrations |
|
2400 | - * |
|
2401 | - * @return Array list of aircraft registrations |
|
2402 | - * |
|
2403 | - */ |
|
2399 | + * Gets a list of all aircraft registrations |
|
2400 | + * |
|
2401 | + * @return Array list of aircraft registrations |
|
2402 | + * |
|
2403 | + */ |
|
2404 | 2404 | public function getAllAircraftRegistrations($filters = array()) |
2405 | 2405 | { |
2406 | 2406 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2425,12 +2425,12 @@ discard block |
||
2425 | 2425 | } |
2426 | 2426 | |
2427 | 2427 | /** |
2428 | - * Gets all source name |
|
2429 | - * |
|
2430 | - * @param String type format of source |
|
2431 | - * @return Array list of source name |
|
2432 | - * |
|
2433 | - */ |
|
2428 | + * Gets all source name |
|
2429 | + * |
|
2430 | + * @param String type format of source |
|
2431 | + * @return Array list of source name |
|
2432 | + * |
|
2433 | + */ |
|
2434 | 2434 | public function getAllSourceName($type = '',$filters = array()) |
2435 | 2435 | { |
2436 | 2436 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2461,11 +2461,11 @@ discard block |
||
2461 | 2461 | |
2462 | 2462 | |
2463 | 2463 | /** |
2464 | - * Gets a list of all airline names |
|
2465 | - * |
|
2466 | - * @return Array list of airline names |
|
2467 | - * |
|
2468 | - */ |
|
2464 | + * Gets a list of all airline names |
|
2465 | + * |
|
2466 | + * @return Array list of airline names |
|
2467 | + * |
|
2468 | + */ |
|
2469 | 2469 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
2470 | 2470 | { |
2471 | 2471 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2515,11 +2515,11 @@ discard block |
||
2515 | 2515 | |
2516 | 2516 | |
2517 | 2517 | /** |
2518 | - * Gets a list of all airline countries |
|
2519 | - * |
|
2520 | - * @return Array list of airline countries |
|
2521 | - * |
|
2522 | - */ |
|
2518 | + * Gets a list of all airline countries |
|
2519 | + * |
|
2520 | + * @return Array list of airline countries |
|
2521 | + * |
|
2522 | + */ |
|
2523 | 2523 | public function getAllAirlineCountries($filters = array()) |
2524 | 2524 | { |
2525 | 2525 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2547,11 +2547,11 @@ discard block |
||
2547 | 2547 | |
2548 | 2548 | |
2549 | 2549 | /** |
2550 | - * Gets a list of all departure & arrival names |
|
2551 | - * |
|
2552 | - * @return Array list of airport names |
|
2553 | - * |
|
2554 | - */ |
|
2550 | + * Gets a list of all departure & arrival names |
|
2551 | + * |
|
2552 | + * @return Array list of airport names |
|
2553 | + * |
|
2554 | + */ |
|
2555 | 2555 | public function getAllAirportNames($filters = array()) |
2556 | 2556 | { |
2557 | 2557 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2600,11 +2600,11 @@ discard block |
||
2600 | 2600 | |
2601 | 2601 | |
2602 | 2602 | /** |
2603 | - * Gets a list of all departure & arrival airport countries |
|
2604 | - * |
|
2605 | - * @return Array list of airport countries |
|
2606 | - * |
|
2607 | - */ |
|
2603 | + * Gets a list of all departure & arrival airport countries |
|
2604 | + * |
|
2605 | + * @return Array list of airport countries |
|
2606 | + * |
|
2607 | + */ |
|
2608 | 2608 | public function getAllAirportCountries($filters = array()) |
2609 | 2609 | { |
2610 | 2610 | $airport_array = array(); |
@@ -2652,11 +2652,11 @@ discard block |
||
2652 | 2652 | |
2653 | 2653 | |
2654 | 2654 | /** |
2655 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2656 | - * |
|
2657 | - * @return Array list of countries |
|
2658 | - * |
|
2659 | - */ |
|
2655 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2656 | + * |
|
2657 | + * @return Array list of countries |
|
2658 | + * |
|
2659 | + */ |
|
2660 | 2660 | public function getAllCountries($filters = array()) |
2661 | 2661 | { |
2662 | 2662 | $Connection= new Connection($this->db); |
@@ -2733,11 +2733,11 @@ discard block |
||
2733 | 2733 | |
2734 | 2734 | |
2735 | 2735 | /** |
2736 | - * Gets a list of all idents/callsigns |
|
2737 | - * |
|
2738 | - * @return Array list of ident/callsign names |
|
2739 | - * |
|
2740 | - */ |
|
2736 | + * Gets a list of all idents/callsigns |
|
2737 | + * |
|
2738 | + * @return Array list of ident/callsign names |
|
2739 | + * |
|
2740 | + */ |
|
2741 | 2741 | public function getAllIdents($filters = array()) |
2742 | 2742 | { |
2743 | 2743 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2761,9 +2761,9 @@ discard block |
||
2761 | 2761 | } |
2762 | 2762 | |
2763 | 2763 | /** |
2764 | - * Get a list of flights from airport since 7 days |
|
2765 | - * @return Array number, icao, name and city of airports |
|
2766 | - */ |
|
2764 | + * Get a list of flights from airport since 7 days |
|
2765 | + * @return Array number, icao, name and city of airports |
|
2766 | + */ |
|
2767 | 2767 | |
2768 | 2768 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
2769 | 2769 | global $globalTimezone, $globalDBdriver; |
@@ -2794,9 +2794,9 @@ discard block |
||
2794 | 2794 | } |
2795 | 2795 | |
2796 | 2796 | /** |
2797 | - * Get a list of flights from airport since 7 days |
|
2798 | - * @return Array number, icao, name and city of airports |
|
2799 | - */ |
|
2797 | + * Get a list of flights from airport since 7 days |
|
2798 | + * @return Array number, icao, name and city of airports |
|
2799 | + */ |
|
2800 | 2800 | |
2801 | 2801 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
2802 | 2802 | global $globalTimezone, $globalDBdriver; |
@@ -2826,9 +2826,9 @@ discard block |
||
2826 | 2826 | } |
2827 | 2827 | |
2828 | 2828 | /** |
2829 | - * Get a list of flights from detected airport since 7 days |
|
2830 | - * @return Array number, icao, name and city of airports |
|
2831 | - */ |
|
2829 | + * Get a list of flights from detected airport since 7 days |
|
2830 | + * @return Array number, icao, name and city of airports |
|
2831 | + */ |
|
2832 | 2832 | |
2833 | 2833 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2834 | 2834 | global $globalTimezone, $globalDBdriver; |
@@ -2866,9 +2866,9 @@ discard block |
||
2866 | 2866 | } |
2867 | 2867 | |
2868 | 2868 | /** |
2869 | - * Get a list of flights from detected airport since 7 days |
|
2870 | - * @return Array number, icao, name and city of airports |
|
2871 | - */ |
|
2869 | + * Get a list of flights from detected airport since 7 days |
|
2870 | + * @return Array number, icao, name and city of airports |
|
2871 | + */ |
|
2872 | 2872 | |
2873 | 2873 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
2874 | 2874 | global $globalTimezone, $globalDBdriver; |
@@ -2910,9 +2910,9 @@ discard block |
||
2910 | 2910 | |
2911 | 2911 | |
2912 | 2912 | /** |
2913 | - * Get a list of flights to airport since 7 days |
|
2914 | - * @return Array number, icao, name and city of airports |
|
2915 | - */ |
|
2913 | + * Get a list of flights to airport since 7 days |
|
2914 | + * @return Array number, icao, name and city of airports |
|
2915 | + */ |
|
2916 | 2916 | |
2917 | 2917 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2918 | 2918 | global $globalTimezone, $globalDBdriver; |
@@ -2945,9 +2945,9 @@ discard block |
||
2945 | 2945 | |
2946 | 2946 | |
2947 | 2947 | /** |
2948 | - * Get a list of flights detected to airport since 7 days |
|
2949 | - * @return Array number, icao, name and city of airports |
|
2950 | - */ |
|
2948 | + * Get a list of flights detected to airport since 7 days |
|
2949 | + * @return Array number, icao, name and city of airports |
|
2950 | + */ |
|
2951 | 2951 | |
2952 | 2952 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
2953 | 2953 | global $globalTimezone, $globalDBdriver; |
@@ -2988,9 +2988,9 @@ discard block |
||
2988 | 2988 | |
2989 | 2989 | |
2990 | 2990 | /** |
2991 | - * Get a list of flights to airport since 7 days |
|
2992 | - * @return Array number, icao, name and city of airports |
|
2993 | - */ |
|
2991 | + * Get a list of flights to airport since 7 days |
|
2992 | + * @return Array number, icao, name and city of airports |
|
2993 | + */ |
|
2994 | 2994 | |
2995 | 2995 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
2996 | 2996 | global $globalTimezone, $globalDBdriver; |
@@ -3022,9 +3022,9 @@ discard block |
||
3022 | 3022 | |
3023 | 3023 | |
3024 | 3024 | /** |
3025 | - * Get a list of flights detected to airport since 7 days |
|
3026 | - * @return Array number, icao, name and city of airports |
|
3027 | - */ |
|
3025 | + * Get a list of flights detected to airport since 7 days |
|
3026 | + * @return Array number, icao, name and city of airports |
|
3027 | + */ |
|
3028 | 3028 | |
3029 | 3029 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
3030 | 3030 | global $globalTimezone, $globalDBdriver; |
@@ -3068,11 +3068,11 @@ discard block |
||
3068 | 3068 | |
3069 | 3069 | |
3070 | 3070 | /** |
3071 | - * Gets a list of all dates |
|
3072 | - * |
|
3073 | - * @return Array list of date names |
|
3074 | - * |
|
3075 | - */ |
|
3071 | + * Gets a list of all dates |
|
3072 | + * |
|
3073 | + * @return Array list of date names |
|
3074 | + * |
|
3075 | + */ |
|
3076 | 3076 | public function getAllDates() |
3077 | 3077 | { |
3078 | 3078 | global $globalTimezone, $globalDBdriver; |
@@ -3113,11 +3113,11 @@ discard block |
||
3113 | 3113 | |
3114 | 3114 | |
3115 | 3115 | /** |
3116 | - * Gets all route combinations |
|
3117 | - * |
|
3118 | - * @return Array the route list |
|
3119 | - * |
|
3120 | - */ |
|
3116 | + * Gets all route combinations |
|
3117 | + * |
|
3118 | + * @return Array the route list |
|
3119 | + * |
|
3120 | + */ |
|
3121 | 3121 | public function getAllRoutes() |
3122 | 3122 | { |
3123 | 3123 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
@@ -3143,13 +3143,13 @@ discard block |
||
3143 | 3143 | } |
3144 | 3144 | |
3145 | 3145 | /** |
3146 | - * Update ident spotter data |
|
3147 | - * |
|
3148 | - * @param String $flightaware_id the ID from flightaware |
|
3149 | - * @param String $ident the flight ident |
|
3150 | - * @return String success or false |
|
3151 | - * |
|
3152 | - */ |
|
3146 | + * Update ident spotter data |
|
3147 | + * |
|
3148 | + * @param String $flightaware_id the ID from flightaware |
|
3149 | + * @param String $ident the flight ident |
|
3150 | + * @return String success or false |
|
3151 | + * |
|
3152 | + */ |
|
3153 | 3153 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
3154 | 3154 | { |
3155 | 3155 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3170,14 +3170,14 @@ discard block |
||
3170 | 3170 | } else { |
3171 | 3171 | $airline_array = $this->getAllAirlineInfo("NA"); |
3172 | 3172 | } |
3173 | - $airline_name = $airline_array[0]['name']; |
|
3174 | - $airline_icao = $airline_array[0]['icao']; |
|
3175 | - $airline_country = $airline_array[0]['country']; |
|
3176 | - $airline_type = $airline_array[0]['type']; |
|
3173 | + $airline_name = $airline_array[0]['name']; |
|
3174 | + $airline_icao = $airline_array[0]['icao']; |
|
3175 | + $airline_country = $airline_array[0]['country']; |
|
3176 | + $airline_type = $airline_array[0]['type']; |
|
3177 | 3177 | |
3178 | 3178 | |
3179 | 3179 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
3180 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
3180 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
3181 | 3181 | |
3182 | 3182 | try { |
3183 | 3183 | $sth = $this->db->prepare($query); |
@@ -3190,19 +3190,19 @@ discard block |
||
3190 | 3190 | |
3191 | 3191 | } |
3192 | 3192 | /** |
3193 | - * Update latest spotter data |
|
3194 | - * |
|
3195 | - * @param String $flightaware_id the ID from flightaware |
|
3196 | - * @param String $ident the flight ident |
|
3197 | - * @param String $arrival_airport_icao the arrival airport |
|
3198 | - * @return String success or false |
|
3199 | - * |
|
3200 | - */ |
|
3193 | + * Update latest spotter data |
|
3194 | + * |
|
3195 | + * @param String $flightaware_id the ID from flightaware |
|
3196 | + * @param String $ident the flight ident |
|
3197 | + * @param String $arrival_airport_icao the arrival airport |
|
3198 | + * @return String success or false |
|
3199 | + * |
|
3200 | + */ |
|
3201 | 3201 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3202 | 3202 | { |
3203 | 3203 | if ($groundspeed == '') $groundspeed = NULL; |
3204 | 3204 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
3205 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3205 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
3206 | 3206 | |
3207 | 3207 | try { |
3208 | 3208 | $sth = $this->db->prepare($query); |
@@ -3216,32 +3216,32 @@ discard block |
||
3216 | 3216 | } |
3217 | 3217 | |
3218 | 3218 | /** |
3219 | - * Adds a new spotter data |
|
3220 | - * |
|
3221 | - * @param String $flightaware_id the ID from flightaware |
|
3222 | - * @param String $ident the flight ident |
|
3223 | - * @param String $aircraft_icao the aircraft type |
|
3224 | - * @param String $departure_airport_icao the departure airport |
|
3225 | - * @param String $arrival_airport_icao the arrival airport |
|
3226 | - * @param String $latitude latitude of flight |
|
3227 | - * @param String $longitude latitude of flight |
|
3228 | - * @param String $waypoints waypoints of flight |
|
3229 | - * @param String $altitude altitude of flight |
|
3230 | - * @param String $heading heading of flight |
|
3231 | - * @param String $groundspeed speed of flight |
|
3232 | - * @param String $date date of flight |
|
3233 | - * @param String $departure_airport_time departure time of flight |
|
3234 | - * @param String $arrival_airport_time arrival time of flight |
|
3235 | - * @param String $squawk squawk code of flight |
|
3236 | - * @param String $route_stop route stop of flight |
|
3237 | - * @param String $highlight highlight or not |
|
3238 | - * @param String $ModeS ModesS code of flight |
|
3239 | - * @param String $registration registration code of flight |
|
3240 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3241 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3242 | - * @param String $verticalrate vertival rate of flight |
|
3243 | - * @return String success or false |
|
3244 | - */ |
|
3219 | + * Adds a new spotter data |
|
3220 | + * |
|
3221 | + * @param String $flightaware_id the ID from flightaware |
|
3222 | + * @param String $ident the flight ident |
|
3223 | + * @param String $aircraft_icao the aircraft type |
|
3224 | + * @param String $departure_airport_icao the departure airport |
|
3225 | + * @param String $arrival_airport_icao the arrival airport |
|
3226 | + * @param String $latitude latitude of flight |
|
3227 | + * @param String $longitude latitude of flight |
|
3228 | + * @param String $waypoints waypoints of flight |
|
3229 | + * @param String $altitude altitude of flight |
|
3230 | + * @param String $heading heading of flight |
|
3231 | + * @param String $groundspeed speed of flight |
|
3232 | + * @param String $date date of flight |
|
3233 | + * @param String $departure_airport_time departure time of flight |
|
3234 | + * @param String $arrival_airport_time arrival time of flight |
|
3235 | + * @param String $squawk squawk code of flight |
|
3236 | + * @param String $route_stop route stop of flight |
|
3237 | + * @param String $highlight highlight or not |
|
3238 | + * @param String $ModeS ModesS code of flight |
|
3239 | + * @param String $registration registration code of flight |
|
3240 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3241 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3242 | + * @param String $verticalrate vertival rate of flight |
|
3243 | + * @return String success or false |
|
3244 | + */ |
|
3245 | 3245 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
3246 | 3246 | { |
3247 | 3247 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3455,8 +3455,8 @@ discard block |
||
3455 | 3455 | |
3456 | 3456 | if ($globalIVAO && $aircraft_icao != '') |
3457 | 3457 | { |
3458 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3459 | - else $airline_icao = ''; |
|
3458 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3459 | + else $airline_icao = ''; |
|
3460 | 3460 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3461 | 3461 | if (!isset($image_array[0]['registration'])) |
3462 | 3462 | { |
@@ -3487,52 +3487,52 @@ discard block |
||
3487 | 3487 | |
3488 | 3488 | if (count($airline_array) == 0) |
3489 | 3489 | { |
3490 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
3491 | - } |
|
3492 | - if (count($aircraft_array) == 0) |
|
3493 | - { |
|
3494 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3495 | - } |
|
3496 | - if (count($departure_airport_array) == 0) |
|
3497 | - { |
|
3498 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3499 | - } |
|
3500 | - if (count($arrival_airport_array) == 0) |
|
3501 | - { |
|
3502 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3503 | - } |
|
3504 | - if ($registration == '') $registration = 'NA'; |
|
3505 | - if ($latitude == '' && $longitude == '') { |
|
3506 | - $latitude = 0; |
|
3507 | - $longitude = 0; |
|
3508 | - } |
|
3509 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3510 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3511 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3512 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3513 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3514 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3490 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
3491 | + } |
|
3492 | + if (count($aircraft_array) == 0) |
|
3493 | + { |
|
3494 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3495 | + } |
|
3496 | + if (count($departure_airport_array) == 0) |
|
3497 | + { |
|
3498 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3499 | + } |
|
3500 | + if (count($arrival_airport_array) == 0) |
|
3501 | + { |
|
3502 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3503 | + } |
|
3504 | + if ($registration == '') $registration = 'NA'; |
|
3505 | + if ($latitude == '' && $longitude == '') { |
|
3506 | + $latitude = 0; |
|
3507 | + $longitude = 0; |
|
3508 | + } |
|
3509 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3510 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3511 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3512 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3513 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3514 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
3515 | 3515 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
3516 | 3516 | |
3517 | - $airline_name = $airline_array[0]['name']; |
|
3518 | - $airline_icao = $airline_array[0]['icao']; |
|
3519 | - $airline_country = $airline_array[0]['country']; |
|
3520 | - $airline_type = $airline_array[0]['type']; |
|
3517 | + $airline_name = $airline_array[0]['name']; |
|
3518 | + $airline_icao = $airline_array[0]['icao']; |
|
3519 | + $airline_country = $airline_array[0]['country']; |
|
3520 | + $airline_type = $airline_array[0]['type']; |
|
3521 | 3521 | if ($airline_type == '') { |
3522 | 3522 | $timeelapsed = microtime(true); |
3523 | 3523 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3524 | 3524 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
3525 | 3525 | } |
3526 | 3526 | if ($airline_type == null) $airline_type = ''; |
3527 | - $aircraft_type = $aircraft_array[0]['type']; |
|
3528 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3529 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
3530 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
3531 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
3532 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3533 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3534 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3535 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3527 | + $aircraft_type = $aircraft_array[0]['type']; |
|
3528 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3529 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
3530 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
3531 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
3532 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3533 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3534 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3535 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
3536 | 3536 | |
3537 | 3537 | try { |
3538 | 3538 | |
@@ -3540,7 +3540,7 @@ discard block |
||
3540 | 3540 | $sth->execute($query_values); |
3541 | 3541 | $this->db = null; |
3542 | 3542 | } catch (PDOException $e) { |
3543 | - return "error : ".$e->getMessage(); |
|
3543 | + return "error : ".$e->getMessage(); |
|
3544 | 3544 | } |
3545 | 3545 | |
3546 | 3546 | return "success"; |
@@ -3549,11 +3549,11 @@ discard block |
||
3549 | 3549 | |
3550 | 3550 | |
3551 | 3551 | /** |
3552 | - * Gets the aircraft ident within the last hour |
|
3553 | - * |
|
3554 | - * @return String the ident |
|
3555 | - * |
|
3556 | - */ |
|
3552 | + * Gets the aircraft ident within the last hour |
|
3553 | + * |
|
3554 | + * @return String the ident |
|
3555 | + * |
|
3556 | + */ |
|
3557 | 3557 | public function getIdentFromLastHour($ident) |
3558 | 3558 | { |
3559 | 3559 | global $globalDBdriver, $globalTimezone; |
@@ -3569,11 +3569,11 @@ discard block |
||
3569 | 3569 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3570 | 3570 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
3571 | 3571 | $query_data = array(':ident' => $ident); |
3572 | - } |
|
3572 | + } |
|
3573 | 3573 | |
3574 | 3574 | $sth = $this->db->prepare($query); |
3575 | 3575 | $sth->execute($query_data); |
3576 | - $ident_result=''; |
|
3576 | + $ident_result=''; |
|
3577 | 3577 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
3578 | 3578 | { |
3579 | 3579 | $ident_result = $row['ident']; |
@@ -3584,11 +3584,11 @@ discard block |
||
3584 | 3584 | |
3585 | 3585 | |
3586 | 3586 | /** |
3587 | - * Gets the aircraft data from the last 20 seconds |
|
3588 | - * |
|
3589 | - * @return Array the spotter data |
|
3590 | - * |
|
3591 | - */ |
|
3587 | + * Gets the aircraft data from the last 20 seconds |
|
3588 | + * |
|
3589 | + * @return Array the spotter data |
|
3590 | + * |
|
3591 | + */ |
|
3592 | 3592 | public function getRealTimeData($q = '') |
3593 | 3593 | { |
3594 | 3594 | global $globalDBdriver; |
@@ -3632,11 +3632,11 @@ discard block |
||
3632 | 3632 | |
3633 | 3633 | |
3634 | 3634 | /** |
3635 | - * Gets all airlines that have flown over |
|
3636 | - * |
|
3637 | - * @return Array the airline list |
|
3638 | - * |
|
3639 | - */ |
|
3635 | + * Gets all airlines that have flown over |
|
3636 | + * |
|
3637 | + * @return Array the airline list |
|
3638 | + * |
|
3639 | + */ |
|
3640 | 3640 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3641 | 3641 | { |
3642 | 3642 | global $globalDBdriver; |
@@ -3650,7 +3650,7 @@ discard block |
||
3650 | 3650 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3651 | 3651 | } |
3652 | 3652 | } |
3653 | - if ($sincedate != '') { |
|
3653 | + if ($sincedate != '') { |
|
3654 | 3654 | if ($globalDBdriver == 'mysql') { |
3655 | 3655 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3656 | 3656 | } else { |
@@ -3677,26 +3677,26 @@ discard block |
||
3677 | 3677 | } |
3678 | 3678 | |
3679 | 3679 | /** |
3680 | - * Gets all pilots that have flown over |
|
3681 | - * |
|
3682 | - * @return Array the pilots list |
|
3683 | - * |
|
3684 | - */ |
|
3680 | + * Gets all pilots that have flown over |
|
3681 | + * |
|
3682 | + * @return Array the pilots list |
|
3683 | + * |
|
3684 | + */ |
|
3685 | 3685 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3686 | 3686 | { |
3687 | 3687 | global $globalDBdriver; |
3688 | 3688 | $filter_query = $this->getFilter($filters,true,true); |
3689 | 3689 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
3690 | 3690 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3691 | - if ($olderthanmonths > 0) { |
|
3692 | - if ($globalDBdriver == 'mysql') { |
|
3691 | + if ($olderthanmonths > 0) { |
|
3692 | + if ($globalDBdriver == 'mysql') { |
|
3693 | 3693 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3694 | 3694 | } else { |
3695 | 3695 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3696 | 3696 | } |
3697 | 3697 | } |
3698 | - if ($sincedate != '') { |
|
3699 | - if ($globalDBdriver == 'mysql') { |
|
3698 | + if ($sincedate != '') { |
|
3699 | + if ($globalDBdriver == 'mysql') { |
|
3700 | 3700 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3701 | 3701 | } else { |
3702 | 3702 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3724,25 +3724,25 @@ discard block |
||
3724 | 3724 | } |
3725 | 3725 | |
3726 | 3726 | /** |
3727 | - * Gets all pilots that have flown over |
|
3728 | - * |
|
3729 | - * @return Array the pilots list |
|
3730 | - * |
|
3731 | - */ |
|
3727 | + * Gets all pilots that have flown over |
|
3728 | + * |
|
3729 | + * @return Array the pilots list |
|
3730 | + * |
|
3731 | + */ |
|
3732 | 3732 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3733 | 3733 | { |
3734 | 3734 | global $globalDBdriver; |
3735 | 3735 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
3736 | 3736 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3737 | - if ($olderthanmonths > 0) { |
|
3738 | - if ($globalDBdriver == 'mysql') { |
|
3737 | + if ($olderthanmonths > 0) { |
|
3738 | + if ($globalDBdriver == 'mysql') { |
|
3739 | 3739 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3740 | 3740 | } else { |
3741 | 3741 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3742 | 3742 | } |
3743 | 3743 | } |
3744 | - if ($sincedate != '') { |
|
3745 | - if ($globalDBdriver == 'mysql') { |
|
3744 | + if ($sincedate != '') { |
|
3745 | + if ($globalDBdriver == 'mysql') { |
|
3746 | 3746 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3747 | 3747 | } else { |
3748 | 3748 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3771,26 +3771,26 @@ discard block |
||
3771 | 3771 | } |
3772 | 3772 | |
3773 | 3773 | /** |
3774 | - * Gets all owner that have flown over |
|
3775 | - * |
|
3776 | - * @return Array the pilots list |
|
3777 | - * |
|
3778 | - */ |
|
3774 | + * Gets all owner that have flown over |
|
3775 | + * |
|
3776 | + * @return Array the pilots list |
|
3777 | + * |
|
3778 | + */ |
|
3779 | 3779 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3780 | 3780 | { |
3781 | 3781 | global $globalDBdriver; |
3782 | 3782 | $filter_query = $this->getFilter($filters,true,true); |
3783 | 3783 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3784 | 3784 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3785 | - if ($olderthanmonths > 0) { |
|
3786 | - if ($globalDBdriver == 'mysql') { |
|
3785 | + if ($olderthanmonths > 0) { |
|
3786 | + if ($globalDBdriver == 'mysql') { |
|
3787 | 3787 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3788 | 3788 | } else { |
3789 | 3789 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3790 | 3790 | } |
3791 | 3791 | } |
3792 | - if ($sincedate != '') { |
|
3793 | - if ($globalDBdriver == 'mysql') { |
|
3792 | + if ($sincedate != '') { |
|
3793 | + if ($globalDBdriver == 'mysql') { |
|
3794 | 3794 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3795 | 3795 | } else { |
3796 | 3796 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3816,26 +3816,26 @@ discard block |
||
3816 | 3816 | } |
3817 | 3817 | |
3818 | 3818 | /** |
3819 | - * Gets all owner that have flown over |
|
3820 | - * |
|
3821 | - * @return Array the pilots list |
|
3822 | - * |
|
3823 | - */ |
|
3819 | + * Gets all owner that have flown over |
|
3820 | + * |
|
3821 | + * @return Array the pilots list |
|
3822 | + * |
|
3823 | + */ |
|
3824 | 3824 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3825 | 3825 | { |
3826 | 3826 | global $globalDBdriver; |
3827 | 3827 | $filter_query = $this->getFilter($filters,true,true); |
3828 | 3828 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3829 | 3829 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3830 | - if ($olderthanmonths > 0) { |
|
3831 | - if ($globalDBdriver == 'mysql') { |
|
3830 | + if ($olderthanmonths > 0) { |
|
3831 | + if ($globalDBdriver == 'mysql') { |
|
3832 | 3832 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3833 | 3833 | } else { |
3834 | 3834 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3835 | 3835 | } |
3836 | 3836 | } |
3837 | - if ($sincedate != '') { |
|
3838 | - if ($globalDBdriver == 'mysql') { |
|
3837 | + if ($sincedate != '') { |
|
3838 | + if ($globalDBdriver == 'mysql') { |
|
3839 | 3839 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3840 | 3840 | } else { |
3841 | 3841 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3862,11 +3862,11 @@ discard block |
||
3862 | 3862 | } |
3863 | 3863 | |
3864 | 3864 | /** |
3865 | - * Gets all airlines that have flown over by aircraft |
|
3866 | - * |
|
3867 | - * @return Array the airline list |
|
3868 | - * |
|
3869 | - */ |
|
3865 | + * Gets all airlines that have flown over by aircraft |
|
3866 | + * |
|
3867 | + * @return Array the airline list |
|
3868 | + * |
|
3869 | + */ |
|
3870 | 3870 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
3871 | 3871 | { |
3872 | 3872 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3898,11 +3898,11 @@ discard block |
||
3898 | 3898 | |
3899 | 3899 | |
3900 | 3900 | /** |
3901 | - * Gets all airline countries that have flown over by aircraft |
|
3902 | - * |
|
3903 | - * @return Array the airline country list |
|
3904 | - * |
|
3905 | - */ |
|
3901 | + * Gets all airline countries that have flown over by aircraft |
|
3902 | + * |
|
3903 | + * @return Array the airline country list |
|
3904 | + * |
|
3905 | + */ |
|
3906 | 3906 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
3907 | 3907 | { |
3908 | 3908 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3934,11 +3934,11 @@ discard block |
||
3934 | 3934 | |
3935 | 3935 | |
3936 | 3936 | /** |
3937 | - * Gets all airlines that have flown over by airport |
|
3938 | - * |
|
3939 | - * @return Array the airline list |
|
3940 | - * |
|
3941 | - */ |
|
3937 | + * Gets all airlines that have flown over by airport |
|
3938 | + * |
|
3939 | + * @return Array the airline list |
|
3940 | + * |
|
3941 | + */ |
|
3942 | 3942 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
3943 | 3943 | { |
3944 | 3944 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3969,11 +3969,11 @@ discard block |
||
3969 | 3969 | |
3970 | 3970 | |
3971 | 3971 | /** |
3972 | - * Gets all airline countries that have flown over by airport icao |
|
3973 | - * |
|
3974 | - * @return Array the airline country list |
|
3975 | - * |
|
3976 | - */ |
|
3972 | + * Gets all airline countries that have flown over by airport icao |
|
3973 | + * |
|
3974 | + * @return Array the airline country list |
|
3975 | + * |
|
3976 | + */ |
|
3977 | 3977 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
3978 | 3978 | { |
3979 | 3979 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4003,11 +4003,11 @@ discard block |
||
4003 | 4003 | |
4004 | 4004 | |
4005 | 4005 | /** |
4006 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
4007 | - * |
|
4008 | - * @return Array the airline list |
|
4009 | - * |
|
4010 | - */ |
|
4006 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
4007 | + * |
|
4008 | + * @return Array the airline list |
|
4009 | + * |
|
4010 | + */ |
|
4011 | 4011 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
4012 | 4012 | { |
4013 | 4013 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4038,11 +4038,11 @@ discard block |
||
4038 | 4038 | |
4039 | 4039 | |
4040 | 4040 | /** |
4041 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
4042 | - * |
|
4043 | - * @return Array the airline country list |
|
4044 | - * |
|
4045 | - */ |
|
4041 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
4042 | + * |
|
4043 | + * @return Array the airline country list |
|
4044 | + * |
|
4045 | + */ |
|
4046 | 4046 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
4047 | 4047 | { |
4048 | 4048 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4071,11 +4071,11 @@ discard block |
||
4071 | 4071 | |
4072 | 4072 | |
4073 | 4073 | /** |
4074 | - * Gets all airlines that have flown over by date |
|
4075 | - * |
|
4076 | - * @return Array the airline list |
|
4077 | - * |
|
4078 | - */ |
|
4074 | + * Gets all airlines that have flown over by date |
|
4075 | + * |
|
4076 | + * @return Array the airline list |
|
4077 | + * |
|
4078 | + */ |
|
4079 | 4079 | public function countAllAirlinesByDate($date,$filters = array()) |
4080 | 4080 | { |
4081 | 4081 | global $globalTimezone, $globalDBdriver; |
@@ -4119,11 +4119,11 @@ discard block |
||
4119 | 4119 | |
4120 | 4120 | |
4121 | 4121 | /** |
4122 | - * Gets all airline countries that have flown over by date |
|
4123 | - * |
|
4124 | - * @return Array the airline country list |
|
4125 | - * |
|
4126 | - */ |
|
4122 | + * Gets all airline countries that have flown over by date |
|
4123 | + * |
|
4124 | + * @return Array the airline country list |
|
4125 | + * |
|
4126 | + */ |
|
4127 | 4127 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
4128 | 4128 | { |
4129 | 4129 | global $globalTimezone, $globalDBdriver; |
@@ -4166,11 +4166,11 @@ discard block |
||
4166 | 4166 | |
4167 | 4167 | |
4168 | 4168 | /** |
4169 | - * Gets all airlines that have flown over by ident/callsign |
|
4170 | - * |
|
4171 | - * @return Array the airline list |
|
4172 | - * |
|
4173 | - */ |
|
4169 | + * Gets all airlines that have flown over by ident/callsign |
|
4170 | + * |
|
4171 | + * @return Array the airline list |
|
4172 | + * |
|
4173 | + */ |
|
4174 | 4174 | public function countAllAirlinesByIdent($ident,$filters = array()) |
4175 | 4175 | { |
4176 | 4176 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4200,11 +4200,11 @@ discard block |
||
4200 | 4200 | } |
4201 | 4201 | |
4202 | 4202 | /** |
4203 | - * Gets all airlines that have flown over by route |
|
4204 | - * |
|
4205 | - * @return Array the airline list |
|
4206 | - * |
|
4207 | - */ |
|
4203 | + * Gets all airlines that have flown over by route |
|
4204 | + * |
|
4205 | + * @return Array the airline list |
|
4206 | + * |
|
4207 | + */ |
|
4208 | 4208 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
4209 | 4209 | { |
4210 | 4210 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4236,11 +4236,11 @@ discard block |
||
4236 | 4236 | } |
4237 | 4237 | |
4238 | 4238 | /** |
4239 | - * Gets all airline countries that have flown over by route |
|
4240 | - * |
|
4241 | - * @return Array the airline country list |
|
4242 | - * |
|
4243 | - */ |
|
4239 | + * Gets all airline countries that have flown over by route |
|
4240 | + * |
|
4241 | + * @return Array the airline country list |
|
4242 | + * |
|
4243 | + */ |
|
4244 | 4244 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
4245 | 4245 | { |
4246 | 4246 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4272,11 +4272,11 @@ discard block |
||
4272 | 4272 | |
4273 | 4273 | |
4274 | 4274 | /** |
4275 | - * Gets all airlines that have flown over by country |
|
4276 | - * |
|
4277 | - * @return Array the airline list |
|
4278 | - * |
|
4279 | - */ |
|
4275 | + * Gets all airlines that have flown over by country |
|
4276 | + * |
|
4277 | + * @return Array the airline list |
|
4278 | + * |
|
4279 | + */ |
|
4280 | 4280 | public function countAllAirlinesByCountry($country,$filters = array()) |
4281 | 4281 | { |
4282 | 4282 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4306,11 +4306,11 @@ discard block |
||
4306 | 4306 | |
4307 | 4307 | |
4308 | 4308 | /** |
4309 | - * Gets all airline countries that have flown over by country |
|
4310 | - * |
|
4311 | - * @return Array the airline country list |
|
4312 | - * |
|
4313 | - */ |
|
4309 | + * Gets all airline countries that have flown over by country |
|
4310 | + * |
|
4311 | + * @return Array the airline country list |
|
4312 | + * |
|
4313 | + */ |
|
4314 | 4314 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
4315 | 4315 | { |
4316 | 4316 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4339,11 +4339,11 @@ discard block |
||
4339 | 4339 | |
4340 | 4340 | |
4341 | 4341 | /** |
4342 | - * Gets all airlines countries |
|
4343 | - * |
|
4344 | - * @return Array the airline country list |
|
4345 | - * |
|
4346 | - */ |
|
4342 | + * Gets all airlines countries |
|
4343 | + * |
|
4344 | + * @return Array the airline country list |
|
4345 | + * |
|
4346 | + */ |
|
4347 | 4347 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4348 | 4348 | { |
4349 | 4349 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4369,11 +4369,11 @@ discard block |
||
4369 | 4369 | } |
4370 | 4370 | |
4371 | 4371 | /** |
4372 | - * Gets all number of flight over countries |
|
4373 | - * |
|
4374 | - * @return Array the airline country list |
|
4375 | - * |
|
4376 | - */ |
|
4372 | + * Gets all number of flight over countries |
|
4373 | + * |
|
4374 | + * @return Array the airline country list |
|
4375 | + * |
|
4376 | + */ |
|
4377 | 4377 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
4378 | 4378 | { |
4379 | 4379 | global $globalDBdriver; |
@@ -4388,15 +4388,15 @@ discard block |
||
4388 | 4388 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4389 | 4389 | FROM countries c, spotter_live s |
4390 | 4390 | WHERE c.iso2 = s.over_country "; |
4391 | - if ($olderthanmonths > 0) { |
|
4391 | + if ($olderthanmonths > 0) { |
|
4392 | 4392 | if ($globalDBdriver == 'mysql') { |
4393 | 4393 | $query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
4394 | 4394 | } else { |
4395 | 4395 | $query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
4396 | 4396 | } |
4397 | 4397 | } |
4398 | - if ($sincedate != '') { |
|
4399 | - if ($globalDBdriver == 'mysql') { |
|
4398 | + if ($sincedate != '') { |
|
4399 | + if ($globalDBdriver == 'mysql') { |
|
4400 | 4400 | $query .= "AND spotter_live.date > '".$sincedate."' "; |
4401 | 4401 | } else { |
4402 | 4402 | $query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4426,11 +4426,11 @@ discard block |
||
4426 | 4426 | |
4427 | 4427 | |
4428 | 4428 | /** |
4429 | - * Gets all aircraft types that have flown over |
|
4430 | - * |
|
4431 | - * @return Array the aircraft list |
|
4432 | - * |
|
4433 | - */ |
|
4429 | + * Gets all aircraft types that have flown over |
|
4430 | + * |
|
4431 | + * @return Array the aircraft list |
|
4432 | + * |
|
4433 | + */ |
|
4434 | 4434 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4435 | 4435 | { |
4436 | 4436 | global $globalDBdriver; |
@@ -4473,11 +4473,11 @@ discard block |
||
4473 | 4473 | } |
4474 | 4474 | |
4475 | 4475 | /** |
4476 | - * Gets all aircraft types that have flown over by airline |
|
4477 | - * |
|
4478 | - * @return Array the aircraft list |
|
4479 | - * |
|
4480 | - */ |
|
4476 | + * Gets all aircraft types that have flown over by airline |
|
4477 | + * |
|
4478 | + * @return Array the aircraft list |
|
4479 | + * |
|
4480 | + */ |
|
4481 | 4481 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4482 | 4482 | { |
4483 | 4483 | global $globalDBdriver; |
@@ -4520,11 +4520,11 @@ discard block |
||
4520 | 4520 | } |
4521 | 4521 | |
4522 | 4522 | /** |
4523 | - * Gets all aircraft types that have flown over by months |
|
4524 | - * |
|
4525 | - * @return Array the aircraft list |
|
4526 | - * |
|
4527 | - */ |
|
4523 | + * Gets all aircraft types that have flown over by months |
|
4524 | + * |
|
4525 | + * @return Array the aircraft list |
|
4526 | + * |
|
4527 | + */ |
|
4528 | 4528 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4529 | 4529 | { |
4530 | 4530 | global $globalDBdriver; |
@@ -4568,11 +4568,11 @@ discard block |
||
4568 | 4568 | |
4569 | 4569 | |
4570 | 4570 | /** |
4571 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
4572 | - * |
|
4573 | - * @return Array the aircraft list |
|
4574 | - * |
|
4575 | - */ |
|
4571 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
4572 | + * |
|
4573 | + * @return Array the aircraft list |
|
4574 | + * |
|
4575 | + */ |
|
4576 | 4576 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
4577 | 4577 | { |
4578 | 4578 | $Image = new Image($this->db); |
@@ -4611,11 +4611,11 @@ discard block |
||
4611 | 4611 | |
4612 | 4612 | |
4613 | 4613 | /** |
4614 | - * Gets all aircraft types that have flown over by airline icao |
|
4615 | - * |
|
4616 | - * @return Array the aircraft list |
|
4617 | - * |
|
4618 | - */ |
|
4614 | + * Gets all aircraft types that have flown over by airline icao |
|
4615 | + * |
|
4616 | + * @return Array the aircraft list |
|
4617 | + * |
|
4618 | + */ |
|
4619 | 4619 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
4620 | 4620 | { |
4621 | 4621 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4644,11 +4644,11 @@ discard block |
||
4644 | 4644 | |
4645 | 4645 | |
4646 | 4646 | /** |
4647 | - * Gets all aircraft registration that have flown over by airline icao |
|
4648 | - * |
|
4649 | - * @return Array the aircraft list |
|
4650 | - * |
|
4651 | - */ |
|
4647 | + * Gets all aircraft registration that have flown over by airline icao |
|
4648 | + * |
|
4649 | + * @return Array the aircraft list |
|
4650 | + * |
|
4651 | + */ |
|
4652 | 4652 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
4653 | 4653 | { |
4654 | 4654 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4686,11 +4686,11 @@ discard block |
||
4686 | 4686 | |
4687 | 4687 | |
4688 | 4688 | /** |
4689 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
4690 | - * |
|
4691 | - * @return Array the aircraft list |
|
4692 | - * |
|
4693 | - */ |
|
4689 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
4690 | + * |
|
4691 | + * @return Array the aircraft list |
|
4692 | + * |
|
4693 | + */ |
|
4694 | 4694 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
4695 | 4695 | { |
4696 | 4696 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4718,11 +4718,11 @@ discard block |
||
4718 | 4718 | |
4719 | 4719 | |
4720 | 4720 | /** |
4721 | - * Gets all aircraft types that have flown over by airline icao |
|
4722 | - * |
|
4723 | - * @return Array the aircraft list |
|
4724 | - * |
|
4725 | - */ |
|
4721 | + * Gets all aircraft types that have flown over by airline icao |
|
4722 | + * |
|
4723 | + * @return Array the aircraft list |
|
4724 | + * |
|
4725 | + */ |
|
4726 | 4726 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
4727 | 4727 | { |
4728 | 4728 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4751,11 +4751,11 @@ discard block |
||
4751 | 4751 | |
4752 | 4752 | |
4753 | 4753 | /** |
4754 | - * Gets all aircraft registration that have flown over by airport icao |
|
4755 | - * |
|
4756 | - * @return Array the aircraft list |
|
4757 | - * |
|
4758 | - */ |
|
4754 | + * Gets all aircraft registration that have flown over by airport icao |
|
4755 | + * |
|
4756 | + * @return Array the aircraft list |
|
4757 | + * |
|
4758 | + */ |
|
4759 | 4759 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
4760 | 4760 | { |
4761 | 4761 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4792,11 +4792,11 @@ discard block |
||
4792 | 4792 | |
4793 | 4793 | |
4794 | 4794 | /** |
4795 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
4796 | - * |
|
4797 | - * @return Array the aircraft list |
|
4798 | - * |
|
4799 | - */ |
|
4795 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
4796 | + * |
|
4797 | + * @return Array the aircraft list |
|
4798 | + * |
|
4799 | + */ |
|
4800 | 4800 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
4801 | 4801 | { |
4802 | 4802 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4822,11 +4822,11 @@ discard block |
||
4822 | 4822 | } |
4823 | 4823 | |
4824 | 4824 | /** |
4825 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4826 | - * |
|
4827 | - * @return Array the aircraft list |
|
4828 | - * |
|
4829 | - */ |
|
4825 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4826 | + * |
|
4827 | + * @return Array the aircraft list |
|
4828 | + * |
|
4829 | + */ |
|
4830 | 4830 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
4831 | 4831 | { |
4832 | 4832 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4853,11 +4853,11 @@ discard block |
||
4853 | 4853 | |
4854 | 4854 | |
4855 | 4855 | /** |
4856 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4857 | - * |
|
4858 | - * @return Array the aircraft list |
|
4859 | - * |
|
4860 | - */ |
|
4856 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4857 | + * |
|
4858 | + * @return Array the aircraft list |
|
4859 | + * |
|
4860 | + */ |
|
4861 | 4861 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4862 | 4862 | { |
4863 | 4863 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4893,11 +4893,11 @@ discard block |
||
4893 | 4893 | } |
4894 | 4894 | |
4895 | 4895 | /** |
4896 | - * Gets all aircraft types that have flown over by date |
|
4897 | - * |
|
4898 | - * @return Array the aircraft list |
|
4899 | - * |
|
4900 | - */ |
|
4896 | + * Gets all aircraft types that have flown over by date |
|
4897 | + * |
|
4898 | + * @return Array the aircraft list |
|
4899 | + * |
|
4900 | + */ |
|
4901 | 4901 | public function countAllAircraftTypesByDate($date,$filters = array()) |
4902 | 4902 | { |
4903 | 4903 | global $globalTimezone, $globalDBdriver; |
@@ -4939,11 +4939,11 @@ discard block |
||
4939 | 4939 | |
4940 | 4940 | |
4941 | 4941 | /** |
4942 | - * Gets all aircraft registration that have flown over by date |
|
4943 | - * |
|
4944 | - * @return Array the aircraft list |
|
4945 | - * |
|
4946 | - */ |
|
4942 | + * Gets all aircraft registration that have flown over by date |
|
4943 | + * |
|
4944 | + * @return Array the aircraft list |
|
4945 | + * |
|
4946 | + */ |
|
4947 | 4947 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
4948 | 4948 | { |
4949 | 4949 | global $globalTimezone, $globalDBdriver; |
@@ -4994,11 +4994,11 @@ discard block |
||
4994 | 4994 | |
4995 | 4995 | |
4996 | 4996 | /** |
4997 | - * Gets all aircraft manufacturer that have flown over by date |
|
4998 | - * |
|
4999 | - * @return Array the aircraft manufacturer list |
|
5000 | - * |
|
5001 | - */ |
|
4997 | + * Gets all aircraft manufacturer that have flown over by date |
|
4998 | + * |
|
4999 | + * @return Array the aircraft manufacturer list |
|
5000 | + * |
|
5001 | + */ |
|
5002 | 5002 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
5003 | 5003 | { |
5004 | 5004 | global $globalTimezone, $globalDBdriver; |
@@ -5040,11 +5040,11 @@ discard block |
||
5040 | 5040 | |
5041 | 5041 | |
5042 | 5042 | /** |
5043 | - * Gets all aircraft types that have flown over by ident/callsign |
|
5044 | - * |
|
5045 | - * @return Array the aircraft list |
|
5046 | - * |
|
5047 | - */ |
|
5043 | + * Gets all aircraft types that have flown over by ident/callsign |
|
5044 | + * |
|
5045 | + * @return Array the aircraft list |
|
5046 | + * |
|
5047 | + */ |
|
5048 | 5048 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
5049 | 5049 | { |
5050 | 5050 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5073,11 +5073,11 @@ discard block |
||
5073 | 5073 | |
5074 | 5074 | |
5075 | 5075 | /** |
5076 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
5077 | - * |
|
5078 | - * @return Array the aircraft list |
|
5079 | - * |
|
5080 | - */ |
|
5076 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
5077 | + * |
|
5078 | + * @return Array the aircraft list |
|
5079 | + * |
|
5080 | + */ |
|
5081 | 5081 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
5082 | 5082 | { |
5083 | 5083 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5117,11 +5117,11 @@ discard block |
||
5117 | 5117 | |
5118 | 5118 | |
5119 | 5119 | /** |
5120 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5121 | - * |
|
5122 | - * @return Array the aircraft manufacturer list |
|
5123 | - * |
|
5124 | - */ |
|
5120 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5121 | + * |
|
5122 | + * @return Array the aircraft manufacturer list |
|
5123 | + * |
|
5124 | + */ |
|
5125 | 5125 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
5126 | 5126 | { |
5127 | 5127 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5147,11 +5147,11 @@ discard block |
||
5147 | 5147 | |
5148 | 5148 | |
5149 | 5149 | /** |
5150 | - * Gets all aircraft types that have flown over by route |
|
5151 | - * |
|
5152 | - * @return Array the aircraft list |
|
5153 | - * |
|
5154 | - */ |
|
5150 | + * Gets all aircraft types that have flown over by route |
|
5151 | + * |
|
5152 | + * @return Array the aircraft list |
|
5153 | + * |
|
5154 | + */ |
|
5155 | 5155 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5156 | 5156 | { |
5157 | 5157 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5180,11 +5180,11 @@ discard block |
||
5180 | 5180 | } |
5181 | 5181 | |
5182 | 5182 | /** |
5183 | - * Gets all aircraft registration that have flown over by route |
|
5184 | - * |
|
5185 | - * @return Array the aircraft list |
|
5186 | - * |
|
5187 | - */ |
|
5183 | + * Gets all aircraft registration that have flown over by route |
|
5184 | + * |
|
5185 | + * @return Array the aircraft list |
|
5186 | + * |
|
5187 | + */ |
|
5188 | 5188 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5189 | 5189 | { |
5190 | 5190 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5226,11 +5226,11 @@ discard block |
||
5226 | 5226 | |
5227 | 5227 | |
5228 | 5228 | /** |
5229 | - * Gets all aircraft manufacturer that have flown over by route |
|
5230 | - * |
|
5231 | - * @return Array the aircraft manufacturer list |
|
5232 | - * |
|
5233 | - */ |
|
5229 | + * Gets all aircraft manufacturer that have flown over by route |
|
5230 | + * |
|
5231 | + * @return Array the aircraft manufacturer list |
|
5232 | + * |
|
5233 | + */ |
|
5234 | 5234 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5235 | 5235 | { |
5236 | 5236 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5264,11 +5264,11 @@ discard block |
||
5264 | 5264 | |
5265 | 5265 | |
5266 | 5266 | /** |
5267 | - * Gets all aircraft types that have flown over by country |
|
5268 | - * |
|
5269 | - * @return Array the aircraft list |
|
5270 | - * |
|
5271 | - */ |
|
5267 | + * Gets all aircraft types that have flown over by country |
|
5268 | + * |
|
5269 | + * @return Array the aircraft list |
|
5270 | + * |
|
5271 | + */ |
|
5272 | 5272 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
5273 | 5273 | { |
5274 | 5274 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5299,11 +5299,11 @@ discard block |
||
5299 | 5299 | |
5300 | 5300 | |
5301 | 5301 | /** |
5302 | - * Gets all aircraft registration that have flown over by country |
|
5303 | - * |
|
5304 | - * @return Array the aircraft list |
|
5305 | - * |
|
5306 | - */ |
|
5302 | + * Gets all aircraft registration that have flown over by country |
|
5303 | + * |
|
5304 | + * @return Array the aircraft list |
|
5305 | + * |
|
5306 | + */ |
|
5307 | 5307 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
5308 | 5308 | { |
5309 | 5309 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5343,11 +5343,11 @@ discard block |
||
5343 | 5343 | |
5344 | 5344 | |
5345 | 5345 | /** |
5346 | - * Gets all aircraft manufacturer that have flown over by country |
|
5347 | - * |
|
5348 | - * @return Array the aircraft manufacturer list |
|
5349 | - * |
|
5350 | - */ |
|
5346 | + * Gets all aircraft manufacturer that have flown over by country |
|
5347 | + * |
|
5348 | + * @return Array the aircraft manufacturer list |
|
5349 | + * |
|
5350 | + */ |
|
5351 | 5351 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
5352 | 5352 | { |
5353 | 5353 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5378,17 +5378,17 @@ discard block |
||
5378 | 5378 | |
5379 | 5379 | |
5380 | 5380 | /** |
5381 | - * Gets all aircraft manufacturers that have flown over |
|
5382 | - * |
|
5383 | - * @return Array the aircraft list |
|
5384 | - * |
|
5385 | - */ |
|
5381 | + * Gets all aircraft manufacturers that have flown over |
|
5382 | + * |
|
5383 | + * @return Array the aircraft list |
|
5384 | + * |
|
5385 | + */ |
|
5386 | 5386 | public function countAllAircraftManufacturers($filters = array()) |
5387 | 5387 | { |
5388 | 5388 | $filter_query = $this->getFilter($filters,true,true); |
5389 | 5389 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
5390 | 5390 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5391 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5391 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5392 | 5392 | ORDER BY aircraft_manufacturer_count DESC |
5393 | 5393 | LIMIT 10"; |
5394 | 5394 | |
@@ -5413,11 +5413,11 @@ discard block |
||
5413 | 5413 | |
5414 | 5414 | |
5415 | 5415 | /** |
5416 | - * Gets all aircraft registrations that have flown over |
|
5417 | - * |
|
5418 | - * @return Array the aircraft list |
|
5419 | - * |
|
5420 | - */ |
|
5416 | + * Gets all aircraft registrations that have flown over |
|
5417 | + * |
|
5418 | + * @return Array the aircraft list |
|
5419 | + * |
|
5420 | + */ |
|
5421 | 5421 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5422 | 5422 | { |
5423 | 5423 | global $globalDBdriver; |
@@ -5425,15 +5425,15 @@ discard block |
||
5425 | 5425 | $filter_query = $this->getFilter($filters,true,true); |
5426 | 5426 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5427 | 5427 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5428 | - if ($olderthanmonths > 0) { |
|
5429 | - if ($globalDBdriver == 'mysql') { |
|
5428 | + if ($olderthanmonths > 0) { |
|
5429 | + if ($globalDBdriver == 'mysql') { |
|
5430 | 5430 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5431 | 5431 | } else { |
5432 | 5432 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5433 | 5433 | } |
5434 | 5434 | } |
5435 | - if ($sincedate != '') { |
|
5436 | - if ($globalDBdriver == 'mysql') { |
|
5435 | + if ($sincedate != '') { |
|
5436 | + if ($globalDBdriver == 'mysql') { |
|
5437 | 5437 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5438 | 5438 | } else { |
5439 | 5439 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5442,7 +5442,7 @@ discard block |
||
5442 | 5442 | |
5443 | 5443 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5444 | 5444 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5445 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5445 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5446 | 5446 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5447 | 5447 | |
5448 | 5448 | $sth = $this->db->prepare($query); |
@@ -5473,11 +5473,11 @@ discard block |
||
5473 | 5473 | |
5474 | 5474 | |
5475 | 5475 | /** |
5476 | - * Gets all aircraft registrations that have flown over |
|
5477 | - * |
|
5478 | - * @return Array the aircraft list |
|
5479 | - * |
|
5480 | - */ |
|
5476 | + * Gets all aircraft registrations that have flown over |
|
5477 | + * |
|
5478 | + * @return Array the aircraft list |
|
5479 | + * |
|
5480 | + */ |
|
5481 | 5481 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5482 | 5482 | { |
5483 | 5483 | global $globalDBdriver; |
@@ -5485,15 +5485,15 @@ discard block |
||
5485 | 5485 | $Image = new Image($this->db); |
5486 | 5486 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
5487 | 5487 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5488 | - if ($olderthanmonths > 0) { |
|
5489 | - if ($globalDBdriver == 'mysql') { |
|
5488 | + if ($olderthanmonths > 0) { |
|
5489 | + if ($globalDBdriver == 'mysql') { |
|
5490 | 5490 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5491 | 5491 | } else { |
5492 | 5492 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5493 | 5493 | } |
5494 | 5494 | } |
5495 | - if ($sincedate != '') { |
|
5496 | - if ($globalDBdriver == 'mysql') { |
|
5495 | + if ($sincedate != '') { |
|
5496 | + if ($globalDBdriver == 'mysql') { |
|
5497 | 5497 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5498 | 5498 | } else { |
5499 | 5499 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5502,7 +5502,7 @@ discard block |
||
5502 | 5502 | |
5503 | 5503 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5504 | 5504 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5505 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5505 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5506 | 5506 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5507 | 5507 | |
5508 | 5508 | $sth = $this->db->prepare($query); |
@@ -5534,35 +5534,35 @@ discard block |
||
5534 | 5534 | |
5535 | 5535 | |
5536 | 5536 | /** |
5537 | - * Gets all departure airports of the airplanes that have flown over |
|
5538 | - * |
|
5539 | - * @return Array the airport list |
|
5540 | - * |
|
5541 | - */ |
|
5537 | + * Gets all departure airports of the airplanes that have flown over |
|
5538 | + * |
|
5539 | + * @return Array the airport list |
|
5540 | + * |
|
5541 | + */ |
|
5542 | 5542 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5543 | 5543 | { |
5544 | 5544 | global $globalDBdriver; |
5545 | 5545 | $filter_query = $this->getFilter($filters,true,true); |
5546 | 5546 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5547 | 5547 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
5548 | - if ($olderthanmonths > 0) { |
|
5549 | - if ($globalDBdriver == 'mysql') { |
|
5548 | + if ($olderthanmonths > 0) { |
|
5549 | + if ($globalDBdriver == 'mysql') { |
|
5550 | 5550 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5551 | 5551 | } else { |
5552 | 5552 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5553 | 5553 | } |
5554 | - } |
|
5555 | - if ($sincedate != '') { |
|
5556 | - if ($globalDBdriver == 'mysql') { |
|
5554 | + } |
|
5555 | + if ($sincedate != '') { |
|
5556 | + if ($globalDBdriver == 'mysql') { |
|
5557 | 5557 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5558 | 5558 | } else { |
5559 | 5559 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5560 | 5560 | } |
5561 | 5561 | } |
5562 | 5562 | |
5563 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5564 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5565 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5563 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5564 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5565 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5566 | 5566 | ORDER BY airport_departure_icao_count DESC"; |
5567 | 5567 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5568 | 5568 | |
@@ -5586,35 +5586,35 @@ discard block |
||
5586 | 5586 | } |
5587 | 5587 | |
5588 | 5588 | /** |
5589 | - * Gets all departure airports of the airplanes that have flown over |
|
5590 | - * |
|
5591 | - * @return Array the airport list |
|
5592 | - * |
|
5593 | - */ |
|
5589 | + * Gets all departure airports of the airplanes that have flown over |
|
5590 | + * |
|
5591 | + * @return Array the airport list |
|
5592 | + * |
|
5593 | + */ |
|
5594 | 5594 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5595 | 5595 | { |
5596 | 5596 | global $globalDBdriver; |
5597 | 5597 | $filter_query = $this->getFilter($filters,true,true); |
5598 | 5598 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
5599 | 5599 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
5600 | - if ($olderthanmonths > 0) { |
|
5601 | - if ($globalDBdriver == 'mysql') { |
|
5600 | + if ($olderthanmonths > 0) { |
|
5601 | + if ($globalDBdriver == 'mysql') { |
|
5602 | 5602 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5603 | 5603 | } else { |
5604 | 5604 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5605 | 5605 | } |
5606 | - } |
|
5607 | - if ($sincedate != '') { |
|
5608 | - if ($globalDBdriver == 'mysql') { |
|
5606 | + } |
|
5607 | + if ($sincedate != '') { |
|
5608 | + if ($globalDBdriver == 'mysql') { |
|
5609 | 5609 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5610 | 5610 | } else { |
5611 | 5611 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5612 | 5612 | } |
5613 | 5613 | } |
5614 | 5614 | |
5615 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5616 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5617 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5615 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5616 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5617 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5618 | 5618 | ORDER BY airport_departure_icao_count DESC"; |
5619 | 5619 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5620 | 5620 | |
@@ -5639,37 +5639,37 @@ discard block |
||
5639 | 5639 | } |
5640 | 5640 | |
5641 | 5641 | /** |
5642 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5643 | - * |
|
5644 | - * @return Array the airport list |
|
5645 | - * |
|
5646 | - */ |
|
5642 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5643 | + * |
|
5644 | + * @return Array the airport list |
|
5645 | + * |
|
5646 | + */ |
|
5647 | 5647 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5648 | 5648 | { |
5649 | 5649 | global $globalDBdriver; |
5650 | 5650 | $filter_query = $this->getFilter($filters,true,true); |
5651 | 5651 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
5652 | 5652 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
5653 | - if ($olderthanmonths > 0) { |
|
5654 | - if ($globalDBdriver == 'mysql') { |
|
5653 | + if ($olderthanmonths > 0) { |
|
5654 | + if ($globalDBdriver == 'mysql') { |
|
5655 | 5655 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5656 | 5656 | } else { |
5657 | 5657 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5658 | 5658 | } |
5659 | - } |
|
5660 | - if ($sincedate != '') { |
|
5661 | - if ($globalDBdriver == 'mysql') { |
|
5659 | + } |
|
5660 | + if ($sincedate != '') { |
|
5661 | + if ($globalDBdriver == 'mysql') { |
|
5662 | 5662 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5663 | 5663 | } else { |
5664 | 5664 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5665 | 5665 | } |
5666 | 5666 | } |
5667 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5668 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5669 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5667 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5668 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5669 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5670 | 5670 | ORDER BY airport_departure_icao_count DESC"; |
5671 | 5671 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5672 | - //echo $query; |
|
5672 | + //echo $query; |
|
5673 | 5673 | $sth = $this->db->prepare($query); |
5674 | 5674 | $sth->execute(); |
5675 | 5675 | |
@@ -5690,35 +5690,35 @@ discard block |
||
5690 | 5690 | } |
5691 | 5691 | |
5692 | 5692 | /** |
5693 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5694 | - * |
|
5695 | - * @return Array the airport list |
|
5696 | - * |
|
5697 | - */ |
|
5693 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5694 | + * |
|
5695 | + * @return Array the airport list |
|
5696 | + * |
|
5697 | + */ |
|
5698 | 5698 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5699 | 5699 | { |
5700 | 5700 | global $globalDBdriver; |
5701 | 5701 | $filter_query = $this->getFilter($filters,true,true); |
5702 | 5702 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
5703 | 5703 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
5704 | - if ($olderthanmonths > 0) { |
|
5705 | - if ($globalDBdriver == 'mysql') { |
|
5704 | + if ($olderthanmonths > 0) { |
|
5705 | + if ($globalDBdriver == 'mysql') { |
|
5706 | 5706 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5707 | 5707 | } else { |
5708 | 5708 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5709 | 5709 | } |
5710 | - } |
|
5711 | - if ($sincedate != '') { |
|
5712 | - if ($globalDBdriver == 'mysql') { |
|
5710 | + } |
|
5711 | + if ($sincedate != '') { |
|
5712 | + if ($globalDBdriver == 'mysql') { |
|
5713 | 5713 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5714 | 5714 | } else { |
5715 | 5715 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
5716 | 5716 | } |
5717 | 5717 | } |
5718 | 5718 | |
5719 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5720 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5721 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5719 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5720 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5721 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5722 | 5722 | ORDER BY airport_departure_icao_count DESC"; |
5723 | 5723 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5724 | 5724 | |
@@ -5743,11 +5743,11 @@ discard block |
||
5743 | 5743 | } |
5744 | 5744 | |
5745 | 5745 | /** |
5746 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5747 | - * |
|
5748 | - * @return Array the airport list |
|
5749 | - * |
|
5750 | - */ |
|
5746 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5747 | + * |
|
5748 | + * @return Array the airport list |
|
5749 | + * |
|
5750 | + */ |
|
5751 | 5751 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
5752 | 5752 | { |
5753 | 5753 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5781,11 +5781,11 @@ discard block |
||
5781 | 5781 | |
5782 | 5782 | |
5783 | 5783 | /** |
5784 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5785 | - * |
|
5786 | - * @return Array the airport list |
|
5787 | - * |
|
5788 | - */ |
|
5784 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5785 | + * |
|
5786 | + * @return Array the airport list |
|
5787 | + * |
|
5788 | + */ |
|
5789 | 5789 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
5790 | 5790 | { |
5791 | 5791 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5816,11 +5816,11 @@ discard block |
||
5816 | 5816 | |
5817 | 5817 | |
5818 | 5818 | /** |
5819 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5820 | - * |
|
5821 | - * @return Array the airport list |
|
5822 | - * |
|
5823 | - */ |
|
5819 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5820 | + * |
|
5821 | + * @return Array the airport list |
|
5822 | + * |
|
5823 | + */ |
|
5824 | 5824 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
5825 | 5825 | { |
5826 | 5826 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5853,11 +5853,11 @@ discard block |
||
5853 | 5853 | |
5854 | 5854 | |
5855 | 5855 | /** |
5856 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5857 | - * |
|
5858 | - * @return Array the airport list |
|
5859 | - * |
|
5860 | - */ |
|
5856 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5857 | + * |
|
5858 | + * @return Array the airport list |
|
5859 | + * |
|
5860 | + */ |
|
5861 | 5861 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
5862 | 5862 | { |
5863 | 5863 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5887,11 +5887,11 @@ discard block |
||
5887 | 5887 | |
5888 | 5888 | |
5889 | 5889 | /** |
5890 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5891 | - * |
|
5892 | - * @return Array the airport list |
|
5893 | - * |
|
5894 | - */ |
|
5890 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5891 | + * |
|
5892 | + * @return Array the airport list |
|
5893 | + * |
|
5894 | + */ |
|
5895 | 5895 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
5896 | 5896 | { |
5897 | 5897 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5924,11 +5924,11 @@ discard block |
||
5924 | 5924 | |
5925 | 5925 | |
5926 | 5926 | /** |
5927 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5928 | - * |
|
5929 | - * @return Array the airport list |
|
5930 | - * |
|
5931 | - */ |
|
5927 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5928 | + * |
|
5929 | + * @return Array the airport list |
|
5930 | + * |
|
5931 | + */ |
|
5932 | 5932 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
5933 | 5933 | { |
5934 | 5934 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5958,11 +5958,11 @@ discard block |
||
5958 | 5958 | |
5959 | 5959 | |
5960 | 5960 | /** |
5961 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
5962 | - * |
|
5963 | - * @return Array the airport list |
|
5964 | - * |
|
5965 | - */ |
|
5961 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
5962 | + * |
|
5963 | + * @return Array the airport list |
|
5964 | + * |
|
5965 | + */ |
|
5966 | 5966 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
5967 | 5967 | { |
5968 | 5968 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5995,11 +5995,11 @@ discard block |
||
5995 | 5995 | |
5996 | 5996 | |
5997 | 5997 | /** |
5998 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
5999 | - * |
|
6000 | - * @return Array the airport list |
|
6001 | - * |
|
6002 | - */ |
|
5998 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
5999 | + * |
|
6000 | + * @return Array the airport list |
|
6001 | + * |
|
6002 | + */ |
|
6003 | 6003 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
6004 | 6004 | { |
6005 | 6005 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6030,11 +6030,11 @@ discard block |
||
6030 | 6030 | |
6031 | 6031 | |
6032 | 6032 | /** |
6033 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
6034 | - * |
|
6035 | - * @return Array the airport list |
|
6036 | - * |
|
6037 | - */ |
|
6033 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
6034 | + * |
|
6035 | + * @return Array the airport list |
|
6036 | + * |
|
6037 | + */ |
|
6038 | 6038 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
6039 | 6039 | { |
6040 | 6040 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6067,11 +6067,11 @@ discard block |
||
6067 | 6067 | |
6068 | 6068 | |
6069 | 6069 | /** |
6070 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
6071 | - * |
|
6072 | - * @return Array the airport list |
|
6073 | - * |
|
6074 | - */ |
|
6070 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
6071 | + * |
|
6072 | + * @return Array the airport list |
|
6073 | + * |
|
6074 | + */ |
|
6075 | 6075 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
6076 | 6076 | { |
6077 | 6077 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6101,11 +6101,11 @@ discard block |
||
6101 | 6101 | |
6102 | 6102 | |
6103 | 6103 | /** |
6104 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
6105 | - * |
|
6106 | - * @return Array the airport list |
|
6107 | - * |
|
6108 | - */ |
|
6104 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
6105 | + * |
|
6106 | + * @return Array the airport list |
|
6107 | + * |
|
6108 | + */ |
|
6109 | 6109 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
6110 | 6110 | { |
6111 | 6111 | global $globalTimezone, $globalDBdriver; |
@@ -6151,11 +6151,11 @@ discard block |
||
6151 | 6151 | |
6152 | 6152 | |
6153 | 6153 | /** |
6154 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6155 | - * |
|
6156 | - * @return Array the airport list |
|
6157 | - * |
|
6158 | - */ |
|
6154 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6155 | + * |
|
6156 | + * @return Array the airport list |
|
6157 | + * |
|
6158 | + */ |
|
6159 | 6159 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
6160 | 6160 | { |
6161 | 6161 | global $globalTimezone, $globalDBdriver; |
@@ -6198,11 +6198,11 @@ discard block |
||
6198 | 6198 | |
6199 | 6199 | |
6200 | 6200 | /** |
6201 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6202 | - * |
|
6203 | - * @return Array the airport list |
|
6204 | - * |
|
6205 | - */ |
|
6201 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6202 | + * |
|
6203 | + * @return Array the airport list |
|
6204 | + * |
|
6205 | + */ |
|
6206 | 6206 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
6207 | 6207 | { |
6208 | 6208 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6236,11 +6236,11 @@ discard block |
||
6236 | 6236 | |
6237 | 6237 | |
6238 | 6238 | /** |
6239 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6240 | - * |
|
6241 | - * @return Array the airport list |
|
6242 | - * |
|
6243 | - */ |
|
6239 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6240 | + * |
|
6241 | + * @return Array the airport list |
|
6242 | + * |
|
6243 | + */ |
|
6244 | 6244 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
6245 | 6245 | { |
6246 | 6246 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6271,11 +6271,11 @@ discard block |
||
6271 | 6271 | |
6272 | 6272 | |
6273 | 6273 | /** |
6274 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
6275 | - * |
|
6276 | - * @return Array the airport list |
|
6277 | - * |
|
6278 | - */ |
|
6274 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
6275 | + * |
|
6276 | + * @return Array the airport list |
|
6277 | + * |
|
6278 | + */ |
|
6279 | 6279 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
6280 | 6280 | { |
6281 | 6281 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6309,11 +6309,11 @@ discard block |
||
6309 | 6309 | |
6310 | 6310 | |
6311 | 6311 | /** |
6312 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6313 | - * |
|
6314 | - * @return Array the airport list |
|
6315 | - * |
|
6316 | - */ |
|
6312 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6313 | + * |
|
6314 | + * @return Array the airport list |
|
6315 | + * |
|
6316 | + */ |
|
6317 | 6317 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
6318 | 6318 | { |
6319 | 6319 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6343,40 +6343,40 @@ discard block |
||
6343 | 6343 | |
6344 | 6344 | |
6345 | 6345 | /** |
6346 | - * Gets all arrival airports of the airplanes that have flown over |
|
6347 | - * |
|
6348 | - * @return Array the airport list |
|
6349 | - * |
|
6350 | - */ |
|
6346 | + * Gets all arrival airports of the airplanes that have flown over |
|
6347 | + * |
|
6348 | + * @return Array the airport list |
|
6349 | + * |
|
6350 | + */ |
|
6351 | 6351 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6352 | 6352 | { |
6353 | 6353 | global $globalDBdriver; |
6354 | 6354 | $filter_query = $this->getFilter($filters,true,true); |
6355 | 6355 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6356 | 6356 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
6357 | - if ($olderthanmonths > 0) { |
|
6358 | - if ($globalDBdriver == 'mysql') { |
|
6357 | + if ($olderthanmonths > 0) { |
|
6358 | + if ($globalDBdriver == 'mysql') { |
|
6359 | 6359 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6360 | 6360 | } else { |
6361 | 6361 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6362 | 6362 | } |
6363 | - if ($sincedate != '') { |
|
6364 | - if ($globalDBdriver == 'mysql') { |
|
6363 | + if ($sincedate != '') { |
|
6364 | + if ($globalDBdriver == 'mysql') { |
|
6365 | 6365 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6366 | 6366 | } else { |
6367 | 6367 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6368 | 6368 | } |
6369 | 6369 | } |
6370 | - if ($globalDBdriver == 'mysql') { |
|
6370 | + if ($globalDBdriver == 'mysql') { |
|
6371 | 6371 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6372 | 6372 | } else { |
6373 | 6373 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6374 | 6374 | } |
6375 | 6375 | } |
6376 | 6376 | |
6377 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6378 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6379 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6377 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6378 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6379 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6380 | 6380 | ORDER BY airport_arrival_icao_count DESC"; |
6381 | 6381 | if ($limit) $query .= " LIMIT 10"; |
6382 | 6382 | |
@@ -6405,40 +6405,40 @@ discard block |
||
6405 | 6405 | } |
6406 | 6406 | |
6407 | 6407 | /** |
6408 | - * Gets all arrival airports of the airplanes that have flown over |
|
6409 | - * |
|
6410 | - * @return Array the airport list |
|
6411 | - * |
|
6412 | - */ |
|
6408 | + * Gets all arrival airports of the airplanes that have flown over |
|
6409 | + * |
|
6410 | + * @return Array the airport list |
|
6411 | + * |
|
6412 | + */ |
|
6413 | 6413 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6414 | 6414 | { |
6415 | 6415 | global $globalDBdriver; |
6416 | 6416 | $filter_query = $this->getFilter($filters,true,true); |
6417 | 6417 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
6418 | 6418 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
6419 | - if ($olderthanmonths > 0) { |
|
6420 | - if ($globalDBdriver == 'mysql') { |
|
6419 | + if ($olderthanmonths > 0) { |
|
6420 | + if ($globalDBdriver == 'mysql') { |
|
6421 | 6421 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6422 | 6422 | } else { |
6423 | 6423 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6424 | 6424 | } |
6425 | - if ($sincedate != '') { |
|
6426 | - if ($globalDBdriver == 'mysql') { |
|
6425 | + if ($sincedate != '') { |
|
6426 | + if ($globalDBdriver == 'mysql') { |
|
6427 | 6427 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6428 | 6428 | } else { |
6429 | 6429 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6430 | 6430 | } |
6431 | 6431 | } |
6432 | - if ($globalDBdriver == 'mysql') { |
|
6432 | + if ($globalDBdriver == 'mysql') { |
|
6433 | 6433 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6434 | 6434 | } else { |
6435 | 6435 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6436 | 6436 | } |
6437 | 6437 | } |
6438 | 6438 | |
6439 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6440 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6441 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6439 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6440 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6441 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6442 | 6442 | ORDER BY airport_arrival_icao_count DESC"; |
6443 | 6443 | if ($limit) $query .= " LIMIT 10"; |
6444 | 6444 | |
@@ -6469,39 +6469,39 @@ discard block |
||
6469 | 6469 | |
6470 | 6470 | |
6471 | 6471 | /** |
6472 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6473 | - * |
|
6474 | - * @return Array the airport list |
|
6475 | - * |
|
6476 | - */ |
|
6472 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6473 | + * |
|
6474 | + * @return Array the airport list |
|
6475 | + * |
|
6476 | + */ |
|
6477 | 6477 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6478 | 6478 | { |
6479 | 6479 | global $globalDBdriver; |
6480 | 6480 | $filter_query = $this->getFilter($filters,true,true); |
6481 | 6481 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
6482 | 6482 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
6483 | - if ($olderthanmonths > 0) { |
|
6484 | - if ($globalDBdriver == 'mysql') { |
|
6483 | + if ($olderthanmonths > 0) { |
|
6484 | + if ($globalDBdriver == 'mysql') { |
|
6485 | 6485 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6486 | 6486 | } else { |
6487 | 6487 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6488 | 6488 | } |
6489 | - if ($sincedate != '') { |
|
6490 | - if ($globalDBdriver == 'mysql') { |
|
6489 | + if ($sincedate != '') { |
|
6490 | + if ($globalDBdriver == 'mysql') { |
|
6491 | 6491 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6492 | 6492 | } else { |
6493 | 6493 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6494 | 6494 | } |
6495 | 6495 | } |
6496 | - if ($globalDBdriver == 'mysql') { |
|
6496 | + if ($globalDBdriver == 'mysql') { |
|
6497 | 6497 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6498 | 6498 | } else { |
6499 | 6499 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6500 | 6500 | } |
6501 | 6501 | } |
6502 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6503 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6504 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6502 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6503 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6504 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6505 | 6505 | ORDER BY airport_arrival_icao_count DESC"; |
6506 | 6506 | if ($limit) $query .= " LIMIT 10"; |
6507 | 6507 | |
@@ -6530,40 +6530,40 @@ discard block |
||
6530 | 6530 | } |
6531 | 6531 | |
6532 | 6532 | /** |
6533 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6534 | - * |
|
6535 | - * @return Array the airport list |
|
6536 | - * |
|
6537 | - */ |
|
6533 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6534 | + * |
|
6535 | + * @return Array the airport list |
|
6536 | + * |
|
6537 | + */ |
|
6538 | 6538 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6539 | 6539 | { |
6540 | 6540 | global $globalDBdriver; |
6541 | 6541 | $filter_query = $this->getFilter($filters,true,true); |
6542 | 6542 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
6543 | 6543 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
6544 | - if ($olderthanmonths > 0) { |
|
6545 | - if ($globalDBdriver == 'mysql') { |
|
6544 | + if ($olderthanmonths > 0) { |
|
6545 | + if ($globalDBdriver == 'mysql') { |
|
6546 | 6546 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6547 | 6547 | } else { |
6548 | 6548 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6549 | 6549 | } |
6550 | - if ($sincedate != '') { |
|
6551 | - if ($globalDBdriver == 'mysql') { |
|
6550 | + if ($sincedate != '') { |
|
6551 | + if ($globalDBdriver == 'mysql') { |
|
6552 | 6552 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6553 | 6553 | } else { |
6554 | 6554 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6555 | 6555 | } |
6556 | 6556 | } |
6557 | - if ($globalDBdriver == 'mysql') { |
|
6557 | + if ($globalDBdriver == 'mysql') { |
|
6558 | 6558 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6559 | 6559 | } else { |
6560 | 6560 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6561 | 6561 | } |
6562 | 6562 | } |
6563 | 6563 | |
6564 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6565 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6566 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6564 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6565 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6566 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6567 | 6567 | ORDER BY airport_arrival_icao_count DESC"; |
6568 | 6568 | if ($limit) $query .= " LIMIT 10"; |
6569 | 6569 | |
@@ -6593,11 +6593,11 @@ discard block |
||
6593 | 6593 | } |
6594 | 6594 | |
6595 | 6595 | /** |
6596 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6597 | - * |
|
6598 | - * @return Array the airport list |
|
6599 | - * |
|
6600 | - */ |
|
6596 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6597 | + * |
|
6598 | + * @return Array the airport list |
|
6599 | + * |
|
6600 | + */ |
|
6601 | 6601 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6602 | 6602 | { |
6603 | 6603 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6629,11 +6629,11 @@ discard block |
||
6629 | 6629 | |
6630 | 6630 | |
6631 | 6631 | /** |
6632 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6633 | - * |
|
6634 | - * @return Array the airport list |
|
6635 | - * |
|
6636 | - */ |
|
6632 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6633 | + * |
|
6634 | + * @return Array the airport list |
|
6635 | + * |
|
6636 | + */ |
|
6637 | 6637 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
6638 | 6638 | { |
6639 | 6639 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6664,11 +6664,11 @@ discard block |
||
6664 | 6664 | |
6665 | 6665 | |
6666 | 6666 | /** |
6667 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6668 | - * |
|
6669 | - * @return Array the airport list |
|
6670 | - * |
|
6671 | - */ |
|
6667 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6668 | + * |
|
6669 | + * @return Array the airport list |
|
6670 | + * |
|
6671 | + */ |
|
6672 | 6672 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
6673 | 6673 | { |
6674 | 6674 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6702,11 +6702,11 @@ discard block |
||
6702 | 6702 | |
6703 | 6703 | |
6704 | 6704 | /** |
6705 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6706 | - * |
|
6707 | - * @return Array the airport list |
|
6708 | - * |
|
6709 | - */ |
|
6705 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6706 | + * |
|
6707 | + * @return Array the airport list |
|
6708 | + * |
|
6709 | + */ |
|
6710 | 6710 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
6711 | 6711 | { |
6712 | 6712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6736,11 +6736,11 @@ discard block |
||
6736 | 6736 | |
6737 | 6737 | |
6738 | 6738 | /** |
6739 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6740 | - * |
|
6741 | - * @return Array the airport list |
|
6742 | - * |
|
6743 | - */ |
|
6739 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6740 | + * |
|
6741 | + * @return Array the airport list |
|
6742 | + * |
|
6743 | + */ |
|
6744 | 6744 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
6745 | 6745 | { |
6746 | 6746 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6774,11 +6774,11 @@ discard block |
||
6774 | 6774 | |
6775 | 6775 | |
6776 | 6776 | /** |
6777 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6778 | - * |
|
6779 | - * @return Array the airport list |
|
6780 | - * |
|
6781 | - */ |
|
6777 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6778 | + * |
|
6779 | + * @return Array the airport list |
|
6780 | + * |
|
6781 | + */ |
|
6782 | 6782 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
6783 | 6783 | { |
6784 | 6784 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6809,11 +6809,11 @@ discard block |
||
6809 | 6809 | |
6810 | 6810 | |
6811 | 6811 | /** |
6812 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6813 | - * |
|
6814 | - * @return Array the airport list |
|
6815 | - * |
|
6816 | - */ |
|
6812 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6813 | + * |
|
6814 | + * @return Array the airport list |
|
6815 | + * |
|
6816 | + */ |
|
6817 | 6817 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
6818 | 6818 | { |
6819 | 6819 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6846,11 +6846,11 @@ discard block |
||
6846 | 6846 | |
6847 | 6847 | |
6848 | 6848 | /** |
6849 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6850 | - * |
|
6851 | - * @return Array the airport list |
|
6852 | - * |
|
6853 | - */ |
|
6849 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6850 | + * |
|
6851 | + * @return Array the airport list |
|
6852 | + * |
|
6853 | + */ |
|
6854 | 6854 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
6855 | 6855 | { |
6856 | 6856 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6880,11 +6880,11 @@ discard block |
||
6880 | 6880 | |
6881 | 6881 | |
6882 | 6882 | /** |
6883 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6884 | - * |
|
6885 | - * @return Array the airport list |
|
6886 | - * |
|
6887 | - */ |
|
6883 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6884 | + * |
|
6885 | + * @return Array the airport list |
|
6886 | + * |
|
6887 | + */ |
|
6888 | 6888 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
6889 | 6889 | { |
6890 | 6890 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6918,11 +6918,11 @@ discard block |
||
6918 | 6918 | |
6919 | 6919 | |
6920 | 6920 | /** |
6921 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6922 | - * |
|
6923 | - * @return Array the airport list |
|
6924 | - * |
|
6925 | - */ |
|
6921 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6922 | + * |
|
6923 | + * @return Array the airport list |
|
6924 | + * |
|
6925 | + */ |
|
6926 | 6926 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
6927 | 6927 | { |
6928 | 6928 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6953,11 +6953,11 @@ discard block |
||
6953 | 6953 | |
6954 | 6954 | |
6955 | 6955 | /** |
6956 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6957 | - * |
|
6958 | - * @return Array the airport list |
|
6959 | - * |
|
6960 | - */ |
|
6956 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6957 | + * |
|
6958 | + * @return Array the airport list |
|
6959 | + * |
|
6960 | + */ |
|
6961 | 6961 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
6962 | 6962 | { |
6963 | 6963 | global $globalTimezone, $globalDBdriver; |
@@ -7003,11 +7003,11 @@ discard block |
||
7003 | 7003 | |
7004 | 7004 | |
7005 | 7005 | /** |
7006 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
7007 | - * |
|
7008 | - * @return Array the airport list |
|
7009 | - * |
|
7010 | - */ |
|
7006 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
7007 | + * |
|
7008 | + * @return Array the airport list |
|
7009 | + * |
|
7010 | + */ |
|
7011 | 7011 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
7012 | 7012 | { |
7013 | 7013 | global $globalTimezone, $globalDBdriver; |
@@ -7050,11 +7050,11 @@ discard block |
||
7050 | 7050 | |
7051 | 7051 | |
7052 | 7052 | /** |
7053 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
7054 | - * |
|
7055 | - * @return Array the airport list |
|
7056 | - * |
|
7057 | - */ |
|
7053 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
7054 | + * |
|
7055 | + * @return Array the airport list |
|
7056 | + * |
|
7057 | + */ |
|
7058 | 7058 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
7059 | 7059 | { |
7060 | 7060 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7087,11 +7087,11 @@ discard block |
||
7087 | 7087 | |
7088 | 7088 | |
7089 | 7089 | /** |
7090 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7091 | - * |
|
7092 | - * @return Array the airport list |
|
7093 | - * |
|
7094 | - */ |
|
7090 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7091 | + * |
|
7092 | + * @return Array the airport list |
|
7093 | + * |
|
7094 | + */ |
|
7095 | 7095 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7096 | 7096 | { |
7097 | 7097 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7122,11 +7122,11 @@ discard block |
||
7122 | 7122 | |
7123 | 7123 | |
7124 | 7124 | /** |
7125 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7126 | - * |
|
7127 | - * @return Array the airport list |
|
7128 | - * |
|
7129 | - */ |
|
7125 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7126 | + * |
|
7127 | + * @return Array the airport list |
|
7128 | + * |
|
7129 | + */ |
|
7130 | 7130 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
7131 | 7131 | { |
7132 | 7132 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7159,11 +7159,11 @@ discard block |
||
7159 | 7159 | |
7160 | 7160 | |
7161 | 7161 | /** |
7162 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7163 | - * |
|
7164 | - * @return Array the airport list |
|
7165 | - * |
|
7166 | - */ |
|
7162 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7163 | + * |
|
7164 | + * @return Array the airport list |
|
7165 | + * |
|
7166 | + */ |
|
7167 | 7167 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
7168 | 7168 | { |
7169 | 7169 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7194,11 +7194,11 @@ discard block |
||
7194 | 7194 | |
7195 | 7195 | |
7196 | 7196 | /** |
7197 | - * Counts all airport departure countries |
|
7198 | - * |
|
7199 | - * @return Array the airport departure list |
|
7200 | - * |
|
7201 | - */ |
|
7197 | + * Counts all airport departure countries |
|
7198 | + * |
|
7199 | + * @return Array the airport departure list |
|
7200 | + * |
|
7201 | + */ |
|
7202 | 7202 | public function countAllDepartureCountries($filters = array()) |
7203 | 7203 | { |
7204 | 7204 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7228,11 +7228,11 @@ discard block |
||
7228 | 7228 | |
7229 | 7229 | |
7230 | 7230 | /** |
7231 | - * Counts all airport arrival countries |
|
7232 | - * |
|
7233 | - * @return Array the airport arrival list |
|
7234 | - * |
|
7235 | - */ |
|
7231 | + * Counts all airport arrival countries |
|
7232 | + * |
|
7233 | + * @return Array the airport arrival list |
|
7234 | + * |
|
7235 | + */ |
|
7236 | 7236 | public function countAllArrivalCountries($limit = true,$filters = array()) |
7237 | 7237 | { |
7238 | 7238 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7265,11 +7265,11 @@ discard block |
||
7265 | 7265 | |
7266 | 7266 | |
7267 | 7267 | /** |
7268 | - * Gets all route combinations |
|
7269 | - * |
|
7270 | - * @return Array the route list |
|
7271 | - * |
|
7272 | - */ |
|
7268 | + * Gets all route combinations |
|
7269 | + * |
|
7270 | + * @return Array the route list |
|
7271 | + * |
|
7272 | + */ |
|
7273 | 7273 | public function countAllRoutes($filters = array()) |
7274 | 7274 | { |
7275 | 7275 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7308,11 +7308,11 @@ discard block |
||
7308 | 7308 | |
7309 | 7309 | |
7310 | 7310 | /** |
7311 | - * Gets all route combinations based on an aircraft |
|
7312 | - * |
|
7313 | - * @return Array the route list |
|
7314 | - * |
|
7315 | - */ |
|
7311 | + * Gets all route combinations based on an aircraft |
|
7312 | + * |
|
7313 | + * @return Array the route list |
|
7314 | + * |
|
7315 | + */ |
|
7316 | 7316 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
7317 | 7317 | { |
7318 | 7318 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7348,11 +7348,11 @@ discard block |
||
7348 | 7348 | |
7349 | 7349 | |
7350 | 7350 | /** |
7351 | - * Gets all route combinations based on an aircraft registration |
|
7352 | - * |
|
7353 | - * @return Array the route list |
|
7354 | - * |
|
7355 | - */ |
|
7351 | + * Gets all route combinations based on an aircraft registration |
|
7352 | + * |
|
7353 | + * @return Array the route list |
|
7354 | + * |
|
7355 | + */ |
|
7356 | 7356 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7357 | 7357 | { |
7358 | 7358 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7390,11 +7390,11 @@ discard block |
||
7390 | 7390 | |
7391 | 7391 | |
7392 | 7392 | /** |
7393 | - * Gets all route combinations based on an airline |
|
7394 | - * |
|
7395 | - * @return Array the route list |
|
7396 | - * |
|
7397 | - */ |
|
7393 | + * Gets all route combinations based on an airline |
|
7394 | + * |
|
7395 | + * @return Array the route list |
|
7396 | + * |
|
7397 | + */ |
|
7398 | 7398 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7399 | 7399 | { |
7400 | 7400 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7432,11 +7432,11 @@ discard block |
||
7432 | 7432 | |
7433 | 7433 | |
7434 | 7434 | /** |
7435 | - * Gets all route combinations based on an airport |
|
7436 | - * |
|
7437 | - * @return Array the route list |
|
7438 | - * |
|
7439 | - */ |
|
7435 | + * Gets all route combinations based on an airport |
|
7436 | + * |
|
7437 | + * @return Array the route list |
|
7438 | + * |
|
7439 | + */ |
|
7440 | 7440 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7441 | 7441 | { |
7442 | 7442 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7473,11 +7473,11 @@ discard block |
||
7473 | 7473 | |
7474 | 7474 | |
7475 | 7475 | /** |
7476 | - * Gets all route combinations based on an country |
|
7477 | - * |
|
7478 | - * @return Array the route list |
|
7479 | - * |
|
7480 | - */ |
|
7476 | + * Gets all route combinations based on an country |
|
7477 | + * |
|
7478 | + * @return Array the route list |
|
7479 | + * |
|
7480 | + */ |
|
7481 | 7481 | public function countAllRoutesByCountry($country, $filters = array()) |
7482 | 7482 | { |
7483 | 7483 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7513,11 +7513,11 @@ discard block |
||
7513 | 7513 | |
7514 | 7514 | |
7515 | 7515 | /** |
7516 | - * Gets all route combinations based on an date |
|
7517 | - * |
|
7518 | - * @return Array the route list |
|
7519 | - * |
|
7520 | - */ |
|
7516 | + * Gets all route combinations based on an date |
|
7517 | + * |
|
7518 | + * @return Array the route list |
|
7519 | + * |
|
7520 | + */ |
|
7521 | 7521 | public function countAllRoutesByDate($date, $filters = array()) |
7522 | 7522 | { |
7523 | 7523 | global $globalTimezone, $globalDBdriver; |
@@ -7567,11 +7567,11 @@ discard block |
||
7567 | 7567 | |
7568 | 7568 | |
7569 | 7569 | /** |
7570 | - * Gets all route combinations based on an ident/callsign |
|
7571 | - * |
|
7572 | - * @return Array the route list |
|
7573 | - * |
|
7574 | - */ |
|
7570 | + * Gets all route combinations based on an ident/callsign |
|
7571 | + * |
|
7572 | + * @return Array the route list |
|
7573 | + * |
|
7574 | + */ |
|
7575 | 7575 | public function countAllRoutesByIdent($ident, $filters = array()) |
7576 | 7576 | { |
7577 | 7577 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7608,11 +7608,11 @@ discard block |
||
7608 | 7608 | |
7609 | 7609 | |
7610 | 7610 | /** |
7611 | - * Gets all route combinations based on an manufacturer |
|
7612 | - * |
|
7613 | - * @return Array the route list |
|
7614 | - * |
|
7615 | - */ |
|
7611 | + * Gets all route combinations based on an manufacturer |
|
7612 | + * |
|
7613 | + * @return Array the route list |
|
7614 | + * |
|
7615 | + */ |
|
7616 | 7616 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7617 | 7617 | { |
7618 | 7618 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7650,11 +7650,11 @@ discard block |
||
7650 | 7650 | |
7651 | 7651 | |
7652 | 7652 | /** |
7653 | - * Gets all route combinations with waypoints |
|
7654 | - * |
|
7655 | - * @return Array the route list |
|
7656 | - * |
|
7657 | - */ |
|
7653 | + * Gets all route combinations with waypoints |
|
7654 | + * |
|
7655 | + * @return Array the route list |
|
7656 | + * |
|
7657 | + */ |
|
7658 | 7658 | public function countAllRoutesWithWaypoints($filters = array()) |
7659 | 7659 | { |
7660 | 7660 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7691,11 +7691,11 @@ discard block |
||
7691 | 7691 | } |
7692 | 7692 | |
7693 | 7693 | /** |
7694 | - * Gets all callsigns that have flown over |
|
7695 | - * |
|
7696 | - * @return Array the callsign list |
|
7697 | - * |
|
7698 | - */ |
|
7694 | + * Gets all callsigns that have flown over |
|
7695 | + * |
|
7696 | + * @return Array the callsign list |
|
7697 | + * |
|
7698 | + */ |
|
7699 | 7699 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
7700 | 7700 | { |
7701 | 7701 | global $globalDBdriver; |
@@ -7733,11 +7733,11 @@ discard block |
||
7733 | 7733 | } |
7734 | 7734 | |
7735 | 7735 | /** |
7736 | - * Gets all callsigns that have flown over |
|
7737 | - * |
|
7738 | - * @return Array the callsign list |
|
7739 | - * |
|
7740 | - */ |
|
7736 | + * Gets all callsigns that have flown over |
|
7737 | + * |
|
7738 | + * @return Array the callsign list |
|
7739 | + * |
|
7740 | + */ |
|
7741 | 7741 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7742 | 7742 | { |
7743 | 7743 | global $globalDBdriver; |
@@ -7778,11 +7778,11 @@ discard block |
||
7778 | 7778 | |
7779 | 7779 | |
7780 | 7780 | /** |
7781 | - * Counts all dates |
|
7782 | - * |
|
7783 | - * @return Array the date list |
|
7784 | - * |
|
7785 | - */ |
|
7781 | + * Counts all dates |
|
7782 | + * |
|
7783 | + * @return Array the date list |
|
7784 | + * |
|
7785 | + */ |
|
7786 | 7786 | public function countAllDates($filters = array()) |
7787 | 7787 | { |
7788 | 7788 | global $globalTimezone, $globalDBdriver; |
@@ -7827,11 +7827,11 @@ discard block |
||
7827 | 7827 | } |
7828 | 7828 | |
7829 | 7829 | /** |
7830 | - * Counts all dates |
|
7831 | - * |
|
7832 | - * @return Array the date list |
|
7833 | - * |
|
7834 | - */ |
|
7830 | + * Counts all dates |
|
7831 | + * |
|
7832 | + * @return Array the date list |
|
7833 | + * |
|
7834 | + */ |
|
7835 | 7835 | public function countAllDatesByAirlines($filters = array()) |
7836 | 7836 | { |
7837 | 7837 | global $globalTimezone, $globalDBdriver; |
@@ -7876,11 +7876,11 @@ discard block |
||
7876 | 7876 | } |
7877 | 7877 | |
7878 | 7878 | /** |
7879 | - * Counts all dates during the last 7 days |
|
7880 | - * |
|
7881 | - * @return Array the date list |
|
7882 | - * |
|
7883 | - */ |
|
7879 | + * Counts all dates during the last 7 days |
|
7880 | + * |
|
7881 | + * @return Array the date list |
|
7882 | + * |
|
7883 | + */ |
|
7884 | 7884 | public function countAllDatesLast7Days($filters = array()) |
7885 | 7885 | { |
7886 | 7886 | global $globalTimezone, $globalDBdriver; |
@@ -7902,7 +7902,7 @@ discard block |
||
7902 | 7902 | $query .= " GROUP BY date_name |
7903 | 7903 | ORDER BY date_name ASC"; |
7904 | 7904 | $query_data = array(':offset' => $offset); |
7905 | - } |
|
7905 | + } |
|
7906 | 7906 | |
7907 | 7907 | $sth = $this->db->prepare($query); |
7908 | 7908 | $sth->execute($query_data); |
@@ -7922,11 +7922,11 @@ discard block |
||
7922 | 7922 | } |
7923 | 7923 | |
7924 | 7924 | /** |
7925 | - * Counts all dates during the last month |
|
7926 | - * |
|
7927 | - * @return Array the date list |
|
7928 | - * |
|
7929 | - */ |
|
7925 | + * Counts all dates during the last month |
|
7926 | + * |
|
7927 | + * @return Array the date list |
|
7928 | + * |
|
7929 | + */ |
|
7930 | 7930 | public function countAllDatesLastMonth($filters = array()) |
7931 | 7931 | { |
7932 | 7932 | global $globalTimezone, $globalDBdriver; |
@@ -7948,7 +7948,7 @@ discard block |
||
7948 | 7948 | $query .= " GROUP BY date_name |
7949 | 7949 | ORDER BY date_name ASC"; |
7950 | 7950 | $query_data = array(':offset' => $offset); |
7951 | - } |
|
7951 | + } |
|
7952 | 7952 | |
7953 | 7953 | $sth = $this->db->prepare($query); |
7954 | 7954 | $sth->execute($query_data); |
@@ -7969,11 +7969,11 @@ discard block |
||
7969 | 7969 | |
7970 | 7970 | |
7971 | 7971 | /** |
7972 | - * Counts all dates during the last month |
|
7973 | - * |
|
7974 | - * @return Array the date list |
|
7975 | - * |
|
7976 | - */ |
|
7972 | + * Counts all dates during the last month |
|
7973 | + * |
|
7974 | + * @return Array the date list |
|
7975 | + * |
|
7976 | + */ |
|
7977 | 7977 | public function countAllDatesLastMonthByAirlines($filters = array()) |
7978 | 7978 | { |
7979 | 7979 | global $globalTimezone, $globalDBdriver; |
@@ -7996,7 +7996,7 @@ discard block |
||
7996 | 7996 | GROUP BY spotter_output.airline_icao, date_name |
7997 | 7997 | ORDER BY date_name ASC"; |
7998 | 7998 | $query_data = array(':offset' => $offset); |
7999 | - } |
|
7999 | + } |
|
8000 | 8000 | |
8001 | 8001 | $sth = $this->db->prepare($query); |
8002 | 8002 | $sth->execute($query_data); |
@@ -8018,11 +8018,11 @@ discard block |
||
8018 | 8018 | |
8019 | 8019 | |
8020 | 8020 | /** |
8021 | - * Counts all month |
|
8022 | - * |
|
8023 | - * @return Array the month list |
|
8024 | - * |
|
8025 | - */ |
|
8021 | + * Counts all month |
|
8022 | + * |
|
8023 | + * @return Array the month list |
|
8024 | + * |
|
8025 | + */ |
|
8026 | 8026 | public function countAllMonths($filters = array()) |
8027 | 8027 | { |
8028 | 8028 | global $globalTimezone, $globalDBdriver; |
@@ -8064,11 +8064,11 @@ discard block |
||
8064 | 8064 | } |
8065 | 8065 | |
8066 | 8066 | /** |
8067 | - * Counts all month |
|
8068 | - * |
|
8069 | - * @return Array the month list |
|
8070 | - * |
|
8071 | - */ |
|
8067 | + * Counts all month |
|
8068 | + * |
|
8069 | + * @return Array the month list |
|
8070 | + * |
|
8071 | + */ |
|
8072 | 8072 | public function countAllMonthsByAirlines($filters = array()) |
8073 | 8073 | { |
8074 | 8074 | global $globalTimezone, $globalDBdriver; |
@@ -8113,11 +8113,11 @@ discard block |
||
8113 | 8113 | } |
8114 | 8114 | |
8115 | 8115 | /** |
8116 | - * Counts all military month |
|
8117 | - * |
|
8118 | - * @return Array the month list |
|
8119 | - * |
|
8120 | - */ |
|
8116 | + * Counts all military month |
|
8117 | + * |
|
8118 | + * @return Array the month list |
|
8119 | + * |
|
8120 | + */ |
|
8121 | 8121 | public function countAllMilitaryMonths($filters = array()) |
8122 | 8122 | { |
8123 | 8123 | global $globalTimezone, $globalDBdriver; |
@@ -8158,11 +8158,11 @@ discard block |
||
8158 | 8158 | } |
8159 | 8159 | |
8160 | 8160 | /** |
8161 | - * Counts all month owners |
|
8162 | - * |
|
8163 | - * @return Array the month list |
|
8164 | - * |
|
8165 | - */ |
|
8161 | + * Counts all month owners |
|
8162 | + * |
|
8163 | + * @return Array the month list |
|
8164 | + * |
|
8165 | + */ |
|
8166 | 8166 | public function countAllMonthsOwners($filters = array()) |
8167 | 8167 | { |
8168 | 8168 | global $globalTimezone, $globalDBdriver; |
@@ -8204,11 +8204,11 @@ discard block |
||
8204 | 8204 | } |
8205 | 8205 | |
8206 | 8206 | /** |
8207 | - * Counts all month owners |
|
8208 | - * |
|
8209 | - * @return Array the month list |
|
8210 | - * |
|
8211 | - */ |
|
8207 | + * Counts all month owners |
|
8208 | + * |
|
8209 | + * @return Array the month list |
|
8210 | + * |
|
8211 | + */ |
|
8212 | 8212 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8213 | 8213 | { |
8214 | 8214 | global $globalTimezone, $globalDBdriver; |
@@ -8251,11 +8251,11 @@ discard block |
||
8251 | 8251 | } |
8252 | 8252 | |
8253 | 8253 | /** |
8254 | - * Counts all month pilot |
|
8255 | - * |
|
8256 | - * @return Array the month list |
|
8257 | - * |
|
8258 | - */ |
|
8254 | + * Counts all month pilot |
|
8255 | + * |
|
8256 | + * @return Array the month list |
|
8257 | + * |
|
8258 | + */ |
|
8259 | 8259 | public function countAllMonthsPilots($filters = array()) |
8260 | 8260 | { |
8261 | 8261 | global $globalTimezone, $globalDBdriver; |
@@ -8297,11 +8297,11 @@ discard block |
||
8297 | 8297 | } |
8298 | 8298 | |
8299 | 8299 | /** |
8300 | - * Counts all month pilot |
|
8301 | - * |
|
8302 | - * @return Array the month list |
|
8303 | - * |
|
8304 | - */ |
|
8300 | + * Counts all month pilot |
|
8301 | + * |
|
8302 | + * @return Array the month list |
|
8303 | + * |
|
8304 | + */ |
|
8305 | 8305 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8306 | 8306 | { |
8307 | 8307 | global $globalTimezone, $globalDBdriver; |
@@ -8344,11 +8344,11 @@ discard block |
||
8344 | 8344 | } |
8345 | 8345 | |
8346 | 8346 | /** |
8347 | - * Counts all month airline |
|
8348 | - * |
|
8349 | - * @return Array the month list |
|
8350 | - * |
|
8351 | - */ |
|
8347 | + * Counts all month airline |
|
8348 | + * |
|
8349 | + * @return Array the month list |
|
8350 | + * |
|
8351 | + */ |
|
8352 | 8352 | public function countAllMonthsAirlines($filters = array()) |
8353 | 8353 | { |
8354 | 8354 | global $globalTimezone, $globalDBdriver; |
@@ -8390,11 +8390,11 @@ discard block |
||
8390 | 8390 | } |
8391 | 8391 | |
8392 | 8392 | /** |
8393 | - * Counts all month aircraft |
|
8394 | - * |
|
8395 | - * @return Array the month list |
|
8396 | - * |
|
8397 | - */ |
|
8393 | + * Counts all month aircraft |
|
8394 | + * |
|
8395 | + * @return Array the month list |
|
8396 | + * |
|
8397 | + */ |
|
8398 | 8398 | public function countAllMonthsAircrafts($filters = array()) |
8399 | 8399 | { |
8400 | 8400 | global $globalTimezone, $globalDBdriver; |
@@ -8437,11 +8437,11 @@ discard block |
||
8437 | 8437 | |
8438 | 8438 | |
8439 | 8439 | /** |
8440 | - * Counts all month aircraft |
|
8441 | - * |
|
8442 | - * @return Array the month list |
|
8443 | - * |
|
8444 | - */ |
|
8440 | + * Counts all month aircraft |
|
8441 | + * |
|
8442 | + * @return Array the month list |
|
8443 | + * |
|
8444 | + */ |
|
8445 | 8445 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8446 | 8446 | { |
8447 | 8447 | global $globalTimezone, $globalDBdriver; |
@@ -8484,11 +8484,11 @@ discard block |
||
8484 | 8484 | } |
8485 | 8485 | |
8486 | 8486 | /** |
8487 | - * Counts all month real arrival |
|
8488 | - * |
|
8489 | - * @return Array the month list |
|
8490 | - * |
|
8491 | - */ |
|
8487 | + * Counts all month real arrival |
|
8488 | + * |
|
8489 | + * @return Array the month list |
|
8490 | + * |
|
8491 | + */ |
|
8492 | 8492 | public function countAllMonthsRealArrivals($filters = array()) |
8493 | 8493 | { |
8494 | 8494 | global $globalTimezone, $globalDBdriver; |
@@ -8531,11 +8531,11 @@ discard block |
||
8531 | 8531 | |
8532 | 8532 | |
8533 | 8533 | /** |
8534 | - * Counts all month real arrival |
|
8535 | - * |
|
8536 | - * @return Array the month list |
|
8537 | - * |
|
8538 | - */ |
|
8534 | + * Counts all month real arrival |
|
8535 | + * |
|
8536 | + * @return Array the month list |
|
8537 | + * |
|
8538 | + */ |
|
8539 | 8539 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8540 | 8540 | { |
8541 | 8541 | global $globalTimezone, $globalDBdriver; |
@@ -8579,11 +8579,11 @@ discard block |
||
8579 | 8579 | |
8580 | 8580 | |
8581 | 8581 | /** |
8582 | - * Counts all dates during the last year |
|
8583 | - * |
|
8584 | - * @return Array the date list |
|
8585 | - * |
|
8586 | - */ |
|
8582 | + * Counts all dates during the last year |
|
8583 | + * |
|
8584 | + * @return Array the date list |
|
8585 | + * |
|
8586 | + */ |
|
8587 | 8587 | public function countAllMonthsLastYear($filters) |
8588 | 8588 | { |
8589 | 8589 | global $globalTimezone, $globalDBdriver; |
@@ -8605,7 +8605,7 @@ discard block |
||
8605 | 8605 | $query .= " GROUP BY year_name, month_name |
8606 | 8606 | ORDER BY year_name, month_name ASC"; |
8607 | 8607 | $query_data = array(':offset' => $offset); |
8608 | - } |
|
8608 | + } |
|
8609 | 8609 | |
8610 | 8610 | $sth = $this->db->prepare($query); |
8611 | 8611 | $sth->execute($query_data); |
@@ -8628,11 +8628,11 @@ discard block |
||
8628 | 8628 | |
8629 | 8629 | |
8630 | 8630 | /** |
8631 | - * Counts all hours |
|
8632 | - * |
|
8633 | - * @return Array the hour list |
|
8634 | - * |
|
8635 | - */ |
|
8631 | + * Counts all hours |
|
8632 | + * |
|
8633 | + * @return Array the hour list |
|
8634 | + * |
|
8635 | + */ |
|
8636 | 8636 | public function countAllHours($orderby,$filters = array()) |
8637 | 8637 | { |
8638 | 8638 | global $globalTimezone, $globalDBdriver; |
@@ -8693,11 +8693,11 @@ discard block |
||
8693 | 8693 | } |
8694 | 8694 | |
8695 | 8695 | /** |
8696 | - * Counts all hours |
|
8697 | - * |
|
8698 | - * @return Array the hour list |
|
8699 | - * |
|
8700 | - */ |
|
8696 | + * Counts all hours |
|
8697 | + * |
|
8698 | + * @return Array the hour list |
|
8699 | + * |
|
8700 | + */ |
|
8701 | 8701 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8702 | 8702 | { |
8703 | 8703 | global $globalTimezone, $globalDBdriver; |
@@ -8760,11 +8760,11 @@ discard block |
||
8760 | 8760 | |
8761 | 8761 | |
8762 | 8762 | /** |
8763 | - * Counts all hours by airline |
|
8764 | - * |
|
8765 | - * @return Array the hour list |
|
8766 | - * |
|
8767 | - */ |
|
8763 | + * Counts all hours by airline |
|
8764 | + * |
|
8765 | + * @return Array the hour list |
|
8766 | + * |
|
8767 | + */ |
|
8768 | 8768 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8769 | 8769 | { |
8770 | 8770 | global $globalTimezone, $globalDBdriver; |
@@ -8810,11 +8810,11 @@ discard block |
||
8810 | 8810 | |
8811 | 8811 | |
8812 | 8812 | /** |
8813 | - * Counts all hours by aircraft |
|
8814 | - * |
|
8815 | - * @return Array the hour list |
|
8816 | - * |
|
8817 | - */ |
|
8813 | + * Counts all hours by aircraft |
|
8814 | + * |
|
8815 | + * @return Array the hour list |
|
8816 | + * |
|
8817 | + */ |
|
8818 | 8818 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8819 | 8819 | { |
8820 | 8820 | global $globalTimezone, $globalDBdriver; |
@@ -8857,11 +8857,11 @@ discard block |
||
8857 | 8857 | |
8858 | 8858 | |
8859 | 8859 | /** |
8860 | - * Counts all hours by aircraft registration |
|
8861 | - * |
|
8862 | - * @return Array the hour list |
|
8863 | - * |
|
8864 | - */ |
|
8860 | + * Counts all hours by aircraft registration |
|
8861 | + * |
|
8862 | + * @return Array the hour list |
|
8863 | + * |
|
8864 | + */ |
|
8865 | 8865 | public function countAllHoursByRegistration($registration, $filters = array()) |
8866 | 8866 | { |
8867 | 8867 | global $globalTimezone, $globalDBdriver; |
@@ -8904,11 +8904,11 @@ discard block |
||
8904 | 8904 | |
8905 | 8905 | |
8906 | 8906 | /** |
8907 | - * Counts all hours by airport |
|
8908 | - * |
|
8909 | - * @return Array the hour list |
|
8910 | - * |
|
8911 | - */ |
|
8907 | + * Counts all hours by airport |
|
8908 | + * |
|
8909 | + * @return Array the hour list |
|
8910 | + * |
|
8911 | + */ |
|
8912 | 8912 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8913 | 8913 | { |
8914 | 8914 | global $globalTimezone, $globalDBdriver; |
@@ -8952,11 +8952,11 @@ discard block |
||
8952 | 8952 | |
8953 | 8953 | |
8954 | 8954 | /** |
8955 | - * Counts all hours by manufacturer |
|
8956 | - * |
|
8957 | - * @return Array the hour list |
|
8958 | - * |
|
8959 | - */ |
|
8955 | + * Counts all hours by manufacturer |
|
8956 | + * |
|
8957 | + * @return Array the hour list |
|
8958 | + * |
|
8959 | + */ |
|
8960 | 8960 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
8961 | 8961 | { |
8962 | 8962 | global $globalTimezone, $globalDBdriver; |
@@ -9000,11 +9000,11 @@ discard block |
||
9000 | 9000 | |
9001 | 9001 | |
9002 | 9002 | /** |
9003 | - * Counts all hours by date |
|
9004 | - * |
|
9005 | - * @return Array the hour list |
|
9006 | - * |
|
9007 | - */ |
|
9003 | + * Counts all hours by date |
|
9004 | + * |
|
9005 | + * @return Array the hour list |
|
9006 | + * |
|
9007 | + */ |
|
9008 | 9008 | public function countAllHoursByDate($date, $filters = array()) |
9009 | 9009 | { |
9010 | 9010 | global $globalTimezone, $globalDBdriver; |
@@ -9048,11 +9048,11 @@ discard block |
||
9048 | 9048 | |
9049 | 9049 | |
9050 | 9050 | /** |
9051 | - * Counts all hours by a ident/callsign |
|
9052 | - * |
|
9053 | - * @return Array the hour list |
|
9054 | - * |
|
9055 | - */ |
|
9051 | + * Counts all hours by a ident/callsign |
|
9052 | + * |
|
9053 | + * @return Array the hour list |
|
9054 | + * |
|
9055 | + */ |
|
9056 | 9056 | public function countAllHoursByIdent($ident, $filters = array()) |
9057 | 9057 | { |
9058 | 9058 | global $globalTimezone, $globalDBdriver; |
@@ -9097,11 +9097,11 @@ discard block |
||
9097 | 9097 | |
9098 | 9098 | |
9099 | 9099 | /** |
9100 | - * Counts all hours by route |
|
9101 | - * |
|
9102 | - * @return Array the hour list |
|
9103 | - * |
|
9104 | - */ |
|
9100 | + * Counts all hours by route |
|
9101 | + * |
|
9102 | + * @return Array the hour list |
|
9103 | + * |
|
9104 | + */ |
|
9105 | 9105 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
9106 | 9106 | { |
9107 | 9107 | global $globalTimezone, $globalDBdriver; |
@@ -9145,11 +9145,11 @@ discard block |
||
9145 | 9145 | |
9146 | 9146 | |
9147 | 9147 | /** |
9148 | - * Counts all hours by country |
|
9149 | - * |
|
9150 | - * @return Array the hour list |
|
9151 | - * |
|
9152 | - */ |
|
9148 | + * Counts all hours by country |
|
9149 | + * |
|
9150 | + * @return Array the hour list |
|
9151 | + * |
|
9152 | + */ |
|
9153 | 9153 | public function countAllHoursByCountry($country, $filters = array()) |
9154 | 9154 | { |
9155 | 9155 | global $globalTimezone, $globalDBdriver; |
@@ -9194,11 +9194,11 @@ discard block |
||
9194 | 9194 | |
9195 | 9195 | |
9196 | 9196 | /** |
9197 | - * Counts all aircraft that have flown over |
|
9198 | - * |
|
9199 | - * @return Integer the number of aircrafts |
|
9200 | - * |
|
9201 | - */ |
|
9197 | + * Counts all aircraft that have flown over |
|
9198 | + * |
|
9199 | + * @return Integer the number of aircrafts |
|
9200 | + * |
|
9201 | + */ |
|
9202 | 9202 | public function countOverallAircrafts($filters = array()) |
9203 | 9203 | { |
9204 | 9204 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9210,11 +9210,11 @@ discard block |
||
9210 | 9210 | } |
9211 | 9211 | |
9212 | 9212 | /** |
9213 | - * Counts all flight that really arrival |
|
9214 | - * |
|
9215 | - * @return Integer the number of aircrafts |
|
9216 | - * |
|
9217 | - */ |
|
9213 | + * Counts all flight that really arrival |
|
9214 | + * |
|
9215 | + * @return Integer the number of aircrafts |
|
9216 | + * |
|
9217 | + */ |
|
9218 | 9218 | public function countOverallArrival($filters = array()) |
9219 | 9219 | { |
9220 | 9220 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9227,11 +9227,11 @@ discard block |
||
9227 | 9227 | } |
9228 | 9228 | |
9229 | 9229 | /** |
9230 | - * Counts all pilots that have flown over |
|
9231 | - * |
|
9232 | - * @return Integer the number of pilots |
|
9233 | - * |
|
9234 | - */ |
|
9230 | + * Counts all pilots that have flown over |
|
9231 | + * |
|
9232 | + * @return Integer the number of pilots |
|
9233 | + * |
|
9234 | + */ |
|
9235 | 9235 | public function countOverallPilots($filters = array()) |
9236 | 9236 | { |
9237 | 9237 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9243,11 +9243,11 @@ discard block |
||
9243 | 9243 | } |
9244 | 9244 | |
9245 | 9245 | /** |
9246 | - * Counts all owners that have flown over |
|
9247 | - * |
|
9248 | - * @return Integer the number of owners |
|
9249 | - * |
|
9250 | - */ |
|
9246 | + * Counts all owners that have flown over |
|
9247 | + * |
|
9248 | + * @return Integer the number of owners |
|
9249 | + * |
|
9250 | + */ |
|
9251 | 9251 | public function countOverallOwners($filters = array()) |
9252 | 9252 | { |
9253 | 9253 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9260,11 +9260,11 @@ discard block |
||
9260 | 9260 | |
9261 | 9261 | |
9262 | 9262 | /** |
9263 | - * Counts all flights that have flown over |
|
9264 | - * |
|
9265 | - * @return Integer the number of flights |
|
9266 | - * |
|
9267 | - */ |
|
9263 | + * Counts all flights that have flown over |
|
9264 | + * |
|
9265 | + * @return Integer the number of flights |
|
9266 | + * |
|
9267 | + */ |
|
9268 | 9268 | public function countOverallFlights($filters = array()) |
9269 | 9269 | { |
9270 | 9270 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9277,11 +9277,11 @@ discard block |
||
9277 | 9277 | } |
9278 | 9278 | |
9279 | 9279 | /** |
9280 | - * Counts all military flights that have flown over |
|
9281 | - * |
|
9282 | - * @return Integer the number of flights |
|
9283 | - * |
|
9284 | - */ |
|
9280 | + * Counts all military flights that have flown over |
|
9281 | + * |
|
9282 | + * @return Integer the number of flights |
|
9283 | + * |
|
9284 | + */ |
|
9285 | 9285 | public function countOverallMilitaryFlights($filters = array()) |
9286 | 9286 | { |
9287 | 9287 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9296,11 +9296,11 @@ discard block |
||
9296 | 9296 | |
9297 | 9297 | |
9298 | 9298 | /** |
9299 | - * Counts all airlines that have flown over |
|
9300 | - * |
|
9301 | - * @return Integer the number of airlines |
|
9302 | - * |
|
9303 | - */ |
|
9299 | + * Counts all airlines that have flown over |
|
9300 | + * |
|
9301 | + * @return Integer the number of airlines |
|
9302 | + * |
|
9303 | + */ |
|
9304 | 9304 | public function countOverallAirlines($filters = array()) |
9305 | 9305 | { |
9306 | 9306 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9314,11 +9314,11 @@ discard block |
||
9314 | 9314 | |
9315 | 9315 | |
9316 | 9316 | /** |
9317 | - * Counts all hours of today |
|
9318 | - * |
|
9319 | - * @return Array the hour list |
|
9320 | - * |
|
9321 | - */ |
|
9317 | + * Counts all hours of today |
|
9318 | + * |
|
9319 | + * @return Array the hour list |
|
9320 | + * |
|
9321 | + */ |
|
9322 | 9322 | public function countAllHoursFromToday($filters = array()) |
9323 | 9323 | { |
9324 | 9324 | global $globalTimezone, $globalDBdriver; |
@@ -9358,11 +9358,11 @@ discard block |
||
9358 | 9358 | } |
9359 | 9359 | |
9360 | 9360 | /** |
9361 | - * Gets all the spotter information based on calculated upcoming flights |
|
9362 | - * |
|
9363 | - * @return Array the spotter information |
|
9364 | - * |
|
9365 | - */ |
|
9361 | + * Gets all the spotter information based on calculated upcoming flights |
|
9362 | + * |
|
9363 | + * @return Array the spotter information |
|
9364 | + * |
|
9365 | + */ |
|
9366 | 9366 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9367 | 9367 | { |
9368 | 9368 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9437,12 +9437,12 @@ discard block |
||
9437 | 9437 | } |
9438 | 9438 | |
9439 | 9439 | |
9440 | - /** |
|
9441 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9442 | - * |
|
9443 | - * @return Integer the Barrie Spotter ID |
|
9440 | + /** |
|
9441 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9442 | + * |
|
9443 | + * @return Integer the Barrie Spotter ID |
|
9444 | 9444 | q * |
9445 | - */ |
|
9445 | + */ |
|
9446 | 9446 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9447 | 9447 | { |
9448 | 9448 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9463,13 +9463,13 @@ discard block |
||
9463 | 9463 | |
9464 | 9464 | |
9465 | 9465 | /** |
9466 | - * Parses a date string |
|
9467 | - * |
|
9468 | - * @param String $dateString the date string |
|
9469 | - * @param String $timezone the timezone of a user |
|
9470 | - * @return Array the time information |
|
9471 | - * |
|
9472 | - */ |
|
9466 | + * Parses a date string |
|
9467 | + * |
|
9468 | + * @param String $dateString the date string |
|
9469 | + * @param String $timezone the timezone of a user |
|
9470 | + * @return Array the time information |
|
9471 | + * |
|
9472 | + */ |
|
9473 | 9473 | public function parseDateString($dateString, $timezone = '') |
9474 | 9474 | { |
9475 | 9475 | $time_array = array(); |
@@ -9505,12 +9505,12 @@ discard block |
||
9505 | 9505 | |
9506 | 9506 | |
9507 | 9507 | /** |
9508 | - * Parses the direction degrees to working |
|
9509 | - * |
|
9510 | - * @param Float $direction the direction in degrees |
|
9511 | - * @return Array the direction information |
|
9512 | - * |
|
9513 | - */ |
|
9508 | + * Parses the direction degrees to working |
|
9509 | + * |
|
9510 | + * @param Float $direction the direction in degrees |
|
9511 | + * @return Array the direction information |
|
9512 | + * |
|
9513 | + */ |
|
9514 | 9514 | public function parseDirection($direction = 0) |
9515 | 9515 | { |
9516 | 9516 | if ($direction == '') $direction = 0; |
@@ -9589,12 +9589,12 @@ discard block |
||
9589 | 9589 | |
9590 | 9590 | |
9591 | 9591 | /** |
9592 | - * Gets the aircraft registration |
|
9593 | - * |
|
9594 | - * @param String $flightaware_id the flight aware id |
|
9595 | - * @return String the aircraft registration |
|
9596 | - * |
|
9597 | - */ |
|
9592 | + * Gets the aircraft registration |
|
9593 | + * |
|
9594 | + * @param String $flightaware_id the flight aware id |
|
9595 | + * @return String the aircraft registration |
|
9596 | + * |
|
9597 | + */ |
|
9598 | 9598 | |
9599 | 9599 | public function getAircraftRegistration($flightaware_id) |
9600 | 9600 | { |
@@ -9623,12 +9623,12 @@ discard block |
||
9623 | 9623 | |
9624 | 9624 | |
9625 | 9625 | /** |
9626 | - * Gets the aircraft registration from ModeS |
|
9627 | - * |
|
9628 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9629 | - * @return String the aircraft registration |
|
9630 | - * |
|
9631 | - */ |
|
9626 | + * Gets the aircraft registration from ModeS |
|
9627 | + * |
|
9628 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9629 | + * @return String the aircraft registration |
|
9630 | + * |
|
9631 | + */ |
|
9632 | 9632 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9633 | 9633 | { |
9634 | 9634 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9641,19 +9641,19 @@ discard block |
||
9641 | 9641 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9642 | 9642 | $sth->closeCursor(); |
9643 | 9643 | if (count($row) > 0) { |
9644 | - //return $row['Registration']; |
|
9645 | - return $row['registration']; |
|
9644 | + //return $row['Registration']; |
|
9645 | + return $row['registration']; |
|
9646 | 9646 | } else return ''; |
9647 | 9647 | |
9648 | 9648 | } |
9649 | 9649 | |
9650 | 9650 | /** |
9651 | - * Gets the aircraft type from ModeS |
|
9652 | - * |
|
9653 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9654 | - * @return String the aircraft type |
|
9655 | - * |
|
9656 | - */ |
|
9651 | + * Gets the aircraft type from ModeS |
|
9652 | + * |
|
9653 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9654 | + * @return String the aircraft type |
|
9655 | + * |
|
9656 | + */ |
|
9657 | 9657 | public function getAircraftTypeBymodeS($aircraft_modes) |
9658 | 9658 | { |
9659 | 9659 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9666,19 +9666,19 @@ discard block |
||
9666 | 9666 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9667 | 9667 | $sth->closeCursor(); |
9668 | 9668 | if (count($row) > 0) { |
9669 | - if ($row['type_flight'] == null) return ''; |
|
9670 | - else return $row['type_flight']; |
|
9669 | + if ($row['type_flight'] == null) return ''; |
|
9670 | + else return $row['type_flight']; |
|
9671 | 9671 | } else return ''; |
9672 | 9672 | |
9673 | 9673 | } |
9674 | 9674 | |
9675 | 9675 | /** |
9676 | - * Gets Countrie from latitude/longitude |
|
9677 | - * |
|
9678 | - * @param Float $latitude latitute of the flight |
|
9679 | - * @param Float $longitude longitute of the flight |
|
9680 | - * @return String the countrie |
|
9681 | - */ |
|
9676 | + * Gets Countrie from latitude/longitude |
|
9677 | + * |
|
9678 | + * @param Float $latitude latitute of the flight |
|
9679 | + * @param Float $longitude longitute of the flight |
|
9680 | + * @return String the countrie |
|
9681 | + */ |
|
9682 | 9682 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
9683 | 9683 | { |
9684 | 9684 | global $globalDBdriver, $globalDebug; |
@@ -9715,12 +9715,12 @@ discard block |
||
9715 | 9715 | } |
9716 | 9716 | |
9717 | 9717 | /** |
9718 | - * converts the registration code using the country prefix |
|
9719 | - * |
|
9720 | - * @param String $registration the aircraft registration |
|
9721 | - * @return String the aircraft registration |
|
9722 | - * |
|
9723 | - */ |
|
9718 | + * converts the registration code using the country prefix |
|
9719 | + * |
|
9720 | + * @param String $registration the aircraft registration |
|
9721 | + * @return String the aircraft registration |
|
9722 | + * |
|
9723 | + */ |
|
9724 | 9724 | public function convertAircraftRegistration($registration) |
9725 | 9725 | { |
9726 | 9726 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9772,12 +9772,12 @@ discard block |
||
9772 | 9772 | } |
9773 | 9773 | |
9774 | 9774 | /** |
9775 | - * Country from the registration code |
|
9776 | - * |
|
9777 | - * @param String $registration the aircraft registration |
|
9778 | - * @return String the country |
|
9779 | - * |
|
9780 | - */ |
|
9775 | + * Country from the registration code |
|
9776 | + * |
|
9777 | + * @param String $registration the aircraft registration |
|
9778 | + * @return String the country |
|
9779 | + * |
|
9780 | + */ |
|
9781 | 9781 | public function countryFromAircraftRegistration($registration) |
9782 | 9782 | { |
9783 | 9783 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9796,8 +9796,8 @@ discard block |
||
9796 | 9796 | $country = $row['country']; |
9797 | 9797 | } |
9798 | 9798 | } else { |
9799 | - $registration_1 = substr($registration, 0, 1); |
|
9800 | - $registration_2 = substr($registration, 0, 2); |
|
9799 | + $registration_1 = substr($registration, 0, 1); |
|
9800 | + $registration_2 = substr($registration, 0, 2); |
|
9801 | 9801 | |
9802 | 9802 | $country = ''; |
9803 | 9803 | //first get the prefix based on two characters |
@@ -9833,11 +9833,11 @@ discard block |
||
9833 | 9833 | } |
9834 | 9834 | |
9835 | 9835 | /** |
9836 | - * Set a new highlight value for a flight |
|
9837 | - * |
|
9838 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
9839 | - * @param String $highlight New highlight value |
|
9840 | - */ |
|
9836 | + * Set a new highlight value for a flight |
|
9837 | + * |
|
9838 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
9839 | + * @param String $highlight New highlight value |
|
9840 | + */ |
|
9841 | 9841 | public function setHighlightFlight($flightaware_id,$highlight) { |
9842 | 9842 | |
9843 | 9843 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -9846,12 +9846,12 @@ discard block |
||
9846 | 9846 | } |
9847 | 9847 | |
9848 | 9848 | /** |
9849 | - * Gets the short url from bit.ly |
|
9850 | - * |
|
9851 | - * @param String $url the full url |
|
9852 | - * @return String the bit.ly url |
|
9853 | - * |
|
9854 | - */ |
|
9849 | + * Gets the short url from bit.ly |
|
9850 | + * |
|
9851 | + * @param String $url the full url |
|
9852 | + * @return String the bit.ly url |
|
9853 | + * |
|
9854 | + */ |
|
9855 | 9855 | public function getBitlyURL($url) |
9856 | 9856 | { |
9857 | 9857 | global $globalBitlyAccessToken; |
@@ -10140,11 +10140,11 @@ discard block |
||
10140 | 10140 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
10141 | 10141 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10142 | 10142 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10143 | - } else { |
|
10143 | + } else { |
|
10144 | 10144 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
10145 | 10145 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
10146 | 10146 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
10147 | - } |
|
10147 | + } |
|
10148 | 10148 | $sth = $this->db->prepare($query); |
10149 | 10149 | $sth->execute(); |
10150 | 10150 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
40 | 40 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
41 | 41 | } |
42 | - ?> |
|
42 | + ?> |
|
43 | 43 | </div> |
44 | 44 | <?php |
45 | 45 | // print_r($Stats->getAllAirlineNames()); |
46 | - ?> |
|
46 | + ?> |
|
47 | 47 | <?php include('statistics-sub-menu.php'); ?> |
48 | 48 | <p class="global-stats"> |
49 | 49 | <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span> <?php echo _("Flights"); ?></span> |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
52 | 52 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
53 | 53 | <?php |
54 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
54 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
55 | 55 | ?> |
56 | 56 | <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span> <?php echo _("Pilots"); ?></span> |
57 | 57 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
58 | 58 | <?php |
59 | - } else { |
|
60 | - ?> |
|
59 | + } else { |
|
60 | + ?> |
|
61 | 61 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span> <?php echo _("Owners"); ?></span> |
62 | 62 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
63 | 63 | <?php |
64 | - } |
|
65 | - ?> |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span> <?php echo _("Aircrafts"); ?></span> |
67 | 67 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
68 | 68 | <?php |
69 | - if ($airline_icao == '') { |
|
70 | - ?> |
|
69 | + if ($airline_icao == '') { |
|
70 | + ?> |
|
71 | 71 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span> <?php echo _("Airlines"); ?></span> |
72 | 72 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
73 | 73 | <?php |
@@ -88,25 +88,25 @@ discard block |
||
88 | 88 | <div class="col-md-6"> |
89 | 89 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
90 | 90 | <?php |
91 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
92 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
93 | - else { |
|
91 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name); |
|
92 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
93 | + else { |
|
94 | 94 | |
95 | - print '<div id="chart1" class="chart" width="100%"></div> |
|
95 | + print '<div id="chart1" class="chart" width="100%"></div> |
|
96 | 96 | <script> |
97 | 97 | google.load("visualization", "1", {packages:["corechart"]}); |
98 | 98 | google.setOnLoadCallback(drawChart1); |
99 | 99 | function drawChart1() { |
100 | 100 | var data = google.visualization.arrayToDataTable([ |
101 | 101 | ["'._("Aircraft").'", "'._("# of times").'"], '; |
102 | - $aircraft_data = ''; |
|
103 | - foreach($aircraft_array as $aircraft_item) |
|
104 | - { |
|
105 | - $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
106 | - } |
|
107 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
108 | - print $aircraft_data; |
|
109 | - print ']); |
|
102 | + $aircraft_data = ''; |
|
103 | + foreach($aircraft_array as $aircraft_item) |
|
104 | + { |
|
105 | + $aircraft_data .= '[ "'.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
106 | + } |
|
107 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
108 | + print $aircraft_data; |
|
109 | + print ']); |
|
110 | 110 | |
111 | 111 | var options = { |
112 | 112 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -121,8 +121,8 @@ discard block |
||
121 | 121 | drawChart1(); |
122 | 122 | }); |
123 | 123 | </script>'; |
124 | - } |
|
125 | - ?> |
|
124 | + } |
|
125 | + ?> |
|
126 | 126 | <div class="more"> |
127 | 127 | <a href="<?php print $globalURL; ?>/statistics/aircraft" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
128 | 128 | </div> |
@@ -130,26 +130,26 @@ discard block |
||
130 | 130 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
131 | 131 | <?php |
132 | 132 | // echo $airline_icao; |
133 | - if ($airline_icao == '' || $airline_icao == 'all') { |
|
133 | + if ($airline_icao == '' || $airline_icao == 'all') { |
|
134 | 134 | $airline_array = $Stats->countAllAirlines(true,$filter_name); |
135 | 135 | if (count($airline_array) > 0) { |
136 | - print '<div class="col-md-6">'; |
|
137 | - print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
|
138 | - print '<div id="chart2" class="chart" width="100%"></div> |
|
136 | + print '<div class="col-md-6">'; |
|
137 | + print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
|
138 | + print '<div id="chart2" class="chart" width="100%"></div> |
|
139 | 139 | <script> |
140 | 140 | google.load("visualization", "1", {packages:["corechart"]}); |
141 | 141 | google.setOnLoadCallback(drawChart2); |
142 | 142 | function drawChart2() { |
143 | 143 | var data = google.visualization.arrayToDataTable([ |
144 | 144 | ["'._("Airline").'", "'._("# of times").'"], '; |
145 | - $airline_data = ''; |
|
146 | - foreach($airline_array as $airline_item) |
|
147 | - { |
|
145 | + $airline_data = ''; |
|
146 | + foreach($airline_array as $airline_item) |
|
147 | + { |
|
148 | 148 | $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
149 | - } |
|
150 | - $airline_data = substr($airline_data, 0, -1); |
|
151 | - print $airline_data; |
|
152 | - print ']); |
|
149 | + } |
|
150 | + $airline_data = substr($airline_data, 0, -1); |
|
151 | + print $airline_data; |
|
152 | + print ']); |
|
153 | 153 | |
154 | 154 | var options = { |
155 | 155 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -164,23 +164,23 @@ discard block |
||
164 | 164 | drawChart2(); |
165 | 165 | }); |
166 | 166 | </script>'; |
167 | - print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
|
168 | - print '</div>'; |
|
167 | + print '<div class="more"><a href="'.$globalURL.'/statistics/airline" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
|
168 | + print '</div>'; |
|
169 | 169 | } |
170 | 170 | ?> |
171 | 171 | </div> |
172 | 172 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
173 | 173 | <?php |
174 | - } |
|
174 | + } |
|
175 | 175 | ?> |
176 | 176 | <div class="row column"> |
177 | 177 | <?php |
178 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
179 | - if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
178 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
179 | + if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
180 | 180 | if (empty($flightover_array)) { |
181 | - print '<div class="col-md-12">'; |
|
181 | + print '<div class="col-md-12">'; |
|
182 | 182 | } else { |
183 | - print '<div class="col-md-6">'; |
|
183 | + print '<div class="col-md-6">'; |
|
184 | 184 | } |
185 | 185 | ?> |
186 | 186 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
@@ -188,21 +188,21 @@ discard block |
||
188 | 188 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
189 | 189 | if (count($pilot_array) == 0) print _("No data available"); |
190 | 190 | else { |
191 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
191 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
192 | 192 | <script> |
193 | 193 | google.load("visualization", "1", {packages:["corechart"]}); |
194 | 194 | google.setOnLoadCallback(drawChart7); |
195 | 195 | function drawChart7() { |
196 | 196 | var data = google.visualization.arrayToDataTable([ |
197 | 197 | ["'._("Pilots").'", "'._("# of times").'"], '; |
198 | - $pilot_data = ''; |
|
199 | - foreach($pilot_array as $pilot_item) |
|
200 | - { |
|
198 | + $pilot_data = ''; |
|
199 | + foreach($pilot_array as $pilot_item) |
|
200 | + { |
|
201 | 201 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
202 | - } |
|
203 | - $pilot_data = substr($pilot_data, 0, -1); |
|
204 | - print $pilot_data; |
|
205 | - print ']); |
|
202 | + } |
|
203 | + $pilot_data = substr($pilot_data, 0, -1); |
|
204 | + print $pilot_data; |
|
205 | + print ']); |
|
206 | 206 | |
207 | 207 | var options = { |
208 | 208 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | drawChart7(); |
218 | 218 | }); |
219 | 219 | </script>'; |
220 | - } |
|
220 | + } |
|
221 | 221 | ?> |
222 | 222 | <div class="more"> |
223 | 223 | <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
228 | 228 | <?php |
229 | - } else { |
|
229 | + } else { |
|
230 | 230 | ?> |
231 | 231 | <div class="col-md-6"> |
232 | 232 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
@@ -234,21 +234,21 @@ discard block |
||
234 | 234 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
235 | 235 | if (count($owner_array) == 0) print _("No data available"); |
236 | 236 | else { |
237 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
237 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
238 | 238 | <script> |
239 | 239 | google.load("visualization", "1", {packages:["corechart"]}); |
240 | 240 | google.setOnLoadCallback(drawChart7); |
241 | 241 | function drawChart7() { |
242 | 242 | var data = google.visualization.arrayToDataTable([ |
243 | 243 | ["'._("Owner").'", "'._("# of times").'"], '; |
244 | - $owner_data = ''; |
|
245 | - foreach($owner_array as $owner_item) |
|
246 | - { |
|
244 | + $owner_data = ''; |
|
245 | + foreach($owner_array as $owner_item) |
|
246 | + { |
|
247 | 247 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
248 | - } |
|
249 | - $owner_data = substr($owner_data, 0, -1); |
|
250 | - print $owner_data; |
|
251 | - print ']); |
|
248 | + } |
|
249 | + $owner_data = substr($owner_data, 0, -1); |
|
250 | + print $owner_data; |
|
251 | + print ']); |
|
252 | 252 | |
253 | 253 | var options = { |
254 | 254 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -272,8 +272,8 @@ discard block |
||
272 | 272 | |
273 | 273 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
274 | 274 | <?php |
275 | - } |
|
276 | - if (!empty($flightover_array)) { |
|
275 | + } |
|
276 | + if (!empty($flightover_array)) { |
|
277 | 277 | ?> |
278 | 278 | <div class="col-md-6"> |
279 | 279 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
@@ -281,21 +281,21 @@ discard block |
||
281 | 281 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
282 | 282 | if (count($flightover_array) == 0) print _("No data available"); |
283 | 283 | else { |
284 | - print '<div id="chart10" class="chart" width="100%"></div> |
|
284 | + print '<div id="chart10" class="chart" width="100%"></div> |
|
285 | 285 | <script> |
286 | 286 | google.load("visualization", "1", {packages:["corechart"]}); |
287 | 287 | google.setOnLoadCallback(drawChart10); |
288 | 288 | function drawChart10() { |
289 | 289 | var data = google.visualization.arrayToDataTable([ |
290 | 290 | ["'._("Country").'", "'._("# of times").'"], '; |
291 | - $flightover_data = ''; |
|
292 | - foreach($flightover_array as $flightover_item) |
|
293 | - { |
|
291 | + $flightover_data = ''; |
|
292 | + foreach($flightover_array as $flightover_item) |
|
293 | + { |
|
294 | 294 | $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
295 | - } |
|
296 | - $flightover_data = substr($flightover_data, 0, -1); |
|
297 | - print $flightover_data; |
|
298 | - print ']); |
|
295 | + } |
|
296 | + $flightover_data = substr($flightover_data, 0, -1); |
|
297 | + print $flightover_data; |
|
298 | + print ']); |
|
299 | 299 | |
300 | 300 | var options = { |
301 | 301 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | </div> |
320 | 320 | </div> |
321 | 321 | <?php |
322 | - } |
|
322 | + } |
|
323 | 323 | ?> |
324 | 324 | </div> |
325 | 325 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | <div class="row column"> |
330 | 330 | <div class="col-md-6"> |
331 | 331 | <?php |
332 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
333 | - if (count($airport_airport_array) > 0) { |
|
332 | + $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
333 | + if (count($airport_airport_array) > 0) { |
|
334 | 334 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
335 | 335 | print '<div id="chart3" class="chart" width="100%"></div> |
336 | 336 | <script> |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | |
344 | 344 | var data = google.visualization.arrayToDataTable([ |
345 | 345 | ["'._("Airport").'", "'._("# of times").'"],'; |
346 | - $airport_data = ''; |
|
346 | + $airport_data = ''; |
|
347 | 347 | foreach($airport_airport_array as $airport_item) |
348 | 348 | { |
349 | - $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
350 | - $name = str_replace("'", "", $name); |
|
351 | - $name = str_replace('"', "", $name); |
|
352 | - $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
349 | + $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
350 | + $name = str_replace("'", "", $name); |
|
351 | + $name = str_replace('"', "", $name); |
|
352 | + $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
353 | 353 | } |
354 | 354 | $airport_data = substr($airport_data, 0, -1); |
355 | 355 | print $airport_data; |
@@ -368,15 +368,15 @@ discard block |
||
368 | 368 | } |
369 | 369 | </script>'; |
370 | 370 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
371 | - } |
|
371 | + } |
|
372 | 372 | ?> |
373 | 373 | </div> |
374 | 374 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
375 | 375 | |
376 | 376 | <div class="col-md-6"> |
377 | 377 | <?php |
378 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
379 | - if (count($airport_airport_array2) > 0) { |
|
378 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
379 | + if (count($airport_airport_array2) > 0) { |
|
380 | 380 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
381 | 381 | print '<div id="chart4" class="chart" width="100%"></div> |
382 | 382 | <script> |
@@ -392,9 +392,9 @@ discard block |
||
392 | 392 | $airport_data2 = ''; |
393 | 393 | foreach($airport_airport_array2 as $airport_item2) |
394 | 394 | { |
395 | - $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
396 | - $name2 = str_replace(array("'",'"'), '', $name2); |
|
397 | - $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
395 | + $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
396 | + $name2 = str_replace(array("'",'"'), '', $name2); |
|
397 | + $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
398 | 398 | } |
399 | 399 | $airport_data2 = substr($airport_data2, 0, -1); |
400 | 400 | print $airport_data2; |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | </script>'; |
415 | 415 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
416 | - } |
|
416 | + } |
|
417 | 417 | ?> |
418 | 418 | </div> |
419 | 419 | </div> |
@@ -423,24 +423,24 @@ discard block |
||
423 | 423 | <div class="col-md-6"> |
424 | 424 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
425 | 425 | <?php |
426 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
427 | - if (count($year_array) == 0) print _("No data available"); |
|
428 | - else { |
|
429 | - print '<div id="chart8" class="chart" width="100%"></div> |
|
426 | + $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
427 | + if (count($year_array) == 0) print _("No data available"); |
|
428 | + else { |
|
429 | + print '<div id="chart8" class="chart" width="100%"></div> |
|
430 | 430 | <script> |
431 | 431 | google.load("visualization", "1", {packages:["corechart"]}); |
432 | 432 | google.setOnLoadCallback(drawChart8); |
433 | 433 | function drawChart8() { |
434 | 434 | var data = google.visualization.arrayToDataTable([ |
435 | 435 | ["'._("Month").'", "'._("# of Flights").'"], '; |
436 | - $year_data = ''; |
|
437 | - foreach($year_array as $year_item) |
|
438 | - { |
|
439 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | - } |
|
441 | - $year_data = substr($year_data, 0, -1); |
|
442 | - print $year_data; |
|
443 | - print ']); |
|
436 | + $year_data = ''; |
|
437 | + foreach($year_array as $year_item) |
|
438 | + { |
|
439 | + $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
440 | + } |
|
441 | + $year_data = substr($year_data, 0, -1); |
|
442 | + print $year_data; |
|
443 | + print ']); |
|
444 | 444 | |
445 | 445 | var options = { |
446 | 446 | legend: {position: "none"}, |
@@ -458,8 +458,8 @@ discard block |
||
458 | 458 | drawChart8(); |
459 | 459 | }); |
460 | 460 | </script>'; |
461 | - } |
|
462 | - ?> |
|
461 | + } |
|
462 | + ?> |
|
463 | 463 | <div class="more"> |
464 | 464 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
465 | 465 | </div> |
@@ -469,24 +469,24 @@ discard block |
||
469 | 469 | <div class="col-md-6"> |
470 | 470 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
471 | 471 | <?php |
472 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
473 | - if (count($month_array) == 0) print _("No data available"); |
|
474 | - else { |
|
475 | - print '<div id="chart9" class="chart" width="100%"></div> |
|
472 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
473 | + if (count($month_array) == 0) print _("No data available"); |
|
474 | + else { |
|
475 | + print '<div id="chart9" class="chart" width="100%"></div> |
|
476 | 476 | <script> |
477 | 477 | google.load("visualization", "1", {packages:["corechart"]}); |
478 | 478 | google.setOnLoadCallback(drawChart9); |
479 | 479 | function drawChart9() { |
480 | 480 | var data = google.visualization.arrayToDataTable([ |
481 | 481 | ["'._("Day").'", "'._("# of Flights").'"], '; |
482 | - $month_data = ''; |
|
483 | - foreach($month_array as $month_item) |
|
484 | - { |
|
485 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | - } |
|
487 | - $month_data = substr($month_data, 0, -1); |
|
488 | - print $month_data; |
|
489 | - print ']); |
|
482 | + $month_data = ''; |
|
483 | + foreach($month_array as $month_item) |
|
484 | + { |
|
485 | + $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
486 | + } |
|
487 | + $month_data = substr($month_data, 0, -1); |
|
488 | + print $month_data; |
|
489 | + print ']); |
|
490 | 490 | |
491 | 491 | var options = { |
492 | 492 | legend: {position: "none"}, |
@@ -504,8 +504,8 @@ discard block |
||
504 | 504 | drawChart9(); |
505 | 505 | }); |
506 | 506 | </script>'; |
507 | - } |
|
508 | - ?> |
|
507 | + } |
|
508 | + ?> |
|
509 | 509 | <div class="more"> |
510 | 510 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
511 | 511 | </div> |
@@ -515,25 +515,25 @@ discard block |
||
515 | 515 | <div class="col-md-6"> |
516 | 516 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
517 | 517 | <?php |
518 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
519 | - if (empty($date_array)) print _("No data available"); |
|
520 | - else { |
|
521 | - print '<div id="chart5" class="chart" width="100%"></div> |
|
518 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
519 | + if (empty($date_array)) print _("No data available"); |
|
520 | + else { |
|
521 | + print '<div id="chart5" class="chart" width="100%"></div> |
|
522 | 522 | <script> |
523 | 523 | google.load("visualization", "1", {packages:["corechart"]}); |
524 | 524 | google.setOnLoadCallback(drawChart5); |
525 | 525 | function drawChart5() { |
526 | 526 | var data = google.visualization.arrayToDataTable([ |
527 | 527 | ["'._("Date").'", "'._("# of Flights").'"], '; |
528 | - $date_data = ''; |
|
528 | + $date_data = ''; |
|
529 | 529 | |
530 | - foreach($date_array as $date_item) |
|
531 | - { |
|
532 | - $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
533 | - } |
|
534 | - $date_data = substr($date_data, 0, -1); |
|
535 | - print $date_data; |
|
536 | - print ']); |
|
530 | + foreach($date_array as $date_item) |
|
531 | + { |
|
532 | + $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
533 | + } |
|
534 | + $date_data = substr($date_data, 0, -1); |
|
535 | + print $date_data; |
|
536 | + print ']); |
|
537 | 537 | |
538 | 538 | var options = { |
539 | 539 | legend: {position: "none"}, |
@@ -551,8 +551,8 @@ discard block |
||
551 | 551 | drawChart5(); |
552 | 552 | }); |
553 | 553 | </script>'; |
554 | - } |
|
555 | - ?> |
|
554 | + } |
|
555 | + ?> |
|
556 | 556 | <div class="more"> |
557 | 557 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
558 | 558 | </div> |
@@ -562,25 +562,25 @@ discard block |
||
562 | 562 | <div class="col-md-6"> |
563 | 563 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
564 | 564 | <?php |
565 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
566 | - if (empty($hour_array)) print _("No data available"); |
|
567 | - else { |
|
565 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
566 | + if (empty($hour_array)) print _("No data available"); |
|
567 | + else { |
|
568 | 568 | |
569 | - print '<div id="chart6" class="chart" width="100%"></div> |
|
569 | + print '<div id="chart6" class="chart" width="100%"></div> |
|
570 | 570 | <script> |
571 | 571 | google.load("visualization", "1", {packages:["corechart"]}); |
572 | 572 | google.setOnLoadCallback(drawChart6); |
573 | 573 | function drawChart6() { |
574 | 574 | var data = google.visualization.arrayToDataTable([ |
575 | 575 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
576 | - $hour_data = ''; |
|
577 | - foreach($hour_array as $hour_item) |
|
578 | - { |
|
579 | - $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
580 | - } |
|
581 | - $hour_data = substr($hour_data, 0, -1); |
|
582 | - print $hour_data; |
|
583 | - print ']); |
|
576 | + $hour_data = ''; |
|
577 | + foreach($hour_array as $hour_item) |
|
578 | + { |
|
579 | + $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
580 | + } |
|
581 | + $hour_data = substr($hour_data, 0, -1); |
|
582 | + print $hour_data; |
|
583 | + print ']); |
|
584 | 584 | |
585 | 585 | var options = { |
586 | 586 | legend: {position: "none"}, |
@@ -598,8 +598,8 @@ discard block |
||
598 | 598 | drawChart6(); |
599 | 599 | }); |
600 | 600 | </script>'; |
601 | - } |
|
602 | - ?> |
|
601 | + } |
|
602 | + ?> |
|
603 | 603 | <div class="more"> |
604 | 604 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
605 | 605 | </div> |
@@ -607,21 +607,21 @@ discard block |
||
607 | 607 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
608 | 608 | </div> |
609 | 609 | <?php |
610 | - if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
610 | + if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
611 | 611 | ?> |
612 | 612 | <div class="row column"> |
613 | 613 | <?php |
614 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
615 | - if (!empty($polar)) { |
|
616 | - print '<h2>'._("Coverage pattern").'</h2>'; |
|
617 | - foreach ($polar as $eachpolar) { |
|
618 | - unset($polar_data); |
|
619 | - $Spotter = new Spotter(); |
|
620 | - $data = json_decode($eachpolar['source_data']); |
|
621 | - foreach($data as $value => $key) { |
|
622 | - $direction = $Spotter->parseDirection(($value*22.5)); |
|
623 | - $distance = $key; |
|
624 | - $unit = 'km'; |
|
614 | + $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
615 | + if (!empty($polar)) { |
|
616 | + print '<h2>'._("Coverage pattern").'</h2>'; |
|
617 | + foreach ($polar as $eachpolar) { |
|
618 | + unset($polar_data); |
|
619 | + $Spotter = new Spotter(); |
|
620 | + $data = json_decode($eachpolar['source_data']); |
|
621 | + foreach($data as $value => $key) { |
|
622 | + $direction = $Spotter->parseDirection(($value*22.5)); |
|
623 | + $distance = $key; |
|
624 | + $unit = 'km'; |
|
625 | 625 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
626 | 626 | $distance = round($distance*0.539957); |
627 | 627 | $unit = 'nm'; |
@@ -632,10 +632,10 @@ discard block |
||
632 | 632 | $distance = $distance; |
633 | 633 | $unit = 'km'; |
634 | 634 | } |
635 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
636 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
637 | - } |
|
638 | - ?> |
|
635 | + if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
636 | + else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
637 | + } |
|
638 | + ?> |
|
639 | 639 | <div class="col-md-6"> |
640 | 640 | <h4><?php print $eachpolar['source_name']; ?></h4> |
641 | 641 | <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
@@ -667,22 +667,22 @@ discard block |
||
667 | 667 | </script> |
668 | 668 | </div> |
669 | 669 | <?php |
670 | - } |
|
671 | - } |
|
672 | - ?> |
|
670 | + } |
|
671 | + } |
|
672 | + ?> |
|
673 | 673 | </div> |
674 | 674 | <div class="row column"> |
675 | 675 | <div class="col-md-6"> |
676 | 676 | <?php |
677 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
678 | - if (!empty($msg)) { |
|
679 | - print '<h2>'._("Messages received").'</h2>'; |
|
680 | - foreach ($msg as $eachmsg) { |
|
681 | - //$eachmsg = $msg[0]; |
|
682 | - $data = $eachmsg['source_data']; |
|
683 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
684 | - else $max = 500; |
|
685 | - ?> |
|
677 | + $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
678 | + if (!empty($msg)) { |
|
679 | + print '<h2>'._("Messages received").'</h2>'; |
|
680 | + foreach ($msg as $eachmsg) { |
|
681 | + //$eachmsg = $msg[0]; |
|
682 | + $data = $eachmsg['source_data']; |
|
683 | + if ($data > 500) $max = (round(($data+100)/100))*100; |
|
684 | + else $max = 500; |
|
685 | + ?> |
|
686 | 686 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
687 | 687 | <script> |
688 | 688 | var g = new JustGage({ |
@@ -698,9 +698,9 @@ discard block |
||
698 | 698 | }); |
699 | 699 | </script> |
700 | 700 | <?php |
701 | - } |
|
702 | - } |
|
703 | - ?> |
|
701 | + } |
|
702 | + } |
|
703 | + ?> |
|
704 | 704 | </div> |
705 | 705 | </div> |
706 | 706 | <div class="row column"> |
@@ -727,19 +727,19 @@ discard block |
||
727 | 727 | $hist_data .= '[ "'.$distance.'",'.$nb.'],'; |
728 | 728 | } |
729 | 729 | $hist_data = substr($hist_data, 0, -1); |
730 | - ?> |
|
730 | + ?> |
|
731 | 731 | <div class="col-md-6"> |
732 | 732 | <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
733 | 733 | <?php |
734 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
734 | + print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
735 | 735 | <script> |
736 | 736 | google.load("visualization", "1", {packages:["corechart"]}); |
737 | 737 | google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
738 | 738 | function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
739 | 739 | var data = google.visualization.arrayToDataTable([ |
740 | 740 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
741 | - print $hist_data; |
|
742 | - print ']); |
|
741 | + print $hist_data; |
|
742 | + print ']); |
|
743 | 743 | |
744 | 744 | var options = { |
745 | 745 | legend: {position: "none"}, |
@@ -757,15 +757,15 @@ discard block |
||
757 | 757 | drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
758 | 758 | }); |
759 | 759 | </script>'; |
760 | - ?> |
|
760 | + ?> |
|
761 | 761 | </div> |
762 | 762 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
763 | 763 | <?php |
764 | - } |
|
765 | - ?> |
|
764 | + } |
|
765 | + ?> |
|
766 | 766 | </div> |
767 | 767 | <?php |
768 | - } |
|
768 | + } |
|
769 | 769 | ?> |
770 | 770 | </div> |
771 | 771 | </div> |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | $Common = new Common(); |
12 | 12 | |
13 | 13 | if (isset($_GET['download'])) { |
14 | - if ($_GET['download'] == "true") |
|
15 | - { |
|
14 | + if ($_GET['download'] == "true") |
|
15 | + { |
|
16 | 16 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
17 | - } |
|
17 | + } |
|
18 | 18 | } |
19 | 19 | header('Content-Type: text/javascript'); |
20 | 20 | |
@@ -333,26 +333,26 @@ discard block |
||
333 | 333 | |
334 | 334 | if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
335 | 335 | || (!isset($_COOKIE['flightpath']) |
336 | - && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
337 | - || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
336 | + && (!isset($globalMapHistory) || $globalMapHistory || $allhistory) |
|
337 | + || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id']))) |
|
338 | 338 | || (isset($history) && $history == '' && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) { |
339 | - if ($from_archive) { |
|
340 | - $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
341 | - } else { |
|
342 | - $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
343 | - } |
|
344 | - $d = false; |
|
339 | + if ($from_archive) { |
|
340 | + $spotter_history_array = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
|
341 | + } else { |
|
342 | + $spotter_history_array = $SpotterLive->getAllLiveSpotterDataById($spotter_item['flightaware_id']); |
|
343 | + } |
|
344 | + $d = false; |
|
345 | 345 | foreach ($spotter_history_array as $key => $spotter_history) |
346 | 346 | { |
347 | 347 | $alt = round($spotter_history['altitude']/10)*10; |
348 | 348 | if (!isset($prev_alt) || $prev_alt != $alt) { |
349 | - if (isset($prev_alt)) { |
|
349 | + if (isset($prev_alt)) { |
|
350 | 350 | $output_history .= '['.$spotter_history['longitude'].', '.$spotter_history['latitude'].', '.$spotter_history['altitude'].']'; |
351 | 351 | $output_history .= ']}},'; |
352 | 352 | $output .= $output_history; |
353 | - } |
|
354 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
355 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
353 | + } |
|
354 | + if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
355 | + else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
356 | 356 | } |
357 | 357 | $output_history .= '['; |
358 | 358 | $output_history .= $spotter_history['longitude'].', '; |
@@ -360,38 +360,38 @@ discard block |
||
360 | 360 | $output_history .= $spotter_history['altitude']*30.48; |
361 | 361 | $output_history .= '],'; |
362 | 362 | $prev_alt = $alt; |
363 | - //} |
|
363 | + //} |
|
364 | 364 | } |
365 | 365 | if (isset($output_history)) { |
366 | - $output_history = substr($output_history, 0, -1); |
|
367 | - $output_history .= ']}},'; |
|
368 | - $output .= $output_history; |
|
369 | - unset($prev_alt); |
|
370 | - unset($output_history); |
|
366 | + $output_history = substr($output_history, 0, -1); |
|
367 | + $output_history .= ']}},'; |
|
368 | + $output .= $output_history; |
|
369 | + unset($prev_alt); |
|
370 | + unset($output_history); |
|
371 | 371 | } |
372 | 372 | } |
373 | 373 | |
374 | 374 | if (isset($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))))) { |
375 | - $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
376 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
375 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
376 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
377 | 377 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
378 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
378 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
379 | 379 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
380 | 380 | if (isset($dairport[0]['latitude'])) { |
381 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
381 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
382 | 382 | } |
383 | - } |
|
384 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
383 | + } |
|
384 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
385 | 385 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
386 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
386 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
387 | 387 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
388 | 388 | if (isset($aairport[0]['latitude'])) { |
389 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
389 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
390 | 390 | } |
391 | - } |
|
392 | - $output_air .= ']}},'; |
|
393 | - $output .= $output_air; |
|
394 | - unset($output_air); |
|
391 | + } |
|
392 | + $output_air .= ']}},'; |
|
393 | + $output .= $output_air; |
|
394 | + unset($output_air); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | $output = substr($output, 0, -1); |