@@ -7,109 +7,109 @@ discard block |
||
7 | 7 | public $db; |
8 | 8 | |
9 | 9 | protected $texts = Array( |
10 | - 'MI' => 'Shallow', |
|
11 | - 'PR' => 'Partial', |
|
12 | - 'BC' => 'Low drifting', |
|
13 | - 'BL' => 'Blowing', |
|
14 | - 'SH' => 'Showers', |
|
15 | - 'TS' => 'Thunderstorm', |
|
16 | - 'FZ' => 'Freezing', |
|
17 | - 'DZ' => 'Drizzle', |
|
18 | - 'RA' => 'Rain', |
|
19 | - 'SN' => 'Snow', |
|
20 | - 'SG' => 'Snow Grains', |
|
21 | - 'IC' => 'Ice crystals', |
|
22 | - 'PL' => 'Ice pellets', |
|
23 | - 'GR' => 'Hail', |
|
24 | - 'GS' => 'Small hail', |
|
25 | - 'UP' => 'Unknown', |
|
26 | - 'BR' => 'Mist', |
|
27 | - 'FG' => 'Fog', |
|
28 | - 'FU' => 'Smoke', |
|
29 | - 'VA' => 'Volcanic ash', |
|
30 | - 'DU' => 'Widespread dust', |
|
31 | - 'SA' => 'Sand', |
|
32 | - 'HZ' => 'Haze', |
|
33 | - 'PY' => 'Spray', |
|
34 | - 'PO' => 'Well developed dust / sand whirls', |
|
35 | - 'SQ' => 'Squalls', |
|
36 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
37 | - 'SS' => 'Sandstorm', |
|
38 | - 'DS' => 'Duststorm' |
|
10 | + 'MI' => 'Shallow', |
|
11 | + 'PR' => 'Partial', |
|
12 | + 'BC' => 'Low drifting', |
|
13 | + 'BL' => 'Blowing', |
|
14 | + 'SH' => 'Showers', |
|
15 | + 'TS' => 'Thunderstorm', |
|
16 | + 'FZ' => 'Freezing', |
|
17 | + 'DZ' => 'Drizzle', |
|
18 | + 'RA' => 'Rain', |
|
19 | + 'SN' => 'Snow', |
|
20 | + 'SG' => 'Snow Grains', |
|
21 | + 'IC' => 'Ice crystals', |
|
22 | + 'PL' => 'Ice pellets', |
|
23 | + 'GR' => 'Hail', |
|
24 | + 'GS' => 'Small hail', |
|
25 | + 'UP' => 'Unknown', |
|
26 | + 'BR' => 'Mist', |
|
27 | + 'FG' => 'Fog', |
|
28 | + 'FU' => 'Smoke', |
|
29 | + 'VA' => 'Volcanic ash', |
|
30 | + 'DU' => 'Widespread dust', |
|
31 | + 'SA' => 'Sand', |
|
32 | + 'HZ' => 'Haze', |
|
33 | + 'PY' => 'Spray', |
|
34 | + 'PO' => 'Well developed dust / sand whirls', |
|
35 | + 'SQ' => 'Squalls', |
|
36 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
37 | + 'SS' => 'Sandstorm', |
|
38 | + 'DS' => 'Duststorm' |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | public function __construct($dbc = null) { |
42 | - $Connection = new Connection($dbc); |
|
43 | - $this->db = $Connection->db; |
|
44 | - } |
|
42 | + $Connection = new Connection($dbc); |
|
43 | + $this->db = $Connection->db; |
|
44 | + } |
|
45 | 45 | |
46 | - public static function check_last_update() { |
|
47 | - global $globalDBdriver; |
|
48 | - if ($globalDBdriver == 'mysql') { |
|
46 | + public static function check_last_update() { |
|
47 | + global $globalDBdriver; |
|
48 | + if ($globalDBdriver == 'mysql') { |
|
49 | 49 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)"; |
50 | 50 | } else { |
51 | 51 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'"; |
52 | 52 | } |
53 | - try { |
|
54 | - $Connection = new Connection(); |
|
55 | - $sth = $Connection->db->prepare($query); |
|
56 | - $sth->execute(); |
|
57 | - } catch(PDOException $e) { |
|
58 | - return "error : ".$e->getMessage(); |
|
59 | - } |
|
60 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
61 | - $sth->closeCursor(); |
|
62 | - if ($row['nb'] > 0) return false; |
|
63 | - else return true; |
|
64 | - } |
|
53 | + try { |
|
54 | + $Connection = new Connection(); |
|
55 | + $sth = $Connection->db->prepare($query); |
|
56 | + $sth->execute(); |
|
57 | + } catch(PDOException $e) { |
|
58 | + return "error : ".$e->getMessage(); |
|
59 | + } |
|
60 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
61 | + $sth->closeCursor(); |
|
62 | + if ($row['nb'] > 0) return false; |
|
63 | + else return true; |
|
64 | + } |
|
65 | 65 | |
66 | - public static function insert_last_update() { |
|
67 | - $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
66 | + public static function insert_last_update() { |
|
67 | + $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
68 | 68 | INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());"; |
69 | - try { |
|
70 | - $Connection = new Connection(); |
|
71 | - $sth = $Connection->db->prepare($query); |
|
72 | - $sth->execute(); |
|
73 | - } catch(PDOException $e) { |
|
74 | - return "error : ".$e->getMessage(); |
|
75 | - } |
|
76 | - } |
|
69 | + try { |
|
70 | + $Connection = new Connection(); |
|
71 | + $sth = $Connection->db->prepare($query); |
|
72 | + $sth->execute(); |
|
73 | + } catch(PDOException $e) { |
|
74 | + return "error : ".$e->getMessage(); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - public function parse($data) { |
|
81 | - //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
82 | - $codes = implode('|', array_keys($this->texts)); |
|
83 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
84 | - //$pieces = explode(' ',$data); |
|
85 | - $pieces = preg_split('/\s/',$data); |
|
86 | - $pos = 0; |
|
87 | - if ($pieces[0] == 'METAR') $pos++; |
|
88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | - $result = array(); |
|
91 | - $result['location'] = $pieces[$pos]; |
|
92 | - $pos++; |
|
93 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
94 | - $result['time'] = substr($pieces[$pos],2,4); |
|
95 | - $c = count($pieces); |
|
96 | - for($pos++; $pos < $c; $pos++) { |
|
97 | - $piece = $pieces[$pos]; |
|
98 | - if ($piece == 'RMK') break; |
|
99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | - if ($piece == 'COR') $result['correction'] = true; |
|
101 | - // Wind Speed |
|
102 | - if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
103 | - $result['wind']['direction'] = (float)$matches[1]; |
|
80 | + public function parse($data) { |
|
81 | + //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
82 | + $codes = implode('|', array_keys($this->texts)); |
|
83 | + $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
84 | + //$pieces = explode(' ',$data); |
|
85 | + $pieces = preg_split('/\s/',$data); |
|
86 | + $pos = 0; |
|
87 | + if ($pieces[0] == 'METAR') $pos++; |
|
88 | + elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | + $result = array(); |
|
91 | + $result['location'] = $pieces[$pos]; |
|
92 | + $pos++; |
|
93 | + $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
94 | + $result['time'] = substr($pieces[$pos],2,4); |
|
95 | + $c = count($pieces); |
|
96 | + for($pos++; $pos < $c; $pos++) { |
|
97 | + $piece = $pieces[$pos]; |
|
98 | + if ($piece == 'RMK') break; |
|
99 | + if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | + if ($piece == 'COR') $result['correction'] = true; |
|
101 | + // Wind Speed |
|
102 | + if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
103 | + $result['wind']['direction'] = (float)$matches[1]; |
|
104 | 104 | $result['wind']['unit'] = $matches[4]; |
105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
105 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
108 | 108 | $result['wind']['gust'] = (float)$matches[3]; |
109 | 109 | $result['wind']['unit'] = $matches[4]; |
110 | 110 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
111 | 111 | $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | 114 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
115 | 115 | $result['wind_direction'] = (float)$matches[1]; |
@@ -126,35 +126,35 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | */ |
129 | - // Temperature |
|
130 | - if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
131 | - $temp = (float)$matches[1]; |
|
129 | + // Temperature |
|
130 | + if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
131 | + $temp = (float)$matches[1]; |
|
132 | 132 | if ($matches[1]{0} == 'M') { |
133 | 133 | $temp = ((float)substr($matches[1], 1)) * -1; |
134 | 134 | } |
135 | - $result['temperature'] = $temp; |
|
136 | - $dew = (float)$matches[2]; |
|
135 | + $result['temperature'] = $temp; |
|
136 | + $dew = (float)$matches[2]; |
|
137 | 137 | if ($matches[2]{0} == 'M') { |
138 | 138 | $dew = ((float)substr($matches[2], 1)) * -1; |
139 | 139 | } |
140 | 140 | $result['dew'] = $dew; |
141 | - } |
|
142 | - // QNH |
|
143 | - if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
144 | - // #^(Q|A)(////|[0-9]{4})( )# |
|
145 | - if ($matches[1] == 'Q') { |
|
146 | - // hPa |
|
147 | - $result['QNH'] = $matches[2]; |
|
148 | - } else { |
|
149 | - // inHg |
|
150 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
151 | 141 | } |
152 | - /* |
|
142 | + // QNH |
|
143 | + if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
144 | + // #^(Q|A)(////|[0-9]{4})( )# |
|
145 | + if ($matches[1] == 'Q') { |
|
146 | + // hPa |
|
147 | + $result['QNH'] = $matches[2]; |
|
148 | + } else { |
|
149 | + // inHg |
|
150 | + $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
151 | + } |
|
152 | + /* |
|
153 | 153 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
154 | 154 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
155 | 155 | */ |
156 | - } |
|
157 | - /* |
|
156 | + } |
|
157 | + /* |
|
158 | 158 | // Wind Direction |
159 | 159 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
160 | 160 | $result['wind_direction'] = $matches[1]; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $result['speed_variable'] = $matches[1]; |
166 | 166 | } |
167 | 167 | */ |
168 | - // Visibility |
|
169 | - if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
170 | - if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
168 | + // Visibility |
|
169 | + if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
170 | + if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
171 | 171 | $result['visibility'] = (float)$matches[3] * 1609.34; |
172 | 172 | } else { |
173 | 173 | if ($matches[1] == '9999') { |
@@ -180,28 +180,28 @@ discard block |
||
180 | 180 | $result['visibility'] = '> 10000'; |
181 | 181 | $result['weather'] = "CAVOK"; |
182 | 182 | } |
183 | - } |
|
184 | - // Cloud Coverage |
|
185 | - if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
186 | - //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
187 | - $type = $matches[1]; |
|
188 | - $cloud = array(); |
|
189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
197 | - $cloud['type_code'] = $type; |
|
198 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
199 | - $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
200 | - $result['cloud'][] = $cloud; |
|
201 | - } |
|
202 | - // RVR |
|
203 | - if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
204 | - $rvr = array(); |
|
183 | + } |
|
184 | + // Cloud Coverage |
|
185 | + if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
186 | + //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
187 | + $type = $matches[1]; |
|
188 | + $cloud = array(); |
|
189 | + if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | + elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | + elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | + elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | + elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | + elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | + elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | + elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
197 | + $cloud['type_code'] = $type; |
|
198 | + $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
199 | + $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
200 | + $result['cloud'][] = $cloud; |
|
201 | + } |
|
202 | + // RVR |
|
203 | + if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
204 | + $rvr = array(); |
|
205 | 205 | $rvr['runway'] = $matches[1]; |
206 | 206 | $rvr['assessment'] = $matches[2]; |
207 | 207 | $rvr['rvr'] = $matches[3]; |
@@ -210,33 +210,33 @@ discard block |
||
210 | 210 | $result['RVR'] = $rvr; |
211 | 211 | } |
212 | 212 | |
213 | - //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
214 | - if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
215 | - //print_r($matches); |
|
216 | - // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
217 | - $result['RVR']['runway'] = $matches[1]; |
|
218 | - $result['RVR']['deposits'] = $matches[2]; |
|
219 | - $result['RVR']['extent'] = $matches[3]; |
|
220 | - $result['RVR']['depth'] = $matches[4]; |
|
221 | - $result['RVR']['friction'] = $matches[5]; |
|
222 | - } |
|
223 | - if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
224 | - //echo $piece; |
|
225 | - //print_r($matches); |
|
226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
213 | + //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
214 | + if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
215 | + //print_r($matches); |
|
216 | + // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
217 | + $result['RVR']['runway'] = $matches[1]; |
|
218 | + $result['RVR']['deposits'] = $matches[2]; |
|
219 | + $result['RVR']['extent'] = $matches[3]; |
|
220 | + $result['RVR']['depth'] = $matches[4]; |
|
221 | + $result['RVR']['friction'] = $matches[5]; |
|
222 | + } |
|
223 | + if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
224 | + //echo $piece; |
|
225 | + //print_r($matches); |
|
226 | + if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | + else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
228 | 228 | if (isset($matches[3])) { |
229 | 229 | $range = Array( |
230 | - 'from' => (float)$matches[2], |
|
231 | - 'to' => (float)$matches[4], |
|
232 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
230 | + 'from' => (float)$matches[2], |
|
231 | + 'to' => (float)$matches[4], |
|
232 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
233 | 233 | ); |
234 | 234 | } |
235 | 235 | $result['RVR'] = $matches[1]; |
236 | 236 | $result['RVR_range'] = $range; |
237 | - } |
|
238 | - // Weather |
|
239 | - if (preg_match($regWeather, $piece, $matches)) { |
|
237 | + } |
|
238 | + // Weather |
|
239 | + if (preg_match($regWeather, $piece, $matches)) { |
|
240 | 240 | $text = Array(); |
241 | 241 | switch ($matches[1]) { |
242 | 242 | case '+': |
@@ -259,35 +259,35 @@ discard block |
||
259 | 259 | } |
260 | 260 | if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
261 | 261 | else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
262 | - } |
|
263 | - } |
|
264 | - return $result; |
|
262 | + } |
|
263 | + } |
|
264 | + return $result; |
|
265 | 265 | |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | public function getMETAR($icao) { |
269 | - global $globalMETARcycle, $globalDBdriver; |
|
270 | - if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
271 | - $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
272 | - } else { |
|
273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
275 | - } |
|
276 | - $query_values = array(':icao' => $icao); |
|
277 | - try { |
|
278 | - $sth = $this->db->prepare($query); |
|
279 | - $sth->execute($query_values); |
|
280 | - } catch(PDOException $e) { |
|
281 | - return "error : ".$e->getMessage(); |
|
282 | - } |
|
283 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
284 | - if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
285 | - $all = $this->downloadMETAR($icao); |
|
286 | - } |
|
287 | - return $all; |
|
288 | - } |
|
269 | + global $globalMETARcycle, $globalDBdriver; |
|
270 | + if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
271 | + $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
272 | + } else { |
|
273 | + if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | + else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
275 | + } |
|
276 | + $query_values = array(':icao' => $icao); |
|
277 | + try { |
|
278 | + $sth = $this->db->prepare($query); |
|
279 | + $sth->execute($query_values); |
|
280 | + } catch(PDOException $e) { |
|
281 | + return "error : ".$e->getMessage(); |
|
282 | + } |
|
283 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
284 | + if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
285 | + $all = $this->downloadMETAR($icao); |
|
286 | + } |
|
287 | + return $all; |
|
288 | + } |
|
289 | 289 | |
290 | - public function addMETAR($location,$metar,$date) { |
|
290 | + public function addMETAR($location,$metar,$date) { |
|
291 | 291 | global $globalDBdriver; |
292 | 292 | $date = date('Y-m-d H:i:s',strtotime($date)); |
293 | 293 | if ($globalDBdriver == 'mysql') { |
@@ -295,100 +295,100 @@ discard block |
||
295 | 295 | } else { |
296 | 296 | $query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
297 | 297 | } |
298 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
299 | - try { |
|
300 | - $sth = $this->db->prepare($query); |
|
301 | - $sth->execute($query_values); |
|
302 | - } catch(PDOException $e) { |
|
303 | - return "error : ".$e->getMessage(); |
|
304 | - } |
|
305 | - } |
|
298 | + $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
299 | + try { |
|
300 | + $sth = $this->db->prepare($query); |
|
301 | + $sth->execute($query_values); |
|
302 | + } catch(PDOException $e) { |
|
303 | + return "error : ".$e->getMessage(); |
|
304 | + } |
|
305 | + } |
|
306 | 306 | |
307 | - public function deleteMETAR($id) { |
|
308 | - $query = "DELETE FROM metar WHERE id = :id"; |
|
309 | - $query_values = array(':id' => $id); |
|
310 | - try { |
|
311 | - $sth = $this->db->prepare($query); |
|
312 | - $sth->execute($query_values); |
|
313 | - } catch(PDOException $e) { |
|
314 | - return "error : ".$e->getMessage(); |
|
315 | - } |
|
316 | - } |
|
317 | - public function deleteAllMETARLocation() { |
|
318 | - $query = "DELETE FROM metar"; |
|
319 | - try { |
|
320 | - $sth = $this->db->prepare($query); |
|
321 | - $sth->execute(); |
|
322 | - } catch(PDOException $e) { |
|
323 | - return "error : ".$e->getMessage(); |
|
324 | - } |
|
325 | - } |
|
307 | + public function deleteMETAR($id) { |
|
308 | + $query = "DELETE FROM metar WHERE id = :id"; |
|
309 | + $query_values = array(':id' => $id); |
|
310 | + try { |
|
311 | + $sth = $this->db->prepare($query); |
|
312 | + $sth->execute($query_values); |
|
313 | + } catch(PDOException $e) { |
|
314 | + return "error : ".$e->getMessage(); |
|
315 | + } |
|
316 | + } |
|
317 | + public function deleteAllMETARLocation() { |
|
318 | + $query = "DELETE FROM metar"; |
|
319 | + try { |
|
320 | + $sth = $this->db->prepare($query); |
|
321 | + $sth->execute(); |
|
322 | + } catch(PDOException $e) { |
|
323 | + return "error : ".$e->getMessage(); |
|
324 | + } |
|
325 | + } |
|
326 | 326 | |
327 | - public function addMETARCycle() { |
|
328 | - global $globalDebug, $globalIVAO; |
|
329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
330 | - date_default_timezone_set("UTC"); |
|
331 | - $Common = new Common(); |
|
332 | - if (isset($globalIVAO) && $globalIVAO) { |
|
333 | - $cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
334 | - } else { |
|
327 | + public function addMETARCycle() { |
|
328 | + global $globalDebug, $globalIVAO; |
|
329 | + if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
330 | + date_default_timezone_set("UTC"); |
|
331 | + $Common = new Common(); |
|
332 | + if (isset($globalIVAO) && $globalIVAO) { |
|
333 | + $cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
334 | + } else { |
|
335 | 335 | $cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT'); |
336 | - } |
|
337 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
338 | - $date = ''; |
|
339 | - foreach(explode("\n",$cycle) as $line) { |
|
340 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
341 | - //echo "date : ".$line."\n"; |
|
342 | - $date = $line; |
|
343 | - } |
|
344 | - if ($line != '') { |
|
345 | - //$this->parse($line); |
|
346 | - //echo $line; |
|
347 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
348 | - $pos = 0; |
|
349 | - $pieces = preg_split('/\s/',$line); |
|
350 | - if ($pieces[0] == 'METAR') $pos++; |
|
351 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
352 | - $location = $pieces[$pos]; |
|
353 | - echo $this->addMETAR($location,$line,$date); |
|
354 | - } |
|
355 | - //echo $line."\n"; |
|
356 | - } |
|
357 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
336 | + } |
|
337 | + if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
338 | + $date = ''; |
|
339 | + foreach(explode("\n",$cycle) as $line) { |
|
340 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
341 | + //echo "date : ".$line."\n"; |
|
342 | + $date = $line; |
|
343 | + } |
|
344 | + if ($line != '') { |
|
345 | + //$this->parse($line); |
|
346 | + //echo $line; |
|
347 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
348 | + $pos = 0; |
|
349 | + $pieces = preg_split('/\s/',$line); |
|
350 | + if ($pieces[0] == 'METAR') $pos++; |
|
351 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
352 | + $location = $pieces[$pos]; |
|
353 | + echo $this->addMETAR($location,$line,$date); |
|
354 | + } |
|
355 | + //echo $line."\n"; |
|
356 | + } |
|
357 | + if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
358 | 358 | |
359 | - } |
|
360 | - public function downloadMETAR($icao) { |
|
361 | - global $globalMETARurl; |
|
362 | - if ($globalMETARurl == '') return array(); |
|
363 | - date_default_timezone_set("UTC"); |
|
364 | - $Common = new Common(); |
|
365 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
366 | - $cycle = $Common->getData($url); |
|
367 | - $date = ''; |
|
368 | - foreach(explode("\n",$cycle) as $line) { |
|
369 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
370 | - //echo "date : ".$line."\n"; |
|
371 | - $date = $line; |
|
372 | - } |
|
373 | - if ($line != '') { |
|
374 | - //$this->parse($line); |
|
375 | - //echo $line; |
|
376 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
377 | - $pos = 0; |
|
378 | - $pieces = preg_split('/\s/',$line); |
|
379 | - if ($pieces[0] == 'METAR') $pos++; |
|
380 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
381 | - $location = $pieces[$pos]; |
|
382 | - if (strlen($location == 4)) { |
|
383 | - $this->addMETAR($location,$line,$date); |
|
384 | - return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
385 | - } else return array(); |
|
386 | - } |
|
387 | - //echo $line."\n"; |
|
388 | - } |
|
389 | - return array(); |
|
359 | + } |
|
360 | + public function downloadMETAR($icao) { |
|
361 | + global $globalMETARurl; |
|
362 | + if ($globalMETARurl == '') return array(); |
|
363 | + date_default_timezone_set("UTC"); |
|
364 | + $Common = new Common(); |
|
365 | + $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
366 | + $cycle = $Common->getData($url); |
|
367 | + $date = ''; |
|
368 | + foreach(explode("\n",$cycle) as $line) { |
|
369 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
370 | + //echo "date : ".$line."\n"; |
|
371 | + $date = $line; |
|
372 | + } |
|
373 | + if ($line != '') { |
|
374 | + //$this->parse($line); |
|
375 | + //echo $line; |
|
376 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
377 | + $pos = 0; |
|
378 | + $pieces = preg_split('/\s/',$line); |
|
379 | + if ($pieces[0] == 'METAR') $pos++; |
|
380 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
381 | + $location = $pieces[$pos]; |
|
382 | + if (strlen($location == 4)) { |
|
383 | + $this->addMETAR($location,$line,$date); |
|
384 | + return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
385 | + } else return array(); |
|
386 | + } |
|
387 | + //echo $line."\n"; |
|
388 | + } |
|
389 | + return array(); |
|
390 | 390 | |
391 | - } |
|
391 | + } |
|
392 | 392 | } |
393 | 393 | /* |
394 | 394 | $METAR = new METAR(); |
@@ -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 (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 (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 (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 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) $filter = array_merge($globalStatsFilters[$globalFilterName],$filter); |
@@ -55,14 +55,14 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
58 | - * Executes the SQL statements to get the spotter information |
|
59 | - * |
|
60 | - * @param String $query the SQL query |
|
61 | - * @param Array $params parameter of the query |
|
62 | - * @param String $limitQuery the limit query |
|
63 | - * @return Array the spotter information |
|
64 | - * |
|
65 | - */ |
|
58 | + * Executes the SQL statements to get the spotter information |
|
59 | + * |
|
60 | + * @param String $query the SQL query |
|
61 | + * @param Array $params parameter of the query |
|
62 | + * @param String $limitQuery the limit query |
|
63 | + * @return Array the spotter information |
|
64 | + * |
|
65 | + */ |
|
66 | 66 | public function getDataFromDB($query, $params = array(), $limitQuery = '') |
67 | 67 | { |
68 | 68 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -226,11 +226,11 @@ discard block |
||
226 | 226 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
227 | 227 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
228 | 228 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
229 | - } else { |
|
230 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
229 | + } else { |
|
230 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
231 | 231 | $temp_array['aircraft_name'] = 'N/A'; |
232 | 232 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
233 | - } |
|
233 | + } |
|
234 | 234 | } |
235 | 235 | $fromsource = NULL; |
236 | 236 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -413,11 +413,11 @@ discard block |
||
413 | 413 | |
414 | 414 | |
415 | 415 | /** |
416 | - * Gets all the spotter information |
|
417 | - * |
|
418 | - * @return Array the spotter information |
|
419 | - * |
|
420 | - */ |
|
416 | + * Gets all the spotter information |
|
417 | + * |
|
418 | + * @return Array the spotter information |
|
419 | + * |
|
420 | + */ |
|
421 | 421 | 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()) |
422 | 422 | { |
423 | 423 | global $globalTimezone, $globalDBdriver; |
@@ -764,11 +764,11 @@ discard block |
||
764 | 764 | |
765 | 765 | |
766 | 766 | /** |
767 | - * Gets all the spotter information based on the latest data entry |
|
768 | - * |
|
769 | - * @return Array the spotter information |
|
770 | - * |
|
771 | - */ |
|
767 | + * Gets all the spotter information based on the latest data entry |
|
768 | + * |
|
769 | + * @return Array the spotter information |
|
770 | + * |
|
771 | + */ |
|
772 | 772 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
773 | 773 | { |
774 | 774 | global $global_query; |
@@ -807,12 +807,12 @@ discard block |
||
807 | 807 | } |
808 | 808 | |
809 | 809 | |
810 | - /** |
|
811 | - * Gets all the spotter information based on a user's latitude and longitude |
|
812 | - * |
|
813 | - * @return Array the spotter information |
|
814 | - * |
|
815 | - */ |
|
810 | + /** |
|
811 | + * Gets all the spotter information based on a user's latitude and longitude |
|
812 | + * |
|
813 | + * @return Array the spotter information |
|
814 | + * |
|
815 | + */ |
|
816 | 816 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
817 | 817 | { |
818 | 818 | date_default_timezone_set('UTC'); |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | return false; |
841 | 841 | } |
842 | 842 | } |
843 | - $additional_query = ''; |
|
843 | + $additional_query = ''; |
|
844 | 844 | if ($interval != "") |
845 | 845 | { |
846 | 846 | if (!is_string($interval)) |
@@ -880,12 +880,12 @@ discard block |
||
880 | 880 | } |
881 | 881 | |
882 | 882 | |
883 | - /** |
|
884 | - * Gets all the spotter information sorted by the newest aircraft type |
|
885 | - * |
|
886 | - * @return Array the spotter information |
|
887 | - * |
|
888 | - */ |
|
883 | + /** |
|
884 | + * Gets all the spotter information sorted by the newest aircraft type |
|
885 | + * |
|
886 | + * @return Array the spotter information |
|
887 | + * |
|
888 | + */ |
|
889 | 889 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
890 | 890 | { |
891 | 891 | global $global_query; |
@@ -926,11 +926,11 @@ discard block |
||
926 | 926 | |
927 | 927 | |
928 | 928 | /** |
929 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
930 | - * |
|
931 | - * @return Array the spotter information |
|
932 | - * |
|
933 | - */ |
|
929 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
930 | + * |
|
931 | + * @return Array the spotter information |
|
932 | + * |
|
933 | + */ |
|
934 | 934 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
935 | 935 | { |
936 | 936 | global $global_query; |
@@ -970,11 +970,11 @@ discard block |
||
970 | 970 | |
971 | 971 | |
972 | 972 | /** |
973 | - * Gets all the spotter information sorted by the newest airline |
|
974 | - * |
|
975 | - * @return Array the spotter information |
|
976 | - * |
|
977 | - */ |
|
973 | + * Gets all the spotter information sorted by the newest airline |
|
974 | + * |
|
975 | + * @return Array the spotter information |
|
976 | + * |
|
977 | + */ |
|
978 | 978 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
979 | 979 | { |
980 | 980 | global $global_query; |
@@ -1013,12 +1013,12 @@ discard block |
||
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | |
1016 | - /** |
|
1017 | - * Gets all the spotter information sorted by the newest departure airport |
|
1018 | - * |
|
1019 | - * @return Array the spotter information |
|
1020 | - * |
|
1021 | - */ |
|
1016 | + /** |
|
1017 | + * Gets all the spotter information sorted by the newest departure airport |
|
1018 | + * |
|
1019 | + * @return Array the spotter information |
|
1020 | + * |
|
1021 | + */ |
|
1022 | 1022 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
1023 | 1023 | { |
1024 | 1024 | global $global_query; |
@@ -1060,11 +1060,11 @@ discard block |
||
1060 | 1060 | |
1061 | 1061 | |
1062 | 1062 | /** |
1063 | - * Gets all the spotter information sorted by the newest arrival airport |
|
1064 | - * |
|
1065 | - * @return Array the spotter information |
|
1066 | - * |
|
1067 | - */ |
|
1063 | + * Gets all the spotter information sorted by the newest arrival airport |
|
1064 | + * |
|
1065 | + * @return Array the spotter information |
|
1066 | + * |
|
1067 | + */ |
|
1068 | 1068 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
1069 | 1069 | { |
1070 | 1070 | global $global_query; |
@@ -1103,11 +1103,11 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | |
1105 | 1105 | /** |
1106 | - * Gets all the spotter information based on the spotter id |
|
1107 | - * |
|
1108 | - * @return Array the spotter information |
|
1109 | - * |
|
1110 | - */ |
|
1106 | + * Gets all the spotter information based on the spotter id |
|
1107 | + * |
|
1108 | + * @return Array the spotter information |
|
1109 | + * |
|
1110 | + */ |
|
1111 | 1111 | public function getSpotterDataByID($id = '') |
1112 | 1112 | { |
1113 | 1113 | global $global_query; |
@@ -1129,11 +1129,11 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | |
1131 | 1131 | /** |
1132 | - * Gets all the spotter information based on the callsign |
|
1133 | - * |
|
1134 | - * @return Array the spotter information |
|
1135 | - * |
|
1136 | - */ |
|
1132 | + * Gets all the spotter information based on the callsign |
|
1133 | + * |
|
1134 | + * @return Array the spotter information |
|
1135 | + * |
|
1136 | + */ |
|
1137 | 1137 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '') |
1138 | 1138 | { |
1139 | 1139 | global $global_query; |
@@ -1186,11 +1186,11 @@ discard block |
||
1186 | 1186 | |
1187 | 1187 | |
1188 | 1188 | /** |
1189 | - * Gets all the spotter information based on the aircraft type |
|
1190 | - * |
|
1191 | - * @return Array the spotter information |
|
1192 | - * |
|
1193 | - */ |
|
1189 | + * Gets all the spotter information based on the aircraft type |
|
1190 | + * |
|
1191 | + * @return Array the spotter information |
|
1192 | + * |
|
1193 | + */ |
|
1194 | 1194 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
1195 | 1195 | { |
1196 | 1196 | global $global_query; |
@@ -1244,11 +1244,11 @@ discard block |
||
1244 | 1244 | |
1245 | 1245 | |
1246 | 1246 | /** |
1247 | - * Gets all the spotter information based on the aircraft registration |
|
1248 | - * |
|
1249 | - * @return Array the spotter information |
|
1250 | - * |
|
1251 | - */ |
|
1247 | + * Gets all the spotter information based on the aircraft registration |
|
1248 | + * |
|
1249 | + * @return Array the spotter information |
|
1250 | + * |
|
1251 | + */ |
|
1252 | 1252 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
1253 | 1253 | { |
1254 | 1254 | global $global_query; |
@@ -1305,11 +1305,11 @@ discard block |
||
1305 | 1305 | |
1306 | 1306 | |
1307 | 1307 | /** |
1308 | - * Gets all the spotter information based on the airline |
|
1309 | - * |
|
1310 | - * @return Array the spotter information |
|
1311 | - * |
|
1312 | - */ |
|
1308 | + * Gets all the spotter information based on the airline |
|
1309 | + * |
|
1310 | + * @return Array the spotter information |
|
1311 | + * |
|
1312 | + */ |
|
1313 | 1313 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
1314 | 1314 | { |
1315 | 1315 | global $global_query; |
@@ -1362,11 +1362,11 @@ discard block |
||
1362 | 1362 | |
1363 | 1363 | |
1364 | 1364 | /** |
1365 | - * Gets all the spotter information based on the airport |
|
1366 | - * |
|
1367 | - * @return Array the spotter information |
|
1368 | - * |
|
1369 | - */ |
|
1365 | + * Gets all the spotter information based on the airport |
|
1366 | + * |
|
1367 | + * @return Array the spotter information |
|
1368 | + * |
|
1369 | + */ |
|
1370 | 1370 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
1371 | 1371 | { |
1372 | 1372 | global $global_query; |
@@ -1420,11 +1420,11 @@ discard block |
||
1420 | 1420 | |
1421 | 1421 | |
1422 | 1422 | /** |
1423 | - * Gets all the spotter information based on the date |
|
1424 | - * |
|
1425 | - * @return Array the spotter information |
|
1426 | - * |
|
1427 | - */ |
|
1423 | + * Gets all the spotter information based on the date |
|
1424 | + * |
|
1425 | + * @return Array the spotter information |
|
1426 | + * |
|
1427 | + */ |
|
1428 | 1428 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
1429 | 1429 | { |
1430 | 1430 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1485,11 +1485,11 @@ discard block |
||
1485 | 1485 | |
1486 | 1486 | |
1487 | 1487 | /** |
1488 | - * Gets all the spotter information based on the country name |
|
1489 | - * |
|
1490 | - * @return Array the spotter information |
|
1491 | - * |
|
1492 | - */ |
|
1488 | + * Gets all the spotter information based on the country name |
|
1489 | + * |
|
1490 | + * @return Array the spotter information |
|
1491 | + * |
|
1492 | + */ |
|
1493 | 1493 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
1494 | 1494 | { |
1495 | 1495 | global $global_query; |
@@ -1543,11 +1543,11 @@ discard block |
||
1543 | 1543 | |
1544 | 1544 | |
1545 | 1545 | /** |
1546 | - * Gets all the spotter information based on the manufacturer name |
|
1547 | - * |
|
1548 | - * @return Array the spotter information |
|
1549 | - * |
|
1550 | - */ |
|
1546 | + * Gets all the spotter information based on the manufacturer name |
|
1547 | + * |
|
1548 | + * @return Array the spotter information |
|
1549 | + * |
|
1550 | + */ |
|
1551 | 1551 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
1552 | 1552 | { |
1553 | 1553 | global $global_query; |
@@ -1603,13 +1603,13 @@ discard block |
||
1603 | 1603 | |
1604 | 1604 | |
1605 | 1605 | /** |
1606 | - * Gets a list of all aircraft that take a route |
|
1607 | - * |
|
1608 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
1609 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1610 | - * @return Array the spotter information |
|
1611 | - * |
|
1612 | - */ |
|
1606 | + * Gets a list of all aircraft that take a route |
|
1607 | + * |
|
1608 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
1609 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
1610 | + * @return Array the spotter information |
|
1611 | + * |
|
1612 | + */ |
|
1613 | 1613 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
1614 | 1614 | { |
1615 | 1615 | global $global_query; |
@@ -1676,11 +1676,11 @@ discard block |
||
1676 | 1676 | |
1677 | 1677 | |
1678 | 1678 | /** |
1679 | - * Gets all the spotter information based on the special column in the table |
|
1680 | - * |
|
1681 | - * @return Array the spotter information |
|
1682 | - * |
|
1683 | - */ |
|
1679 | + * Gets all the spotter information based on the special column in the table |
|
1680 | + * |
|
1681 | + * @return Array the spotter information |
|
1682 | + * |
|
1683 | + */ |
|
1684 | 1684 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
1685 | 1685 | { |
1686 | 1686 | global $global_query; |
@@ -1719,11 +1719,11 @@ discard block |
||
1719 | 1719 | } |
1720 | 1720 | |
1721 | 1721 | /** |
1722 | - * Gets all the highlight based on a aircraft registration |
|
1723 | - * |
|
1724 | - * @return String the highlight text |
|
1725 | - * |
|
1726 | - */ |
|
1722 | + * Gets all the highlight based on a aircraft registration |
|
1723 | + * |
|
1724 | + * @return String the highlight text |
|
1725 | + * |
|
1726 | + */ |
|
1727 | 1727 | public function getHighlightByRegistration($registration,$filter = array()) |
1728 | 1728 | { |
1729 | 1729 | global $global_query; |
@@ -1745,13 +1745,13 @@ discard block |
||
1745 | 1745 | |
1746 | 1746 | |
1747 | 1747 | /** |
1748 | - * Gets the squawk usage from squawk code |
|
1749 | - * |
|
1750 | - * @param String $squawk squawk code |
|
1751 | - * @param String $country country |
|
1752 | - * @return String usage |
|
1753 | - * |
|
1754 | - */ |
|
1748 | + * Gets the squawk usage from squawk code |
|
1749 | + * |
|
1750 | + * @param String $squawk squawk code |
|
1751 | + * @param String $country country |
|
1752 | + * @return String usage |
|
1753 | + * |
|
1754 | + */ |
|
1755 | 1755 | public function getSquawkUsage($squawk = '',$country = 'FR') |
1756 | 1756 | { |
1757 | 1757 | |
@@ -1772,12 +1772,12 @@ discard block |
||
1772 | 1772 | } |
1773 | 1773 | |
1774 | 1774 | /** |
1775 | - * Gets the airport icao from the iata |
|
1776 | - * |
|
1777 | - * @param String $airport_iata the iata code of the airport |
|
1778 | - * @return String airport iata |
|
1779 | - * |
|
1780 | - */ |
|
1775 | + * Gets the airport icao from the iata |
|
1776 | + * |
|
1777 | + * @param String $airport_iata the iata code of the airport |
|
1778 | + * @return String airport iata |
|
1779 | + * |
|
1780 | + */ |
|
1781 | 1781 | public function getAirportIcao($airport_iata = '') |
1782 | 1782 | { |
1783 | 1783 | |
@@ -1797,14 +1797,14 @@ discard block |
||
1797 | 1797 | } |
1798 | 1798 | |
1799 | 1799 | /** |
1800 | - * Gets the airport distance |
|
1801 | - * |
|
1802 | - * @param String $airport_icao the icao code of the airport |
|
1803 | - * @param Float $latitude the latitude |
|
1804 | - * @param Float $longitude the longitude |
|
1805 | - * @return Float distance to the airport |
|
1806 | - * |
|
1807 | - */ |
|
1800 | + * Gets the airport distance |
|
1801 | + * |
|
1802 | + * @param String $airport_icao the icao code of the airport |
|
1803 | + * @param Float $latitude the latitude |
|
1804 | + * @param Float $longitude the longitude |
|
1805 | + * @return Float distance to the airport |
|
1806 | + * |
|
1807 | + */ |
|
1808 | 1808 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
1809 | 1809 | { |
1810 | 1810 | |
@@ -1825,12 +1825,12 @@ discard block |
||
1825 | 1825 | } |
1826 | 1826 | |
1827 | 1827 | /** |
1828 | - * Gets the airport info based on the icao |
|
1829 | - * |
|
1830 | - * @param String $airport the icao code of the airport |
|
1831 | - * @return Array airport information |
|
1832 | - * |
|
1833 | - */ |
|
1828 | + * Gets the airport info based on the icao |
|
1829 | + * |
|
1830 | + * @param String $airport the icao code of the airport |
|
1831 | + * @return Array airport information |
|
1832 | + * |
|
1833 | + */ |
|
1834 | 1834 | public function getAllAirportInfo($airport = '') |
1835 | 1835 | { |
1836 | 1836 | |
@@ -1876,12 +1876,12 @@ discard block |
||
1876 | 1876 | } |
1877 | 1877 | |
1878 | 1878 | /** |
1879 | - * Gets the airport info based on the country |
|
1880 | - * |
|
1881 | - * @param Array $countries Airports countries |
|
1882 | - * @return Array airport information |
|
1883 | - * |
|
1884 | - */ |
|
1879 | + * Gets the airport info based on the country |
|
1880 | + * |
|
1881 | + * @param Array $countries Airports countries |
|
1882 | + * @return Array airport information |
|
1883 | + * |
|
1884 | + */ |
|
1885 | 1885 | public function getAllAirportInfobyCountry($countries) |
1886 | 1886 | { |
1887 | 1887 | $lst_countries = ''; |
@@ -1919,12 +1919,12 @@ discard block |
||
1919 | 1919 | } |
1920 | 1920 | |
1921 | 1921 | /** |
1922 | - * Gets airports info based on the coord |
|
1923 | - * |
|
1924 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1925 | - * @return Array airport information |
|
1926 | - * |
|
1927 | - */ |
|
1922 | + * Gets airports info based on the coord |
|
1923 | + * |
|
1924 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
1925 | + * @return Array airport information |
|
1926 | + * |
|
1927 | + */ |
|
1928 | 1928 | public function getAllAirportInfobyCoord($coord) |
1929 | 1929 | { |
1930 | 1930 | global $globalDBdriver; |
@@ -1955,12 +1955,12 @@ discard block |
||
1955 | 1955 | } |
1956 | 1956 | |
1957 | 1957 | /** |
1958 | - * Gets waypoints info based on the coord |
|
1959 | - * |
|
1960 | - * @param Array $coord waypoints coord |
|
1961 | - * @return Array airport information |
|
1962 | - * |
|
1963 | - */ |
|
1958 | + * Gets waypoints info based on the coord |
|
1959 | + * |
|
1960 | + * @param Array $coord waypoints coord |
|
1961 | + * @return Array airport information |
|
1962 | + * |
|
1963 | + */ |
|
1964 | 1964 | public function getAllWaypointsInfobyCoord($coord) |
1965 | 1965 | { |
1966 | 1966 | if (is_array($coord)) { |
@@ -1994,12 +1994,12 @@ discard block |
||
1994 | 1994 | |
1995 | 1995 | |
1996 | 1996 | /** |
1997 | - * Gets the airline info based on the icao code or iata code |
|
1998 | - * |
|
1999 | - * @param String $airline_icao the iata code of the airport |
|
2000 | - * @return Array airport information |
|
2001 | - * |
|
2002 | - */ |
|
1997 | + * Gets the airline info based on the icao code or iata code |
|
1998 | + * |
|
1999 | + * @param String $airline_icao the iata code of the airport |
|
2000 | + * @return Array airport information |
|
2001 | + * |
|
2002 | + */ |
|
2003 | 2003 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
2004 | 2004 | { |
2005 | 2005 | global $globalUseRealAirlines; |
@@ -2030,7 +2030,7 @@ discard block |
||
2030 | 2030 | } else { |
2031 | 2031 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
2032 | 2032 | } |
2033 | - /* |
|
2033 | + /* |
|
2034 | 2034 | $airline_array = array(); |
2035 | 2035 | $temp_array = array(); |
2036 | 2036 | |
@@ -2062,12 +2062,12 @@ discard block |
||
2062 | 2062 | |
2063 | 2063 | |
2064 | 2064 | /** |
2065 | - * Gets the aircraft info based on the aircraft type |
|
2066 | - * |
|
2067 | - * @param String $aircraft_type the aircraft type |
|
2068 | - * @return Array aircraft information |
|
2069 | - * |
|
2070 | - */ |
|
2065 | + * Gets the aircraft info based on the aircraft type |
|
2066 | + * |
|
2067 | + * @param String $aircraft_type the aircraft type |
|
2068 | + * @return Array aircraft information |
|
2069 | + * |
|
2070 | + */ |
|
2071 | 2071 | public function getAllAircraftInfo($aircraft_type) |
2072 | 2072 | { |
2073 | 2073 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2099,12 +2099,12 @@ discard block |
||
2099 | 2099 | } |
2100 | 2100 | |
2101 | 2101 | /** |
2102 | - * Gets the aircraft icao based on the aircraft name/type |
|
2103 | - * |
|
2104 | - * @param String $aircraft_type the aircraft type |
|
2105 | - * @return String aircraft information |
|
2106 | - * |
|
2107 | - */ |
|
2102 | + * Gets the aircraft icao based on the aircraft name/type |
|
2103 | + * |
|
2104 | + * @param String $aircraft_type the aircraft type |
|
2105 | + * @return String aircraft information |
|
2106 | + * |
|
2107 | + */ |
|
2108 | 2108 | public function getAircraftIcao($aircraft_type) |
2109 | 2109 | { |
2110 | 2110 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2129,12 +2129,12 @@ discard block |
||
2129 | 2129 | } |
2130 | 2130 | |
2131 | 2131 | /** |
2132 | - * Gets the aircraft info based on the aircraft ident |
|
2133 | - * |
|
2134 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
2135 | - * @return String aircraft type |
|
2136 | - * |
|
2137 | - */ |
|
2132 | + * Gets the aircraft info based on the aircraft ident |
|
2133 | + * |
|
2134 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
2135 | + * @return String aircraft type |
|
2136 | + * |
|
2137 | + */ |
|
2138 | 2138 | public function getAllAircraftType($aircraft_modes) |
2139 | 2139 | { |
2140 | 2140 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2152,12 +2152,12 @@ discard block |
||
2152 | 2152 | } |
2153 | 2153 | |
2154 | 2154 | /** |
2155 | - * Gets correct aircraft operator corde |
|
2156 | - * |
|
2157 | - * @param String $operator the aircraft operator code (callsign) |
|
2158 | - * @return String aircraft operator code |
|
2159 | - * |
|
2160 | - */ |
|
2155 | + * Gets correct aircraft operator corde |
|
2156 | + * |
|
2157 | + * @param String $operator the aircraft operator code (callsign) |
|
2158 | + * @return String aircraft operator code |
|
2159 | + * |
|
2160 | + */ |
|
2161 | 2161 | public function getOperator($operator) |
2162 | 2162 | { |
2163 | 2163 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2174,16 +2174,16 @@ discard block |
||
2174 | 2174 | } |
2175 | 2175 | |
2176 | 2176 | /** |
2177 | - * Gets the aircraft route based on the aircraft callsign |
|
2178 | - * |
|
2179 | - * @param String $callsign the aircraft callsign |
|
2180 | - * @return Array aircraft type |
|
2181 | - * |
|
2182 | - */ |
|
2177 | + * Gets the aircraft route based on the aircraft callsign |
|
2178 | + * |
|
2179 | + * @param String $callsign the aircraft callsign |
|
2180 | + * @return Array aircraft type |
|
2181 | + * |
|
2182 | + */ |
|
2183 | 2183 | public function getRouteInfo($callsign) |
2184 | 2184 | { |
2185 | 2185 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
2186 | - if ($callsign == '') return array(); |
|
2186 | + if ($callsign == '') return array(); |
|
2187 | 2187 | $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"; |
2188 | 2188 | |
2189 | 2189 | $sth = $this->db->prepare($query); |
@@ -2197,12 +2197,12 @@ discard block |
||
2197 | 2197 | } |
2198 | 2198 | |
2199 | 2199 | /** |
2200 | - * Gets the aircraft info based on the aircraft registration |
|
2201 | - * |
|
2202 | - * @param String $registration the aircraft registration |
|
2203 | - * @return Array aircraft information |
|
2204 | - * |
|
2205 | - */ |
|
2200 | + * Gets the aircraft info based on the aircraft registration |
|
2201 | + * |
|
2202 | + * @param String $registration the aircraft registration |
|
2203 | + * @return Array aircraft information |
|
2204 | + * |
|
2205 | + */ |
|
2206 | 2206 | public function getAircraftInfoByRegistration($registration) |
2207 | 2207 | { |
2208 | 2208 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2229,12 +2229,12 @@ discard block |
||
2229 | 2229 | } |
2230 | 2230 | |
2231 | 2231 | /** |
2232 | - * Gets the aircraft owner & base based on the aircraft registration |
|
2233 | - * |
|
2234 | - * @param String $registration the aircraft registration |
|
2235 | - * @return Array aircraft information |
|
2236 | - * |
|
2237 | - */ |
|
2232 | + * Gets the aircraft owner & base based on the aircraft registration |
|
2233 | + * |
|
2234 | + * @param String $registration the aircraft registration |
|
2235 | + * @return Array aircraft information |
|
2236 | + * |
|
2237 | + */ |
|
2238 | 2238 | public function getAircraftOwnerByRegistration($registration) |
2239 | 2239 | { |
2240 | 2240 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2251,11 +2251,11 @@ discard block |
||
2251 | 2251 | |
2252 | 2252 | |
2253 | 2253 | /** |
2254 | - * Gets all flights (but with only little info) |
|
2255 | - * |
|
2256 | - * @return Array basic flight information |
|
2257 | - * |
|
2258 | - */ |
|
2254 | + * Gets all flights (but with only little info) |
|
2255 | + * |
|
2256 | + * @return Array basic flight information |
|
2257 | + * |
|
2258 | + */ |
|
2259 | 2259 | public function getAllFlightsforSitemap() |
2260 | 2260 | { |
2261 | 2261 | //$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 "; |
@@ -2263,7 +2263,7 @@ discard block |
||
2263 | 2263 | |
2264 | 2264 | $sth = $this->db->prepare($query); |
2265 | 2265 | $sth->execute(); |
2266 | - /* |
|
2266 | + /* |
|
2267 | 2267 | $flight_array = array(); |
2268 | 2268 | $temp_array = array(); |
2269 | 2269 | |
@@ -2285,11 +2285,11 @@ discard block |
||
2285 | 2285 | } |
2286 | 2286 | |
2287 | 2287 | /** |
2288 | - * Gets a list of all aircraft manufacturers |
|
2289 | - * |
|
2290 | - * @return Array list of aircraft types |
|
2291 | - * |
|
2292 | - */ |
|
2288 | + * Gets a list of all aircraft manufacturers |
|
2289 | + * |
|
2290 | + * @return Array list of aircraft types |
|
2291 | + * |
|
2292 | + */ |
|
2293 | 2293 | public function getAllManufacturers() |
2294 | 2294 | { |
2295 | 2295 | /* |
@@ -2318,11 +2318,11 @@ discard block |
||
2318 | 2318 | |
2319 | 2319 | |
2320 | 2320 | /** |
2321 | - * Gets a list of all aircraft types |
|
2322 | - * |
|
2323 | - * @return Array list of aircraft types |
|
2324 | - * |
|
2325 | - */ |
|
2321 | + * Gets a list of all aircraft types |
|
2322 | + * |
|
2323 | + * @return Array list of aircraft types |
|
2324 | + * |
|
2325 | + */ |
|
2326 | 2326 | public function getAllAircraftTypes($filters = array()) |
2327 | 2327 | { |
2328 | 2328 | /* |
@@ -2355,11 +2355,11 @@ discard block |
||
2355 | 2355 | |
2356 | 2356 | |
2357 | 2357 | /** |
2358 | - * Gets a list of all aircraft registrations |
|
2359 | - * |
|
2360 | - * @return Array list of aircraft registrations |
|
2361 | - * |
|
2362 | - */ |
|
2358 | + * Gets a list of all aircraft registrations |
|
2359 | + * |
|
2360 | + * @return Array list of aircraft registrations |
|
2361 | + * |
|
2362 | + */ |
|
2363 | 2363 | public function getAllAircraftRegistrations($filters = array()) |
2364 | 2364 | { |
2365 | 2365 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2384,12 +2384,12 @@ discard block |
||
2384 | 2384 | } |
2385 | 2385 | |
2386 | 2386 | /** |
2387 | - * Gets all source name |
|
2388 | - * |
|
2389 | - * @param String type format of source |
|
2390 | - * @return Array list of source name |
|
2391 | - * |
|
2392 | - */ |
|
2387 | + * Gets all source name |
|
2388 | + * |
|
2389 | + * @param String type format of source |
|
2390 | + * @return Array list of source name |
|
2391 | + * |
|
2392 | + */ |
|
2393 | 2393 | public function getAllSourceName($type = '',$filters = array()) |
2394 | 2394 | { |
2395 | 2395 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2420,11 +2420,11 @@ discard block |
||
2420 | 2420 | |
2421 | 2421 | |
2422 | 2422 | /** |
2423 | - * Gets a list of all airline names |
|
2424 | - * |
|
2425 | - * @return Array list of airline names |
|
2426 | - * |
|
2427 | - */ |
|
2423 | + * Gets a list of all airline names |
|
2424 | + * |
|
2425 | + * @return Array list of airline names |
|
2426 | + * |
|
2427 | + */ |
|
2428 | 2428 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
2429 | 2429 | { |
2430 | 2430 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2474,11 +2474,11 @@ discard block |
||
2474 | 2474 | |
2475 | 2475 | |
2476 | 2476 | /** |
2477 | - * Gets a list of all airline countries |
|
2478 | - * |
|
2479 | - * @return Array list of airline countries |
|
2480 | - * |
|
2481 | - */ |
|
2477 | + * Gets a list of all airline countries |
|
2478 | + * |
|
2479 | + * @return Array list of airline countries |
|
2480 | + * |
|
2481 | + */ |
|
2482 | 2482 | public function getAllAirlineCountries($filters = array()) |
2483 | 2483 | { |
2484 | 2484 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2506,11 +2506,11 @@ discard block |
||
2506 | 2506 | |
2507 | 2507 | |
2508 | 2508 | /** |
2509 | - * Gets a list of all departure & arrival names |
|
2510 | - * |
|
2511 | - * @return Array list of airport names |
|
2512 | - * |
|
2513 | - */ |
|
2509 | + * Gets a list of all departure & arrival names |
|
2510 | + * |
|
2511 | + * @return Array list of airport names |
|
2512 | + * |
|
2513 | + */ |
|
2514 | 2514 | public function getAllAirportNames($filters = array()) |
2515 | 2515 | { |
2516 | 2516 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2559,11 +2559,11 @@ discard block |
||
2559 | 2559 | |
2560 | 2560 | |
2561 | 2561 | /** |
2562 | - * Gets a list of all departure & arrival airport countries |
|
2563 | - * |
|
2564 | - * @return Array list of airport countries |
|
2565 | - * |
|
2566 | - */ |
|
2562 | + * Gets a list of all departure & arrival airport countries |
|
2563 | + * |
|
2564 | + * @return Array list of airport countries |
|
2565 | + * |
|
2566 | + */ |
|
2567 | 2567 | public function getAllAirportCountries($filters = array()) |
2568 | 2568 | { |
2569 | 2569 | $airport_array = array(); |
@@ -2611,11 +2611,11 @@ discard block |
||
2611 | 2611 | |
2612 | 2612 | |
2613 | 2613 | /** |
2614 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2615 | - * |
|
2616 | - * @return Array list of countries |
|
2617 | - * |
|
2618 | - */ |
|
2614 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
2615 | + * |
|
2616 | + * @return Array list of countries |
|
2617 | + * |
|
2618 | + */ |
|
2619 | 2619 | public function getAllCountries($filters = array()) |
2620 | 2620 | { |
2621 | 2621 | $Connection= new Connection($this->db); |
@@ -2692,11 +2692,11 @@ discard block |
||
2692 | 2692 | |
2693 | 2693 | |
2694 | 2694 | /** |
2695 | - * Gets a list of all idents/callsigns |
|
2696 | - * |
|
2697 | - * @return Array list of ident/callsign names |
|
2698 | - * |
|
2699 | - */ |
|
2695 | + * Gets a list of all idents/callsigns |
|
2696 | + * |
|
2697 | + * @return Array list of ident/callsign names |
|
2698 | + * |
|
2699 | + */ |
|
2700 | 2700 | public function getAllIdents($filters = array()) |
2701 | 2701 | { |
2702 | 2702 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2720,9 +2720,9 @@ discard block |
||
2720 | 2720 | } |
2721 | 2721 | |
2722 | 2722 | /** |
2723 | - * Get a list of flights from airport since 7 days |
|
2724 | - * @return Array number, icao, name and city of airports |
|
2725 | - */ |
|
2723 | + * Get a list of flights from airport since 7 days |
|
2724 | + * @return Array number, icao, name and city of airports |
|
2725 | + */ |
|
2726 | 2726 | |
2727 | 2727 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
2728 | 2728 | global $globalTimezone, $globalDBdriver; |
@@ -2753,9 +2753,9 @@ discard block |
||
2753 | 2753 | } |
2754 | 2754 | |
2755 | 2755 | /** |
2756 | - * Get a list of flights from airport since 7 days |
|
2757 | - * @return Array number, icao, name and city of airports |
|
2758 | - */ |
|
2756 | + * Get a list of flights from airport since 7 days |
|
2757 | + * @return Array number, icao, name and city of airports |
|
2758 | + */ |
|
2759 | 2759 | |
2760 | 2760 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
2761 | 2761 | global $globalTimezone, $globalDBdriver; |
@@ -2785,9 +2785,9 @@ discard block |
||
2785 | 2785 | } |
2786 | 2786 | |
2787 | 2787 | /** |
2788 | - * Get a list of flights from detected airport since 7 days |
|
2789 | - * @return Array number, icao, name and city of airports |
|
2790 | - */ |
|
2788 | + * Get a list of flights from detected airport since 7 days |
|
2789 | + * @return Array number, icao, name and city of airports |
|
2790 | + */ |
|
2791 | 2791 | |
2792 | 2792 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
2793 | 2793 | global $globalTimezone, $globalDBdriver; |
@@ -2825,9 +2825,9 @@ discard block |
||
2825 | 2825 | } |
2826 | 2826 | |
2827 | 2827 | /** |
2828 | - * Get a list of flights from detected airport since 7 days |
|
2829 | - * @return Array number, icao, name and city of airports |
|
2830 | - */ |
|
2828 | + * Get a list of flights from detected airport since 7 days |
|
2829 | + * @return Array number, icao, name and city of airports |
|
2830 | + */ |
|
2831 | 2831 | |
2832 | 2832 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
2833 | 2833 | global $globalTimezone, $globalDBdriver; |
@@ -2869,9 +2869,9 @@ discard block |
||
2869 | 2869 | |
2870 | 2870 | |
2871 | 2871 | /** |
2872 | - * Get a list of flights to airport since 7 days |
|
2873 | - * @return Array number, icao, name and city of airports |
|
2874 | - */ |
|
2872 | + * Get a list of flights to airport since 7 days |
|
2873 | + * @return Array number, icao, name and city of airports |
|
2874 | + */ |
|
2875 | 2875 | |
2876 | 2876 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
2877 | 2877 | global $globalTimezone, $globalDBdriver; |
@@ -2904,9 +2904,9 @@ discard block |
||
2904 | 2904 | |
2905 | 2905 | |
2906 | 2906 | /** |
2907 | - * Get a list of flights detected to airport since 7 days |
|
2908 | - * @return Array number, icao, name and city of airports |
|
2909 | - */ |
|
2907 | + * Get a list of flights detected to airport since 7 days |
|
2908 | + * @return Array number, icao, name and city of airports |
|
2909 | + */ |
|
2910 | 2910 | |
2911 | 2911 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
2912 | 2912 | global $globalTimezone, $globalDBdriver; |
@@ -2947,9 +2947,9 @@ discard block |
||
2947 | 2947 | |
2948 | 2948 | |
2949 | 2949 | /** |
2950 | - * Get a list of flights to airport since 7 days |
|
2951 | - * @return Array number, icao, name and city of airports |
|
2952 | - */ |
|
2950 | + * Get a list of flights to airport since 7 days |
|
2951 | + * @return Array number, icao, name and city of airports |
|
2952 | + */ |
|
2953 | 2953 | |
2954 | 2954 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
2955 | 2955 | global $globalTimezone, $globalDBdriver; |
@@ -2981,9 +2981,9 @@ discard block |
||
2981 | 2981 | |
2982 | 2982 | |
2983 | 2983 | /** |
2984 | - * Get a list of flights detected to airport since 7 days |
|
2985 | - * @return Array number, icao, name and city of airports |
|
2986 | - */ |
|
2984 | + * Get a list of flights detected to airport since 7 days |
|
2985 | + * @return Array number, icao, name and city of airports |
|
2986 | + */ |
|
2987 | 2987 | |
2988 | 2988 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
2989 | 2989 | global $globalTimezone, $globalDBdriver; |
@@ -3027,11 +3027,11 @@ discard block |
||
3027 | 3027 | |
3028 | 3028 | |
3029 | 3029 | /** |
3030 | - * Gets a list of all dates |
|
3031 | - * |
|
3032 | - * @return Array list of date names |
|
3033 | - * |
|
3034 | - */ |
|
3030 | + * Gets a list of all dates |
|
3031 | + * |
|
3032 | + * @return Array list of date names |
|
3033 | + * |
|
3034 | + */ |
|
3035 | 3035 | public function getAllDates() |
3036 | 3036 | { |
3037 | 3037 | global $globalTimezone, $globalDBdriver; |
@@ -3072,11 +3072,11 @@ discard block |
||
3072 | 3072 | |
3073 | 3073 | |
3074 | 3074 | /** |
3075 | - * Gets all route combinations |
|
3076 | - * |
|
3077 | - * @return Array the route list |
|
3078 | - * |
|
3079 | - */ |
|
3075 | + * Gets all route combinations |
|
3076 | + * |
|
3077 | + * @return Array the route list |
|
3078 | + * |
|
3079 | + */ |
|
3080 | 3080 | public function getAllRoutes() |
3081 | 3081 | { |
3082 | 3082 | $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 |
@@ -3102,13 +3102,13 @@ discard block |
||
3102 | 3102 | } |
3103 | 3103 | |
3104 | 3104 | /** |
3105 | - * Update ident spotter data |
|
3106 | - * |
|
3107 | - * @param String $flightaware_id the ID from flightaware |
|
3108 | - * @param String $ident the flight ident |
|
3109 | - * @return String success or false |
|
3110 | - * |
|
3111 | - */ |
|
3105 | + * Update ident spotter data |
|
3106 | + * |
|
3107 | + * @param String $flightaware_id the ID from flightaware |
|
3108 | + * @param String $ident the flight ident |
|
3109 | + * @return String success or false |
|
3110 | + * |
|
3111 | + */ |
|
3112 | 3112 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
3113 | 3113 | { |
3114 | 3114 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3129,14 +3129,14 @@ discard block |
||
3129 | 3129 | } else { |
3130 | 3130 | $airline_array = $this->getAllAirlineInfo("NA"); |
3131 | 3131 | } |
3132 | - $airline_name = $airline_array[0]['name']; |
|
3133 | - $airline_icao = $airline_array[0]['icao']; |
|
3134 | - $airline_country = $airline_array[0]['country']; |
|
3135 | - $airline_type = $airline_array[0]['type']; |
|
3132 | + $airline_name = $airline_array[0]['name']; |
|
3133 | + $airline_icao = $airline_array[0]['icao']; |
|
3134 | + $airline_country = $airline_array[0]['country']; |
|
3135 | + $airline_type = $airline_array[0]['type']; |
|
3136 | 3136 | |
3137 | 3137 | |
3138 | 3138 | $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'; |
3139 | - $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); |
|
3139 | + $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); |
|
3140 | 3140 | |
3141 | 3141 | try { |
3142 | 3142 | $sth = $this->db->prepare($query); |
@@ -3149,19 +3149,19 @@ discard block |
||
3149 | 3149 | |
3150 | 3150 | } |
3151 | 3151 | /** |
3152 | - * Update latest spotter data |
|
3153 | - * |
|
3154 | - * @param String $flightaware_id the ID from flightaware |
|
3155 | - * @param String $ident the flight ident |
|
3156 | - * @param String $arrival_airport_icao the arrival airport |
|
3157 | - * @return String success or false |
|
3158 | - * |
|
3159 | - */ |
|
3152 | + * Update latest spotter data |
|
3153 | + * |
|
3154 | + * @param String $flightaware_id the ID from flightaware |
|
3155 | + * @param String $ident the flight ident |
|
3156 | + * @param String $arrival_airport_icao the arrival airport |
|
3157 | + * @return String success or false |
|
3158 | + * |
|
3159 | + */ |
|
3160 | 3160 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
3161 | 3161 | { |
3162 | 3162 | if ($groundspeed == '') $groundspeed = NULL; |
3163 | 3163 | $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'; |
3164 | - $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); |
|
3164 | + $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); |
|
3165 | 3165 | |
3166 | 3166 | try { |
3167 | 3167 | $sth = $this->db->prepare($query); |
@@ -3175,32 +3175,32 @@ discard block |
||
3175 | 3175 | } |
3176 | 3176 | |
3177 | 3177 | /** |
3178 | - * Adds a new spotter data |
|
3179 | - * |
|
3180 | - * @param String $flightaware_id the ID from flightaware |
|
3181 | - * @param String $ident the flight ident |
|
3182 | - * @param String $aircraft_icao the aircraft type |
|
3183 | - * @param String $departure_airport_icao the departure airport |
|
3184 | - * @param String $arrival_airport_icao the arrival airport |
|
3185 | - * @param String $latitude latitude of flight |
|
3186 | - * @param String $longitude latitude of flight |
|
3187 | - * @param String $waypoints waypoints of flight |
|
3188 | - * @param String $altitude altitude of flight |
|
3189 | - * @param String $heading heading of flight |
|
3190 | - * @param String $groundspeed speed of flight |
|
3191 | - * @param String $date date of flight |
|
3192 | - * @param String $departure_airport_time departure time of flight |
|
3193 | - * @param String $arrival_airport_time arrival time of flight |
|
3194 | - * @param String $squawk squawk code of flight |
|
3195 | - * @param String $route_stop route stop of flight |
|
3196 | - * @param String $highlight highlight or not |
|
3197 | - * @param String $ModeS ModesS code of flight |
|
3198 | - * @param String $registration registration code of flight |
|
3199 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3200 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3201 | - * @param String $verticalrate vertival rate of flight |
|
3202 | - * @return String success or false |
|
3203 | - */ |
|
3178 | + * Adds a new spotter data |
|
3179 | + * |
|
3180 | + * @param String $flightaware_id the ID from flightaware |
|
3181 | + * @param String $ident the flight ident |
|
3182 | + * @param String $aircraft_icao the aircraft type |
|
3183 | + * @param String $departure_airport_icao the departure airport |
|
3184 | + * @param String $arrival_airport_icao the arrival airport |
|
3185 | + * @param String $latitude latitude of flight |
|
3186 | + * @param String $longitude latitude of flight |
|
3187 | + * @param String $waypoints waypoints of flight |
|
3188 | + * @param String $altitude altitude of flight |
|
3189 | + * @param String $heading heading of flight |
|
3190 | + * @param String $groundspeed speed of flight |
|
3191 | + * @param String $date date of flight |
|
3192 | + * @param String $departure_airport_time departure time of flight |
|
3193 | + * @param String $arrival_airport_time arrival time of flight |
|
3194 | + * @param String $squawk squawk code of flight |
|
3195 | + * @param String $route_stop route stop of flight |
|
3196 | + * @param String $highlight highlight or not |
|
3197 | + * @param String $ModeS ModesS code of flight |
|
3198 | + * @param String $registration registration code of flight |
|
3199 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
3200 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
3201 | + * @param String $verticalrate vertival rate of flight |
|
3202 | + * @return String success or false |
|
3203 | + */ |
|
3204 | 3204 | 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 = '') |
3205 | 3205 | { |
3206 | 3206 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3414,8 +3414,8 @@ discard block |
||
3414 | 3414 | |
3415 | 3415 | if ($globalIVAO && $aircraft_icao != '') |
3416 | 3416 | { |
3417 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3418 | - else $airline_icao = ''; |
|
3417 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
3418 | + else $airline_icao = ''; |
|
3419 | 3419 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
3420 | 3420 | if (!isset($image_array[0]['registration'])) |
3421 | 3421 | { |
@@ -3446,52 +3446,52 @@ discard block |
||
3446 | 3446 | |
3447 | 3447 | if (count($airline_array) == 0) |
3448 | 3448 | { |
3449 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
3450 | - } |
|
3451 | - if (count($aircraft_array) == 0) |
|
3452 | - { |
|
3453 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3454 | - } |
|
3455 | - if (count($departure_airport_array) == 0) |
|
3456 | - { |
|
3457 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3458 | - } |
|
3459 | - if (count($arrival_airport_array) == 0) |
|
3460 | - { |
|
3461 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3462 | - } |
|
3463 | - if ($registration == '') $registration = 'NA'; |
|
3464 | - if ($latitude == '' && $longitude == '') { |
|
3465 | - $latitude = 0; |
|
3466 | - $longitude = 0; |
|
3467 | - } |
|
3468 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3469 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3470 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3471 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3472 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3473 | - $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) |
|
3449 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
3450 | + } |
|
3451 | + if (count($aircraft_array) == 0) |
|
3452 | + { |
|
3453 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
3454 | + } |
|
3455 | + if (count($departure_airport_array) == 0) |
|
3456 | + { |
|
3457 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
3458 | + } |
|
3459 | + if (count($arrival_airport_array) == 0) |
|
3460 | + { |
|
3461 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
3462 | + } |
|
3463 | + if ($registration == '') $registration = 'NA'; |
|
3464 | + if ($latitude == '' && $longitude == '') { |
|
3465 | + $latitude = 0; |
|
3466 | + $longitude = 0; |
|
3467 | + } |
|
3468 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
3469 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
3470 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
3471 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
3472 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
3473 | + $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) |
|
3474 | 3474 | 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)"; |
3475 | 3475 | |
3476 | - $airline_name = $airline_array[0]['name']; |
|
3477 | - $airline_icao = $airline_array[0]['icao']; |
|
3478 | - $airline_country = $airline_array[0]['country']; |
|
3479 | - $airline_type = $airline_array[0]['type']; |
|
3476 | + $airline_name = $airline_array[0]['name']; |
|
3477 | + $airline_icao = $airline_array[0]['icao']; |
|
3478 | + $airline_country = $airline_array[0]['country']; |
|
3479 | + $airline_type = $airline_array[0]['type']; |
|
3480 | 3480 | if ($airline_type == '') { |
3481 | 3481 | $timeelapsed = microtime(true); |
3482 | 3482 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
3483 | 3483 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
3484 | 3484 | } |
3485 | 3485 | if ($airline_type == null) $airline_type = ''; |
3486 | - $aircraft_type = $aircraft_array[0]['type']; |
|
3487 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3488 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
3489 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
3490 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
3491 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3492 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3493 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3494 | - $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); |
|
3486 | + $aircraft_type = $aircraft_array[0]['type']; |
|
3487 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
3488 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
3489 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
3490 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
3491 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
3492 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
3493 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
3494 | + $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); |
|
3495 | 3495 | |
3496 | 3496 | try { |
3497 | 3497 | |
@@ -3499,7 +3499,7 @@ discard block |
||
3499 | 3499 | $sth->execute($query_values); |
3500 | 3500 | $this->db = null; |
3501 | 3501 | } catch (PDOException $e) { |
3502 | - return "error : ".$e->getMessage(); |
|
3502 | + return "error : ".$e->getMessage(); |
|
3503 | 3503 | } |
3504 | 3504 | |
3505 | 3505 | return "success"; |
@@ -3508,11 +3508,11 @@ discard block |
||
3508 | 3508 | |
3509 | 3509 | |
3510 | 3510 | /** |
3511 | - * Gets the aircraft ident within the last hour |
|
3512 | - * |
|
3513 | - * @return String the ident |
|
3514 | - * |
|
3515 | - */ |
|
3511 | + * Gets the aircraft ident within the last hour |
|
3512 | + * |
|
3513 | + * @return String the ident |
|
3514 | + * |
|
3515 | + */ |
|
3516 | 3516 | public function getIdentFromLastHour($ident) |
3517 | 3517 | { |
3518 | 3518 | global $globalDBdriver, $globalTimezone; |
@@ -3528,11 +3528,11 @@ discard block |
||
3528 | 3528 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
3529 | 3529 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
3530 | 3530 | $query_data = array(':ident' => $ident); |
3531 | - } |
|
3531 | + } |
|
3532 | 3532 | |
3533 | 3533 | $sth = $this->db->prepare($query); |
3534 | 3534 | $sth->execute($query_data); |
3535 | - $ident_result=''; |
|
3535 | + $ident_result=''; |
|
3536 | 3536 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
3537 | 3537 | { |
3538 | 3538 | $ident_result = $row['ident']; |
@@ -3543,11 +3543,11 @@ discard block |
||
3543 | 3543 | |
3544 | 3544 | |
3545 | 3545 | /** |
3546 | - * Gets the aircraft data from the last 20 seconds |
|
3547 | - * |
|
3548 | - * @return Array the spotter data |
|
3549 | - * |
|
3550 | - */ |
|
3546 | + * Gets the aircraft data from the last 20 seconds |
|
3547 | + * |
|
3548 | + * @return Array the spotter data |
|
3549 | + * |
|
3550 | + */ |
|
3551 | 3551 | public function getRealTimeData($q = '') |
3552 | 3552 | { |
3553 | 3553 | global $globalDBdriver; |
@@ -3591,11 +3591,11 @@ discard block |
||
3591 | 3591 | |
3592 | 3592 | |
3593 | 3593 | /** |
3594 | - * Gets all airlines that have flown over |
|
3595 | - * |
|
3596 | - * @return Array the airline list |
|
3597 | - * |
|
3598 | - */ |
|
3594 | + * Gets all airlines that have flown over |
|
3595 | + * |
|
3596 | + * @return Array the airline list |
|
3597 | + * |
|
3598 | + */ |
|
3599 | 3599 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3600 | 3600 | { |
3601 | 3601 | global $globalDBdriver; |
@@ -3609,7 +3609,7 @@ discard block |
||
3609 | 3609 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3610 | 3610 | } |
3611 | 3611 | } |
3612 | - if ($sincedate != '') { |
|
3612 | + if ($sincedate != '') { |
|
3613 | 3613 | if ($globalDBdriver == 'mysql') { |
3614 | 3614 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3615 | 3615 | } else { |
@@ -3636,26 +3636,26 @@ discard block |
||
3636 | 3636 | } |
3637 | 3637 | |
3638 | 3638 | /** |
3639 | - * Gets all pilots that have flown over |
|
3640 | - * |
|
3641 | - * @return Array the pilots list |
|
3642 | - * |
|
3643 | - */ |
|
3639 | + * Gets all pilots that have flown over |
|
3640 | + * |
|
3641 | + * @return Array the pilots list |
|
3642 | + * |
|
3643 | + */ |
|
3644 | 3644 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3645 | 3645 | { |
3646 | 3646 | global $globalDBdriver; |
3647 | 3647 | $filter_query = $this->getFilter($filters,true,true); |
3648 | 3648 | $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
3649 | 3649 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
3650 | - if ($olderthanmonths > 0) { |
|
3651 | - if ($globalDBdriver == 'mysql') { |
|
3650 | + if ($olderthanmonths > 0) { |
|
3651 | + if ($globalDBdriver == 'mysql') { |
|
3652 | 3652 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3653 | 3653 | } else { |
3654 | 3654 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3655 | 3655 | } |
3656 | 3656 | } |
3657 | - if ($sincedate != '') { |
|
3658 | - if ($globalDBdriver == 'mysql') { |
|
3657 | + if ($sincedate != '') { |
|
3658 | + if ($globalDBdriver == 'mysql') { |
|
3659 | 3659 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3660 | 3660 | } else { |
3661 | 3661 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3682,25 +3682,25 @@ discard block |
||
3682 | 3682 | } |
3683 | 3683 | |
3684 | 3684 | /** |
3685 | - * Gets all pilots that have flown over |
|
3686 | - * |
|
3687 | - * @return Array the pilots list |
|
3688 | - * |
|
3689 | - */ |
|
3685 | + * Gets all pilots that have flown over |
|
3686 | + * |
|
3687 | + * @return Array the pilots list |
|
3688 | + * |
|
3689 | + */ |
|
3690 | 3690 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
3691 | 3691 | { |
3692 | 3692 | global $globalDBdriver; |
3693 | 3693 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count |
3694 | 3694 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
3695 | - if ($olderthanmonths > 0) { |
|
3696 | - if ($globalDBdriver == 'mysql') { |
|
3695 | + if ($olderthanmonths > 0) { |
|
3696 | + if ($globalDBdriver == 'mysql') { |
|
3697 | 3697 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3698 | 3698 | } else { |
3699 | 3699 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3700 | 3700 | } |
3701 | 3701 | } |
3702 | - if ($sincedate != '') { |
|
3703 | - if ($globalDBdriver == 'mysql') { |
|
3702 | + if ($sincedate != '') { |
|
3703 | + if ($globalDBdriver == 'mysql') { |
|
3704 | 3704 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3705 | 3705 | } else { |
3706 | 3706 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3728,26 +3728,26 @@ discard block |
||
3728 | 3728 | } |
3729 | 3729 | |
3730 | 3730 | /** |
3731 | - * Gets all owner that have flown over |
|
3732 | - * |
|
3733 | - * @return Array the pilots list |
|
3734 | - * |
|
3735 | - */ |
|
3731 | + * Gets all owner that have flown over |
|
3732 | + * |
|
3733 | + * @return Array the pilots list |
|
3734 | + * |
|
3735 | + */ |
|
3736 | 3736 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3737 | 3737 | { |
3738 | 3738 | global $globalDBdriver; |
3739 | 3739 | $filter_query = $this->getFilter($filters,true,true); |
3740 | 3740 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3741 | 3741 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3742 | - if ($olderthanmonths > 0) { |
|
3743 | - if ($globalDBdriver == 'mysql') { |
|
3742 | + if ($olderthanmonths > 0) { |
|
3743 | + if ($globalDBdriver == 'mysql') { |
|
3744 | 3744 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3745 | 3745 | } else { |
3746 | 3746 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3747 | 3747 | } |
3748 | 3748 | } |
3749 | - if ($sincedate != '') { |
|
3750 | - if ($globalDBdriver == 'mysql') { |
|
3749 | + if ($sincedate != '') { |
|
3750 | + if ($globalDBdriver == 'mysql') { |
|
3751 | 3751 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3752 | 3752 | } else { |
3753 | 3753 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3773,26 +3773,26 @@ discard block |
||
3773 | 3773 | } |
3774 | 3774 | |
3775 | 3775 | /** |
3776 | - * Gets all owner that have flown over |
|
3777 | - * |
|
3778 | - * @return Array the pilots list |
|
3779 | - * |
|
3780 | - */ |
|
3776 | + * Gets all owner that have flown over |
|
3777 | + * |
|
3778 | + * @return Array the pilots list |
|
3779 | + * |
|
3780 | + */ |
|
3781 | 3781 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
3782 | 3782 | { |
3783 | 3783 | global $globalDBdriver; |
3784 | 3784 | $filter_query = $this->getFilter($filters,true,true); |
3785 | 3785 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
3786 | 3786 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
3787 | - if ($olderthanmonths > 0) { |
|
3788 | - if ($globalDBdriver == 'mysql') { |
|
3787 | + if ($olderthanmonths > 0) { |
|
3788 | + if ($globalDBdriver == 'mysql') { |
|
3789 | 3789 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
3790 | 3790 | } else { |
3791 | 3791 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
3792 | 3792 | } |
3793 | 3793 | } |
3794 | - if ($sincedate != '') { |
|
3795 | - if ($globalDBdriver == 'mysql') { |
|
3794 | + if ($sincedate != '') { |
|
3795 | + if ($globalDBdriver == 'mysql') { |
|
3796 | 3796 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
3797 | 3797 | } else { |
3798 | 3798 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -3819,11 +3819,11 @@ discard block |
||
3819 | 3819 | } |
3820 | 3820 | |
3821 | 3821 | /** |
3822 | - * Gets all airlines that have flown over by aircraft |
|
3823 | - * |
|
3824 | - * @return Array the airline list |
|
3825 | - * |
|
3826 | - */ |
|
3822 | + * Gets all airlines that have flown over by aircraft |
|
3823 | + * |
|
3824 | + * @return Array the airline list |
|
3825 | + * |
|
3826 | + */ |
|
3827 | 3827 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
3828 | 3828 | { |
3829 | 3829 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3855,11 +3855,11 @@ discard block |
||
3855 | 3855 | |
3856 | 3856 | |
3857 | 3857 | /** |
3858 | - * Gets all airline countries that have flown over by aircraft |
|
3859 | - * |
|
3860 | - * @return Array the airline country list |
|
3861 | - * |
|
3862 | - */ |
|
3858 | + * Gets all airline countries that have flown over by aircraft |
|
3859 | + * |
|
3860 | + * @return Array the airline country list |
|
3861 | + * |
|
3862 | + */ |
|
3863 | 3863 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
3864 | 3864 | { |
3865 | 3865 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -3891,11 +3891,11 @@ discard block |
||
3891 | 3891 | |
3892 | 3892 | |
3893 | 3893 | /** |
3894 | - * Gets all airlines that have flown over by airport |
|
3895 | - * |
|
3896 | - * @return Array the airline list |
|
3897 | - * |
|
3898 | - */ |
|
3894 | + * Gets all airlines that have flown over by airport |
|
3895 | + * |
|
3896 | + * @return Array the airline list |
|
3897 | + * |
|
3898 | + */ |
|
3899 | 3899 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
3900 | 3900 | { |
3901 | 3901 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3926,11 +3926,11 @@ discard block |
||
3926 | 3926 | |
3927 | 3927 | |
3928 | 3928 | /** |
3929 | - * Gets all airline countries that have flown over by airport icao |
|
3930 | - * |
|
3931 | - * @return Array the airline country list |
|
3932 | - * |
|
3933 | - */ |
|
3929 | + * Gets all airline countries that have flown over by airport icao |
|
3930 | + * |
|
3931 | + * @return Array the airline country list |
|
3932 | + * |
|
3933 | + */ |
|
3934 | 3934 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
3935 | 3935 | { |
3936 | 3936 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -3960,11 +3960,11 @@ discard block |
||
3960 | 3960 | |
3961 | 3961 | |
3962 | 3962 | /** |
3963 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
3964 | - * |
|
3965 | - * @return Array the airline list |
|
3966 | - * |
|
3967 | - */ |
|
3963 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
3964 | + * |
|
3965 | + * @return Array the airline list |
|
3966 | + * |
|
3967 | + */ |
|
3968 | 3968 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
3969 | 3969 | { |
3970 | 3970 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -3995,11 +3995,11 @@ discard block |
||
3995 | 3995 | |
3996 | 3996 | |
3997 | 3997 | /** |
3998 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
3999 | - * |
|
4000 | - * @return Array the airline country list |
|
4001 | - * |
|
4002 | - */ |
|
3998 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
3999 | + * |
|
4000 | + * @return Array the airline country list |
|
4001 | + * |
|
4002 | + */ |
|
4003 | 4003 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
4004 | 4004 | { |
4005 | 4005 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4028,11 +4028,11 @@ discard block |
||
4028 | 4028 | |
4029 | 4029 | |
4030 | 4030 | /** |
4031 | - * Gets all airlines that have flown over by date |
|
4032 | - * |
|
4033 | - * @return Array the airline list |
|
4034 | - * |
|
4035 | - */ |
|
4031 | + * Gets all airlines that have flown over by date |
|
4032 | + * |
|
4033 | + * @return Array the airline list |
|
4034 | + * |
|
4035 | + */ |
|
4036 | 4036 | public function countAllAirlinesByDate($date,$filters = array()) |
4037 | 4037 | { |
4038 | 4038 | global $globalTimezone, $globalDBdriver; |
@@ -4076,11 +4076,11 @@ discard block |
||
4076 | 4076 | |
4077 | 4077 | |
4078 | 4078 | /** |
4079 | - * Gets all airline countries that have flown over by date |
|
4080 | - * |
|
4081 | - * @return Array the airline country list |
|
4082 | - * |
|
4083 | - */ |
|
4079 | + * Gets all airline countries that have flown over by date |
|
4080 | + * |
|
4081 | + * @return Array the airline country list |
|
4082 | + * |
|
4083 | + */ |
|
4084 | 4084 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
4085 | 4085 | { |
4086 | 4086 | global $globalTimezone, $globalDBdriver; |
@@ -4123,11 +4123,11 @@ discard block |
||
4123 | 4123 | |
4124 | 4124 | |
4125 | 4125 | /** |
4126 | - * Gets all airlines that have flown over by ident/callsign |
|
4127 | - * |
|
4128 | - * @return Array the airline list |
|
4129 | - * |
|
4130 | - */ |
|
4126 | + * Gets all airlines that have flown over by ident/callsign |
|
4127 | + * |
|
4128 | + * @return Array the airline list |
|
4129 | + * |
|
4130 | + */ |
|
4131 | 4131 | public function countAllAirlinesByIdent($ident,$filters = array()) |
4132 | 4132 | { |
4133 | 4133 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4157,11 +4157,11 @@ discard block |
||
4157 | 4157 | } |
4158 | 4158 | |
4159 | 4159 | /** |
4160 | - * Gets all airlines that have flown over by route |
|
4161 | - * |
|
4162 | - * @return Array the airline list |
|
4163 | - * |
|
4164 | - */ |
|
4160 | + * Gets all airlines that have flown over by route |
|
4161 | + * |
|
4162 | + * @return Array the airline list |
|
4163 | + * |
|
4164 | + */ |
|
4165 | 4165 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
4166 | 4166 | { |
4167 | 4167 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4193,11 +4193,11 @@ discard block |
||
4193 | 4193 | } |
4194 | 4194 | |
4195 | 4195 | /** |
4196 | - * Gets all airline countries that have flown over by route |
|
4197 | - * |
|
4198 | - * @return Array the airline country list |
|
4199 | - * |
|
4200 | - */ |
|
4196 | + * Gets all airline countries that have flown over by route |
|
4197 | + * |
|
4198 | + * @return Array the airline country list |
|
4199 | + * |
|
4200 | + */ |
|
4201 | 4201 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
4202 | 4202 | { |
4203 | 4203 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4229,11 +4229,11 @@ discard block |
||
4229 | 4229 | |
4230 | 4230 | |
4231 | 4231 | /** |
4232 | - * Gets all airlines that have flown over by country |
|
4233 | - * |
|
4234 | - * @return Array the airline list |
|
4235 | - * |
|
4236 | - */ |
|
4232 | + * Gets all airlines that have flown over by country |
|
4233 | + * |
|
4234 | + * @return Array the airline list |
|
4235 | + * |
|
4236 | + */ |
|
4237 | 4237 | public function countAllAirlinesByCountry($country,$filters = array()) |
4238 | 4238 | { |
4239 | 4239 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4263,11 +4263,11 @@ discard block |
||
4263 | 4263 | |
4264 | 4264 | |
4265 | 4265 | /** |
4266 | - * Gets all airline countries that have flown over by country |
|
4267 | - * |
|
4268 | - * @return Array the airline country list |
|
4269 | - * |
|
4270 | - */ |
|
4266 | + * Gets all airline countries that have flown over by country |
|
4267 | + * |
|
4268 | + * @return Array the airline country list |
|
4269 | + * |
|
4270 | + */ |
|
4271 | 4271 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
4272 | 4272 | { |
4273 | 4273 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4296,11 +4296,11 @@ discard block |
||
4296 | 4296 | |
4297 | 4297 | |
4298 | 4298 | /** |
4299 | - * Gets all airlines countries |
|
4300 | - * |
|
4301 | - * @return Array the airline country list |
|
4302 | - * |
|
4303 | - */ |
|
4299 | + * Gets all airlines countries |
|
4300 | + * |
|
4301 | + * @return Array the airline country list |
|
4302 | + * |
|
4303 | + */ |
|
4304 | 4304 | public function countAllAirlineCountries($limit = true, $filters = array()) |
4305 | 4305 | { |
4306 | 4306 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4326,11 +4326,11 @@ discard block |
||
4326 | 4326 | } |
4327 | 4327 | |
4328 | 4328 | /** |
4329 | - * Gets all number of flight over countries |
|
4330 | - * |
|
4331 | - * @return Array the airline country list |
|
4332 | - * |
|
4333 | - */ |
|
4329 | + * Gets all number of flight over countries |
|
4330 | + * |
|
4331 | + * @return Array the airline country list |
|
4332 | + * |
|
4333 | + */ |
|
4334 | 4334 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
4335 | 4335 | { |
4336 | 4336 | global $globalDBdriver; |
@@ -4345,15 +4345,15 @@ discard block |
||
4345 | 4345 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
4346 | 4346 | FROM countries c, spotter_live s |
4347 | 4347 | WHERE c.iso2 = s.over_country "; |
4348 | - if ($olderthanmonths > 0) { |
|
4348 | + if ($olderthanmonths > 0) { |
|
4349 | 4349 | if ($globalDBdriver == 'mysql') { |
4350 | 4350 | $query .= 'AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
4351 | 4351 | } else { |
4352 | 4352 | $query .= "AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
4353 | 4353 | } |
4354 | 4354 | } |
4355 | - if ($sincedate != '') { |
|
4356 | - if ($globalDBdriver == 'mysql') { |
|
4355 | + if ($sincedate != '') { |
|
4356 | + if ($globalDBdriver == 'mysql') { |
|
4357 | 4357 | $query .= "AND spotter_live.date > '".$sincedate."' "; |
4358 | 4358 | } else { |
4359 | 4359 | $query .= "AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4383,11 +4383,11 @@ discard block |
||
4383 | 4383 | |
4384 | 4384 | |
4385 | 4385 | /** |
4386 | - * Gets all aircraft types that have flown over |
|
4387 | - * |
|
4388 | - * @return Array the aircraft list |
|
4389 | - * |
|
4390 | - */ |
|
4386 | + * Gets all aircraft types that have flown over |
|
4387 | + * |
|
4388 | + * @return Array the aircraft list |
|
4389 | + * |
|
4390 | + */ |
|
4391 | 4391 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4392 | 4392 | { |
4393 | 4393 | global $globalDBdriver; |
@@ -4430,11 +4430,11 @@ discard block |
||
4430 | 4430 | } |
4431 | 4431 | |
4432 | 4432 | /** |
4433 | - * Gets all aircraft types that have flown over by airline |
|
4434 | - * |
|
4435 | - * @return Array the aircraft list |
|
4436 | - * |
|
4437 | - */ |
|
4433 | + * Gets all aircraft types that have flown over by airline |
|
4434 | + * |
|
4435 | + * @return Array the aircraft list |
|
4436 | + * |
|
4437 | + */ |
|
4438 | 4438 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
4439 | 4439 | { |
4440 | 4440 | global $globalDBdriver; |
@@ -4478,11 +4478,11 @@ discard block |
||
4478 | 4478 | |
4479 | 4479 | |
4480 | 4480 | /** |
4481 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
4482 | - * |
|
4483 | - * @return Array the aircraft list |
|
4484 | - * |
|
4485 | - */ |
|
4481 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
4482 | + * |
|
4483 | + * @return Array the aircraft list |
|
4484 | + * |
|
4485 | + */ |
|
4486 | 4486 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
4487 | 4487 | { |
4488 | 4488 | $Image = new Image($this->db); |
@@ -4521,11 +4521,11 @@ discard block |
||
4521 | 4521 | |
4522 | 4522 | |
4523 | 4523 | /** |
4524 | - * Gets all aircraft types that have flown over by airline icao |
|
4525 | - * |
|
4526 | - * @return Array the aircraft list |
|
4527 | - * |
|
4528 | - */ |
|
4524 | + * Gets all aircraft types that have flown over by airline icao |
|
4525 | + * |
|
4526 | + * @return Array the aircraft list |
|
4527 | + * |
|
4528 | + */ |
|
4529 | 4529 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
4530 | 4530 | { |
4531 | 4531 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4554,11 +4554,11 @@ discard block |
||
4554 | 4554 | |
4555 | 4555 | |
4556 | 4556 | /** |
4557 | - * Gets all aircraft registration that have flown over by airline icao |
|
4558 | - * |
|
4559 | - * @return Array the aircraft list |
|
4560 | - * |
|
4561 | - */ |
|
4557 | + * Gets all aircraft registration that have flown over by airline icao |
|
4558 | + * |
|
4559 | + * @return Array the aircraft list |
|
4560 | + * |
|
4561 | + */ |
|
4562 | 4562 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
4563 | 4563 | { |
4564 | 4564 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4596,11 +4596,11 @@ discard block |
||
4596 | 4596 | |
4597 | 4597 | |
4598 | 4598 | /** |
4599 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
4600 | - * |
|
4601 | - * @return Array the aircraft list |
|
4602 | - * |
|
4603 | - */ |
|
4599 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
4600 | + * |
|
4601 | + * @return Array the aircraft list |
|
4602 | + * |
|
4603 | + */ |
|
4604 | 4604 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
4605 | 4605 | { |
4606 | 4606 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4628,11 +4628,11 @@ discard block |
||
4628 | 4628 | |
4629 | 4629 | |
4630 | 4630 | /** |
4631 | - * Gets all aircraft types that have flown over by airline icao |
|
4632 | - * |
|
4633 | - * @return Array the aircraft list |
|
4634 | - * |
|
4635 | - */ |
|
4631 | + * Gets all aircraft types that have flown over by airline icao |
|
4632 | + * |
|
4633 | + * @return Array the aircraft list |
|
4634 | + * |
|
4635 | + */ |
|
4636 | 4636 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
4637 | 4637 | { |
4638 | 4638 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4661,11 +4661,11 @@ discard block |
||
4661 | 4661 | |
4662 | 4662 | |
4663 | 4663 | /** |
4664 | - * Gets all aircraft registration that have flown over by airport icao |
|
4665 | - * |
|
4666 | - * @return Array the aircraft list |
|
4667 | - * |
|
4668 | - */ |
|
4664 | + * Gets all aircraft registration that have flown over by airport icao |
|
4665 | + * |
|
4666 | + * @return Array the aircraft list |
|
4667 | + * |
|
4668 | + */ |
|
4669 | 4669 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
4670 | 4670 | { |
4671 | 4671 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4702,11 +4702,11 @@ discard block |
||
4702 | 4702 | |
4703 | 4703 | |
4704 | 4704 | /** |
4705 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
4706 | - * |
|
4707 | - * @return Array the aircraft list |
|
4708 | - * |
|
4709 | - */ |
|
4705 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
4706 | + * |
|
4707 | + * @return Array the aircraft list |
|
4708 | + * |
|
4709 | + */ |
|
4710 | 4710 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
4711 | 4711 | { |
4712 | 4712 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4732,11 +4732,11 @@ discard block |
||
4732 | 4732 | } |
4733 | 4733 | |
4734 | 4734 | /** |
4735 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4736 | - * |
|
4737 | - * @return Array the aircraft list |
|
4738 | - * |
|
4739 | - */ |
|
4735 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
4736 | + * |
|
4737 | + * @return Array the aircraft list |
|
4738 | + * |
|
4739 | + */ |
|
4740 | 4740 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
4741 | 4741 | { |
4742 | 4742 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4763,11 +4763,11 @@ discard block |
||
4763 | 4763 | |
4764 | 4764 | |
4765 | 4765 | /** |
4766 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4767 | - * |
|
4768 | - * @return Array the aircraft list |
|
4769 | - * |
|
4770 | - */ |
|
4766 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
4767 | + * |
|
4768 | + * @return Array the aircraft list |
|
4769 | + * |
|
4770 | + */ |
|
4771 | 4771 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
4772 | 4772 | { |
4773 | 4773 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4803,11 +4803,11 @@ discard block |
||
4803 | 4803 | } |
4804 | 4804 | |
4805 | 4805 | /** |
4806 | - * Gets all aircraft types that have flown over by date |
|
4807 | - * |
|
4808 | - * @return Array the aircraft list |
|
4809 | - * |
|
4810 | - */ |
|
4806 | + * Gets all aircraft types that have flown over by date |
|
4807 | + * |
|
4808 | + * @return Array the aircraft list |
|
4809 | + * |
|
4810 | + */ |
|
4811 | 4811 | public function countAllAircraftTypesByDate($date,$filters = array()) |
4812 | 4812 | { |
4813 | 4813 | global $globalTimezone, $globalDBdriver; |
@@ -4849,11 +4849,11 @@ discard block |
||
4849 | 4849 | |
4850 | 4850 | |
4851 | 4851 | /** |
4852 | - * Gets all aircraft registration that have flown over by date |
|
4853 | - * |
|
4854 | - * @return Array the aircraft list |
|
4855 | - * |
|
4856 | - */ |
|
4852 | + * Gets all aircraft registration that have flown over by date |
|
4853 | + * |
|
4854 | + * @return Array the aircraft list |
|
4855 | + * |
|
4856 | + */ |
|
4857 | 4857 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
4858 | 4858 | { |
4859 | 4859 | global $globalTimezone, $globalDBdriver; |
@@ -4904,11 +4904,11 @@ discard block |
||
4904 | 4904 | |
4905 | 4905 | |
4906 | 4906 | /** |
4907 | - * Gets all aircraft manufacturer that have flown over by date |
|
4908 | - * |
|
4909 | - * @return Array the aircraft manufacturer list |
|
4910 | - * |
|
4911 | - */ |
|
4907 | + * Gets all aircraft manufacturer that have flown over by date |
|
4908 | + * |
|
4909 | + * @return Array the aircraft manufacturer list |
|
4910 | + * |
|
4911 | + */ |
|
4912 | 4912 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
4913 | 4913 | { |
4914 | 4914 | global $globalTimezone, $globalDBdriver; |
@@ -4950,11 +4950,11 @@ discard block |
||
4950 | 4950 | |
4951 | 4951 | |
4952 | 4952 | /** |
4953 | - * Gets all aircraft types that have flown over by ident/callsign |
|
4954 | - * |
|
4955 | - * @return Array the aircraft list |
|
4956 | - * |
|
4957 | - */ |
|
4953 | + * Gets all aircraft types that have flown over by ident/callsign |
|
4954 | + * |
|
4955 | + * @return Array the aircraft list |
|
4956 | + * |
|
4957 | + */ |
|
4958 | 4958 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
4959 | 4959 | { |
4960 | 4960 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4983,11 +4983,11 @@ discard block |
||
4983 | 4983 | |
4984 | 4984 | |
4985 | 4985 | /** |
4986 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
4987 | - * |
|
4988 | - * @return Array the aircraft list |
|
4989 | - * |
|
4990 | - */ |
|
4986 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
4987 | + * |
|
4988 | + * @return Array the aircraft list |
|
4989 | + * |
|
4990 | + */ |
|
4991 | 4991 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
4992 | 4992 | { |
4993 | 4993 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5027,11 +5027,11 @@ discard block |
||
5027 | 5027 | |
5028 | 5028 | |
5029 | 5029 | /** |
5030 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5031 | - * |
|
5032 | - * @return Array the aircraft manufacturer list |
|
5033 | - * |
|
5034 | - */ |
|
5030 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
5031 | + * |
|
5032 | + * @return Array the aircraft manufacturer list |
|
5033 | + * |
|
5034 | + */ |
|
5035 | 5035 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
5036 | 5036 | { |
5037 | 5037 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5057,11 +5057,11 @@ discard block |
||
5057 | 5057 | |
5058 | 5058 | |
5059 | 5059 | /** |
5060 | - * Gets all aircraft types that have flown over by route |
|
5061 | - * |
|
5062 | - * @return Array the aircraft list |
|
5063 | - * |
|
5064 | - */ |
|
5060 | + * Gets all aircraft types that have flown over by route |
|
5061 | + * |
|
5062 | + * @return Array the aircraft list |
|
5063 | + * |
|
5064 | + */ |
|
5065 | 5065 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5066 | 5066 | { |
5067 | 5067 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5090,11 +5090,11 @@ discard block |
||
5090 | 5090 | } |
5091 | 5091 | |
5092 | 5092 | /** |
5093 | - * Gets all aircraft registration that have flown over by route |
|
5094 | - * |
|
5095 | - * @return Array the aircraft list |
|
5096 | - * |
|
5097 | - */ |
|
5093 | + * Gets all aircraft registration that have flown over by route |
|
5094 | + * |
|
5095 | + * @return Array the aircraft list |
|
5096 | + * |
|
5097 | + */ |
|
5098 | 5098 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5099 | 5099 | { |
5100 | 5100 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5136,11 +5136,11 @@ discard block |
||
5136 | 5136 | |
5137 | 5137 | |
5138 | 5138 | /** |
5139 | - * Gets all aircraft manufacturer that have flown over by route |
|
5140 | - * |
|
5141 | - * @return Array the aircraft manufacturer list |
|
5142 | - * |
|
5143 | - */ |
|
5139 | + * Gets all aircraft manufacturer that have flown over by route |
|
5140 | + * |
|
5141 | + * @return Array the aircraft manufacturer list |
|
5142 | + * |
|
5143 | + */ |
|
5144 | 5144 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
5145 | 5145 | { |
5146 | 5146 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5174,11 +5174,11 @@ discard block |
||
5174 | 5174 | |
5175 | 5175 | |
5176 | 5176 | /** |
5177 | - * Gets all aircraft types that have flown over by country |
|
5178 | - * |
|
5179 | - * @return Array the aircraft list |
|
5180 | - * |
|
5181 | - */ |
|
5177 | + * Gets all aircraft types that have flown over by country |
|
5178 | + * |
|
5179 | + * @return Array the aircraft list |
|
5180 | + * |
|
5181 | + */ |
|
5182 | 5182 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
5183 | 5183 | { |
5184 | 5184 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5209,11 +5209,11 @@ discard block |
||
5209 | 5209 | |
5210 | 5210 | |
5211 | 5211 | /** |
5212 | - * Gets all aircraft registration that have flown over by country |
|
5213 | - * |
|
5214 | - * @return Array the aircraft list |
|
5215 | - * |
|
5216 | - */ |
|
5212 | + * Gets all aircraft registration that have flown over by country |
|
5213 | + * |
|
5214 | + * @return Array the aircraft list |
|
5215 | + * |
|
5216 | + */ |
|
5217 | 5217 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
5218 | 5218 | { |
5219 | 5219 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5253,11 +5253,11 @@ discard block |
||
5253 | 5253 | |
5254 | 5254 | |
5255 | 5255 | /** |
5256 | - * Gets all aircraft manufacturer that have flown over by country |
|
5257 | - * |
|
5258 | - * @return Array the aircraft manufacturer list |
|
5259 | - * |
|
5260 | - */ |
|
5256 | + * Gets all aircraft manufacturer that have flown over by country |
|
5257 | + * |
|
5258 | + * @return Array the aircraft manufacturer list |
|
5259 | + * |
|
5260 | + */ |
|
5261 | 5261 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
5262 | 5262 | { |
5263 | 5263 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5288,17 +5288,17 @@ discard block |
||
5288 | 5288 | |
5289 | 5289 | |
5290 | 5290 | /** |
5291 | - * Gets all aircraft manufacturers that have flown over |
|
5292 | - * |
|
5293 | - * @return Array the aircraft list |
|
5294 | - * |
|
5295 | - */ |
|
5291 | + * Gets all aircraft manufacturers that have flown over |
|
5292 | + * |
|
5293 | + * @return Array the aircraft list |
|
5294 | + * |
|
5295 | + */ |
|
5296 | 5296 | public function countAllAircraftManufacturers($filters = array()) |
5297 | 5297 | { |
5298 | 5298 | $filter_query = $this->getFilter($filters,true,true); |
5299 | 5299 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
5300 | 5300 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
5301 | - $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5301 | + $query .= " GROUP BY spotter_output.aircraft_manufacturer |
|
5302 | 5302 | ORDER BY aircraft_manufacturer_count DESC |
5303 | 5303 | LIMIT 10"; |
5304 | 5304 | |
@@ -5323,11 +5323,11 @@ discard block |
||
5323 | 5323 | |
5324 | 5324 | |
5325 | 5325 | /** |
5326 | - * Gets all aircraft registrations that have flown over |
|
5327 | - * |
|
5328 | - * @return Array the aircraft list |
|
5329 | - * |
|
5330 | - */ |
|
5326 | + * Gets all aircraft registrations that have flown over |
|
5327 | + * |
|
5328 | + * @return Array the aircraft list |
|
5329 | + * |
|
5330 | + */ |
|
5331 | 5331 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5332 | 5332 | { |
5333 | 5333 | global $globalDBdriver; |
@@ -5335,15 +5335,15 @@ discard block |
||
5335 | 5335 | $filter_query = $this->getFilter($filters,true,true); |
5336 | 5336 | $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 |
5337 | 5337 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
5338 | - if ($olderthanmonths > 0) { |
|
5339 | - if ($globalDBdriver == 'mysql') { |
|
5338 | + if ($olderthanmonths > 0) { |
|
5339 | + if ($globalDBdriver == 'mysql') { |
|
5340 | 5340 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5341 | 5341 | } else { |
5342 | 5342 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5343 | 5343 | } |
5344 | 5344 | } |
5345 | - if ($sincedate != '') { |
|
5346 | - if ($globalDBdriver == 'mysql') { |
|
5345 | + if ($sincedate != '') { |
|
5346 | + if ($globalDBdriver == 'mysql') { |
|
5347 | 5347 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5348 | 5348 | } else { |
5349 | 5349 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5352,7 +5352,7 @@ discard block |
||
5352 | 5352 | |
5353 | 5353 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5354 | 5354 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5355 | - $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5355 | + $query .= " GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
5356 | 5356 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5357 | 5357 | |
5358 | 5358 | $sth = $this->db->prepare($query); |
@@ -5383,11 +5383,11 @@ discard block |
||
5383 | 5383 | |
5384 | 5384 | |
5385 | 5385 | /** |
5386 | - * Gets all aircraft registrations that have flown over |
|
5387 | - * |
|
5388 | - * @return Array the aircraft list |
|
5389 | - * |
|
5390 | - */ |
|
5386 | + * Gets all aircraft registrations that have flown over |
|
5387 | + * |
|
5388 | + * @return Array the aircraft list |
|
5389 | + * |
|
5390 | + */ |
|
5391 | 5391 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
5392 | 5392 | { |
5393 | 5393 | global $globalDBdriver; |
@@ -5395,15 +5395,15 @@ discard block |
||
5395 | 5395 | $Image = new Image($this->db); |
5396 | 5396 | $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 |
5397 | 5397 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
5398 | - if ($olderthanmonths > 0) { |
|
5399 | - if ($globalDBdriver == 'mysql') { |
|
5398 | + if ($olderthanmonths > 0) { |
|
5399 | + if ($globalDBdriver == 'mysql') { |
|
5400 | 5400 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5401 | 5401 | } else { |
5402 | 5402 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5403 | 5403 | } |
5404 | 5404 | } |
5405 | - if ($sincedate != '') { |
|
5406 | - if ($globalDBdriver == 'mysql') { |
|
5405 | + if ($sincedate != '') { |
|
5406 | + if ($globalDBdriver == 'mysql') { |
|
5407 | 5407 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5408 | 5408 | } else { |
5409 | 5409 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5412,7 +5412,7 @@ discard block |
||
5412 | 5412 | |
5413 | 5413 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
5414 | 5414 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
5415 | - $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"; |
|
5415 | + $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"; |
|
5416 | 5416 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5417 | 5417 | |
5418 | 5418 | $sth = $this->db->prepare($query); |
@@ -5444,35 +5444,35 @@ discard block |
||
5444 | 5444 | |
5445 | 5445 | |
5446 | 5446 | /** |
5447 | - * Gets all departure airports of the airplanes that have flown over |
|
5448 | - * |
|
5449 | - * @return Array the airport list |
|
5450 | - * |
|
5451 | - */ |
|
5447 | + * Gets all departure airports of the airplanes that have flown over |
|
5448 | + * |
|
5449 | + * @return Array the airport list |
|
5450 | + * |
|
5451 | + */ |
|
5452 | 5452 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5453 | 5453 | { |
5454 | 5454 | global $globalDBdriver; |
5455 | 5455 | $filter_query = $this->getFilter($filters,true,true); |
5456 | 5456 | $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 |
5457 | 5457 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
5458 | - if ($olderthanmonths > 0) { |
|
5459 | - if ($globalDBdriver == 'mysql') { |
|
5458 | + if ($olderthanmonths > 0) { |
|
5459 | + if ($globalDBdriver == 'mysql') { |
|
5460 | 5460 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5461 | 5461 | } else { |
5462 | 5462 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5463 | 5463 | } |
5464 | - } |
|
5465 | - if ($sincedate != '') { |
|
5466 | - if ($globalDBdriver == 'mysql') { |
|
5464 | + } |
|
5465 | + if ($sincedate != '') { |
|
5466 | + if ($globalDBdriver == 'mysql') { |
|
5467 | 5467 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5468 | 5468 | } else { |
5469 | 5469 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5470 | 5470 | } |
5471 | 5471 | } |
5472 | 5472 | |
5473 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5474 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5475 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5473 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5474 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5475 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
5476 | 5476 | ORDER BY airport_departure_icao_count DESC"; |
5477 | 5477 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5478 | 5478 | |
@@ -5496,35 +5496,35 @@ discard block |
||
5496 | 5496 | } |
5497 | 5497 | |
5498 | 5498 | /** |
5499 | - * Gets all departure airports of the airplanes that have flown over |
|
5500 | - * |
|
5501 | - * @return Array the airport list |
|
5502 | - * |
|
5503 | - */ |
|
5499 | + * Gets all departure airports of the airplanes that have flown over |
|
5500 | + * |
|
5501 | + * @return Array the airport list |
|
5502 | + * |
|
5503 | + */ |
|
5504 | 5504 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5505 | 5505 | { |
5506 | 5506 | global $globalDBdriver; |
5507 | 5507 | $filter_query = $this->getFilter($filters,true,true); |
5508 | 5508 | $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 |
5509 | 5509 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
5510 | - if ($olderthanmonths > 0) { |
|
5511 | - if ($globalDBdriver == 'mysql') { |
|
5510 | + if ($olderthanmonths > 0) { |
|
5511 | + if ($globalDBdriver == 'mysql') { |
|
5512 | 5512 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5513 | 5513 | } else { |
5514 | 5514 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5515 | 5515 | } |
5516 | - } |
|
5517 | - if ($sincedate != '') { |
|
5518 | - if ($globalDBdriver == 'mysql') { |
|
5516 | + } |
|
5517 | + if ($sincedate != '') { |
|
5518 | + if ($globalDBdriver == 'mysql') { |
|
5519 | 5519 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5520 | 5520 | } else { |
5521 | 5521 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5522 | 5522 | } |
5523 | 5523 | } |
5524 | 5524 | |
5525 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5526 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5527 | - $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 |
|
5525 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5526 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5527 | + $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 |
|
5528 | 5528 | ORDER BY airport_departure_icao_count DESC"; |
5529 | 5529 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5530 | 5530 | |
@@ -5549,37 +5549,37 @@ discard block |
||
5549 | 5549 | } |
5550 | 5550 | |
5551 | 5551 | /** |
5552 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5553 | - * |
|
5554 | - * @return Array the airport list |
|
5555 | - * |
|
5556 | - */ |
|
5552 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5553 | + * |
|
5554 | + * @return Array the airport list |
|
5555 | + * |
|
5556 | + */ |
|
5557 | 5557 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5558 | 5558 | { |
5559 | 5559 | global $globalDBdriver; |
5560 | 5560 | $filter_query = $this->getFilter($filters,true,true); |
5561 | 5561 | $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 |
5562 | 5562 | 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"; |
5563 | - if ($olderthanmonths > 0) { |
|
5564 | - if ($globalDBdriver == 'mysql') { |
|
5563 | + if ($olderthanmonths > 0) { |
|
5564 | + if ($globalDBdriver == 'mysql') { |
|
5565 | 5565 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
5566 | 5566 | } else { |
5567 | 5567 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
5568 | 5568 | } |
5569 | - } |
|
5570 | - if ($sincedate != '') { |
|
5571 | - if ($globalDBdriver == 'mysql') { |
|
5569 | + } |
|
5570 | + if ($sincedate != '') { |
|
5571 | + if ($globalDBdriver == 'mysql') { |
|
5572 | 5572 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
5573 | 5573 | } else { |
5574 | 5574 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
5575 | 5575 | } |
5576 | 5576 | } |
5577 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5578 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5579 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5577 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5578 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5579 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5580 | 5580 | ORDER BY airport_departure_icao_count DESC"; |
5581 | 5581 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5582 | - //echo $query; |
|
5582 | + //echo $query; |
|
5583 | 5583 | $sth = $this->db->prepare($query); |
5584 | 5584 | $sth->execute(); |
5585 | 5585 | |
@@ -5600,35 +5600,35 @@ discard block |
||
5600 | 5600 | } |
5601 | 5601 | |
5602 | 5602 | /** |
5603 | - * Gets all detected departure airports of the airplanes that have flown over |
|
5604 | - * |
|
5605 | - * @return Array the airport list |
|
5606 | - * |
|
5607 | - */ |
|
5603 | + * Gets all detected departure airports of the airplanes that have flown over |
|
5604 | + * |
|
5605 | + * @return Array the airport list |
|
5606 | + * |
|
5607 | + */ |
|
5608 | 5608 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
5609 | 5609 | { |
5610 | 5610 | global $globalDBdriver; |
5611 | 5611 | $filter_query = $this->getFilter($filters,true,true); |
5612 | 5612 | $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 |
5613 | 5613 | 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 "; |
5614 | - if ($olderthanmonths > 0) { |
|
5615 | - if ($globalDBdriver == 'mysql') { |
|
5614 | + if ($olderthanmonths > 0) { |
|
5615 | + if ($globalDBdriver == 'mysql') { |
|
5616 | 5616 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
5617 | 5617 | } else { |
5618 | 5618 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
5619 | 5619 | } |
5620 | - } |
|
5621 | - if ($sincedate != '') { |
|
5622 | - if ($globalDBdriver == 'mysql') { |
|
5620 | + } |
|
5621 | + if ($sincedate != '') { |
|
5622 | + if ($globalDBdriver == 'mysql') { |
|
5623 | 5623 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
5624 | 5624 | } else { |
5625 | 5625 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
5626 | 5626 | } |
5627 | 5627 | } |
5628 | 5628 | |
5629 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5630 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5631 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5629 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
5630 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
5631 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
5632 | 5632 | ORDER BY airport_departure_icao_count DESC"; |
5633 | 5633 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
5634 | 5634 | |
@@ -5653,11 +5653,11 @@ discard block |
||
5653 | 5653 | } |
5654 | 5654 | |
5655 | 5655 | /** |
5656 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5657 | - * |
|
5658 | - * @return Array the airport list |
|
5659 | - * |
|
5660 | - */ |
|
5656 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
5657 | + * |
|
5658 | + * @return Array the airport list |
|
5659 | + * |
|
5660 | + */ |
|
5661 | 5661 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
5662 | 5662 | { |
5663 | 5663 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5691,11 +5691,11 @@ discard block |
||
5691 | 5691 | |
5692 | 5692 | |
5693 | 5693 | /** |
5694 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5695 | - * |
|
5696 | - * @return Array the airport list |
|
5697 | - * |
|
5698 | - */ |
|
5694 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
5695 | + * |
|
5696 | + * @return Array the airport list |
|
5697 | + * |
|
5698 | + */ |
|
5699 | 5699 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
5700 | 5700 | { |
5701 | 5701 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5726,11 +5726,11 @@ discard block |
||
5726 | 5726 | |
5727 | 5727 | |
5728 | 5728 | /** |
5729 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5730 | - * |
|
5731 | - * @return Array the airport list |
|
5732 | - * |
|
5733 | - */ |
|
5729 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
5730 | + * |
|
5731 | + * @return Array the airport list |
|
5732 | + * |
|
5733 | + */ |
|
5734 | 5734 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
5735 | 5735 | { |
5736 | 5736 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5763,11 +5763,11 @@ discard block |
||
5763 | 5763 | |
5764 | 5764 | |
5765 | 5765 | /** |
5766 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5767 | - * |
|
5768 | - * @return Array the airport list |
|
5769 | - * |
|
5770 | - */ |
|
5766 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
5767 | + * |
|
5768 | + * @return Array the airport list |
|
5769 | + * |
|
5770 | + */ |
|
5771 | 5771 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
5772 | 5772 | { |
5773 | 5773 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5797,11 +5797,11 @@ discard block |
||
5797 | 5797 | |
5798 | 5798 | |
5799 | 5799 | /** |
5800 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5801 | - * |
|
5802 | - * @return Array the airport list |
|
5803 | - * |
|
5804 | - */ |
|
5800 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
5801 | + * |
|
5802 | + * @return Array the airport list |
|
5803 | + * |
|
5804 | + */ |
|
5805 | 5805 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
5806 | 5806 | { |
5807 | 5807 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5834,11 +5834,11 @@ discard block |
||
5834 | 5834 | |
5835 | 5835 | |
5836 | 5836 | /** |
5837 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5838 | - * |
|
5839 | - * @return Array the airport list |
|
5840 | - * |
|
5841 | - */ |
|
5837 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
5838 | + * |
|
5839 | + * @return Array the airport list |
|
5840 | + * |
|
5841 | + */ |
|
5842 | 5842 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
5843 | 5843 | { |
5844 | 5844 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5868,11 +5868,11 @@ discard block |
||
5868 | 5868 | |
5869 | 5869 | |
5870 | 5870 | /** |
5871 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
5872 | - * |
|
5873 | - * @return Array the airport list |
|
5874 | - * |
|
5875 | - */ |
|
5871 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
5872 | + * |
|
5873 | + * @return Array the airport list |
|
5874 | + * |
|
5875 | + */ |
|
5876 | 5876 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
5877 | 5877 | { |
5878 | 5878 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5905,11 +5905,11 @@ discard block |
||
5905 | 5905 | |
5906 | 5906 | |
5907 | 5907 | /** |
5908 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
5909 | - * |
|
5910 | - * @return Array the airport list |
|
5911 | - * |
|
5912 | - */ |
|
5908 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
5909 | + * |
|
5910 | + * @return Array the airport list |
|
5911 | + * |
|
5912 | + */ |
|
5913 | 5913 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
5914 | 5914 | { |
5915 | 5915 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5940,11 +5940,11 @@ discard block |
||
5940 | 5940 | |
5941 | 5941 | |
5942 | 5942 | /** |
5943 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
5944 | - * |
|
5945 | - * @return Array the airport list |
|
5946 | - * |
|
5947 | - */ |
|
5943 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
5944 | + * |
|
5945 | + * @return Array the airport list |
|
5946 | + * |
|
5947 | + */ |
|
5948 | 5948 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
5949 | 5949 | { |
5950 | 5950 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5977,11 +5977,11 @@ discard block |
||
5977 | 5977 | |
5978 | 5978 | |
5979 | 5979 | /** |
5980 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
5981 | - * |
|
5982 | - * @return Array the airport list |
|
5983 | - * |
|
5984 | - */ |
|
5980 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
5981 | + * |
|
5982 | + * @return Array the airport list |
|
5983 | + * |
|
5984 | + */ |
|
5985 | 5985 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
5986 | 5986 | { |
5987 | 5987 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6011,11 +6011,11 @@ discard block |
||
6011 | 6011 | |
6012 | 6012 | |
6013 | 6013 | /** |
6014 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
6015 | - * |
|
6016 | - * @return Array the airport list |
|
6017 | - * |
|
6018 | - */ |
|
6014 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
6015 | + * |
|
6016 | + * @return Array the airport list |
|
6017 | + * |
|
6018 | + */ |
|
6019 | 6019 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
6020 | 6020 | { |
6021 | 6021 | global $globalTimezone, $globalDBdriver; |
@@ -6061,11 +6061,11 @@ discard block |
||
6061 | 6061 | |
6062 | 6062 | |
6063 | 6063 | /** |
6064 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6065 | - * |
|
6066 | - * @return Array the airport list |
|
6067 | - * |
|
6068 | - */ |
|
6064 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
6065 | + * |
|
6066 | + * @return Array the airport list |
|
6067 | + * |
|
6068 | + */ |
|
6069 | 6069 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
6070 | 6070 | { |
6071 | 6071 | global $globalTimezone, $globalDBdriver; |
@@ -6108,11 +6108,11 @@ discard block |
||
6108 | 6108 | |
6109 | 6109 | |
6110 | 6110 | /** |
6111 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6112 | - * |
|
6113 | - * @return Array the airport list |
|
6114 | - * |
|
6115 | - */ |
|
6111 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
6112 | + * |
|
6113 | + * @return Array the airport list |
|
6114 | + * |
|
6115 | + */ |
|
6116 | 6116 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
6117 | 6117 | { |
6118 | 6118 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6146,11 +6146,11 @@ discard block |
||
6146 | 6146 | |
6147 | 6147 | |
6148 | 6148 | /** |
6149 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6150 | - * |
|
6151 | - * @return Array the airport list |
|
6152 | - * |
|
6153 | - */ |
|
6149 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
6150 | + * |
|
6151 | + * @return Array the airport list |
|
6152 | + * |
|
6153 | + */ |
|
6154 | 6154 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
6155 | 6155 | { |
6156 | 6156 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6181,11 +6181,11 @@ discard block |
||
6181 | 6181 | |
6182 | 6182 | |
6183 | 6183 | /** |
6184 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
6185 | - * |
|
6186 | - * @return Array the airport list |
|
6187 | - * |
|
6188 | - */ |
|
6184 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
6185 | + * |
|
6186 | + * @return Array the airport list |
|
6187 | + * |
|
6188 | + */ |
|
6189 | 6189 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
6190 | 6190 | { |
6191 | 6191 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6219,11 +6219,11 @@ discard block |
||
6219 | 6219 | |
6220 | 6220 | |
6221 | 6221 | /** |
6222 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6223 | - * |
|
6224 | - * @return Array the airport list |
|
6225 | - * |
|
6226 | - */ |
|
6222 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
6223 | + * |
|
6224 | + * @return Array the airport list |
|
6225 | + * |
|
6226 | + */ |
|
6227 | 6227 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
6228 | 6228 | { |
6229 | 6229 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6253,40 +6253,40 @@ discard block |
||
6253 | 6253 | |
6254 | 6254 | |
6255 | 6255 | /** |
6256 | - * Gets all arrival airports of the airplanes that have flown over |
|
6257 | - * |
|
6258 | - * @return Array the airport list |
|
6259 | - * |
|
6260 | - */ |
|
6256 | + * Gets all arrival airports of the airplanes that have flown over |
|
6257 | + * |
|
6258 | + * @return Array the airport list |
|
6259 | + * |
|
6260 | + */ |
|
6261 | 6261 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6262 | 6262 | { |
6263 | 6263 | global $globalDBdriver; |
6264 | 6264 | $filter_query = $this->getFilter($filters,true,true); |
6265 | 6265 | $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 |
6266 | 6266 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
6267 | - if ($olderthanmonths > 0) { |
|
6268 | - if ($globalDBdriver == 'mysql') { |
|
6267 | + if ($olderthanmonths > 0) { |
|
6268 | + if ($globalDBdriver == 'mysql') { |
|
6269 | 6269 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6270 | 6270 | } else { |
6271 | 6271 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6272 | 6272 | } |
6273 | - if ($sincedate != '') { |
|
6274 | - if ($globalDBdriver == 'mysql') { |
|
6273 | + if ($sincedate != '') { |
|
6274 | + if ($globalDBdriver == 'mysql') { |
|
6275 | 6275 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6276 | 6276 | } else { |
6277 | 6277 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6278 | 6278 | } |
6279 | 6279 | } |
6280 | - if ($globalDBdriver == 'mysql') { |
|
6280 | + if ($globalDBdriver == 'mysql') { |
|
6281 | 6281 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6282 | 6282 | } else { |
6283 | 6283 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6284 | 6284 | } |
6285 | 6285 | } |
6286 | 6286 | |
6287 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6288 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6289 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6287 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6288 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6289 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
6290 | 6290 | ORDER BY airport_arrival_icao_count DESC"; |
6291 | 6291 | if ($limit) $query .= " LIMIT 10"; |
6292 | 6292 | |
@@ -6315,40 +6315,40 @@ discard block |
||
6315 | 6315 | } |
6316 | 6316 | |
6317 | 6317 | /** |
6318 | - * Gets all arrival airports of the airplanes that have flown over |
|
6319 | - * |
|
6320 | - * @return Array the airport list |
|
6321 | - * |
|
6322 | - */ |
|
6318 | + * Gets all arrival airports of the airplanes that have flown over |
|
6319 | + * |
|
6320 | + * @return Array the airport list |
|
6321 | + * |
|
6322 | + */ |
|
6323 | 6323 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
6324 | 6324 | { |
6325 | 6325 | global $globalDBdriver; |
6326 | 6326 | $filter_query = $this->getFilter($filters,true,true); |
6327 | 6327 | $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 |
6328 | 6328 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
6329 | - if ($olderthanmonths > 0) { |
|
6330 | - if ($globalDBdriver == 'mysql') { |
|
6329 | + if ($olderthanmonths > 0) { |
|
6330 | + if ($globalDBdriver == 'mysql') { |
|
6331 | 6331 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6332 | 6332 | } else { |
6333 | 6333 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6334 | 6334 | } |
6335 | - if ($sincedate != '') { |
|
6336 | - if ($globalDBdriver == 'mysql') { |
|
6335 | + if ($sincedate != '') { |
|
6336 | + if ($globalDBdriver == 'mysql') { |
|
6337 | 6337 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6338 | 6338 | } else { |
6339 | 6339 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6340 | 6340 | } |
6341 | 6341 | } |
6342 | - if ($globalDBdriver == 'mysql') { |
|
6342 | + if ($globalDBdriver == 'mysql') { |
|
6343 | 6343 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6344 | 6344 | } else { |
6345 | 6345 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6346 | 6346 | } |
6347 | 6347 | } |
6348 | 6348 | |
6349 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6350 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6351 | - $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 |
|
6349 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6350 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6351 | + $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 |
|
6352 | 6352 | ORDER BY airport_arrival_icao_count DESC"; |
6353 | 6353 | if ($limit) $query .= " LIMIT 10"; |
6354 | 6354 | |
@@ -6379,39 +6379,39 @@ discard block |
||
6379 | 6379 | |
6380 | 6380 | |
6381 | 6381 | /** |
6382 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6383 | - * |
|
6384 | - * @return Array the airport list |
|
6385 | - * |
|
6386 | - */ |
|
6382 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6383 | + * |
|
6384 | + * @return Array the airport list |
|
6385 | + * |
|
6386 | + */ |
|
6387 | 6387 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6388 | 6388 | { |
6389 | 6389 | global $globalDBdriver; |
6390 | 6390 | $filter_query = $this->getFilter($filters,true,true); |
6391 | 6391 | $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 |
6392 | 6392 | 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"; |
6393 | - if ($olderthanmonths > 0) { |
|
6394 | - if ($globalDBdriver == 'mysql') { |
|
6393 | + if ($olderthanmonths > 0) { |
|
6394 | + if ($globalDBdriver == 'mysql') { |
|
6395 | 6395 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
6396 | 6396 | } else { |
6397 | 6397 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
6398 | 6398 | } |
6399 | - if ($sincedate != '') { |
|
6400 | - if ($globalDBdriver == 'mysql') { |
|
6399 | + if ($sincedate != '') { |
|
6400 | + if ($globalDBdriver == 'mysql') { |
|
6401 | 6401 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6402 | 6402 | } else { |
6403 | 6403 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6404 | 6404 | } |
6405 | 6405 | } |
6406 | - if ($globalDBdriver == 'mysql') { |
|
6406 | + if ($globalDBdriver == 'mysql') { |
|
6407 | 6407 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
6408 | 6408 | } else { |
6409 | 6409 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6410 | 6410 | } |
6411 | 6411 | } |
6412 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6413 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6414 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6412 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6413 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6414 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6415 | 6415 | ORDER BY airport_arrival_icao_count DESC"; |
6416 | 6416 | if ($limit) $query .= " LIMIT 10"; |
6417 | 6417 | |
@@ -6440,40 +6440,40 @@ discard block |
||
6440 | 6440 | } |
6441 | 6441 | |
6442 | 6442 | /** |
6443 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
6444 | - * |
|
6445 | - * @return Array the airport list |
|
6446 | - * |
|
6447 | - */ |
|
6443 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
6444 | + * |
|
6445 | + * @return Array the airport list |
|
6446 | + * |
|
6447 | + */ |
|
6448 | 6448 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
6449 | 6449 | { |
6450 | 6450 | global $globalDBdriver; |
6451 | 6451 | $filter_query = $this->getFilter($filters,true,true); |
6452 | 6452 | $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 |
6453 | 6453 | 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 "; |
6454 | - if ($olderthanmonths > 0) { |
|
6455 | - if ($globalDBdriver == 'mysql') { |
|
6454 | + if ($olderthanmonths > 0) { |
|
6455 | + if ($globalDBdriver == 'mysql') { |
|
6456 | 6456 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
6457 | 6457 | } else { |
6458 | 6458 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
6459 | 6459 | } |
6460 | - if ($sincedate != '') { |
|
6461 | - if ($globalDBdriver == 'mysql') { |
|
6460 | + if ($sincedate != '') { |
|
6461 | + if ($globalDBdriver == 'mysql') { |
|
6462 | 6462 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6463 | 6463 | } else { |
6464 | 6464 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6465 | 6465 | } |
6466 | 6466 | } |
6467 | - if ($globalDBdriver == 'mysql') { |
|
6467 | + if ($globalDBdriver == 'mysql') { |
|
6468 | 6468 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
6469 | 6469 | } else { |
6470 | 6470 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
6471 | 6471 | } |
6472 | 6472 | } |
6473 | 6473 | |
6474 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6475 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6476 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6474 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
6475 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
6476 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
6477 | 6477 | ORDER BY airport_arrival_icao_count DESC"; |
6478 | 6478 | if ($limit) $query .= " LIMIT 10"; |
6479 | 6479 | |
@@ -6503,11 +6503,11 @@ discard block |
||
6503 | 6503 | } |
6504 | 6504 | |
6505 | 6505 | /** |
6506 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6507 | - * |
|
6508 | - * @return Array the airport list |
|
6509 | - * |
|
6510 | - */ |
|
6506 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
6507 | + * |
|
6508 | + * @return Array the airport list |
|
6509 | + * |
|
6510 | + */ |
|
6511 | 6511 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
6512 | 6512 | { |
6513 | 6513 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6539,11 +6539,11 @@ discard block |
||
6539 | 6539 | |
6540 | 6540 | |
6541 | 6541 | /** |
6542 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6543 | - * |
|
6544 | - * @return Array the airport list |
|
6545 | - * |
|
6546 | - */ |
|
6542 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
6543 | + * |
|
6544 | + * @return Array the airport list |
|
6545 | + * |
|
6546 | + */ |
|
6547 | 6547 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
6548 | 6548 | { |
6549 | 6549 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6574,11 +6574,11 @@ discard block |
||
6574 | 6574 | |
6575 | 6575 | |
6576 | 6576 | /** |
6577 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6578 | - * |
|
6579 | - * @return Array the airport list |
|
6580 | - * |
|
6581 | - */ |
|
6577 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
6578 | + * |
|
6579 | + * @return Array the airport list |
|
6580 | + * |
|
6581 | + */ |
|
6582 | 6582 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
6583 | 6583 | { |
6584 | 6584 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6612,11 +6612,11 @@ discard block |
||
6612 | 6612 | |
6613 | 6613 | |
6614 | 6614 | /** |
6615 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6616 | - * |
|
6617 | - * @return Array the airport list |
|
6618 | - * |
|
6619 | - */ |
|
6615 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
6616 | + * |
|
6617 | + * @return Array the airport list |
|
6618 | + * |
|
6619 | + */ |
|
6620 | 6620 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
6621 | 6621 | { |
6622 | 6622 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6646,11 +6646,11 @@ discard block |
||
6646 | 6646 | |
6647 | 6647 | |
6648 | 6648 | /** |
6649 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6650 | - * |
|
6651 | - * @return Array the airport list |
|
6652 | - * |
|
6653 | - */ |
|
6649 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
6650 | + * |
|
6651 | + * @return Array the airport list |
|
6652 | + * |
|
6653 | + */ |
|
6654 | 6654 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
6655 | 6655 | { |
6656 | 6656 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6684,11 +6684,11 @@ discard block |
||
6684 | 6684 | |
6685 | 6685 | |
6686 | 6686 | /** |
6687 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6688 | - * |
|
6689 | - * @return Array the airport list |
|
6690 | - * |
|
6691 | - */ |
|
6687 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
6688 | + * |
|
6689 | + * @return Array the airport list |
|
6690 | + * |
|
6691 | + */ |
|
6692 | 6692 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
6693 | 6693 | { |
6694 | 6694 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6719,11 +6719,11 @@ discard block |
||
6719 | 6719 | |
6720 | 6720 | |
6721 | 6721 | /** |
6722 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6723 | - * |
|
6724 | - * @return Array the airport list |
|
6725 | - * |
|
6726 | - */ |
|
6722 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
6723 | + * |
|
6724 | + * @return Array the airport list |
|
6725 | + * |
|
6726 | + */ |
|
6727 | 6727 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
6728 | 6728 | { |
6729 | 6729 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6756,11 +6756,11 @@ discard block |
||
6756 | 6756 | |
6757 | 6757 | |
6758 | 6758 | /** |
6759 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6760 | - * |
|
6761 | - * @return Array the airport list |
|
6762 | - * |
|
6763 | - */ |
|
6759 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
6760 | + * |
|
6761 | + * @return Array the airport list |
|
6762 | + * |
|
6763 | + */ |
|
6764 | 6764 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
6765 | 6765 | { |
6766 | 6766 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6790,11 +6790,11 @@ discard block |
||
6790 | 6790 | |
6791 | 6791 | |
6792 | 6792 | /** |
6793 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6794 | - * |
|
6795 | - * @return Array the airport list |
|
6796 | - * |
|
6797 | - */ |
|
6793 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
6794 | + * |
|
6795 | + * @return Array the airport list |
|
6796 | + * |
|
6797 | + */ |
|
6798 | 6798 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
6799 | 6799 | { |
6800 | 6800 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6828,11 +6828,11 @@ discard block |
||
6828 | 6828 | |
6829 | 6829 | |
6830 | 6830 | /** |
6831 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6832 | - * |
|
6833 | - * @return Array the airport list |
|
6834 | - * |
|
6835 | - */ |
|
6831 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
6832 | + * |
|
6833 | + * @return Array the airport list |
|
6834 | + * |
|
6835 | + */ |
|
6836 | 6836 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
6837 | 6837 | { |
6838 | 6838 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6863,11 +6863,11 @@ discard block |
||
6863 | 6863 | |
6864 | 6864 | |
6865 | 6865 | /** |
6866 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6867 | - * |
|
6868 | - * @return Array the airport list |
|
6869 | - * |
|
6870 | - */ |
|
6866 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
6867 | + * |
|
6868 | + * @return Array the airport list |
|
6869 | + * |
|
6870 | + */ |
|
6871 | 6871 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
6872 | 6872 | { |
6873 | 6873 | global $globalTimezone, $globalDBdriver; |
@@ -6913,11 +6913,11 @@ discard block |
||
6913 | 6913 | |
6914 | 6914 | |
6915 | 6915 | /** |
6916 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
6917 | - * |
|
6918 | - * @return Array the airport list |
|
6919 | - * |
|
6920 | - */ |
|
6916 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
6917 | + * |
|
6918 | + * @return Array the airport list |
|
6919 | + * |
|
6920 | + */ |
|
6921 | 6921 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
6922 | 6922 | { |
6923 | 6923 | global $globalTimezone, $globalDBdriver; |
@@ -6960,11 +6960,11 @@ discard block |
||
6960 | 6960 | |
6961 | 6961 | |
6962 | 6962 | /** |
6963 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
6964 | - * |
|
6965 | - * @return Array the airport list |
|
6966 | - * |
|
6967 | - */ |
|
6963 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
6964 | + * |
|
6965 | + * @return Array the airport list |
|
6966 | + * |
|
6967 | + */ |
|
6968 | 6968 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
6969 | 6969 | { |
6970 | 6970 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6997,11 +6997,11 @@ discard block |
||
6997 | 6997 | |
6998 | 6998 | |
6999 | 6999 | /** |
7000 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7001 | - * |
|
7002 | - * @return Array the airport list |
|
7003 | - * |
|
7004 | - */ |
|
7000 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
7001 | + * |
|
7002 | + * @return Array the airport list |
|
7003 | + * |
|
7004 | + */ |
|
7005 | 7005 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
7006 | 7006 | { |
7007 | 7007 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7032,11 +7032,11 @@ discard block |
||
7032 | 7032 | |
7033 | 7033 | |
7034 | 7034 | /** |
7035 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7036 | - * |
|
7037 | - * @return Array the airport list |
|
7038 | - * |
|
7039 | - */ |
|
7035 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
7036 | + * |
|
7037 | + * @return Array the airport list |
|
7038 | + * |
|
7039 | + */ |
|
7040 | 7040 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
7041 | 7041 | { |
7042 | 7042 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7069,11 +7069,11 @@ discard block |
||
7069 | 7069 | |
7070 | 7070 | |
7071 | 7071 | /** |
7072 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7073 | - * |
|
7074 | - * @return Array the airport list |
|
7075 | - * |
|
7076 | - */ |
|
7072 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
7073 | + * |
|
7074 | + * @return Array the airport list |
|
7075 | + * |
|
7076 | + */ |
|
7077 | 7077 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
7078 | 7078 | { |
7079 | 7079 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7104,11 +7104,11 @@ discard block |
||
7104 | 7104 | |
7105 | 7105 | |
7106 | 7106 | /** |
7107 | - * Counts all airport departure countries |
|
7108 | - * |
|
7109 | - * @return Array the airport departure list |
|
7110 | - * |
|
7111 | - */ |
|
7107 | + * Counts all airport departure countries |
|
7108 | + * |
|
7109 | + * @return Array the airport departure list |
|
7110 | + * |
|
7111 | + */ |
|
7112 | 7112 | public function countAllDepartureCountries($filters = array()) |
7113 | 7113 | { |
7114 | 7114 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7138,11 +7138,11 @@ discard block |
||
7138 | 7138 | |
7139 | 7139 | |
7140 | 7140 | /** |
7141 | - * Counts all airport arrival countries |
|
7142 | - * |
|
7143 | - * @return Array the airport arrival list |
|
7144 | - * |
|
7145 | - */ |
|
7141 | + * Counts all airport arrival countries |
|
7142 | + * |
|
7143 | + * @return Array the airport arrival list |
|
7144 | + * |
|
7145 | + */ |
|
7146 | 7146 | public function countAllArrivalCountries($limit = true,$filters = array()) |
7147 | 7147 | { |
7148 | 7148 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7175,11 +7175,11 @@ discard block |
||
7175 | 7175 | |
7176 | 7176 | |
7177 | 7177 | /** |
7178 | - * Gets all route combinations |
|
7179 | - * |
|
7180 | - * @return Array the route list |
|
7181 | - * |
|
7182 | - */ |
|
7178 | + * Gets all route combinations |
|
7179 | + * |
|
7180 | + * @return Array the route list |
|
7181 | + * |
|
7182 | + */ |
|
7183 | 7183 | public function countAllRoutes($filters = array()) |
7184 | 7184 | { |
7185 | 7185 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7218,11 +7218,11 @@ discard block |
||
7218 | 7218 | |
7219 | 7219 | |
7220 | 7220 | /** |
7221 | - * Gets all route combinations based on an aircraft |
|
7222 | - * |
|
7223 | - * @return Array the route list |
|
7224 | - * |
|
7225 | - */ |
|
7221 | + * Gets all route combinations based on an aircraft |
|
7222 | + * |
|
7223 | + * @return Array the route list |
|
7224 | + * |
|
7225 | + */ |
|
7226 | 7226 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
7227 | 7227 | { |
7228 | 7228 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7258,11 +7258,11 @@ discard block |
||
7258 | 7258 | |
7259 | 7259 | |
7260 | 7260 | /** |
7261 | - * Gets all route combinations based on an aircraft registration |
|
7262 | - * |
|
7263 | - * @return Array the route list |
|
7264 | - * |
|
7265 | - */ |
|
7261 | + * Gets all route combinations based on an aircraft registration |
|
7262 | + * |
|
7263 | + * @return Array the route list |
|
7264 | + * |
|
7265 | + */ |
|
7266 | 7266 | public function countAllRoutesByRegistration($registration, $filters = array()) |
7267 | 7267 | { |
7268 | 7268 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7300,11 +7300,11 @@ discard block |
||
7300 | 7300 | |
7301 | 7301 | |
7302 | 7302 | /** |
7303 | - * Gets all route combinations based on an airline |
|
7304 | - * |
|
7305 | - * @return Array the route list |
|
7306 | - * |
|
7307 | - */ |
|
7303 | + * Gets all route combinations based on an airline |
|
7304 | + * |
|
7305 | + * @return Array the route list |
|
7306 | + * |
|
7307 | + */ |
|
7308 | 7308 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
7309 | 7309 | { |
7310 | 7310 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7342,11 +7342,11 @@ discard block |
||
7342 | 7342 | |
7343 | 7343 | |
7344 | 7344 | /** |
7345 | - * Gets all route combinations based on an airport |
|
7346 | - * |
|
7347 | - * @return Array the route list |
|
7348 | - * |
|
7349 | - */ |
|
7345 | + * Gets all route combinations based on an airport |
|
7346 | + * |
|
7347 | + * @return Array the route list |
|
7348 | + * |
|
7349 | + */ |
|
7350 | 7350 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
7351 | 7351 | { |
7352 | 7352 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7383,11 +7383,11 @@ discard block |
||
7383 | 7383 | |
7384 | 7384 | |
7385 | 7385 | /** |
7386 | - * Gets all route combinations based on an country |
|
7387 | - * |
|
7388 | - * @return Array the route list |
|
7389 | - * |
|
7390 | - */ |
|
7386 | + * Gets all route combinations based on an country |
|
7387 | + * |
|
7388 | + * @return Array the route list |
|
7389 | + * |
|
7390 | + */ |
|
7391 | 7391 | public function countAllRoutesByCountry($country, $filters = array()) |
7392 | 7392 | { |
7393 | 7393 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7423,11 +7423,11 @@ discard block |
||
7423 | 7423 | |
7424 | 7424 | |
7425 | 7425 | /** |
7426 | - * Gets all route combinations based on an date |
|
7427 | - * |
|
7428 | - * @return Array the route list |
|
7429 | - * |
|
7430 | - */ |
|
7426 | + * Gets all route combinations based on an date |
|
7427 | + * |
|
7428 | + * @return Array the route list |
|
7429 | + * |
|
7430 | + */ |
|
7431 | 7431 | public function countAllRoutesByDate($date, $filters = array()) |
7432 | 7432 | { |
7433 | 7433 | global $globalTimezone, $globalDBdriver; |
@@ -7477,11 +7477,11 @@ discard block |
||
7477 | 7477 | |
7478 | 7478 | |
7479 | 7479 | /** |
7480 | - * Gets all route combinations based on an ident/callsign |
|
7481 | - * |
|
7482 | - * @return Array the route list |
|
7483 | - * |
|
7484 | - */ |
|
7480 | + * Gets all route combinations based on an ident/callsign |
|
7481 | + * |
|
7482 | + * @return Array the route list |
|
7483 | + * |
|
7484 | + */ |
|
7485 | 7485 | public function countAllRoutesByIdent($ident, $filters = array()) |
7486 | 7486 | { |
7487 | 7487 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7518,11 +7518,11 @@ discard block |
||
7518 | 7518 | |
7519 | 7519 | |
7520 | 7520 | /** |
7521 | - * Gets all route combinations based on an manufacturer |
|
7522 | - * |
|
7523 | - * @return Array the route list |
|
7524 | - * |
|
7525 | - */ |
|
7521 | + * Gets all route combinations based on an manufacturer |
|
7522 | + * |
|
7523 | + * @return Array the route list |
|
7524 | + * |
|
7525 | + */ |
|
7526 | 7526 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
7527 | 7527 | { |
7528 | 7528 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7560,11 +7560,11 @@ discard block |
||
7560 | 7560 | |
7561 | 7561 | |
7562 | 7562 | /** |
7563 | - * Gets all route combinations with waypoints |
|
7564 | - * |
|
7565 | - * @return Array the route list |
|
7566 | - * |
|
7567 | - */ |
|
7563 | + * Gets all route combinations with waypoints |
|
7564 | + * |
|
7565 | + * @return Array the route list |
|
7566 | + * |
|
7567 | + */ |
|
7568 | 7568 | public function countAllRoutesWithWaypoints($filters = array()) |
7569 | 7569 | { |
7570 | 7570 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7601,11 +7601,11 @@ discard block |
||
7601 | 7601 | } |
7602 | 7602 | |
7603 | 7603 | /** |
7604 | - * Gets all callsigns that have flown over |
|
7605 | - * |
|
7606 | - * @return Array the callsign list |
|
7607 | - * |
|
7608 | - */ |
|
7604 | + * Gets all callsigns that have flown over |
|
7605 | + * |
|
7606 | + * @return Array the callsign list |
|
7607 | + * |
|
7608 | + */ |
|
7609 | 7609 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
7610 | 7610 | { |
7611 | 7611 | global $globalDBdriver; |
@@ -7643,11 +7643,11 @@ discard block |
||
7643 | 7643 | } |
7644 | 7644 | |
7645 | 7645 | /** |
7646 | - * Gets all callsigns that have flown over |
|
7647 | - * |
|
7648 | - * @return Array the callsign list |
|
7649 | - * |
|
7650 | - */ |
|
7646 | + * Gets all callsigns that have flown over |
|
7647 | + * |
|
7648 | + * @return Array the callsign list |
|
7649 | + * |
|
7650 | + */ |
|
7651 | 7651 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
7652 | 7652 | { |
7653 | 7653 | global $globalDBdriver; |
@@ -7688,11 +7688,11 @@ discard block |
||
7688 | 7688 | |
7689 | 7689 | |
7690 | 7690 | /** |
7691 | - * Counts all dates |
|
7692 | - * |
|
7693 | - * @return Array the date list |
|
7694 | - * |
|
7695 | - */ |
|
7691 | + * Counts all dates |
|
7692 | + * |
|
7693 | + * @return Array the date list |
|
7694 | + * |
|
7695 | + */ |
|
7696 | 7696 | public function countAllDates($filters = array()) |
7697 | 7697 | { |
7698 | 7698 | global $globalTimezone, $globalDBdriver; |
@@ -7737,11 +7737,11 @@ discard block |
||
7737 | 7737 | } |
7738 | 7738 | |
7739 | 7739 | /** |
7740 | - * Counts all dates |
|
7741 | - * |
|
7742 | - * @return Array the date list |
|
7743 | - * |
|
7744 | - */ |
|
7740 | + * Counts all dates |
|
7741 | + * |
|
7742 | + * @return Array the date list |
|
7743 | + * |
|
7744 | + */ |
|
7745 | 7745 | public function countAllDatesByAirlines($filters = array()) |
7746 | 7746 | { |
7747 | 7747 | global $globalTimezone, $globalDBdriver; |
@@ -7786,11 +7786,11 @@ discard block |
||
7786 | 7786 | } |
7787 | 7787 | |
7788 | 7788 | /** |
7789 | - * Counts all dates during the last 7 days |
|
7790 | - * |
|
7791 | - * @return Array the date list |
|
7792 | - * |
|
7793 | - */ |
|
7789 | + * Counts all dates during the last 7 days |
|
7790 | + * |
|
7791 | + * @return Array the date list |
|
7792 | + * |
|
7793 | + */ |
|
7794 | 7794 | public function countAllDatesLast7Days($filters = array()) |
7795 | 7795 | { |
7796 | 7796 | global $globalTimezone, $globalDBdriver; |
@@ -7812,7 +7812,7 @@ discard block |
||
7812 | 7812 | $query .= " GROUP BY date_name |
7813 | 7813 | ORDER BY date_name ASC"; |
7814 | 7814 | $query_data = array(':offset' => $offset); |
7815 | - } |
|
7815 | + } |
|
7816 | 7816 | |
7817 | 7817 | $sth = $this->db->prepare($query); |
7818 | 7818 | $sth->execute($query_data); |
@@ -7832,11 +7832,11 @@ discard block |
||
7832 | 7832 | } |
7833 | 7833 | |
7834 | 7834 | /** |
7835 | - * Counts all dates during the last month |
|
7836 | - * |
|
7837 | - * @return Array the date list |
|
7838 | - * |
|
7839 | - */ |
|
7835 | + * Counts all dates during the last month |
|
7836 | + * |
|
7837 | + * @return Array the date list |
|
7838 | + * |
|
7839 | + */ |
|
7840 | 7840 | public function countAllDatesLastMonth($filters = array()) |
7841 | 7841 | { |
7842 | 7842 | global $globalTimezone, $globalDBdriver; |
@@ -7858,7 +7858,7 @@ discard block |
||
7858 | 7858 | $query .= " GROUP BY date_name |
7859 | 7859 | ORDER BY date_name ASC"; |
7860 | 7860 | $query_data = array(':offset' => $offset); |
7861 | - } |
|
7861 | + } |
|
7862 | 7862 | |
7863 | 7863 | $sth = $this->db->prepare($query); |
7864 | 7864 | $sth->execute($query_data); |
@@ -7879,11 +7879,11 @@ discard block |
||
7879 | 7879 | |
7880 | 7880 | |
7881 | 7881 | /** |
7882 | - * Counts all dates during the last month |
|
7883 | - * |
|
7884 | - * @return Array the date list |
|
7885 | - * |
|
7886 | - */ |
|
7882 | + * Counts all dates during the last month |
|
7883 | + * |
|
7884 | + * @return Array the date list |
|
7885 | + * |
|
7886 | + */ |
|
7887 | 7887 | public function countAllDatesLastMonthByAirlines($filters = array()) |
7888 | 7888 | { |
7889 | 7889 | global $globalTimezone, $globalDBdriver; |
@@ -7906,7 +7906,7 @@ discard block |
||
7906 | 7906 | GROUP BY spotter_output.airline_icao, date_name |
7907 | 7907 | ORDER BY date_name ASC"; |
7908 | 7908 | $query_data = array(':offset' => $offset); |
7909 | - } |
|
7909 | + } |
|
7910 | 7910 | |
7911 | 7911 | $sth = $this->db->prepare($query); |
7912 | 7912 | $sth->execute($query_data); |
@@ -7928,11 +7928,11 @@ discard block |
||
7928 | 7928 | |
7929 | 7929 | |
7930 | 7930 | /** |
7931 | - * Counts all month |
|
7932 | - * |
|
7933 | - * @return Array the month list |
|
7934 | - * |
|
7935 | - */ |
|
7931 | + * Counts all month |
|
7932 | + * |
|
7933 | + * @return Array the month list |
|
7934 | + * |
|
7935 | + */ |
|
7936 | 7936 | public function countAllMonths($filters = array()) |
7937 | 7937 | { |
7938 | 7938 | global $globalTimezone, $globalDBdriver; |
@@ -7974,11 +7974,11 @@ discard block |
||
7974 | 7974 | } |
7975 | 7975 | |
7976 | 7976 | /** |
7977 | - * Counts all month |
|
7978 | - * |
|
7979 | - * @return Array the month list |
|
7980 | - * |
|
7981 | - */ |
|
7977 | + * Counts all month |
|
7978 | + * |
|
7979 | + * @return Array the month list |
|
7980 | + * |
|
7981 | + */ |
|
7982 | 7982 | public function countAllMonthsByAirlines($filters = array()) |
7983 | 7983 | { |
7984 | 7984 | global $globalTimezone, $globalDBdriver; |
@@ -8023,11 +8023,11 @@ discard block |
||
8023 | 8023 | } |
8024 | 8024 | |
8025 | 8025 | /** |
8026 | - * Counts all military month |
|
8027 | - * |
|
8028 | - * @return Array the month list |
|
8029 | - * |
|
8030 | - */ |
|
8026 | + * Counts all military month |
|
8027 | + * |
|
8028 | + * @return Array the month list |
|
8029 | + * |
|
8030 | + */ |
|
8031 | 8031 | public function countAllMilitaryMonths($filters = array()) |
8032 | 8032 | { |
8033 | 8033 | global $globalTimezone, $globalDBdriver; |
@@ -8068,11 +8068,11 @@ discard block |
||
8068 | 8068 | } |
8069 | 8069 | |
8070 | 8070 | /** |
8071 | - * Counts all month owners |
|
8072 | - * |
|
8073 | - * @return Array the month list |
|
8074 | - * |
|
8075 | - */ |
|
8071 | + * Counts all month owners |
|
8072 | + * |
|
8073 | + * @return Array the month list |
|
8074 | + * |
|
8075 | + */ |
|
8076 | 8076 | public function countAllMonthsOwners($filters = array()) |
8077 | 8077 | { |
8078 | 8078 | global $globalTimezone, $globalDBdriver; |
@@ -8114,11 +8114,11 @@ discard block |
||
8114 | 8114 | } |
8115 | 8115 | |
8116 | 8116 | /** |
8117 | - * Counts all month owners |
|
8118 | - * |
|
8119 | - * @return Array the month list |
|
8120 | - * |
|
8121 | - */ |
|
8117 | + * Counts all month owners |
|
8118 | + * |
|
8119 | + * @return Array the month list |
|
8120 | + * |
|
8121 | + */ |
|
8122 | 8122 | public function countAllMonthsOwnersByAirlines($filters = array()) |
8123 | 8123 | { |
8124 | 8124 | global $globalTimezone, $globalDBdriver; |
@@ -8161,11 +8161,11 @@ discard block |
||
8161 | 8161 | } |
8162 | 8162 | |
8163 | 8163 | /** |
8164 | - * Counts all month pilot |
|
8165 | - * |
|
8166 | - * @return Array the month list |
|
8167 | - * |
|
8168 | - */ |
|
8164 | + * Counts all month pilot |
|
8165 | + * |
|
8166 | + * @return Array the month list |
|
8167 | + * |
|
8168 | + */ |
|
8169 | 8169 | public function countAllMonthsPilots($filters = array()) |
8170 | 8170 | { |
8171 | 8171 | global $globalTimezone, $globalDBdriver; |
@@ -8207,11 +8207,11 @@ discard block |
||
8207 | 8207 | } |
8208 | 8208 | |
8209 | 8209 | /** |
8210 | - * Counts all month pilot |
|
8211 | - * |
|
8212 | - * @return Array the month list |
|
8213 | - * |
|
8214 | - */ |
|
8210 | + * Counts all month pilot |
|
8211 | + * |
|
8212 | + * @return Array the month list |
|
8213 | + * |
|
8214 | + */ |
|
8215 | 8215 | public function countAllMonthsPilotsByAirlines($filters = array()) |
8216 | 8216 | { |
8217 | 8217 | global $globalTimezone, $globalDBdriver; |
@@ -8254,11 +8254,11 @@ discard block |
||
8254 | 8254 | } |
8255 | 8255 | |
8256 | 8256 | /** |
8257 | - * Counts all month airline |
|
8258 | - * |
|
8259 | - * @return Array the month list |
|
8260 | - * |
|
8261 | - */ |
|
8257 | + * Counts all month airline |
|
8258 | + * |
|
8259 | + * @return Array the month list |
|
8260 | + * |
|
8261 | + */ |
|
8262 | 8262 | public function countAllMonthsAirlines($filters = array()) |
8263 | 8263 | { |
8264 | 8264 | global $globalTimezone, $globalDBdriver; |
@@ -8300,11 +8300,11 @@ discard block |
||
8300 | 8300 | } |
8301 | 8301 | |
8302 | 8302 | /** |
8303 | - * Counts all month aircraft |
|
8304 | - * |
|
8305 | - * @return Array the month list |
|
8306 | - * |
|
8307 | - */ |
|
8303 | + * Counts all month aircraft |
|
8304 | + * |
|
8305 | + * @return Array the month list |
|
8306 | + * |
|
8307 | + */ |
|
8308 | 8308 | public function countAllMonthsAircrafts($filters = array()) |
8309 | 8309 | { |
8310 | 8310 | global $globalTimezone, $globalDBdriver; |
@@ -8347,11 +8347,11 @@ discard block |
||
8347 | 8347 | |
8348 | 8348 | |
8349 | 8349 | /** |
8350 | - * Counts all month aircraft |
|
8351 | - * |
|
8352 | - * @return Array the month list |
|
8353 | - * |
|
8354 | - */ |
|
8350 | + * Counts all month aircraft |
|
8351 | + * |
|
8352 | + * @return Array the month list |
|
8353 | + * |
|
8354 | + */ |
|
8355 | 8355 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
8356 | 8356 | { |
8357 | 8357 | global $globalTimezone, $globalDBdriver; |
@@ -8394,11 +8394,11 @@ discard block |
||
8394 | 8394 | } |
8395 | 8395 | |
8396 | 8396 | /** |
8397 | - * Counts all month real arrival |
|
8398 | - * |
|
8399 | - * @return Array the month list |
|
8400 | - * |
|
8401 | - */ |
|
8397 | + * Counts all month real arrival |
|
8398 | + * |
|
8399 | + * @return Array the month list |
|
8400 | + * |
|
8401 | + */ |
|
8402 | 8402 | public function countAllMonthsRealArrivals($filters = array()) |
8403 | 8403 | { |
8404 | 8404 | global $globalTimezone, $globalDBdriver; |
@@ -8441,11 +8441,11 @@ discard block |
||
8441 | 8441 | |
8442 | 8442 | |
8443 | 8443 | /** |
8444 | - * Counts all month real arrival |
|
8445 | - * |
|
8446 | - * @return Array the month list |
|
8447 | - * |
|
8448 | - */ |
|
8444 | + * Counts all month real arrival |
|
8445 | + * |
|
8446 | + * @return Array the month list |
|
8447 | + * |
|
8448 | + */ |
|
8449 | 8449 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
8450 | 8450 | { |
8451 | 8451 | global $globalTimezone, $globalDBdriver; |
@@ -8489,11 +8489,11 @@ discard block |
||
8489 | 8489 | |
8490 | 8490 | |
8491 | 8491 | /** |
8492 | - * Counts all dates during the last year |
|
8493 | - * |
|
8494 | - * @return Array the date list |
|
8495 | - * |
|
8496 | - */ |
|
8492 | + * Counts all dates during the last year |
|
8493 | + * |
|
8494 | + * @return Array the date list |
|
8495 | + * |
|
8496 | + */ |
|
8497 | 8497 | public function countAllMonthsLastYear($filters) |
8498 | 8498 | { |
8499 | 8499 | global $globalTimezone, $globalDBdriver; |
@@ -8515,7 +8515,7 @@ discard block |
||
8515 | 8515 | $query .= " GROUP BY year_name, month_name |
8516 | 8516 | ORDER BY year_name, month_name ASC"; |
8517 | 8517 | $query_data = array(':offset' => $offset); |
8518 | - } |
|
8518 | + } |
|
8519 | 8519 | |
8520 | 8520 | $sth = $this->db->prepare($query); |
8521 | 8521 | $sth->execute($query_data); |
@@ -8538,11 +8538,11 @@ discard block |
||
8538 | 8538 | |
8539 | 8539 | |
8540 | 8540 | /** |
8541 | - * Counts all hours |
|
8542 | - * |
|
8543 | - * @return Array the hour list |
|
8544 | - * |
|
8545 | - */ |
|
8541 | + * Counts all hours |
|
8542 | + * |
|
8543 | + * @return Array the hour list |
|
8544 | + * |
|
8545 | + */ |
|
8546 | 8546 | public function countAllHours($orderby,$filters = array()) |
8547 | 8547 | { |
8548 | 8548 | global $globalTimezone, $globalDBdriver; |
@@ -8603,11 +8603,11 @@ discard block |
||
8603 | 8603 | } |
8604 | 8604 | |
8605 | 8605 | /** |
8606 | - * Counts all hours |
|
8607 | - * |
|
8608 | - * @return Array the hour list |
|
8609 | - * |
|
8610 | - */ |
|
8606 | + * Counts all hours |
|
8607 | + * |
|
8608 | + * @return Array the hour list |
|
8609 | + * |
|
8610 | + */ |
|
8611 | 8611 | public function countAllHoursByAirlines($orderby, $filters = array()) |
8612 | 8612 | { |
8613 | 8613 | global $globalTimezone, $globalDBdriver; |
@@ -8670,11 +8670,11 @@ discard block |
||
8670 | 8670 | |
8671 | 8671 | |
8672 | 8672 | /** |
8673 | - * Counts all hours by airline |
|
8674 | - * |
|
8675 | - * @return Array the hour list |
|
8676 | - * |
|
8677 | - */ |
|
8673 | + * Counts all hours by airline |
|
8674 | + * |
|
8675 | + * @return Array the hour list |
|
8676 | + * |
|
8677 | + */ |
|
8678 | 8678 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
8679 | 8679 | { |
8680 | 8680 | global $globalTimezone, $globalDBdriver; |
@@ -8720,11 +8720,11 @@ discard block |
||
8720 | 8720 | |
8721 | 8721 | |
8722 | 8722 | /** |
8723 | - * Counts all hours by aircraft |
|
8724 | - * |
|
8725 | - * @return Array the hour list |
|
8726 | - * |
|
8727 | - */ |
|
8723 | + * Counts all hours by aircraft |
|
8724 | + * |
|
8725 | + * @return Array the hour list |
|
8726 | + * |
|
8727 | + */ |
|
8728 | 8728 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
8729 | 8729 | { |
8730 | 8730 | global $globalTimezone, $globalDBdriver; |
@@ -8767,11 +8767,11 @@ discard block |
||
8767 | 8767 | |
8768 | 8768 | |
8769 | 8769 | /** |
8770 | - * Counts all hours by aircraft registration |
|
8771 | - * |
|
8772 | - * @return Array the hour list |
|
8773 | - * |
|
8774 | - */ |
|
8770 | + * Counts all hours by aircraft registration |
|
8771 | + * |
|
8772 | + * @return Array the hour list |
|
8773 | + * |
|
8774 | + */ |
|
8775 | 8775 | public function countAllHoursByRegistration($registration, $filters = array()) |
8776 | 8776 | { |
8777 | 8777 | global $globalTimezone, $globalDBdriver; |
@@ -8814,11 +8814,11 @@ discard block |
||
8814 | 8814 | |
8815 | 8815 | |
8816 | 8816 | /** |
8817 | - * Counts all hours by airport |
|
8818 | - * |
|
8819 | - * @return Array the hour list |
|
8820 | - * |
|
8821 | - */ |
|
8817 | + * Counts all hours by airport |
|
8818 | + * |
|
8819 | + * @return Array the hour list |
|
8820 | + * |
|
8821 | + */ |
|
8822 | 8822 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
8823 | 8823 | { |
8824 | 8824 | global $globalTimezone, $globalDBdriver; |
@@ -8862,11 +8862,11 @@ discard block |
||
8862 | 8862 | |
8863 | 8863 | |
8864 | 8864 | /** |
8865 | - * Counts all hours by manufacturer |
|
8866 | - * |
|
8867 | - * @return Array the hour list |
|
8868 | - * |
|
8869 | - */ |
|
8865 | + * Counts all hours by manufacturer |
|
8866 | + * |
|
8867 | + * @return Array the hour list |
|
8868 | + * |
|
8869 | + */ |
|
8870 | 8870 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
8871 | 8871 | { |
8872 | 8872 | global $globalTimezone, $globalDBdriver; |
@@ -8910,11 +8910,11 @@ discard block |
||
8910 | 8910 | |
8911 | 8911 | |
8912 | 8912 | /** |
8913 | - * Counts all hours by date |
|
8914 | - * |
|
8915 | - * @return Array the hour list |
|
8916 | - * |
|
8917 | - */ |
|
8913 | + * Counts all hours by date |
|
8914 | + * |
|
8915 | + * @return Array the hour list |
|
8916 | + * |
|
8917 | + */ |
|
8918 | 8918 | public function countAllHoursByDate($date, $filters = array()) |
8919 | 8919 | { |
8920 | 8920 | global $globalTimezone, $globalDBdriver; |
@@ -8958,11 +8958,11 @@ discard block |
||
8958 | 8958 | |
8959 | 8959 | |
8960 | 8960 | /** |
8961 | - * Counts all hours by a ident/callsign |
|
8962 | - * |
|
8963 | - * @return Array the hour list |
|
8964 | - * |
|
8965 | - */ |
|
8961 | + * Counts all hours by a ident/callsign |
|
8962 | + * |
|
8963 | + * @return Array the hour list |
|
8964 | + * |
|
8965 | + */ |
|
8966 | 8966 | public function countAllHoursByIdent($ident, $filters = array()) |
8967 | 8967 | { |
8968 | 8968 | global $globalTimezone, $globalDBdriver; |
@@ -9007,11 +9007,11 @@ discard block |
||
9007 | 9007 | |
9008 | 9008 | |
9009 | 9009 | /** |
9010 | - * Counts all hours by route |
|
9011 | - * |
|
9012 | - * @return Array the hour list |
|
9013 | - * |
|
9014 | - */ |
|
9010 | + * Counts all hours by route |
|
9011 | + * |
|
9012 | + * @return Array the hour list |
|
9013 | + * |
|
9014 | + */ |
|
9015 | 9015 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
9016 | 9016 | { |
9017 | 9017 | global $globalTimezone, $globalDBdriver; |
@@ -9055,11 +9055,11 @@ discard block |
||
9055 | 9055 | |
9056 | 9056 | |
9057 | 9057 | /** |
9058 | - * Counts all hours by country |
|
9059 | - * |
|
9060 | - * @return Array the hour list |
|
9061 | - * |
|
9062 | - */ |
|
9058 | + * Counts all hours by country |
|
9059 | + * |
|
9060 | + * @return Array the hour list |
|
9061 | + * |
|
9062 | + */ |
|
9063 | 9063 | public function countAllHoursByCountry($country, $filters = array()) |
9064 | 9064 | { |
9065 | 9065 | global $globalTimezone, $globalDBdriver; |
@@ -9104,11 +9104,11 @@ discard block |
||
9104 | 9104 | |
9105 | 9105 | |
9106 | 9106 | /** |
9107 | - * Counts all aircraft that have flown over |
|
9108 | - * |
|
9109 | - * @return Integer the number of aircrafts |
|
9110 | - * |
|
9111 | - */ |
|
9107 | + * Counts all aircraft that have flown over |
|
9108 | + * |
|
9109 | + * @return Integer the number of aircrafts |
|
9110 | + * |
|
9111 | + */ |
|
9112 | 9112 | public function countOverallAircrafts($filters = array()) |
9113 | 9113 | { |
9114 | 9114 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9120,11 +9120,11 @@ discard block |
||
9120 | 9120 | } |
9121 | 9121 | |
9122 | 9122 | /** |
9123 | - * Counts all flight that really arrival |
|
9124 | - * |
|
9125 | - * @return Integer the number of aircrafts |
|
9126 | - * |
|
9127 | - */ |
|
9123 | + * Counts all flight that really arrival |
|
9124 | + * |
|
9125 | + * @return Integer the number of aircrafts |
|
9126 | + * |
|
9127 | + */ |
|
9128 | 9128 | public function countOverallArrival($filters = array()) |
9129 | 9129 | { |
9130 | 9130 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9137,11 +9137,11 @@ discard block |
||
9137 | 9137 | } |
9138 | 9138 | |
9139 | 9139 | /** |
9140 | - * Counts all pilots that have flown over |
|
9141 | - * |
|
9142 | - * @return Integer the number of pilots |
|
9143 | - * |
|
9144 | - */ |
|
9140 | + * Counts all pilots that have flown over |
|
9141 | + * |
|
9142 | + * @return Integer the number of pilots |
|
9143 | + * |
|
9144 | + */ |
|
9145 | 9145 | public function countOverallPilots($filters = array()) |
9146 | 9146 | { |
9147 | 9147 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9153,11 +9153,11 @@ discard block |
||
9153 | 9153 | } |
9154 | 9154 | |
9155 | 9155 | /** |
9156 | - * Counts all owners that have flown over |
|
9157 | - * |
|
9158 | - * @return Integer the number of owners |
|
9159 | - * |
|
9160 | - */ |
|
9156 | + * Counts all owners that have flown over |
|
9157 | + * |
|
9158 | + * @return Integer the number of owners |
|
9159 | + * |
|
9160 | + */ |
|
9161 | 9161 | public function countOverallOwners($filters = array()) |
9162 | 9162 | { |
9163 | 9163 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9170,11 +9170,11 @@ discard block |
||
9170 | 9170 | |
9171 | 9171 | |
9172 | 9172 | /** |
9173 | - * Counts all flights that have flown over |
|
9174 | - * |
|
9175 | - * @return Integer the number of flights |
|
9176 | - * |
|
9177 | - */ |
|
9173 | + * Counts all flights that have flown over |
|
9174 | + * |
|
9175 | + * @return Integer the number of flights |
|
9176 | + * |
|
9177 | + */ |
|
9178 | 9178 | public function countOverallFlights($filters = array()) |
9179 | 9179 | { |
9180 | 9180 | $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
@@ -9187,11 +9187,11 @@ discard block |
||
9187 | 9187 | } |
9188 | 9188 | |
9189 | 9189 | /** |
9190 | - * Counts all military flights that have flown over |
|
9191 | - * |
|
9192 | - * @return Integer the number of flights |
|
9193 | - * |
|
9194 | - */ |
|
9190 | + * Counts all military flights that have flown over |
|
9191 | + * |
|
9192 | + * @return Integer the number of flights |
|
9193 | + * |
|
9194 | + */ |
|
9195 | 9195 | public function countOverallMilitaryFlights($filters = array()) |
9196 | 9196 | { |
9197 | 9197 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9206,11 +9206,11 @@ discard block |
||
9206 | 9206 | |
9207 | 9207 | |
9208 | 9208 | /** |
9209 | - * Counts all airlines that have flown over |
|
9210 | - * |
|
9211 | - * @return Integer the number of airlines |
|
9212 | - * |
|
9213 | - */ |
|
9209 | + * Counts all airlines that have flown over |
|
9210 | + * |
|
9211 | + * @return Integer the number of airlines |
|
9212 | + * |
|
9213 | + */ |
|
9214 | 9214 | public function countOverallAirlines($filters = array()) |
9215 | 9215 | { |
9216 | 9216 | $query = "SELECT COUNT(DISTINCT spotter_output.airline_name) AS airline_count |
@@ -9224,11 +9224,11 @@ discard block |
||
9224 | 9224 | |
9225 | 9225 | |
9226 | 9226 | /** |
9227 | - * Counts all hours of today |
|
9228 | - * |
|
9229 | - * @return Array the hour list |
|
9230 | - * |
|
9231 | - */ |
|
9227 | + * Counts all hours of today |
|
9228 | + * |
|
9229 | + * @return Array the hour list |
|
9230 | + * |
|
9231 | + */ |
|
9232 | 9232 | public function countAllHoursFromToday($filters = array()) |
9233 | 9233 | { |
9234 | 9234 | global $globalTimezone, $globalDBdriver; |
@@ -9268,11 +9268,11 @@ discard block |
||
9268 | 9268 | } |
9269 | 9269 | |
9270 | 9270 | /** |
9271 | - * Gets all the spotter information based on calculated upcoming flights |
|
9272 | - * |
|
9273 | - * @return Array the spotter information |
|
9274 | - * |
|
9275 | - */ |
|
9271 | + * Gets all the spotter information based on calculated upcoming flights |
|
9272 | + * |
|
9273 | + * @return Array the spotter information |
|
9274 | + * |
|
9275 | + */ |
|
9276 | 9276 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
9277 | 9277 | { |
9278 | 9278 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -9347,12 +9347,12 @@ discard block |
||
9347 | 9347 | } |
9348 | 9348 | |
9349 | 9349 | |
9350 | - /** |
|
9351 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9352 | - * |
|
9353 | - * @return Integer the Barrie Spotter ID |
|
9350 | + /** |
|
9351 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
9352 | + * |
|
9353 | + * @return Integer the Barrie Spotter ID |
|
9354 | 9354 | q * |
9355 | - */ |
|
9355 | + */ |
|
9356 | 9356 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
9357 | 9357 | { |
9358 | 9358 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -9373,13 +9373,13 @@ discard block |
||
9373 | 9373 | |
9374 | 9374 | |
9375 | 9375 | /** |
9376 | - * Parses a date string |
|
9377 | - * |
|
9378 | - * @param String $dateString the date string |
|
9379 | - * @param String $timezone the timezone of a user |
|
9380 | - * @return Array the time information |
|
9381 | - * |
|
9382 | - */ |
|
9376 | + * Parses a date string |
|
9377 | + * |
|
9378 | + * @param String $dateString the date string |
|
9379 | + * @param String $timezone the timezone of a user |
|
9380 | + * @return Array the time information |
|
9381 | + * |
|
9382 | + */ |
|
9383 | 9383 | public function parseDateString($dateString, $timezone = '') |
9384 | 9384 | { |
9385 | 9385 | $time_array = array(); |
@@ -9415,12 +9415,12 @@ discard block |
||
9415 | 9415 | |
9416 | 9416 | |
9417 | 9417 | /** |
9418 | - * Parses the direction degrees to working |
|
9419 | - * |
|
9420 | - * @param Float $direction the direction in degrees |
|
9421 | - * @return Array the direction information |
|
9422 | - * |
|
9423 | - */ |
|
9418 | + * Parses the direction degrees to working |
|
9419 | + * |
|
9420 | + * @param Float $direction the direction in degrees |
|
9421 | + * @return Array the direction information |
|
9422 | + * |
|
9423 | + */ |
|
9424 | 9424 | public function parseDirection($direction = 0) |
9425 | 9425 | { |
9426 | 9426 | if ($direction == '') $direction = 0; |
@@ -9499,12 +9499,12 @@ discard block |
||
9499 | 9499 | |
9500 | 9500 | |
9501 | 9501 | /** |
9502 | - * Gets the aircraft registration |
|
9503 | - * |
|
9504 | - * @param String $flightaware_id the flight aware id |
|
9505 | - * @return String the aircraft registration |
|
9506 | - * |
|
9507 | - */ |
|
9502 | + * Gets the aircraft registration |
|
9503 | + * |
|
9504 | + * @param String $flightaware_id the flight aware id |
|
9505 | + * @return String the aircraft registration |
|
9506 | + * |
|
9507 | + */ |
|
9508 | 9508 | |
9509 | 9509 | public function getAircraftRegistration($flightaware_id) |
9510 | 9510 | { |
@@ -9533,12 +9533,12 @@ discard block |
||
9533 | 9533 | |
9534 | 9534 | |
9535 | 9535 | /** |
9536 | - * Gets the aircraft registration from ModeS |
|
9537 | - * |
|
9538 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9539 | - * @return String the aircraft registration |
|
9540 | - * |
|
9541 | - */ |
|
9536 | + * Gets the aircraft registration from ModeS |
|
9537 | + * |
|
9538 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9539 | + * @return String the aircraft registration |
|
9540 | + * |
|
9541 | + */ |
|
9542 | 9542 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
9543 | 9543 | { |
9544 | 9544 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9551,19 +9551,19 @@ discard block |
||
9551 | 9551 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9552 | 9552 | $sth->closeCursor(); |
9553 | 9553 | if (count($row) > 0) { |
9554 | - //return $row['Registration']; |
|
9555 | - return $row['registration']; |
|
9554 | + //return $row['Registration']; |
|
9555 | + return $row['registration']; |
|
9556 | 9556 | } else return ''; |
9557 | 9557 | |
9558 | 9558 | } |
9559 | 9559 | |
9560 | 9560 | /** |
9561 | - * Gets the aircraft type from ModeS |
|
9562 | - * |
|
9563 | - * @param String $aircraft_modes the flight ModeS in hex |
|
9564 | - * @return String the aircraft type |
|
9565 | - * |
|
9566 | - */ |
|
9561 | + * Gets the aircraft type from ModeS |
|
9562 | + * |
|
9563 | + * @param String $aircraft_modes the flight ModeS in hex |
|
9564 | + * @return String the aircraft type |
|
9565 | + * |
|
9566 | + */ |
|
9567 | 9567 | public function getAircraftTypeBymodeS($aircraft_modes) |
9568 | 9568 | { |
9569 | 9569 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -9576,19 +9576,19 @@ discard block |
||
9576 | 9576 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
9577 | 9577 | $sth->closeCursor(); |
9578 | 9578 | if (count($row) > 0) { |
9579 | - if ($row['type_flight'] == null) return ''; |
|
9580 | - else return $row['type_flight']; |
|
9579 | + if ($row['type_flight'] == null) return ''; |
|
9580 | + else return $row['type_flight']; |
|
9581 | 9581 | } else return ''; |
9582 | 9582 | |
9583 | 9583 | } |
9584 | 9584 | |
9585 | 9585 | /** |
9586 | - * Gets Countrie from latitude/longitude |
|
9587 | - * |
|
9588 | - * @param Float $latitude latitute of the flight |
|
9589 | - * @param Float $longitude longitute of the flight |
|
9590 | - * @return String the countrie |
|
9591 | - */ |
|
9586 | + * Gets Countrie from latitude/longitude |
|
9587 | + * |
|
9588 | + * @param Float $latitude latitute of the flight |
|
9589 | + * @param Float $longitude longitute of the flight |
|
9590 | + * @return String the countrie |
|
9591 | + */ |
|
9592 | 9592 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
9593 | 9593 | { |
9594 | 9594 | global $globalDBdriver, $globalDebug; |
@@ -9625,12 +9625,12 @@ discard block |
||
9625 | 9625 | } |
9626 | 9626 | |
9627 | 9627 | /** |
9628 | - * converts the registration code using the country prefix |
|
9629 | - * |
|
9630 | - * @param String $registration the aircraft registration |
|
9631 | - * @return String the aircraft registration |
|
9632 | - * |
|
9633 | - */ |
|
9628 | + * converts the registration code using the country prefix |
|
9629 | + * |
|
9630 | + * @param String $registration the aircraft registration |
|
9631 | + * @return String the aircraft registration |
|
9632 | + * |
|
9633 | + */ |
|
9634 | 9634 | public function convertAircraftRegistration($registration) |
9635 | 9635 | { |
9636 | 9636 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9682,12 +9682,12 @@ discard block |
||
9682 | 9682 | } |
9683 | 9683 | |
9684 | 9684 | /** |
9685 | - * Country from the registration code |
|
9686 | - * |
|
9687 | - * @param String $registration the aircraft registration |
|
9688 | - * @return String the country |
|
9689 | - * |
|
9690 | - */ |
|
9685 | + * Country from the registration code |
|
9686 | + * |
|
9687 | + * @param String $registration the aircraft registration |
|
9688 | + * @return String the country |
|
9689 | + * |
|
9690 | + */ |
|
9691 | 9691 | public function countryFromAircraftRegistration($registration) |
9692 | 9692 | { |
9693 | 9693 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -9706,8 +9706,8 @@ discard block |
||
9706 | 9706 | $country = $row['country']; |
9707 | 9707 | } |
9708 | 9708 | } else { |
9709 | - $registration_1 = substr($registration, 0, 1); |
|
9710 | - $registration_2 = substr($registration, 0, 2); |
|
9709 | + $registration_1 = substr($registration, 0, 1); |
|
9710 | + $registration_2 = substr($registration, 0, 2); |
|
9711 | 9711 | |
9712 | 9712 | $country = ''; |
9713 | 9713 | //first get the prefix based on two characters |
@@ -9743,11 +9743,11 @@ discard block |
||
9743 | 9743 | } |
9744 | 9744 | |
9745 | 9745 | /** |
9746 | - * Set a new highlight value for a flight |
|
9747 | - * |
|
9748 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
9749 | - * @param String $highlight New highlight value |
|
9750 | - */ |
|
9746 | + * Set a new highlight value for a flight |
|
9747 | + * |
|
9748 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
9749 | + * @param String $highlight New highlight value |
|
9750 | + */ |
|
9751 | 9751 | public function setHighlightFlight($flightaware_id,$highlight) { |
9752 | 9752 | |
9753 | 9753 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -9756,12 +9756,12 @@ discard block |
||
9756 | 9756 | } |
9757 | 9757 | |
9758 | 9758 | /** |
9759 | - * Gets the short url from bit.ly |
|
9760 | - * |
|
9761 | - * @param String $url the full url |
|
9762 | - * @return String the bit.ly url |
|
9763 | - * |
|
9764 | - */ |
|
9759 | + * Gets the short url from bit.ly |
|
9760 | + * |
|
9761 | + * @param String $url the full url |
|
9762 | + * @return String the bit.ly url |
|
9763 | + * |
|
9764 | + */ |
|
9765 | 9765 | public function getBitlyURL($url) |
9766 | 9766 | { |
9767 | 9767 | global $globalBitlyAccessToken; |
@@ -10050,11 +10050,11 @@ discard block |
||
10050 | 10050 | $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 |
10051 | 10051 | 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)) |
10052 | 10052 | 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;"; |
10053 | - } else { |
|
10053 | + } else { |
|
10054 | 10054 | $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 |
10055 | 10055 | 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)) |
10056 | 10056 | 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;"; |
10057 | - } |
|
10057 | + } |
|
10058 | 10058 | $sth = $this->db->prepare($query); |
10059 | 10059 | $sth->execute(); |
10060 | 10060 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | // When button "Remove all filters" is clicked |
29 | 29 | if (isset($_POST['removefilters'])) { |
30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
31 | - return strpos($key,'filter_') === 0; |
|
31 | + return strpos($key,'filter_') === 0; |
|
32 | 32 | }); |
33 | 33 | foreach ($allfilters as $filt) { |
34 | 34 | unset($_COOKIE[$filt]); |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | } |
168 | 168 | ?> |
169 | 169 | <?php |
170 | - if (isset($_POST['archive'])) { |
|
170 | + if (isset($_POST['archive'])) { |
|
171 | 171 | ?> |
172 | 172 | <?php |
173 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
173 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
174 | 174 | ?> |
175 | 175 | |
176 | 176 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
177 | 177 | <?php |
178 | - } |
|
179 | - } else { |
|
178 | + } |
|
179 | + } else { |
|
180 | 180 | ?> |
181 | 181 | <?php |
182 | 182 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -188,18 +188,18 @@ discard block |
||
188 | 188 | */ |
189 | 189 | ?> |
190 | 190 | <?php |
191 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
191 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
192 | 192 | ?> |
193 | 193 | <script src="<?php print $globalURL; ?>/js/leaflet-playback.js"></script> |
194 | 194 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script> |
195 | 195 | <?php |
196 | - } |
|
196 | + } |
|
197 | 197 | ?> |
198 | 198 | <?php |
199 | 199 | // } |
200 | 200 | ?> |
201 | 201 | <?php |
202 | - } |
|
202 | + } |
|
203 | 203 | } |
204 | 204 | ?> |
205 | 205 | <?php |
@@ -359,23 +359,23 @@ discard block |
||
359 | 359 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
360 | 360 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
361 | 361 | <?php |
362 | - if ($globalACARS) { |
|
363 | - if (isset($globalDemo) && $globalDemo) { |
|
364 | - ?> |
|
362 | + if ($globalACARS) { |
|
363 | + if (isset($globalDemo) && $globalDemo) { |
|
364 | + ?> |
|
365 | 365 | <li><hr /></li> |
366 | 366 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
367 | 367 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
368 | 368 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
369 | 369 | <?php |
370 | - } else { |
|
371 | - ?> |
|
370 | + } else { |
|
371 | + ?> |
|
372 | 372 | <li><hr /></li> |
373 | 373 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
374 | 374 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
375 | 375 | <?php |
376 | - } |
|
377 | - } |
|
378 | - ?> |
|
376 | + } |
|
377 | + } |
|
378 | + ?> |
|
379 | 379 | <li><hr /></li> |
380 | 380 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
381 | 381 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
@@ -417,14 +417,14 @@ discard block |
||
417 | 417 | <form> |
418 | 418 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
419 | 419 | <?php |
420 | - $Language = new Language(); |
|
421 | - $alllang = $Language->getLanguages(); |
|
422 | - foreach ($alllang as $key => $lang) { |
|
423 | - print '<option value="'.$key.'"'; |
|
424 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
425 | - print '>'.$lang[0].'</option>'; |
|
426 | - } |
|
427 | - ?> |
|
420 | + $Language = new Language(); |
|
421 | + $alllang = $Language->getLanguages(); |
|
422 | + foreach ($alllang as $key => $lang) { |
|
423 | + print '<option value="'.$key.'"'; |
|
424 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
425 | + print '>'.$lang[0].'</option>'; |
|
426 | + } |
|
427 | + ?> |
|
428 | 428 | </select> |
429 | 429 | </form> |
430 | 430 | </div> |
@@ -455,18 +455,18 @@ discard block |
||
455 | 455 | ?> |
456 | 456 | <div class="top-header clear" role="main"> |
457 | 457 | <?php |
458 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
458 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
459 | 459 | ?> |
460 | 460 | <div id="archive-map"></div> |
461 | 461 | <?php |
462 | - } |
|
462 | + } |
|
463 | 463 | ?> |
464 | 464 | </div> |
465 | 465 | <?php |
466 | 466 | } |
467 | 467 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
468 | 468 | { |
469 | - ?> |
|
469 | + ?> |
|
470 | 470 | <div class="top-header clear" role="main"> |
471 | 471 | <div id="map"></div> |
472 | 472 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -477,15 +477,15 @@ discard block |
||
477 | 477 | var zoom = 13; |
478 | 478 | //create the map |
479 | 479 | <?php |
480 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
480 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
481 | 481 | ?> |
482 | 482 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
483 | 483 | <?php |
484 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
484 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
485 | 485 | ?> |
486 | 486 | map = L.map('map', { zoomControl:true }); |
487 | 487 | <?php |
488 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
488 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
489 | 489 | ?> |
490 | 490 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
491 | 491 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -493,22 +493,22 @@ discard block |
||
493 | 493 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
494 | 494 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
495 | 495 | <?php |
496 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
496 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
497 | 497 | ?> |
498 | 498 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
499 | 499 | <?php |
500 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
500 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
501 | 501 | ?> |
502 | 502 | map = L.map('map', { zoomControl:true }); |
503 | 503 | <?php |
504 | - } |
|
504 | + } |
|
505 | 505 | ?> |
506 | 506 | //initialize the layer group for the aircrft markers |
507 | 507 | var layer_data = L.layerGroup(); |
508 | 508 | |
509 | 509 | //a few title layers |
510 | 510 | <?php |
511 | - if ($globalMapProvider == 'Mapbox') { |
|
511 | + if ($globalMapProvider == 'Mapbox') { |
|
512 | 512 | ?> |
513 | 513 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
514 | 514 | maxZoom: 18, |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | token : '<?php print $globalMapboxToken; ?>' |
520 | 520 | }).addTo(map); |
521 | 521 | <?php |
522 | - } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
522 | + } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
523 | 523 | ?> |
524 | 524 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
525 | 525 | maxZoom: 18, |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>' |
528 | 528 | }).addTo(map); |
529 | 529 | <?php |
530 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
530 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
531 | 531 | ?> |
532 | 532 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
533 | 533 | maxZoom: 18, |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
537 | 537 | }).addTo(map); |
538 | 538 | <?php |
539 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
539 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
540 | 540 | ?> |
541 | 541 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
542 | 542 | maxZoom: 18, |
@@ -545,27 +545,27 @@ discard block |
||
545 | 545 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
546 | 546 | }).addTo(map); |
547 | 547 | <?php |
548 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
548 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
549 | 549 | ?> |
550 | 550 | var googleLayer = new L.Google('ROADMAP'); |
551 | 551 | map.addLayer(googleLayer); |
552 | 552 | <?php |
553 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
553 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
554 | 554 | ?> |
555 | 555 | var googleLayer = new L.Google('SATELLITE'); |
556 | 556 | map.addLayer(googleLayer); |
557 | 557 | <?php |
558 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
558 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
559 | 559 | ?> |
560 | 560 | var googleLayer = new L.Google('HYBRID'); |
561 | 561 | map.addLayer(googleLayer); |
562 | 562 | <?php |
563 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
563 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
564 | 564 | ?> |
565 | 565 | var googleLayer = new L.Google('Terrain'); |
566 | 566 | map.addLayer(googleLayer); |
567 | 567 | <?php |
568 | - } |
|
568 | + } |
|
569 | 569 | ?> |
570 | 570 | </script> |
571 | 571 | </div> |
@@ -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 | <div class="row global-stats"> |
49 | 49 | <div class="col-md-2"><span class="type"><?php echo _("Flights"); ?></span><span><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name)); ?></span></div> |
@@ -51,23 +51,23 @@ discard block |
||
51 | 51 | <div class="col-md-2"><span class="type"><?php echo _("Arrivals seen"); ?></span><span><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name)); ?></span></div> |
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 | <div class="col-md-2"><span class="type"><?php echo _("Pilots"); ?></span><span><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name)); ?></span></div> |
57 | 57 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
58 | 58 | <?php |
59 | - } else { |
|
60 | - ?> |
|
59 | + } else { |
|
60 | + ?> |
|
61 | 61 | <div class="col-md-2"><span class="type"><?php echo _("Owners"); ?></span><span><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name)); ?></span></div> |
62 | 62 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
63 | 63 | <?php |
64 | - } |
|
65 | - ?> |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <div class="col-md-2"><span class="type"><?php echo _("Aircrafts"); ?></span><span><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name)); ?></span></div> |
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 | <div class="col-md-2"><span class="type"><?php echo _("Airlines"); ?></span><span><?php print number_format($Stats->countOverallAirlines($filter_name)); ?></span></div> |
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,30 +130,30 @@ 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 | ?> |
135 | 135 | <div class="col-md-6"> |
136 | 136 | <h2><?php echo _("Top 10 Most Common Airline"); ?></h2> |
137 | 137 | <?php |
138 | - $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
139 | - if (count($airline_array) == 0) print _("No data available"); |
|
140 | - else { |
|
138 | + $airline_array = $Stats->countAllAirlines(true,$filter_name); |
|
139 | + if (count($airline_array) == 0) print _("No data available"); |
|
140 | + else { |
|
141 | 141 | |
142 | - print '<div id="chart2" class="chart" width="100%"></div> |
|
142 | + print '<div id="chart2" class="chart" width="100%"></div> |
|
143 | 143 | <script> |
144 | 144 | google.load("visualization", "1", {packages:["corechart"]}); |
145 | 145 | google.setOnLoadCallback(drawChart2); |
146 | 146 | function drawChart2() { |
147 | 147 | var data = google.visualization.arrayToDataTable([ |
148 | 148 | ["'._("Airline").'", "'._("# of times").'"], '; |
149 | - $airline_data = ''; |
|
150 | - foreach($airline_array as $airline_item) |
|
151 | - { |
|
152 | - $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
153 | - } |
|
154 | - $airline_data = substr($airline_data, 0, -1); |
|
155 | - print $airline_data; |
|
156 | - print ']); |
|
149 | + $airline_data = ''; |
|
150 | + foreach($airline_array as $airline_item) |
|
151 | + { |
|
152 | + $airline_data .= '[ "'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
|
153 | + } |
|
154 | + $airline_data = substr($airline_data, 0, -1); |
|
155 | + print $airline_data; |
|
156 | + print ']); |
|
157 | 157 | |
158 | 158 | var options = { |
159 | 159 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | drawChart2(); |
169 | 169 | }); |
170 | 170 | </script>'; |
171 | - } |
|
172 | - ?> |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | <div class="more"> |
174 | 174 | <a href="<?php print $globalURL; ?>/statistics/airline" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
175 | 175 | </div> |
@@ -177,44 +177,44 @@ discard block |
||
177 | 177 | </div> |
178 | 178 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
179 | 179 | <?php |
180 | - } |
|
180 | + } |
|
181 | 181 | ?> |
182 | 182 | <div class="row column"> |
183 | 183 | |
184 | 184 | <?php |
185 | - $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
185 | + $flightover_array = $Stats->countAllFlightOverCountries($airline_icao,$filter_name); |
|
186 | 186 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
187 | - if (empty($flightover_array)) { |
|
188 | - ?> |
|
187 | + if (empty($flightover_array)) { |
|
188 | + ?> |
|
189 | 189 | <div class="col-md-12"> |
190 | 190 | <?php |
191 | - } else { |
|
192 | - ?> |
|
191 | + } else { |
|
192 | + ?> |
|
193 | 193 | <div class="col-md-6"> |
194 | 194 | <?php |
195 | - } |
|
196 | - ?> |
|
195 | + } |
|
196 | + ?> |
|
197 | 197 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
198 | 198 | <?php |
199 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
200 | - if (count($pilot_array) == 0) print _("No data available"); |
|
201 | - else { |
|
199 | + $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name); |
|
200 | + if (count($pilot_array) == 0) print _("No data available"); |
|
201 | + else { |
|
202 | 202 | |
203 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
203 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
204 | 204 | <script> |
205 | 205 | google.load("visualization", "1", {packages:["corechart"]}); |
206 | 206 | google.setOnLoadCallback(drawChart7); |
207 | 207 | function drawChart7() { |
208 | 208 | var data = google.visualization.arrayToDataTable([ |
209 | 209 | ["'._("Pilots").'", "'._("# of times").'"], '; |
210 | - $pilot_data = ''; |
|
211 | - foreach($pilot_array as $pilot_item) |
|
212 | - { |
|
213 | - $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
214 | - } |
|
215 | - $pilot_data = substr($pilot_data, 0, -1); |
|
216 | - print $pilot_data; |
|
217 | - print ']); |
|
210 | + $pilot_data = ''; |
|
211 | + foreach($pilot_array as $pilot_item) |
|
212 | + { |
|
213 | + $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
|
214 | + } |
|
215 | + $pilot_data = substr($pilot_data, 0, -1); |
|
216 | + print $pilot_data; |
|
217 | + print ']); |
|
218 | 218 | |
219 | 219 | var options = { |
220 | 220 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | drawChart7(); |
230 | 230 | }); |
231 | 231 | </script>'; |
232 | - } |
|
233 | - ?> |
|
232 | + } |
|
233 | + ?> |
|
234 | 234 | <div class="more"> |
235 | 235 | <a href="<?php print $globalURL; ?>/statistics/pilot" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
236 | 236 | </div> |
@@ -238,30 +238,30 @@ discard block |
||
238 | 238 | |
239 | 239 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
240 | 240 | <?php |
241 | - } else { |
|
242 | - ?> |
|
241 | + } else { |
|
242 | + ?> |
|
243 | 243 | <div class="col-md-6"> |
244 | 244 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
245 | 245 | <?php |
246 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
247 | - if (count($owner_array) == 0) print _("No data available"); |
|
248 | - else { |
|
246 | + $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name); |
|
247 | + if (count($owner_array) == 0) print _("No data available"); |
|
248 | + else { |
|
249 | 249 | |
250 | - print '<div id="chart7" class="chart" width="100%"></div> |
|
250 | + print '<div id="chart7" class="chart" width="100%"></div> |
|
251 | 251 | <script> |
252 | 252 | google.load("visualization", "1", {packages:["corechart"]}); |
253 | 253 | google.setOnLoadCallback(drawChart7); |
254 | 254 | function drawChart7() { |
255 | 255 | var data = google.visualization.arrayToDataTable([ |
256 | 256 | ["'._("Owner").'", "'._("# of times").'"], '; |
257 | - $owner_data = ''; |
|
258 | - foreach($owner_array as $owner_item) |
|
259 | - { |
|
260 | - $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
261 | - } |
|
262 | - $owner_data = substr($owner_data, 0, -1); |
|
263 | - print $owner_data; |
|
264 | - print ']); |
|
257 | + $owner_data = ''; |
|
258 | + foreach($owner_array as $owner_item) |
|
259 | + { |
|
260 | + $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
|
261 | + } |
|
262 | + $owner_data = substr($owner_data, 0, -1); |
|
263 | + print $owner_data; |
|
264 | + print ']); |
|
265 | 265 | |
266 | 266 | var options = { |
267 | 267 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -276,8 +276,8 @@ discard block |
||
276 | 276 | drawChart7(); |
277 | 277 | }); |
278 | 278 | </script>'; |
279 | - } |
|
280 | - ?> |
|
279 | + } |
|
280 | + ?> |
|
281 | 281 | <div class="more"> |
282 | 282 | <a href="<?php print $globalURL; ?>/statistics/owner" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
283 | 283 | </div> |
@@ -285,32 +285,32 @@ discard block |
||
285 | 285 | |
286 | 286 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
287 | 287 | <?php |
288 | - } |
|
289 | - if (!empty($flightover_array)) { |
|
290 | - ?> |
|
288 | + } |
|
289 | + if (!empty($flightover_array)) { |
|
290 | + ?> |
|
291 | 291 | |
292 | 292 | <div class="col-md-6"> |
293 | 293 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
294 | 294 | <?php |
295 | - //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
296 | - if (count($flightover_array) == 0) print _("No data available"); |
|
297 | - else { |
|
295 | + //$flightover_array = $Stats->countAllFlightOverCountries(); |
|
296 | + if (count($flightover_array) == 0) print _("No data available"); |
|
297 | + else { |
|
298 | 298 | |
299 | - print '<div id="chart10" class="chart" width="100%"></div> |
|
299 | + print '<div id="chart10" class="chart" width="100%"></div> |
|
300 | 300 | <script> |
301 | 301 | google.load("visualization", "1", {packages:["corechart"]}); |
302 | 302 | google.setOnLoadCallback(drawChart10); |
303 | 303 | function drawChart10() { |
304 | 304 | var data = google.visualization.arrayToDataTable([ |
305 | 305 | ["'._("Country").'", "'._("# of times").'"], '; |
306 | - $flightover_data = ''; |
|
307 | - foreach($flightover_array as $flightover_item) |
|
308 | - { |
|
309 | - $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
310 | - } |
|
311 | - $flightover_data = substr($flightover_data, 0, -1); |
|
312 | - print $flightover_data; |
|
313 | - print ']); |
|
306 | + $flightover_data = ''; |
|
307 | + foreach($flightover_array as $flightover_item) |
|
308 | + { |
|
309 | + $flightover_data .= '[ "'.$flightover_item['flight_country'].' ('.$flightover_item['flight_country_iso2'].')",'.$flightover_item['flight_count'].'],'; |
|
310 | + } |
|
311 | + $flightover_data = substr($flightover_data, 0, -1); |
|
312 | + print $flightover_data; |
|
313 | + print ']); |
|
314 | 314 | |
315 | 315 | var options = { |
316 | 316 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | drawChart10(); |
328 | 328 | }); |
329 | 329 | </script>'; |
330 | - } |
|
331 | - ?> |
|
330 | + } |
|
331 | + ?> |
|
332 | 332 | <div class="more"> |
333 | 333 | <a href="<?php print $globalURL; ?>/statistics/country" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
334 | 334 | </div> |
335 | 335 | </div> |
336 | 336 | <?php |
337 | - } |
|
338 | - ?> |
|
337 | + } |
|
338 | + ?> |
|
339 | 339 | </div> |
340 | 340 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
341 | 341 | |
@@ -345,11 +345,11 @@ discard block |
||
345 | 345 | <div class="col-md-6"> |
346 | 346 | <h2><?php echo _("Top 10 Most Common Departure Airports"); ?></h2> |
347 | 347 | <?php |
348 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
349 | - if (count($airport_airport_array) == 0) print _("No data available"); |
|
350 | - else { |
|
348 | + $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name); |
|
349 | + if (count($airport_airport_array) == 0) print _("No data available"); |
|
350 | + else { |
|
351 | 351 | |
352 | - print '<div id="chart3" class="chart" width="100%"></div> |
|
352 | + print '<div id="chart3" class="chart" width="100%"></div> |
|
353 | 353 | <script> |
354 | 354 | google.load("visualization", "1", {packages:["geochart"]}); |
355 | 355 | google.setOnLoadCallback(drawCharts3); |
@@ -360,17 +360,17 @@ discard block |
||
360 | 360 | |
361 | 361 | var data = google.visualization.arrayToDataTable([ |
362 | 362 | ["'._("Airport").'", "'._("# of times").'"],'; |
363 | - $airport_data = ''; |
|
364 | - foreach($airport_airport_array as $airport_item) |
|
365 | - { |
|
366 | - $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
367 | - $name = str_replace("'", "", $name); |
|
368 | - $name = str_replace('"', "", $name); |
|
369 | - $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
370 | - } |
|
371 | - $airport_data = substr($airport_data, 0, -1); |
|
372 | - print $airport_data; |
|
373 | - print ']); |
|
363 | + $airport_data = ''; |
|
364 | + foreach($airport_airport_array as $airport_item) |
|
365 | + { |
|
366 | + $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
|
367 | + $name = str_replace("'", "", $name); |
|
368 | + $name = str_replace('"', "", $name); |
|
369 | + $airport_data .= '[ "'.$name.'",'.$airport_item['airport_departure_icao_count'].'],'; |
|
370 | + } |
|
371 | + $airport_data = substr($airport_data, 0, -1); |
|
372 | + print $airport_data; |
|
373 | + print ']); |
|
374 | 374 | |
375 | 375 | var options = { |
376 | 376 | legend: {position: "none"}, |
@@ -384,8 +384,8 @@ discard block |
||
384 | 384 | chart.draw(data, options); |
385 | 385 | } |
386 | 386 | </script>'; |
387 | - } |
|
388 | - ?> |
|
387 | + } |
|
388 | + ?> |
|
389 | 389 | <div class="more"> |
390 | 390 | <a href="<?php print $globalURL; ?>/statistics/airport-departure" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
391 | 391 | </div> |
@@ -395,11 +395,11 @@ discard block |
||
395 | 395 | <div class="col-md-6"> |
396 | 396 | <h2><?php echo _("Top 10 Most Common Arrival Airports"); ?></h2> |
397 | 397 | <?php |
398 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
399 | - if (count($airport_airport_array2) == 0) print _("No data available"); |
|
400 | - else { |
|
398 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name); |
|
399 | + if (count($airport_airport_array2) == 0) print _("No data available"); |
|
400 | + else { |
|
401 | 401 | |
402 | - print '<div id="chart4" class="chart" width="100%"></div> |
|
402 | + print '<div id="chart4" class="chart" width="100%"></div> |
|
403 | 403 | <script> |
404 | 404 | google.load("visualization", "1", {packages:["geochart"]}); |
405 | 405 | google.setOnLoadCallback(drawCharts4); |
@@ -410,17 +410,17 @@ discard block |
||
410 | 410 | |
411 | 411 | var data = google.visualization.arrayToDataTable([ |
412 | 412 | ["'._("Airport").'", "'._("# of times").'"],'; |
413 | - $airport_data2 = ''; |
|
414 | - foreach($airport_airport_array2 as $airport_item2) |
|
415 | - { |
|
416 | - $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
417 | - $name2 = str_replace("'", "", $name2); |
|
418 | - $name2 = str_replace('"', "", $name2); |
|
419 | - $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
420 | - } |
|
421 | - $airport_data2 = substr($airport_data2, 0, -1); |
|
422 | - print $airport_data2; |
|
423 | - print ']); |
|
413 | + $airport_data2 = ''; |
|
414 | + foreach($airport_airport_array2 as $airport_item2) |
|
415 | + { |
|
416 | + $name2 = $airport_item2['airport_arrival_city'].', '.$airport_item2['airport_arrival_country'].' ('.$airport_item2['airport_arrival_icao'].')'; |
|
417 | + $name2 = str_replace("'", "", $name2); |
|
418 | + $name2 = str_replace('"', "", $name2); |
|
419 | + $airport_data2 .= '[ "'.$name2.'",'.$airport_item2['airport_arrival_icao_count'].'],'; |
|
420 | + } |
|
421 | + $airport_data2 = substr($airport_data2, 0, -1); |
|
422 | + print $airport_data2; |
|
423 | + print ']); |
|
424 | 424 | |
425 | 425 | var options = { |
426 | 426 | legend: {position: "none"}, |
@@ -434,8 +434,8 @@ discard block |
||
434 | 434 | chart.draw(data, options); |
435 | 435 | } |
436 | 436 | </script>'; |
437 | - } |
|
438 | - ?> |
|
437 | + } |
|
438 | + ?> |
|
439 | 439 | <div class="more"> |
440 | 440 | <a href="<?php print $globalURL; ?>/statistics/airport-arrival" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
441 | 441 | </div> |
@@ -447,24 +447,24 @@ discard block |
||
447 | 447 | <div class="col-md-6"> |
448 | 448 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
449 | 449 | <?php |
450 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
451 | - if (count($year_array) == 0) print _("No data available"); |
|
452 | - else { |
|
453 | - print '<div id="chart8" class="chart" width="100%"></div> |
|
450 | + $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
451 | + if (count($year_array) == 0) print _("No data available"); |
|
452 | + else { |
|
453 | + print '<div id="chart8" class="chart" width="100%"></div> |
|
454 | 454 | <script> |
455 | 455 | google.load("visualization", "1", {packages:["corechart"]}); |
456 | 456 | google.setOnLoadCallback(drawChart8); |
457 | 457 | function drawChart8() { |
458 | 458 | var data = google.visualization.arrayToDataTable([ |
459 | 459 | ["'._("Month").'", "'._("# of Flights").'"], '; |
460 | - $year_data = ''; |
|
461 | - foreach($year_array as $year_item) |
|
462 | - { |
|
463 | - $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
464 | - } |
|
465 | - $year_data = substr($year_data, 0, -1); |
|
466 | - print $year_data; |
|
467 | - print ']); |
|
460 | + $year_data = ''; |
|
461 | + foreach($year_array as $year_item) |
|
462 | + { |
|
463 | + $year_data .= '[ "'.date('F, Y',strtotime($year_item['year_name'].'-'.$year_item['month_name'].'-01')).'",'.$year_item['date_count'].'],'; |
|
464 | + } |
|
465 | + $year_data = substr($year_data, 0, -1); |
|
466 | + print $year_data; |
|
467 | + print ']); |
|
468 | 468 | |
469 | 469 | var options = { |
470 | 470 | legend: {position: "none"}, |
@@ -482,8 +482,8 @@ discard block |
||
482 | 482 | drawChart8(); |
483 | 483 | }); |
484 | 484 | </script>'; |
485 | - } |
|
486 | - ?> |
|
485 | + } |
|
486 | + ?> |
|
487 | 487 | <div class="more"> |
488 | 488 | <a href="<?php print $globalURL; ?>/statistics/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
489 | 489 | </div> |
@@ -493,24 +493,24 @@ discard block |
||
493 | 493 | <div class="col-md-6"> |
494 | 494 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
495 | 495 | <?php |
496 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
497 | - if (count($month_array) == 0) print _("No data available"); |
|
498 | - else { |
|
499 | - print '<div id="chart9" class="chart" width="100%"></div> |
|
496 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
497 | + if (count($month_array) == 0) print _("No data available"); |
|
498 | + else { |
|
499 | + print '<div id="chart9" class="chart" width="100%"></div> |
|
500 | 500 | <script> |
501 | 501 | google.load("visualization", "1", {packages:["corechart"]}); |
502 | 502 | google.setOnLoadCallback(drawChart9); |
503 | 503 | function drawChart9() { |
504 | 504 | var data = google.visualization.arrayToDataTable([ |
505 | 505 | ["'._("Day").'", "'._("# of Flights").'"], '; |
506 | - $month_data = ''; |
|
507 | - foreach($month_array as $month_item) |
|
508 | - { |
|
509 | - $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
510 | - } |
|
511 | - $month_data = substr($month_data, 0, -1); |
|
512 | - print $month_data; |
|
513 | - print ']); |
|
506 | + $month_data = ''; |
|
507 | + foreach($month_array as $month_item) |
|
508 | + { |
|
509 | + $month_data .= '[ "'.date('F j, Y',strtotime($month_item['date_name'])).'",'.$month_item['date_count'].'],'; |
|
510 | + } |
|
511 | + $month_data = substr($month_data, 0, -1); |
|
512 | + print $month_data; |
|
513 | + print ']); |
|
514 | 514 | |
515 | 515 | var options = { |
516 | 516 | legend: {position: "none"}, |
@@ -528,8 +528,8 @@ discard block |
||
528 | 528 | drawChart9(); |
529 | 529 | }); |
530 | 530 | </script>'; |
531 | - } |
|
532 | - ?> |
|
531 | + } |
|
532 | + ?> |
|
533 | 533 | <div class="more"> |
534 | 534 | <a href="<?php print $globalURL; ?>/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
535 | 535 | </div> |
@@ -539,25 +539,25 @@ discard block |
||
539 | 539 | <div class="col-md-6"> |
540 | 540 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
541 | 541 | <?php |
542 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
543 | - if (empty($date_array)) print _("No data available"); |
|
544 | - else { |
|
545 | - print '<div id="chart5" class="chart" width="100%"></div> |
|
542 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
543 | + if (empty($date_array)) print _("No data available"); |
|
544 | + else { |
|
545 | + print '<div id="chart5" class="chart" width="100%"></div> |
|
546 | 546 | <script> |
547 | 547 | google.load("visualization", "1", {packages:["corechart"]}); |
548 | 548 | google.setOnLoadCallback(drawChart5); |
549 | 549 | function drawChart5() { |
550 | 550 | var data = google.visualization.arrayToDataTable([ |
551 | 551 | ["'._("Date").'", "'._("# of Flights").'"], '; |
552 | - $date_data = ''; |
|
552 | + $date_data = ''; |
|
553 | 553 | |
554 | - foreach($date_array as $date_item) |
|
555 | - { |
|
556 | - $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
557 | - } |
|
558 | - $date_data = substr($date_data, 0, -1); |
|
559 | - print $date_data; |
|
560 | - print ']); |
|
554 | + foreach($date_array as $date_item) |
|
555 | + { |
|
556 | + $date_data .= '[ "'.date("F j, Y", strtotime($date_item['date_name'])).'",'.$date_item['date_count'].'],'; |
|
557 | + } |
|
558 | + $date_data = substr($date_data, 0, -1); |
|
559 | + print $date_data; |
|
560 | + print ']); |
|
561 | 561 | |
562 | 562 | var options = { |
563 | 563 | legend: {position: "none"}, |
@@ -575,8 +575,8 @@ discard block |
||
575 | 575 | drawChart5(); |
576 | 576 | }); |
577 | 577 | </script>'; |
578 | - } |
|
579 | - ?> |
|
578 | + } |
|
579 | + ?> |
|
580 | 580 | <div class="more"> |
581 | 581 | <a href="<?php print $globalURL; ?>/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
582 | 582 | </div> |
@@ -586,25 +586,25 @@ discard block |
||
586 | 586 | <div class="col-md-6"> |
587 | 587 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
588 | 588 | <?php |
589 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
590 | - if (empty($hour_array)) print _("No data available"); |
|
591 | - else { |
|
589 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
590 | + if (empty($hour_array)) print _("No data available"); |
|
591 | + else { |
|
592 | 592 | |
593 | - print '<div id="chart6" class="chart" width="100%"></div> |
|
593 | + print '<div id="chart6" class="chart" width="100%"></div> |
|
594 | 594 | <script> |
595 | 595 | google.load("visualization", "1", {packages:["corechart"]}); |
596 | 596 | google.setOnLoadCallback(drawChart6); |
597 | 597 | function drawChart6() { |
598 | 598 | var data = google.visualization.arrayToDataTable([ |
599 | 599 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
600 | - $hour_data = ''; |
|
601 | - foreach($hour_array as $hour_item) |
|
602 | - { |
|
603 | - $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
604 | - } |
|
605 | - $hour_data = substr($hour_data, 0, -1); |
|
606 | - print $hour_data; |
|
607 | - print ']); |
|
600 | + $hour_data = ''; |
|
601 | + foreach($hour_array as $hour_item) |
|
602 | + { |
|
603 | + $hour_data .= '[ "'.$hour_item['hour_name'].':00",'.$hour_item['hour_count'].'],'; |
|
604 | + } |
|
605 | + $hour_data = substr($hour_data, 0, -1); |
|
606 | + print $hour_data; |
|
607 | + print ']); |
|
608 | 608 | |
609 | 609 | var options = { |
610 | 610 | legend: {position: "none"}, |
@@ -622,8 +622,8 @@ discard block |
||
622 | 622 | drawChart6(); |
623 | 623 | }); |
624 | 624 | </script>'; |
625 | - } |
|
626 | - ?> |
|
625 | + } |
|
626 | + ?> |
|
627 | 627 | <div class="more"> |
628 | 628 | <a href="<?php print $globalURL; ?>/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
629 | 629 | </div> |
@@ -631,21 +631,21 @@ discard block |
||
631 | 631 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
632 | 632 | </div> |
633 | 633 | <?php |
634 | - if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
634 | + if (($airline_icao == '' || $airline_icao == 'all') && $filter_name == '') { |
|
635 | 635 | ?> |
636 | 636 | <div class="row column"> |
637 | 637 | <?php |
638 | - $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
639 | - if (!empty($polar)) { |
|
640 | - print '<h2>'._("Coverage pattern").'</h2>'; |
|
641 | - foreach ($polar as $eachpolar) { |
|
642 | - unset($polar_data); |
|
643 | - $Spotter = new Spotter(); |
|
644 | - $data = json_decode($eachpolar['source_data']); |
|
645 | - foreach($data as $value => $key) { |
|
646 | - $direction = $Spotter->parseDirection(($value*22.5)); |
|
647 | - $distance = $key; |
|
648 | - $unit = 'km'; |
|
638 | + $polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
|
639 | + if (!empty($polar)) { |
|
640 | + print '<h2>'._("Coverage pattern").'</h2>'; |
|
641 | + foreach ($polar as $eachpolar) { |
|
642 | + unset($polar_data); |
|
643 | + $Spotter = new Spotter(); |
|
644 | + $data = json_decode($eachpolar['source_data']); |
|
645 | + foreach($data as $value => $key) { |
|
646 | + $direction = $Spotter->parseDirection(($value*22.5)); |
|
647 | + $distance = $key; |
|
648 | + $unit = 'km'; |
|
649 | 649 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
650 | 650 | $distance = round($distance*0.539957); |
651 | 651 | $unit = 'nm'; |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | $distance = $distance; |
657 | 657 | $unit = 'km'; |
658 | 658 | } |
659 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
660 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
661 | - } |
|
662 | - ?> |
|
659 | + if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
660 | + else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
661 | + } |
|
662 | + ?> |
|
663 | 663 | <div class="col-md-6"> |
664 | 664 | <h4><?php print $eachpolar['source_name']; ?></h4> |
665 | 665 | <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
@@ -691,22 +691,22 @@ discard block |
||
691 | 691 | </script> |
692 | 692 | </div> |
693 | 693 | <?php |
694 | - } |
|
695 | - } |
|
696 | - ?> |
|
694 | + } |
|
695 | + } |
|
696 | + ?> |
|
697 | 697 | </div> |
698 | 698 | <div class="row column"> |
699 | 699 | <div class="col-md-6"> |
700 | 700 | <?php |
701 | - $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
702 | - if (!empty($msg)) { |
|
703 | - print '<h2>'._("Messages received").'</h2>'; |
|
704 | - foreach ($msg as $eachmsg) { |
|
705 | - //$eachmsg = $msg[0]; |
|
706 | - $data = $eachmsg['source_data']; |
|
707 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
708 | - else $max = 500; |
|
709 | - ?> |
|
701 | + $msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
|
702 | + if (!empty($msg)) { |
|
703 | + print '<h2>'._("Messages received").'</h2>'; |
|
704 | + foreach ($msg as $eachmsg) { |
|
705 | + //$eachmsg = $msg[0]; |
|
706 | + $data = $eachmsg['source_data']; |
|
707 | + if ($data > 500) $max = (round(($data+100)/100))*100; |
|
708 | + else $max = 500; |
|
709 | + ?> |
|
710 | 710 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
711 | 711 | <script> |
712 | 712 | var g = new JustGage({ |
@@ -722,9 +722,9 @@ discard block |
||
722 | 722 | }); |
723 | 723 | </script> |
724 | 724 | <?php |
725 | - } |
|
726 | - } |
|
727 | - ?> |
|
725 | + } |
|
726 | + } |
|
727 | + ?> |
|
728 | 728 | </div> |
729 | 729 | </div> |
730 | 730 | <div class="row column"> |
@@ -751,19 +751,19 @@ discard block |
||
751 | 751 | $hist_data .= '[ "'.$distance.'",'.$nb.'],'; |
752 | 752 | } |
753 | 753 | $hist_data = substr($hist_data, 0, -1); |
754 | - ?> |
|
754 | + ?> |
|
755 | 755 | <div class="col-md-6"> |
756 | 756 | <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
757 | 757 | <?php |
758 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
758 | + print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div> |
|
759 | 759 | <script> |
760 | 760 | google.load("visualization", "1", {packages:["corechart"]}); |
761 | 761 | google.setOnLoadCallback(drawCharthist_'.str_replace(' ','_',strtolower($source)).'); |
762 | 762 | function drawCharthist_'.str_replace(' ','_',strtolower($source)).'() { |
763 | 763 | var data = google.visualization.arrayToDataTable([ |
764 | 764 | ["'._("Distance").'", "'._("# of Flights").'"], '; |
765 | - print $hist_data; |
|
766 | - print ']); |
|
765 | + print $hist_data; |
|
766 | + print ']); |
|
767 | 767 | |
768 | 768 | var options = { |
769 | 769 | legend: {position: "none"}, |
@@ -781,15 +781,15 @@ discard block |
||
781 | 781 | drawCharthist_'.str_replace(' ','_',strtolower($source)).'(); |
782 | 782 | }); |
783 | 783 | </script>'; |
784 | - ?> |
|
784 | + ?> |
|
785 | 785 | </div> |
786 | 786 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
787 | 787 | <?php |
788 | - } |
|
789 | - ?> |
|
788 | + } |
|
789 | + ?> |
|
790 | 790 | </div> |
791 | 791 | <?php |
792 | - } |
|
792 | + } |
|
793 | 793 | ?> |
794 | 794 | </div> |
795 | 795 | </div> |
@@ -305,17 +305,17 @@ discard block |
||
305 | 305 | </tr> |
306 | 306 | <!-- |
307 | 307 | <?php |
308 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
309 | - $Connection = new Connection(); |
|
308 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
309 | + $Connection = new Connection(); |
|
310 | 310 | ?> |
311 | 311 | --> |
312 | 312 | <?php |
313 | - if ($Connection->db != NULL) { |
|
313 | + if ($Connection->db != NULL) { |
|
314 | 314 | if ($Connection->tableExists('source_location')) { |
315 | - require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
316 | - $Source = new Source(); |
|
317 | - $alllocations = $Source->getAllLocationInfo(); |
|
318 | - foreach ($alllocations as $location) { |
|
315 | + require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
316 | + $Source = new Source(); |
|
317 | + $alllocations = $Source->getAllLocationInfo(); |
|
318 | + foreach ($alllocations as $location) { |
|
319 | 319 | ?> |
320 | 320 | <tr> |
321 | 321 | <input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" /> |
@@ -329,9 +329,9 @@ discard block |
||
329 | 329 | </tr> |
330 | 330 | |
331 | 331 | <?php |
332 | - } |
|
332 | + } |
|
333 | + } |
|
333 | 334 | } |
334 | - } |
|
335 | 335 | ?> |
336 | 336 | |
337 | 337 | <tr> |
@@ -424,12 +424,12 @@ discard block |
||
424 | 424 | ?> |
425 | 425 | <tr> |
426 | 426 | <?php |
427 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
427 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
428 | 428 | ?> |
429 | 429 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
430 | 430 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
431 | 431 | <?php |
432 | - } else { |
|
432 | + } else { |
|
433 | 433 | $hostport = explode(':',$source['host']); |
434 | 434 | if (isset($hostport[1])) { |
435 | 435 | $host = $hostport[0]; |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
443 | 443 | <td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td> |
444 | 444 | <?php |
445 | - } |
|
445 | + } |
|
446 | 446 | ?> |
447 | 447 | <td> |
448 | 448 | <select name="format[]" id="format"> |
@@ -758,7 +758,7 @@ discard block |
||
758 | 758 | <br /> |
759 | 759 | <p> |
760 | 760 | <?php |
761 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
761 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
762 | 762 | ?> |
763 | 763 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
764 | 764 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -768,11 +768,11 @@ discard block |
||
768 | 768 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
769 | 769 | <?php |
770 | 770 | } |
771 | - } else { |
|
771 | + } else { |
|
772 | 772 | ?> |
773 | 773 | <b>PHP GD is not installed, you can t change color of aircraft icon on map</b> |
774 | 774 | <?php |
775 | - } |
|
775 | + } |
|
776 | 776 | ?> |
777 | 777 | </p> |
778 | 778 | <br /> |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | </p> |
792 | 792 | <?php |
793 | 793 | require('../footer.php'); |
794 | - exit; |
|
794 | + exit; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | $settings = array(); |
@@ -881,8 +881,8 @@ discard block |
||
881 | 881 | |
882 | 882 | $sources = array(); |
883 | 883 | foreach ($source_name as $keys => $name) { |
884 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
885 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
884 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
885 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
886 | 886 | } |
887 | 887 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
888 | 888 | |
@@ -1176,14 +1176,14 @@ discard block |
||
1176 | 1176 | |
1177 | 1177 | // Set some defaults values... |
1178 | 1178 | if (!isset($globalAircraftImageSources)) { |
1179 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1180 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1179 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1180 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1181 | 1181 | } |
1182 | 1182 | |
1183 | 1183 | if (!isset($globalSchedulesSources)) { |
1184 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1185 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1186 | - } |
|
1184 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1185 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1186 | + } |
|
1187 | 1187 | |
1188 | 1188 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1189 | 1189 | |
@@ -1235,21 +1235,21 @@ discard block |
||
1235 | 1235 | $popi = false; |
1236 | 1236 | $popw = false; |
1237 | 1237 | foreach ($_SESSION['done'] as $done) { |
1238 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1239 | - if ($done == 'Create database') $pop = true; |
|
1240 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1241 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1242 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1238 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1239 | + if ($done == 'Create database') $pop = true; |
|
1240 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1241 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1242 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1243 | 1243 | } |
1244 | 1244 | if ($pop) { |
1245 | - sleep(5); |
|
1246 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1245 | + sleep(5); |
|
1246 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1247 | 1247 | } else if ($popi) { |
1248 | - sleep(5); |
|
1249 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1248 | + sleep(5); |
|
1249 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1250 | 1250 | } else if ($popw) { |
1251 | - sleep(5); |
|
1252 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1251 | + sleep(5); |
|
1252 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1253 | 1253 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1254 | 1254 | print '</div></ul>'; |
1255 | 1255 | print '<div id="error"></div>'; |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | unset($_COOKIE['install']); |
1313 | 1313 | print '<div class="info column"><ul>'; |
1314 | 1314 | foreach ($_SESSION['done'] as $done) { |
1315 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1315 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1316 | 1316 | } |
1317 | 1317 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1318 | 1318 | print '</ul></div>'; |
@@ -19,47 +19,47 @@ discard block |
||
19 | 19 | // Check if schema is at latest version |
20 | 20 | $Connection = new Connection(); |
21 | 21 | if ($Connection->latest() === false) { |
22 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
23 | - exit(); |
|
22 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
23 | + exit(); |
|
24 | 24 | } |
25 | 25 | if (PHP_SAPI != 'cli') { |
26 | - echo "This script MUST be called from console, not a web browser."; |
|
26 | + echo "This script MUST be called from console, not a web browser."; |
|
27 | 27 | // exit(); |
28 | 28 | } |
29 | 29 | |
30 | 30 | // This is to be compatible with old version of settings.php |
31 | 31 | if (!isset($globalSources)) { |
32 | - if (isset($globalSBS1Hosts)) { |
|
33 | - //$hosts = $globalSBS1Hosts; |
|
34 | - foreach ($globalSBS1Hosts as $host) { |
|
35 | - $globalSources[] = array('host' => $host); |
|
36 | - } |
|
37 | - } else { |
|
38 | - if (!isset($globalSBS1Host)) { |
|
39 | - echo '$globalSources MUST be defined !'; |
|
40 | - die; |
|
32 | + if (isset($globalSBS1Hosts)) { |
|
33 | + //$hosts = $globalSBS1Hosts; |
|
34 | + foreach ($globalSBS1Hosts as $host) { |
|
35 | + $globalSources[] = array('host' => $host); |
|
36 | + } |
|
37 | + } else { |
|
38 | + if (!isset($globalSBS1Host)) { |
|
39 | + echo '$globalSources MUST be defined !'; |
|
40 | + die; |
|
41 | 41 | } |
42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
43 | 43 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
44 | - } |
|
44 | + } |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | $options = getopt('s::',array('source::','server','idsource::')); |
48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
50 | 50 | if (isset($options['s'])) { |
51 | - $globalSources = array(); |
|
52 | - $globalSources[] = array('host' => $options['s']); |
|
51 | + $globalSources = array(); |
|
52 | + $globalSources[] = array('host' => $options['s']); |
|
53 | 53 | } elseif (isset($options['source'])) { |
54 | - $globalSources = array(); |
|
55 | - $globalSources[] = array('host' => $options['source']); |
|
54 | + $globalSources = array(); |
|
55 | + $globalSources[] = array('host' => $options['source']); |
|
56 | 56 | } |
57 | 57 | if (isset($options['server'])) $globalServer = TRUE; |
58 | 58 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
59 | 59 | else $id_source = 1; |
60 | 60 | if (isset($globalServer) && $globalServer) { |
61 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
62 | - $SI=new SpotterServer(); |
|
61 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
62 | + $SI=new SpotterServer(); |
|
63 | 63 | } else $SI=new SpotterImport($Connection->db); |
64 | 64 | //$APRS=new APRS($Connection->db); |
65 | 65 | $SBS=new SBS(); |
@@ -69,12 +69,12 @@ discard block |
||
69 | 69 | //$servertz = system('date +%Z'); |
70 | 70 | // signal handler - playing nice with sockets and dump1090 |
71 | 71 | if (function_exists('pcntl_fork')) { |
72 | - pcntl_signal(SIGINT, function() { |
|
73 | - global $sockets; |
|
74 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
75 | - die("Bye!\n"); |
|
76 | - }); |
|
77 | - pcntl_signal_dispatch(); |
|
72 | + pcntl_signal(SIGINT, function() { |
|
73 | + global $sockets; |
|
74 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
75 | + die("Bye!\n"); |
|
76 | + }); |
|
77 | + pcntl_signal_dispatch(); |
|
78 | 78 | } |
79 | 79 | |
80 | 80 | // let's try and connect |
@@ -83,161 +83,161 @@ discard block |
||
83 | 83 | $aprs_full = false; |
84 | 84 | |
85 | 85 | function create_socket($host, $port, &$errno, &$errstr) { |
86 | - $ip = gethostbyname($host); |
|
87 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
88 | - $r = @socket_connect($s, $ip, $port); |
|
89 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
90 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
91 | - return $s; |
|
92 | - } |
|
93 | - $errno = socket_last_error($s); |
|
94 | - $errstr = socket_strerror($errno); |
|
95 | - socket_close($s); |
|
96 | - return false; |
|
86 | + $ip = gethostbyname($host); |
|
87 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
88 | + $r = @socket_connect($s, $ip, $port); |
|
89 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
90 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
91 | + return $s; |
|
92 | + } |
|
93 | + $errno = socket_last_error($s); |
|
94 | + $errstr = socket_strerror($errno); |
|
95 | + socket_close($s); |
|
96 | + return false; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
100 | - echo "UDP !!"; |
|
101 | - $ip = gethostbyname($host); |
|
102 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
103 | - $r = @socket_bind($s, $ip, $port); |
|
104 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
105 | - return $s; |
|
106 | - } |
|
107 | - $errno = socket_last_error($s); |
|
108 | - $errstr = socket_strerror($errno); |
|
109 | - socket_close($s); |
|
110 | - return false; |
|
100 | + echo "UDP !!"; |
|
101 | + $ip = gethostbyname($host); |
|
102 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
103 | + $r = @socket_bind($s, $ip, $port); |
|
104 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
105 | + return $s; |
|
106 | + } |
|
107 | + $errno = socket_last_error($s); |
|
108 | + $errstr = socket_strerror($errno); |
|
109 | + socket_close($s); |
|
110 | + return false; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | function connect_all($hosts) { |
114 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
116 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
117 | - foreach ($hosts as $id => $value) { |
|
114 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
115 | + global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
116 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
117 | + foreach ($hosts as $id => $value) { |
|
118 | 118 | $host = $value['host']; |
119 | 119 | $globalSources[$id]['last_exec'] = 0; |
120 | 120 | // Here we check type of source(s) |
121 | 121 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
122 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | - //$formats[$id] = 'deltadbtxt'; |
|
124 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
125 | - //$last_exec['deltadbtxt'] = 0; |
|
126 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
127 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
128 | - //$formats[$id] = 'vatsimtxt'; |
|
129 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
130 | - //$last_exec['vatsimtxt'] = 0; |
|
131 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
132 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
133 | - //$formats[$id] = 'aircraftlistjson'; |
|
134 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
135 | - //$last_exec['aircraftlistjson'] = 0; |
|
136 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
137 | - } else if (preg_match('/opensky/i',$host)) { |
|
138 | - //$formats[$id] = 'aircraftlistjson'; |
|
139 | - $globalSources[$id]['format'] = 'opensky'; |
|
140 | - //$last_exec['aircraftlistjson'] = 0; |
|
141 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
142 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
143 | - //$formats[$id] = 'radarvirtueljson'; |
|
144 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
145 | - //$last_exec['radarvirtueljson'] = 0; |
|
146 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
147 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
148 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
149 | - exit(0); |
|
150 | - } |
|
151 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
152 | - //$formats[$id] = 'planeupdatefaa'; |
|
153 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
154 | - //$last_exec['planeupdatefaa'] = 0; |
|
155 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
156 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
157 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
158 | - exit(0); |
|
159 | - } |
|
160 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
161 | - //$formats[$id] = 'phpvmacars'; |
|
162 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
163 | - //$last_exec['phpvmacars'] = 0; |
|
164 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
165 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
166 | - //$formats[$id] = 'phpvmacars'; |
|
167 | - $globalSources[$id]['format'] = 'vam'; |
|
168 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
169 | - } else if (preg_match('/whazzup/i',$host)) { |
|
170 | - //$formats[$id] = 'whazzup'; |
|
171 | - $globalSources[$id]['format'] = 'whazzup'; |
|
172 | - //$last_exec['whazzup'] = 0; |
|
173 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
174 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
175 | - //$formats[$id] = 'pirepsjson'; |
|
176 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
177 | - //$last_exec['pirepsjson'] = 0; |
|
178 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
179 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
180 | - //$formats[$id] = 'fr24json'; |
|
181 | - $globalSources[$id]['format'] = 'fr24json'; |
|
182 | - //$last_exec['fr24json'] = 0; |
|
183 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
184 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
185 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
186 | - exit(0); |
|
187 | - } |
|
188 | - //} else if (preg_match('/10001/',$host)) { |
|
189 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | - //$formats[$id] = 'tsv'; |
|
191 | - $globalSources[$id]['format'] = 'tsv'; |
|
192 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
193 | - } |
|
194 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
195 | - if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
196 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | - $hostport = explode(':',$host); |
|
198 | - if (isset($hostport[1])) { |
|
122 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
123 | + //$formats[$id] = 'deltadbtxt'; |
|
124 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
125 | + //$last_exec['deltadbtxt'] = 0; |
|
126 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
127 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
128 | + //$formats[$id] = 'vatsimtxt'; |
|
129 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
130 | + //$last_exec['vatsimtxt'] = 0; |
|
131 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
132 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
133 | + //$formats[$id] = 'aircraftlistjson'; |
|
134 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
135 | + //$last_exec['aircraftlistjson'] = 0; |
|
136 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
137 | + } else if (preg_match('/opensky/i',$host)) { |
|
138 | + //$formats[$id] = 'aircraftlistjson'; |
|
139 | + $globalSources[$id]['format'] = 'opensky'; |
|
140 | + //$last_exec['aircraftlistjson'] = 0; |
|
141 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
142 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
143 | + //$formats[$id] = 'radarvirtueljson'; |
|
144 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
145 | + //$last_exec['radarvirtueljson'] = 0; |
|
146 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
147 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
148 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
149 | + exit(0); |
|
150 | + } |
|
151 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
152 | + //$formats[$id] = 'planeupdatefaa'; |
|
153 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
154 | + //$last_exec['planeupdatefaa'] = 0; |
|
155 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
156 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
157 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
158 | + exit(0); |
|
159 | + } |
|
160 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
161 | + //$formats[$id] = 'phpvmacars'; |
|
162 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
163 | + //$last_exec['phpvmacars'] = 0; |
|
164 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
165 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
166 | + //$formats[$id] = 'phpvmacars'; |
|
167 | + $globalSources[$id]['format'] = 'vam'; |
|
168 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
169 | + } else if (preg_match('/whazzup/i',$host)) { |
|
170 | + //$formats[$id] = 'whazzup'; |
|
171 | + $globalSources[$id]['format'] = 'whazzup'; |
|
172 | + //$last_exec['whazzup'] = 0; |
|
173 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
174 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
175 | + //$formats[$id] = 'pirepsjson'; |
|
176 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
177 | + //$last_exec['pirepsjson'] = 0; |
|
178 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
179 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
180 | + //$formats[$id] = 'fr24json'; |
|
181 | + $globalSources[$id]['format'] = 'fr24json'; |
|
182 | + //$last_exec['fr24json'] = 0; |
|
183 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
184 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
185 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
186 | + exit(0); |
|
187 | + } |
|
188 | + //} else if (preg_match('/10001/',$host)) { |
|
189 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | + //$formats[$id] = 'tsv'; |
|
191 | + $globalSources[$id]['format'] = 'tsv'; |
|
192 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
193 | + } |
|
194 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
195 | + if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
196 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
197 | + $hostport = explode(':',$host); |
|
198 | + if (isset($hostport[1])) { |
|
199 | 199 | $port = $hostport[1]; |
200 | 200 | $hostn = $hostport[0]; |
201 | - } else { |
|
201 | + } else { |
|
202 | 202 | $port = $globalSources[$id]['port']; |
203 | 203 | $hostn = $globalSources[$id]['host']; |
204 | - } |
|
205 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
206 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
207 | - } else { |
|
208 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
209 | - } |
|
210 | - if ($s) { |
|
211 | - $sockets[$id] = $s; |
|
212 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
213 | - if (preg_match('/aprs/',$hostn)) { |
|
204 | + } |
|
205 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
206 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
207 | + } else { |
|
208 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
209 | + } |
|
210 | + if ($s) { |
|
211 | + $sockets[$id] = $s; |
|
212 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
213 | + if (preg_match('/aprs/',$hostn)) { |
|
214 | 214 | //$formats[$id] = 'aprs'; |
215 | 215 | $globalSources[$id]['format'] = 'aprs'; |
216 | 216 | //$aprs_connect = 0; |
217 | 217 | //$use_aprs = true; |
218 | - } elseif ($port == '10001') { |
|
219 | - //$formats[$id] = 'tsv'; |
|
220 | - $globalSources[$id]['format'] = 'tsv'; |
|
221 | - } elseif ($port == '30002') { |
|
222 | - //$formats[$id] = 'raw'; |
|
223 | - $globalSources[$id]['format'] = 'raw'; |
|
224 | - } elseif ($port == '5001') { |
|
225 | - //$formats[$id] = 'raw'; |
|
226 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
227 | - } elseif ($port == '30005') { |
|
218 | + } elseif ($port == '10001') { |
|
219 | + //$formats[$id] = 'tsv'; |
|
220 | + $globalSources[$id]['format'] = 'tsv'; |
|
221 | + } elseif ($port == '30002') { |
|
222 | + //$formats[$id] = 'raw'; |
|
223 | + $globalSources[$id]['format'] = 'raw'; |
|
224 | + } elseif ($port == '5001') { |
|
225 | + //$formats[$id] = 'raw'; |
|
226 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
227 | + } elseif ($port == '30005') { |
|
228 | 228 | // Not yet supported |
229 | - //$formats[$id] = 'beast'; |
|
230 | - $globalSources[$id]['format'] = 'beast'; |
|
231 | - //} else $formats[$id] = 'sbs'; |
|
232 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
233 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
229 | + //$formats[$id] = 'beast'; |
|
230 | + $globalSources[$id]['format'] = 'beast'; |
|
231 | + //} else $formats[$id] = 'sbs'; |
|
232 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
233 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
234 | 234 | } |
235 | 235 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
236 | - } else { |
|
236 | + } else { |
|
237 | 237 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
238 | - } |
|
239 | - } |
|
240 | - } |
|
238 | + } |
|
239 | + } |
|
240 | + } |
|
241 | 241 | } |
242 | 242 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
243 | 243 | |
@@ -264,18 +264,18 @@ discard block |
||
264 | 264 | die; |
265 | 265 | } |
266 | 266 | foreach ($globalSources as $key => $source) { |
267 | - if (!isset($source['format'])) { |
|
268 | - $globalSources[$key]['format'] = 'auto'; |
|
269 | - } |
|
267 | + if (!isset($source['format'])) { |
|
268 | + $globalSources[$key]['format'] = 'auto'; |
|
269 | + } |
|
270 | 270 | } |
271 | 271 | connect_all($globalSources); |
272 | 272 | foreach ($globalSources as $key => $source) { |
273 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
273 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
274 | 274 | $aprs_connect = 0; |
275 | 275 | $use_aprs = true; |
276 | 276 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
277 | 277 | break; |
278 | - } |
|
278 | + } |
|
279 | 279 | } |
280 | 280 | |
281 | 281 | if ($use_aprs) { |
@@ -315,67 +315,67 @@ discard block |
||
315 | 315 | |
316 | 316 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
317 | 317 | while ($i > 0) { |
318 | - if (!$globalDaemon) $i = $endtime-time(); |
|
319 | - // Delete old ATC |
|
320 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
318 | + if (!$globalDaemon) $i = $endtime-time(); |
|
319 | + // Delete old ATC |
|
320 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
321 | 321 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
322 | - $ATC->deleteOldATC(); |
|
323 | - } |
|
322 | + $ATC->deleteOldATC(); |
|
323 | + } |
|
324 | 324 | |
325 | - if (count($last_exec) > 0) { |
|
325 | + if (count($last_exec) > 0) { |
|
326 | 326 | $max = $globalMinFetch; |
327 | 327 | foreach ($last_exec as $last) { |
328 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
328 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
329 | 329 | } |
330 | 330 | if ($max != $globalMinFetch) { |
331 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
332 | - sleep($globalMinFetch-$max+2); |
|
331 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
332 | + sleep($globalMinFetch-$max+2); |
|
333 | + } |
|
333 | 334 | } |
334 | - } |
|
335 | 335 | |
336 | 336 | |
337 | - //foreach ($formats as $id => $value) { |
|
338 | - foreach ($globalSources as $id => $value) { |
|
337 | + //foreach ($formats as $id => $value) { |
|
338 | + foreach ($globalSources as $id => $value) { |
|
339 | 339 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
340 | 340 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
341 | - //$buffer = $Common->getData($hosts[$id]); |
|
342 | - $buffer = $Common->getData($value['host']); |
|
343 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | - $buffer = explode('\n',$buffer); |
|
345 | - foreach ($buffer as $line) { |
|
346 | - if ($line != '' && count($line) > 7) { |
|
347 | - $line = explode(',', $line); |
|
348 | - $data = array(); |
|
349 | - $data['hex'] = $line[1]; // hex |
|
350 | - $data['ident'] = $line[2]; // ident |
|
351 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
352 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
353 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
354 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
355 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
356 | - $data['verticalrate'] = ''; // vertical rate |
|
357 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
358 | - $data['emergency'] = ''; // emergency |
|
359 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
360 | - $data['format_source'] = 'deltadbtxt'; |
|
361 | - $data['id_source'] = $id_source; |
|
362 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
363 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
364 | - $SI->add($data); |
|
365 | - unset($data); |
|
366 | - } |
|
367 | - } |
|
368 | - $last_exec[$id]['last'] = time(); |
|
341 | + //$buffer = $Common->getData($hosts[$id]); |
|
342 | + $buffer = $Common->getData($value['host']); |
|
343 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
344 | + $buffer = explode('\n',$buffer); |
|
345 | + foreach ($buffer as $line) { |
|
346 | + if ($line != '' && count($line) > 7) { |
|
347 | + $line = explode(',', $line); |
|
348 | + $data = array(); |
|
349 | + $data['hex'] = $line[1]; // hex |
|
350 | + $data['ident'] = $line[2]; // ident |
|
351 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
352 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
353 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
354 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
355 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
356 | + $data['verticalrate'] = ''; // vertical rate |
|
357 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
358 | + $data['emergency'] = ''; // emergency |
|
359 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
360 | + $data['format_source'] = 'deltadbtxt'; |
|
361 | + $data['id_source'] = $id_source; |
|
362 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
363 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
364 | + $SI->add($data); |
|
365 | + unset($data); |
|
366 | + } |
|
367 | + } |
|
368 | + $last_exec[$id]['last'] = time(); |
|
369 | 369 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
370 | 370 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
371 | - //$buffer = $Common->getData($hosts[$id]); |
|
372 | - $buffer = $Common->getData($value['host']); |
|
373 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | - $buffer = explode('\n',$buffer); |
|
375 | - foreach ($buffer as $line) { |
|
376 | - if ($line != '') { |
|
377 | - $line = explode(':', $line); |
|
378 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
371 | + //$buffer = $Common->getData($hosts[$id]); |
|
372 | + $buffer = $Common->getData($value['host']); |
|
373 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
374 | + $buffer = explode('\n',$buffer); |
|
375 | + foreach ($buffer as $line) { |
|
376 | + if ($line != '') { |
|
377 | + $line = explode(':', $line); |
|
378 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
379 | 379 | $data = array(); |
380 | 380 | $data['id'] = $line[1].'-'.$line[0]; |
381 | 381 | $data['pilot_id'] = $line[1]; |
@@ -387,36 +387,36 @@ discard block |
||
387 | 387 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
388 | 388 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
389 | 389 | $data['latitude'] = $line[5]; // lat |
390 | - $data['longitude'] = $line[6]; // long |
|
391 | - $data['verticalrate'] = ''; // vertical rate |
|
392 | - $data['squawk'] = ''; // squawk |
|
393 | - $data['emergency'] = ''; // emergency |
|
394 | - $data['waypoints'] = $line[30]; |
|
390 | + $data['longitude'] = $line[6]; // long |
|
391 | + $data['verticalrate'] = ''; // vertical rate |
|
392 | + $data['squawk'] = ''; // squawk |
|
393 | + $data['emergency'] = ''; // emergency |
|
394 | + $data['waypoints'] = $line[30]; |
|
395 | 395 | $data['datetime'] = date('Y-m-d H:i:s'); |
396 | 396 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
397 | 397 | if (isset($line[37])) $data['last_update'] = $line[37]; |
398 | - $data['departure_airport_icao'] = $line[11]; |
|
399 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
400 | - $data['arrival_airport_icao'] = $line[13]; |
|
398 | + $data['departure_airport_icao'] = $line[11]; |
|
399 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
400 | + $data['arrival_airport_icao'] = $line[13]; |
|
401 | 401 | $data['frequency'] = $line[4]; |
402 | 402 | $data['type'] = $line[18]; |
403 | 403 | $data['range'] = $line[19]; |
404 | 404 | if (isset($line[35])) $data['info'] = $line[35]; |
405 | - $data['id_source'] = $id_source; |
|
406 | - //$data['arrival_airport_time'] = ; |
|
407 | - if ($line[9] != '') { |
|
408 | - $aircraft_data = explode('/',$line[9]); |
|
409 | - if (isset($aircraft_data[1])) { |
|
410 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
411 | - } |
|
412 | - } |
|
413 | - /* |
|
405 | + $data['id_source'] = $id_source; |
|
406 | + //$data['arrival_airport_time'] = ; |
|
407 | + if ($line[9] != '') { |
|
408 | + $aircraft_data = explode('/',$line[9]); |
|
409 | + if (isset($aircraft_data[1])) { |
|
410 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
411 | + } |
|
412 | + } |
|
413 | + /* |
|
414 | 414 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
415 | 415 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
416 | 416 | */ |
417 | - $data['format_source'] = $value['format']; |
|
417 | + $data['format_source'] = $value['format']; |
|
418 | 418 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
419 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
419 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
420 | 420 | elseif ($line[3] == 'ATC') { |
421 | 421 | //print_r($data); |
422 | 422 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -434,240 +434,240 @@ discard block |
||
434 | 434 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
435 | 435 | echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
436 | 436 | } |
437 | - unset($data); |
|
438 | - } |
|
439 | - } |
|
440 | - } |
|
441 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
442 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
443 | - $last_exec[$id]['last'] = time(); |
|
444 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
445 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
446 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
447 | - if ($buffer != '') { |
|
448 | - $all_data = json_decode($buffer,true); |
|
449 | - if (isset($all_data['acList'])) { |
|
437 | + unset($data); |
|
438 | + } |
|
439 | + } |
|
440 | + } |
|
441 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
442 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
443 | + $last_exec[$id]['last'] = time(); |
|
444 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
445 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
446 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
447 | + if ($buffer != '') { |
|
448 | + $all_data = json_decode($buffer,true); |
|
449 | + if (isset($all_data['acList'])) { |
|
450 | 450 | foreach ($all_data['acList'] as $line) { |
451 | - $data = array(); |
|
452 | - $data['hex'] = $line['Icao']; // hex |
|
453 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
454 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
455 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
456 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
457 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
458 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
459 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
460 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
461 | - $data['emergency'] = ''; // emergency |
|
462 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
463 | - /* |
|
451 | + $data = array(); |
|
452 | + $data['hex'] = $line['Icao']; // hex |
|
453 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
454 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
455 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
456 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
457 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
458 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
459 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
460 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
461 | + $data['emergency'] = ''; // emergency |
|
462 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
463 | + /* |
|
464 | 464 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
465 | 465 | else $data['datetime'] = date('Y-m-d H:i:s'); |
466 | 466 | */ |
467 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
468 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
469 | - $data['format_source'] = 'aircraftlistjson'; |
|
470 | - $data['id_source'] = $id_source; |
|
471 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
472 | - if (isset($data['datetime'])) $SI->add($data); |
|
473 | - unset($data); |
|
467 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
468 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
469 | + $data['format_source'] = 'aircraftlistjson'; |
|
470 | + $data['id_source'] = $id_source; |
|
471 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
472 | + if (isset($data['datetime'])) $SI->add($data); |
|
473 | + unset($data); |
|
474 | 474 | } |
475 | - } else { |
|
475 | + } else { |
|
476 | 476 | foreach ($all_data as $line) { |
477 | - $data = array(); |
|
478 | - $data['hex'] = $line['hex']; // hex |
|
479 | - $data['ident'] = $line['flight']; // ident |
|
480 | - $data['altitude'] = $line['altitude']; // altitude |
|
481 | - $data['speed'] = $line['speed']; // speed |
|
482 | - $data['heading'] = $line['track']; // heading |
|
483 | - $data['latitude'] = $line['lat']; // lat |
|
484 | - $data['longitude'] = $line['lon']; // long |
|
485 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
486 | - $data['squawk'] = $line['squawk']; // squawk |
|
487 | - $data['emergency'] = ''; // emergency |
|
488 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
489 | - $data['format_source'] = 'aircraftlistjson'; |
|
490 | - $data['id_source'] = $id_source; |
|
491 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
492 | - $SI->add($data); |
|
493 | - unset($data); |
|
477 | + $data = array(); |
|
478 | + $data['hex'] = $line['hex']; // hex |
|
479 | + $data['ident'] = $line['flight']; // ident |
|
480 | + $data['altitude'] = $line['altitude']; // altitude |
|
481 | + $data['speed'] = $line['speed']; // speed |
|
482 | + $data['heading'] = $line['track']; // heading |
|
483 | + $data['latitude'] = $line['lat']; // lat |
|
484 | + $data['longitude'] = $line['lon']; // long |
|
485 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
486 | + $data['squawk'] = $line['squawk']; // squawk |
|
487 | + $data['emergency'] = ''; // emergency |
|
488 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
489 | + $data['format_source'] = 'aircraftlistjson'; |
|
490 | + $data['id_source'] = $id_source; |
|
491 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
492 | + $SI->add($data); |
|
493 | + unset($data); |
|
494 | + } |
|
495 | + } |
|
494 | 496 | } |
495 | - } |
|
496 | - } |
|
497 | - //$last_exec['aircraftlistjson'] = time(); |
|
498 | - $last_exec[$id]['last'] = time(); |
|
499 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
500 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
501 | - $buffer = $Common->getData($value['host']); |
|
502 | - $all_data = json_decode($buffer,true); |
|
503 | - if (isset($all_data['planes'])) { |
|
497 | + //$last_exec['aircraftlistjson'] = time(); |
|
498 | + $last_exec[$id]['last'] = time(); |
|
499 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
500 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
501 | + $buffer = $Common->getData($value['host']); |
|
502 | + $all_data = json_decode($buffer,true); |
|
503 | + if (isset($all_data['planes'])) { |
|
504 | 504 | foreach ($all_data['planes'] as $key => $line) { |
505 | - $data = array(); |
|
506 | - $data['hex'] = $key; // hex |
|
507 | - $data['ident'] = $line[3]; // ident |
|
508 | - $data['altitude'] = $line[6]; // altitude |
|
509 | - $data['speed'] = $line[8]; // speed |
|
510 | - $data['heading'] = $line[7]; // heading |
|
511 | - $data['latitude'] = $line[4]; // lat |
|
512 | - $data['longitude'] = $line[5]; // long |
|
513 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
514 | - $data['squawk'] = $line[10]; // squawk |
|
515 | - $data['emergency'] = ''; // emergency |
|
516 | - $data['registration'] = $line[2]; |
|
517 | - $data['aircraft_icao'] = $line[0]; |
|
518 | - $deparr = explode('-',$line[1]); |
|
519 | - if (count($deparr) == 2) { |
|
505 | + $data = array(); |
|
506 | + $data['hex'] = $key; // hex |
|
507 | + $data['ident'] = $line[3]; // ident |
|
508 | + $data['altitude'] = $line[6]; // altitude |
|
509 | + $data['speed'] = $line[8]; // speed |
|
510 | + $data['heading'] = $line[7]; // heading |
|
511 | + $data['latitude'] = $line[4]; // lat |
|
512 | + $data['longitude'] = $line[5]; // long |
|
513 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
514 | + $data['squawk'] = $line[10]; // squawk |
|
515 | + $data['emergency'] = ''; // emergency |
|
516 | + $data['registration'] = $line[2]; |
|
517 | + $data['aircraft_icao'] = $line[0]; |
|
518 | + $deparr = explode('-',$line[1]); |
|
519 | + if (count($deparr) == 2) { |
|
520 | 520 | $data['departure_airport_icao'] = $deparr[0]; |
521 | 521 | $data['arrival_airport_icao'] = $deparr[1]; |
522 | - } |
|
523 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
524 | - $data['format_source'] = 'planeupdatefaa'; |
|
525 | - $data['id_source'] = $id_source; |
|
526 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
527 | - $SI->add($data); |
|
528 | - unset($data); |
|
522 | + } |
|
523 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
524 | + $data['format_source'] = 'planeupdatefaa'; |
|
525 | + $data['id_source'] = $id_source; |
|
526 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
527 | + $SI->add($data); |
|
528 | + unset($data); |
|
529 | 529 | } |
530 | - } |
|
531 | - //$last_exec['planeupdatefaa'] = time(); |
|
532 | - $last_exec[$id]['last'] = time(); |
|
533 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
534 | - $buffer = $Common->getData($value['host']); |
|
535 | - $all_data = json_decode($buffer,true); |
|
536 | - if (isset($all_data['states'])) { |
|
530 | + } |
|
531 | + //$last_exec['planeupdatefaa'] = time(); |
|
532 | + $last_exec[$id]['last'] = time(); |
|
533 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
534 | + $buffer = $Common->getData($value['host']); |
|
535 | + $all_data = json_decode($buffer,true); |
|
536 | + if (isset($all_data['states'])) { |
|
537 | 537 | foreach ($all_data['states'] as $key => $line) { |
538 | - $data = array(); |
|
539 | - $data['hex'] = $line[0]; // hex |
|
540 | - $data['ident'] = trim($line[1]); // ident |
|
541 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
542 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
543 | - $data['heading'] = round($line[10]); // heading |
|
544 | - $data['latitude'] = $line[5]; // lat |
|
545 | - $data['longitude'] = $line[6]; // long |
|
546 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
547 | - //$data['squawk'] = $line[10]; // squawk |
|
548 | - //$data['emergency'] = ''; // emergency |
|
549 | - //$data['registration'] = $line[2]; |
|
550 | - //$data['aircraft_icao'] = $line[0]; |
|
551 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
552 | - $data['format_source'] = 'opensky'; |
|
553 | - $data['id_source'] = $id_source; |
|
554 | - $SI->add($data); |
|
555 | - unset($data); |
|
538 | + $data = array(); |
|
539 | + $data['hex'] = $line[0]; // hex |
|
540 | + $data['ident'] = trim($line[1]); // ident |
|
541 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
542 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
543 | + $data['heading'] = round($line[10]); // heading |
|
544 | + $data['latitude'] = $line[5]; // lat |
|
545 | + $data['longitude'] = $line[6]; // long |
|
546 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
547 | + //$data['squawk'] = $line[10]; // squawk |
|
548 | + //$data['emergency'] = ''; // emergency |
|
549 | + //$data['registration'] = $line[2]; |
|
550 | + //$data['aircraft_icao'] = $line[0]; |
|
551 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
552 | + $data['format_source'] = 'opensky'; |
|
553 | + $data['id_source'] = $id_source; |
|
554 | + $SI->add($data); |
|
555 | + unset($data); |
|
556 | 556 | } |
557 | - } |
|
558 | - //$last_exec['planeupdatefaa'] = time(); |
|
559 | - $last_exec[$id]['last'] = time(); |
|
560 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
561 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
562 | - //$buffer = $Common->getData($hosts[$id]); |
|
563 | - $buffer = $Common->getData($value['host']); |
|
564 | - $all_data = json_decode($buffer,true); |
|
565 | - foreach ($all_data as $key => $line) { |
|
557 | + } |
|
558 | + //$last_exec['planeupdatefaa'] = time(); |
|
559 | + $last_exec[$id]['last'] = time(); |
|
560 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
561 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
562 | + //$buffer = $Common->getData($hosts[$id]); |
|
563 | + $buffer = $Common->getData($value['host']); |
|
564 | + $all_data = json_decode($buffer,true); |
|
565 | + foreach ($all_data as $key => $line) { |
|
566 | 566 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
567 | - $data = array(); |
|
568 | - $data['hex'] = $line[0]; |
|
569 | - $data['ident'] = $line[16]; //$line[13] |
|
570 | - $data['altitude'] = $line[4]; // altitude |
|
571 | - $data['speed'] = $line[5]; // speed |
|
572 | - $data['heading'] = $line[3]; // heading |
|
573 | - $data['latitude'] = $line[1]; // lat |
|
574 | - $data['longitude'] = $line[2]; // long |
|
575 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
576 | - $data['squawk'] = $line[6]; // squawk |
|
577 | - $data['aircraft_icao'] = $line[8]; |
|
578 | - $data['registration'] = $line[9]; |
|
579 | - $data['departure_airport_iata'] = $line[11]; |
|
580 | - $data['arrival_airport_iata'] = $line[12]; |
|
581 | - $data['emergency'] = ''; // emergency |
|
582 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
583 | - $data['format_source'] = 'fr24json'; |
|
584 | - $data['id_source'] = $id_source; |
|
585 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
586 | - $SI->add($data); |
|
587 | - unset($data); |
|
567 | + $data = array(); |
|
568 | + $data['hex'] = $line[0]; |
|
569 | + $data['ident'] = $line[16]; //$line[13] |
|
570 | + $data['altitude'] = $line[4]; // altitude |
|
571 | + $data['speed'] = $line[5]; // speed |
|
572 | + $data['heading'] = $line[3]; // heading |
|
573 | + $data['latitude'] = $line[1]; // lat |
|
574 | + $data['longitude'] = $line[2]; // long |
|
575 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
576 | + $data['squawk'] = $line[6]; // squawk |
|
577 | + $data['aircraft_icao'] = $line[8]; |
|
578 | + $data['registration'] = $line[9]; |
|
579 | + $data['departure_airport_iata'] = $line[11]; |
|
580 | + $data['arrival_airport_iata'] = $line[12]; |
|
581 | + $data['emergency'] = ''; // emergency |
|
582 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
583 | + $data['format_source'] = 'fr24json'; |
|
584 | + $data['id_source'] = $id_source; |
|
585 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
586 | + $SI->add($data); |
|
587 | + unset($data); |
|
588 | 588 | } |
589 | - } |
|
590 | - //$last_exec['fr24json'] = time(); |
|
591 | - $last_exec[$id]['last'] = time(); |
|
592 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
593 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
594 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
595 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
596 | - //echo $buffer; |
|
597 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | - $all_data = json_decode($buffer,true); |
|
600 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
589 | + } |
|
590 | + //$last_exec['fr24json'] = time(); |
|
591 | + $last_exec[$id]['last'] = time(); |
|
592 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
593 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
594 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
595 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
596 | + //echo $buffer; |
|
597 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
598 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
599 | + $all_data = json_decode($buffer,true); |
|
600 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
601 | 601 | die(json_last_error_msg()); |
602 | - } |
|
603 | - if (isset($all_data['mrkrs'])) { |
|
602 | + } |
|
603 | + if (isset($all_data['mrkrs'])) { |
|
604 | 604 | foreach ($all_data['mrkrs'] as $key => $line) { |
605 | - if (isset($line['inf'])) { |
|
605 | + if (isset($line['inf'])) { |
|
606 | 606 | $data = array(); |
607 | 607 | $data['hex'] = $line['inf']['ia']; |
608 | 608 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
609 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
610 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
611 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
612 | - $data['latitude'] = $line['pt'][0]; // lat |
|
613 | - $data['longitude'] = $line['pt'][1]; // long |
|
614 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
615 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
616 | - //$data['aircraft_icao'] = $line[8]; |
|
617 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
609 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
610 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
611 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
612 | + $data['latitude'] = $line['pt'][0]; // lat |
|
613 | + $data['longitude'] = $line['pt'][1]; // long |
|
614 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
615 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
616 | + //$data['aircraft_icao'] = $line[8]; |
|
617 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
618 | 618 | //$data['departure_airport_iata'] = $line[11]; |
619 | 619 | //$data['arrival_airport_iata'] = $line[12]; |
620 | - //$data['emergency'] = ''; // emergency |
|
620 | + //$data['emergency'] = ''; // emergency |
|
621 | 621 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
622 | - $data['format_source'] = 'radarvirtueljson'; |
|
623 | - $data['id_source'] = $id_source; |
|
622 | + $data['format_source'] = 'radarvirtueljson'; |
|
623 | + $data['id_source'] = $id_source; |
|
624 | 624 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
625 | 625 | $SI->add($data); |
626 | 626 | unset($data); |
627 | - } |
|
627 | + } |
|
628 | 628 | } |
629 | - } |
|
630 | - //$last_exec['radarvirtueljson'] = time(); |
|
631 | - $last_exec[$id]['last'] = time(); |
|
632 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
633 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
634 | - //$buffer = $Common->getData($hosts[$id]); |
|
635 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
636 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
629 | + } |
|
630 | + //$last_exec['radarvirtueljson'] = time(); |
|
631 | + $last_exec[$id]['last'] = time(); |
|
632 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
633 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
634 | + //$buffer = $Common->getData($hosts[$id]); |
|
635 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
636 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
637 | 637 | |
638 | - if (isset($all_data['pireps'])) { |
|
639 | - foreach ($all_data['pireps'] as $line) { |
|
640 | - $data = array(); |
|
641 | - $data['id'] = $line['id']; |
|
642 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
643 | - $data['ident'] = $line['callsign']; // ident |
|
644 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
645 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
646 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
647 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
648 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
649 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
650 | - $data['latitude'] = $line['lat']; // lat |
|
651 | - $data['longitude'] = $line['lon']; // long |
|
652 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
653 | - //$data['squawk'] = $line['squawk']; // squawk |
|
654 | - //$data['emergency'] = ''; // emergency |
|
655 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
656 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
657 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
658 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
659 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
660 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
661 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
662 | - else $data['info'] = ''; |
|
663 | - $data['format_source'] = 'pireps'; |
|
664 | - $data['id_source'] = $id_source; |
|
665 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
666 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
667 | - if ($line['icon'] == 'plane') { |
|
638 | + if (isset($all_data['pireps'])) { |
|
639 | + foreach ($all_data['pireps'] as $line) { |
|
640 | + $data = array(); |
|
641 | + $data['id'] = $line['id']; |
|
642 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
643 | + $data['ident'] = $line['callsign']; // ident |
|
644 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
645 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
646 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
647 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
648 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
649 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
650 | + $data['latitude'] = $line['lat']; // lat |
|
651 | + $data['longitude'] = $line['lon']; // long |
|
652 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
653 | + //$data['squawk'] = $line['squawk']; // squawk |
|
654 | + //$data['emergency'] = ''; // emergency |
|
655 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
656 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
657 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
658 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
659 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
660 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
661 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
662 | + else $data['info'] = ''; |
|
663 | + $data['format_source'] = 'pireps'; |
|
664 | + $data['id_source'] = $id_source; |
|
665 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
666 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
667 | + if ($line['icon'] == 'plane') { |
|
668 | 668 | $SI->add($data); |
669 | - // print_r($data); |
|
670 | - } elseif ($line['icon'] == 'ct') { |
|
669 | + // print_r($data); |
|
670 | + } elseif ($line['icon'] == 'ct') { |
|
671 | 671 | $data['info'] = str_replace('^§','<br />',$data['info']); |
672 | 672 | $data['info'] = str_replace('&sect;','',$data['info']); |
673 | 673 | $typec = substr($data['ident'],-3); |
@@ -682,160 +682,160 @@ discard block |
||
682 | 682 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
683 | 683 | else $data['type'] = 'Observer'; |
684 | 684 | echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
685 | - } |
|
686 | - unset($data); |
|
685 | + } |
|
686 | + unset($data); |
|
687 | 687 | } |
688 | - } |
|
689 | - //$last_exec['pirepsjson'] = time(); |
|
690 | - $last_exec[$id]['last'] = time(); |
|
691 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
692 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
693 | - //$buffer = $Common->getData($hosts[$id]); |
|
694 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
695 | - $buffer = $Common->getData($value['host']); |
|
696 | - $all_data = json_decode($buffer,true); |
|
697 | - if ($buffer != '' && is_array($all_data)) { |
|
688 | + } |
|
689 | + //$last_exec['pirepsjson'] = time(); |
|
690 | + $last_exec[$id]['last'] = time(); |
|
691 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
692 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
693 | + //$buffer = $Common->getData($hosts[$id]); |
|
694 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
695 | + $buffer = $Common->getData($value['host']); |
|
696 | + $all_data = json_decode($buffer,true); |
|
697 | + if ($buffer != '' && is_array($all_data)) { |
|
698 | 698 | foreach ($all_data as $line) { |
699 | - $data = array(); |
|
700 | - //$data['id'] = $line['id']; // id not usable |
|
701 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
702 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
703 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
704 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
705 | - $data['ident'] = $line['flightnum']; // ident |
|
706 | - $data['altitude'] = $line['alt']; // altitude |
|
707 | - $data['speed'] = $line['gs']; // speed |
|
708 | - $data['heading'] = $line['heading']; // heading |
|
709 | - $data['latitude'] = $line['lat']; // lat |
|
710 | - $data['longitude'] = $line['lng']; // long |
|
711 | - $data['verticalrate'] = ''; // verticale rate |
|
712 | - $data['squawk'] = ''; // squawk |
|
713 | - $data['emergency'] = ''; // emergency |
|
714 | - //$data['datetime'] = $line['lastupdate']; |
|
715 | - $data['last_update'] = $line['lastupdate']; |
|
716 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
717 | - $data['departure_airport_icao'] = $line['depicao']; |
|
718 | - $data['departure_airport_time'] = $line['deptime']; |
|
719 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
720 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
721 | - $data['registration'] = $line['aircraft']; |
|
722 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
723 | - if (isset($line['aircraftname'])) { |
|
699 | + $data = array(); |
|
700 | + //$data['id'] = $line['id']; // id not usable |
|
701 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
702 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
703 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
704 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
705 | + $data['ident'] = $line['flightnum']; // ident |
|
706 | + $data['altitude'] = $line['alt']; // altitude |
|
707 | + $data['speed'] = $line['gs']; // speed |
|
708 | + $data['heading'] = $line['heading']; // heading |
|
709 | + $data['latitude'] = $line['lat']; // lat |
|
710 | + $data['longitude'] = $line['lng']; // long |
|
711 | + $data['verticalrate'] = ''; // verticale rate |
|
712 | + $data['squawk'] = ''; // squawk |
|
713 | + $data['emergency'] = ''; // emergency |
|
714 | + //$data['datetime'] = $line['lastupdate']; |
|
715 | + $data['last_update'] = $line['lastupdate']; |
|
716 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
717 | + $data['departure_airport_icao'] = $line['depicao']; |
|
718 | + $data['departure_airport_time'] = $line['deptime']; |
|
719 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
720 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
721 | + $data['registration'] = $line['aircraft']; |
|
722 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
723 | + if (isset($line['aircraftname'])) { |
|
724 | 724 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
725 | 725 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
726 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
727 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
728 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
729 | - else { |
|
730 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
731 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
732 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
733 | - } |
|
734 | - } |
|
735 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
736 | - $data['id_source'] = $id_source; |
|
737 | - $data['format_source'] = 'phpvmacars'; |
|
738 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
739 | - $SI->add($data); |
|
740 | - unset($data); |
|
726 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
727 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
728 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
729 | + else { |
|
730 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
731 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
732 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
733 | + } |
|
734 | + } |
|
735 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
736 | + $data['id_source'] = $id_source; |
|
737 | + $data['format_source'] = 'phpvmacars'; |
|
738 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
739 | + $SI->add($data); |
|
740 | + unset($data); |
|
741 | 741 | } |
742 | 742 | if ($globalDebug) echo 'No more data...'."\n"; |
743 | 743 | unset($buffer); |
744 | 744 | unset($all_data); |
745 | - } |
|
746 | - //$last_exec['phpvmacars'] = time(); |
|
747 | - $last_exec[$id]['last'] = time(); |
|
748 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
749 | - //$buffer = $Common->getData($hosts[$id]); |
|
750 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
751 | - $buffer = $Common->getData($value['host']); |
|
752 | - $all_data = json_decode($buffer,true); |
|
753 | - if ($buffer != '' && is_array($all_data)) { |
|
745 | + } |
|
746 | + //$last_exec['phpvmacars'] = time(); |
|
747 | + $last_exec[$id]['last'] = time(); |
|
748 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
749 | + //$buffer = $Common->getData($hosts[$id]); |
|
750 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
751 | + $buffer = $Common->getData($value['host']); |
|
752 | + $all_data = json_decode($buffer,true); |
|
753 | + if ($buffer != '' && is_array($all_data)) { |
|
754 | 754 | foreach ($all_data as $line) { |
755 | - $data = array(); |
|
756 | - //$data['id'] = $line['id']; // id not usable |
|
757 | - $data['id'] = trim($line['flight_id']); |
|
758 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
759 | - $data['pilot_name'] = $line['pilot_name']; |
|
760 | - $data['pilot_id'] = $line['pilot_id']; |
|
761 | - $data['ident'] = trim($line['callsign']); // ident |
|
762 | - $data['altitude'] = $line['altitude']; // altitude |
|
763 | - $data['speed'] = $line['gs']; // speed |
|
764 | - $data['heading'] = $line['heading']; // heading |
|
765 | - $data['latitude'] = $line['latitude']; // lat |
|
766 | - $data['longitude'] = $line['longitude']; // long |
|
767 | - $data['verticalrate'] = ''; // verticale rate |
|
768 | - $data['squawk'] = ''; // squawk |
|
769 | - $data['emergency'] = ''; // emergency |
|
770 | - //$data['datetime'] = $line['lastupdate']; |
|
771 | - $data['last_update'] = $line['last_update']; |
|
772 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
773 | - $data['departure_airport_icao'] = $line['departure']; |
|
774 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
775 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
776 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
777 | - //$data['registration'] = $line['aircraft']; |
|
778 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
779 | - $data['aircraft_icao'] = $line['plane_type']; |
|
780 | - $data['id_source'] = $id_source; |
|
781 | - $data['format_source'] = 'vam'; |
|
782 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
783 | - $SI->add($data); |
|
784 | - unset($data); |
|
755 | + $data = array(); |
|
756 | + //$data['id'] = $line['id']; // id not usable |
|
757 | + $data['id'] = trim($line['flight_id']); |
|
758 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
759 | + $data['pilot_name'] = $line['pilot_name']; |
|
760 | + $data['pilot_id'] = $line['pilot_id']; |
|
761 | + $data['ident'] = trim($line['callsign']); // ident |
|
762 | + $data['altitude'] = $line['altitude']; // altitude |
|
763 | + $data['speed'] = $line['gs']; // speed |
|
764 | + $data['heading'] = $line['heading']; // heading |
|
765 | + $data['latitude'] = $line['latitude']; // lat |
|
766 | + $data['longitude'] = $line['longitude']; // long |
|
767 | + $data['verticalrate'] = ''; // verticale rate |
|
768 | + $data['squawk'] = ''; // squawk |
|
769 | + $data['emergency'] = ''; // emergency |
|
770 | + //$data['datetime'] = $line['lastupdate']; |
|
771 | + $data['last_update'] = $line['last_update']; |
|
772 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
773 | + $data['departure_airport_icao'] = $line['departure']; |
|
774 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
775 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
776 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
777 | + //$data['registration'] = $line['aircraft']; |
|
778 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
779 | + $data['aircraft_icao'] = $line['plane_type']; |
|
780 | + $data['id_source'] = $id_source; |
|
781 | + $data['format_source'] = 'vam'; |
|
782 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
783 | + $SI->add($data); |
|
784 | + unset($data); |
|
785 | 785 | } |
786 | 786 | if ($globalDebug) echo 'No more data...'."\n"; |
787 | 787 | unset($buffer); |
788 | 788 | unset($all_data); |
789 | - } |
|
790 | - //$last_exec['phpvmacars'] = time(); |
|
791 | - $last_exec[$id]['last'] = time(); |
|
789 | + } |
|
790 | + //$last_exec['phpvmacars'] = time(); |
|
791 | + $last_exec[$id]['last'] = time(); |
|
792 | 792 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
793 | 793 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3') { |
794 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
795 | - //$last_exec[$id]['last'] = time(); |
|
794 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
795 | + //$last_exec[$id]['last'] = time(); |
|
796 | 796 | |
797 | - //$read = array( $sockets[$id] ); |
|
798 | - $read = $sockets; |
|
799 | - $write = NULL; |
|
800 | - $e = NULL; |
|
801 | - $n = socket_select($read, $write, $e, $timeout); |
|
802 | - if ($e != NULL) var_dump($e); |
|
803 | - if ($n > 0) { |
|
797 | + //$read = array( $sockets[$id] ); |
|
798 | + $read = $sockets; |
|
799 | + $write = NULL; |
|
800 | + $e = NULL; |
|
801 | + $n = socket_select($read, $write, $e, $timeout); |
|
802 | + if ($e != NULL) var_dump($e); |
|
803 | + if ($n > 0) { |
|
804 | 804 | foreach ($read as $nb => $r) { |
805 | - //$value = $formats[$nb]; |
|
806 | - $format = $globalSources[$nb]['format']; |
|
807 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
808 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
809 | - } else { |
|
810 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
811 | - } |
|
812 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
813 | - //echo $buffer."\n"; |
|
814 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
815 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
816 | - $error = false; |
|
817 | - //$SI::del(); |
|
818 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
819 | - // SBS format is CSV format |
|
820 | - if ($buffer != '') { |
|
805 | + //$value = $formats[$nb]; |
|
806 | + $format = $globalSources[$nb]['format']; |
|
807 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
808 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
809 | + } else { |
|
810 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
811 | + } |
|
812 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
813 | + //echo $buffer."\n"; |
|
814 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
815 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
816 | + $error = false; |
|
817 | + //$SI::del(); |
|
818 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
819 | + // SBS format is CSV format |
|
820 | + if ($buffer != '') { |
|
821 | 821 | $tt[$format] = 0; |
822 | 822 | if ($format == 'acarssbs3') { |
823 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
824 | - $ACARS->add(trim($buffer)); |
|
825 | - $ACARS->deleteLiveAcarsData(); |
|
823 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
824 | + $ACARS->add(trim($buffer)); |
|
825 | + $ACARS->deleteLiveAcarsData(); |
|
826 | 826 | } elseif ($format == 'raw') { |
827 | - // AVR format |
|
828 | - $data = $SBS->parse($buffer); |
|
829 | - if (is_array($data)) { |
|
827 | + // AVR format |
|
828 | + $data = $SBS->parse($buffer); |
|
829 | + if (is_array($data)) { |
|
830 | 830 | $data['datetime'] = date('Y-m-d H:i:s'); |
831 | 831 | $data['format_source'] = 'raw'; |
832 | 832 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
833 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
834 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
835 | - } |
|
836 | - } elseif ($format == 'flightgearsp') { |
|
837 | - //echo $buffer."\n"; |
|
838 | - if (strlen($buffer) > 5) { |
|
833 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
834 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
835 | + } |
|
836 | + } elseif ($format == 'flightgearsp') { |
|
837 | + //echo $buffer."\n"; |
|
838 | + if (strlen($buffer) > 5) { |
|
839 | 839 | $line = explode(',',$buffer); |
840 | 840 | $data = array(); |
841 | 841 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -851,114 +851,114 @@ discard block |
||
851 | 851 | $data['format_source'] = 'flightgearsp'; |
852 | 852 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
853 | 853 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
854 | - } |
|
855 | - } elseif ($format == 'acars') { |
|
856 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
857 | - $ACARS->add(trim($buffer)); |
|
858 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
859 | - $ACARS->deleteLiveAcarsData(); |
|
854 | + } |
|
855 | + } elseif ($format == 'acars') { |
|
856 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
857 | + $ACARS->add(trim($buffer)); |
|
858 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
859 | + $ACARS->deleteLiveAcarsData(); |
|
860 | 860 | } elseif ($format == 'flightgearmp') { |
861 | - if (substr($buffer,0,1) != '#') { |
|
861 | + if (substr($buffer,0,1) != '#') { |
|
862 | 862 | $data = array(); |
863 | 863 | //echo $buffer."\n"; |
864 | 864 | $line = explode(' ',$buffer); |
865 | 865 | if (count($line) == 11) { |
866 | - $userserver = explode('@',$line[0]); |
|
867 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
868 | - $data['ident'] = $userserver[0]; |
|
869 | - $data['registration'] = $userserver[0]; |
|
870 | - $data['latitude'] = $line[4]; |
|
871 | - $data['longitude'] = $line[5]; |
|
872 | - $data['altitude'] = $line[6]; |
|
873 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
874 | - $aircraft_type = $line[10]; |
|
875 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
877 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
866 | + $userserver = explode('@',$line[0]); |
|
867 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
868 | + $data['ident'] = $userserver[0]; |
|
869 | + $data['registration'] = $userserver[0]; |
|
870 | + $data['latitude'] = $line[4]; |
|
871 | + $data['longitude'] = $line[5]; |
|
872 | + $data['altitude'] = $line[6]; |
|
873 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
874 | + $aircraft_type = $line[10]; |
|
875 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
876 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
877 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
878 | + } |
|
878 | 879 | } |
879 | - } |
|
880 | 880 | } elseif ($format == 'beast') { |
881 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
882 | - die; |
|
881 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
882 | + die; |
|
883 | 883 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
884 | - $line = explode("\t", $buffer); |
|
885 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
884 | + $line = explode("\t", $buffer); |
|
885 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
886 | 886 | $key = $line[$k]; |
887 | - $lined[$key] = $line[$k+1]; |
|
888 | - } |
|
889 | - if (count($lined) > 3) { |
|
890 | - $data['hex'] = $lined['hexid']; |
|
891 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
892 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
893 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
894 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
895 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
896 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
897 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
898 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
899 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
900 | - $data['id_source'] = $id_source; |
|
901 | - $data['format_source'] = 'tsv'; |
|
902 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
903 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
904 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
905 | - unset($lined); |
|
906 | - unset($data); |
|
907 | - } else $error = true; |
|
887 | + $lined[$key] = $line[$k+1]; |
|
888 | + } |
|
889 | + if (count($lined) > 3) { |
|
890 | + $data['hex'] = $lined['hexid']; |
|
891 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
892 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
893 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
894 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
895 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
896 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
897 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
898 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
899 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
900 | + $data['id_source'] = $id_source; |
|
901 | + $data['format_source'] = 'tsv'; |
|
902 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
903 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
904 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
905 | + unset($lined); |
|
906 | + unset($data); |
|
907 | + } else $error = true; |
|
908 | 908 | } elseif ($format == 'aprs' && $use_aprs) { |
909 | - if ($aprs_connect == 0) { |
|
909 | + if ($aprs_connect == 0) { |
|
910 | 910 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
911 | 911 | $aprs_connect = 1; |
912 | - } |
|
913 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
912 | + } |
|
913 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
914 | 914 | $aprs_last_tx = time(); |
915 | 915 | $data_aprs = "# Keep alive"; |
916 | 916 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
917 | - } |
|
918 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
919 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
917 | + } |
|
918 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
919 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
920 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
921 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
922 | 922 | $line = $APRS->parse($buffer); |
923 | 923 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
924 | - $data = array(); |
|
925 | - //print_r($line); |
|
926 | - $data['hex'] = $line['address']; |
|
927 | - $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
928 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
929 | - $data['ident'] = $line['ident']; |
|
930 | - $data['latitude'] = $line['latitude']; |
|
931 | - $data['longitude'] = $line['longitude']; |
|
932 | - //$data['verticalrate'] = $line[16]; |
|
933 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
934 | - else $data['speed'] = 0; |
|
935 | - $data['altitude'] = $line['altitude']; |
|
936 | - if (isset($line['course'])) $data['heading'] = $line['course']; |
|
937 | - //else $data['heading'] = 0; |
|
938 | - $data['aircraft_type'] = $line['stealth']; |
|
939 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
940 | - $data['id_source'] = $id_source; |
|
941 | - $data['format_source'] = 'aprs'; |
|
942 | - $data['source_name'] = $line['source']; |
|
943 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
944 | - $currentdate = date('Y-m-d H:i:s'); |
|
945 | - $aprsdate = strtotime($data['datetime']); |
|
946 | - // Accept data if time <= system time + 20s |
|
947 | - if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
948 | - else { |
|
924 | + $data = array(); |
|
925 | + //print_r($line); |
|
926 | + $data['hex'] = $line['address']; |
|
927 | + $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
928 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
929 | + $data['ident'] = $line['ident']; |
|
930 | + $data['latitude'] = $line['latitude']; |
|
931 | + $data['longitude'] = $line['longitude']; |
|
932 | + //$data['verticalrate'] = $line[16]; |
|
933 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
934 | + else $data['speed'] = 0; |
|
935 | + $data['altitude'] = $line['altitude']; |
|
936 | + if (isset($line['course'])) $data['heading'] = $line['course']; |
|
937 | + //else $data['heading'] = 0; |
|
938 | + $data['aircraft_type'] = $line['stealth']; |
|
939 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
940 | + $data['id_source'] = $id_source; |
|
941 | + $data['format_source'] = 'aprs'; |
|
942 | + $data['source_name'] = $line['source']; |
|
943 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
944 | + $currentdate = date('Y-m-d H:i:s'); |
|
945 | + $aprsdate = strtotime($data['datetime']); |
|
946 | + // Accept data if time <= system time + 20s |
|
947 | + if ($line['stealth'] == 0 && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) $send = $SI->add($data); |
|
948 | + else { |
|
949 | 949 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
950 | 950 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
951 | - } |
|
952 | - unset($data); |
|
951 | + } |
|
952 | + unset($data); |
|
953 | 953 | } |
954 | 954 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
955 | 955 | elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
956 | - } |
|
956 | + } |
|
957 | 957 | } else { |
958 | - $line = explode(',', $buffer); |
|
959 | - if (count($line) > 20) { |
|
960 | - $data['hex'] = $line[4]; |
|
961 | - /* |
|
958 | + $line = explode(',', $buffer); |
|
959 | + if (count($line) > 20) { |
|
960 | + $data['hex'] = $line[4]; |
|
961 | + /* |
|
962 | 962 | $data['datetime'] = $line[6].' '.$line[7]; |
963 | 963 | date_default_timezone_set($globalTimezone); |
964 | 964 | $datetime = new DateTime($data['datetime']); |
@@ -966,28 +966,28 @@ discard block |
||
966 | 966 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
967 | 967 | date_default_timezone_set('UTC'); |
968 | 968 | */ |
969 | - // Force datetime to current UTC datetime |
|
970 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
971 | - $data['ident'] = trim($line[10]); |
|
972 | - $data['latitude'] = $line[14]; |
|
973 | - $data['longitude'] = $line[15]; |
|
974 | - $data['verticalrate'] = $line[16]; |
|
975 | - $data['emergency'] = $line[20]; |
|
976 | - $data['speed'] = $line[12]; |
|
977 | - $data['squawk'] = $line[17]; |
|
978 | - $data['altitude'] = $line[11]; |
|
979 | - $data['heading'] = $line[13]; |
|
980 | - $data['ground'] = $line[21]; |
|
981 | - $data['emergency'] = $line[19]; |
|
982 | - $data['format_source'] = 'sbs'; |
|
969 | + // Force datetime to current UTC datetime |
|
970 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
971 | + $data['ident'] = trim($line[10]); |
|
972 | + $data['latitude'] = $line[14]; |
|
973 | + $data['longitude'] = $line[15]; |
|
974 | + $data['verticalrate'] = $line[16]; |
|
975 | + $data['emergency'] = $line[20]; |
|
976 | + $data['speed'] = $line[12]; |
|
977 | + $data['squawk'] = $line[17]; |
|
978 | + $data['altitude'] = $line[11]; |
|
979 | + $data['heading'] = $line[13]; |
|
980 | + $data['ground'] = $line[21]; |
|
981 | + $data['emergency'] = $line[19]; |
|
982 | + $data['format_source'] = 'sbs'; |
|
983 | 983 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
984 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
985 | - $data['id_source'] = $id_source; |
|
986 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
987 | - else $error = true; |
|
988 | - unset($data); |
|
989 | - } else $error = true; |
|
990 | - if ($error) { |
|
984 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
985 | + $data['id_source'] = $id_source; |
|
986 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
987 | + else $error = true; |
|
988 | + unset($data); |
|
989 | + } else $error = true; |
|
990 | + if ($error) { |
|
991 | 991 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
992 | 992 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
993 | 993 | } else { |
@@ -1003,13 +1003,13 @@ discard block |
||
1003 | 1003 | connect_all($sourceer); |
1004 | 1004 | $sourceer = array(); |
1005 | 1005 | } |
1006 | - } |
|
1006 | + } |
|
1007 | 1007 | } |
1008 | 1008 | // Sleep for xxx microseconds |
1009 | 1009 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
1010 | - } else { |
|
1010 | + } else { |
|
1011 | 1011 | if ($format == 'flightgearmp') { |
1012 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1012 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
1013 | 1013 | //@socket_close($r); |
1014 | 1014 | sleep($globalMinFetch); |
1015 | 1015 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1018,9 +1018,9 @@ discard block |
||
1018 | 1018 | break; |
1019 | 1019 | |
1020 | 1020 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
1021 | - if (isset($tt[$format])) $tt[$format]++; |
|
1022 | - else $tt[$format] = 0; |
|
1023 | - if ($tt[$format] > 30) { |
|
1021 | + if (isset($tt[$format])) $tt[$format]++; |
|
1022 | + else $tt[$format] = 0; |
|
1023 | + if ($tt[$format] > 30) { |
|
1024 | 1024 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
1025 | 1025 | //@socket_close($r); |
1026 | 1026 | sleep(2); |
@@ -1031,40 +1031,40 @@ discard block |
||
1031 | 1031 | //connect_all($globalSources); |
1032 | 1032 | $tt[$format]=0; |
1033 | 1033 | break; |
1034 | - } |
|
1034 | + } |
|
1035 | + } |
|
1035 | 1036 | } |
1036 | - } |
|
1037 | 1037 | } |
1038 | - } else { |
|
1038 | + } else { |
|
1039 | 1039 | $error = socket_strerror(socket_last_error()); |
1040 | 1040 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
1041 | 1041 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
1042 | 1042 | if (isset($globalDebug)) echo "Restarting...\n"; |
1043 | 1043 | // Restart the script if possible |
1044 | 1044 | if (is_array($sockets)) { |
1045 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
1045 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
1046 | 1046 | |
1047 | - foreach ($sockets as $sock) { |
|
1047 | + foreach ($sockets as $sock) { |
|
1048 | 1048 | @socket_shutdown($sock,2); |
1049 | 1049 | @socket_close($sock); |
1050 | - } |
|
1050 | + } |
|
1051 | 1051 | |
1052 | 1052 | } |
1053 | - if ($globalDebug) echo "Restart all connections..."; |
|
1054 | - sleep(2); |
|
1055 | - $time = time(); |
|
1056 | - //connect_all($hosts); |
|
1057 | - $aprs_connect = 0; |
|
1058 | - connect_all($globalSources); |
|
1053 | + if ($globalDebug) echo "Restart all connections..."; |
|
1054 | + sleep(2); |
|
1055 | + $time = time(); |
|
1056 | + //connect_all($hosts); |
|
1057 | + $aprs_connect = 0; |
|
1058 | + connect_all($globalSources); |
|
1059 | 1059 | |
1060 | 1060 | } |
1061 | - } |
|
1061 | + } |
|
1062 | 1062 | } |
1063 | 1063 | if ($globalDaemon === false) { |
1064 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
1065 | - $SI->checkAll(); |
|
1064 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
1065 | + $SI->checkAll(); |
|
1066 | + } |
|
1066 | 1067 | } |
1067 | - } |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | 1070 | ?> |
@@ -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 |