@@ -11,7 +11,7 @@ discard block |
||
11 | 11 | |
12 | 12 | if (isset($_GET['coord'])) |
13 | 13 | { |
14 | - $coords = explode(',',$_GET['coord']); |
|
14 | + $coords = explode(',', $_GET['coord']); |
|
15 | 15 | $spotter_array = $Spotter->getAllAirportInfobyCoord($coords); |
16 | 16 | } else { |
17 | 17 | $spotter_array = $Spotter->getAllAirportInfo(); |
@@ -22,17 +22,17 @@ discard block |
||
22 | 22 | |
23 | 23 | if (!empty($spotter_array)) |
24 | 24 | { |
25 | - foreach($spotter_array as $spotter_item) |
|
25 | + foreach ($spotter_array as $spotter_item) |
|
26 | 26 | { |
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | //waypoint plotting |
29 | 29 | $output .= '{"type": "Feature",'; |
30 | 30 | $output .= '"properties": {'; |
31 | - $output .= '"name": "'.str_replace('"',"'",$spotter_item['name']).'",'; |
|
32 | - $output .= '"city": "'.str_replace('"',"'",$spotter_item['city']).'",'; |
|
31 | + $output .= '"name": "'.str_replace('"', "'", $spotter_item['name']).'",'; |
|
32 | + $output .= '"city": "'.str_replace('"', "'", $spotter_item['city']).'",'; |
|
33 | 33 | $output .= '"country": "'.$spotter_item['country'].'",'; |
34 | 34 | $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
35 | - $output .= '"popupContent": "'.str_replace('"',"'",$spotter_item['name']).' : '.str_replace('"',"'",$spotter_item['city']).', '.$spotter_item['country'].'",'; |
|
35 | + $output .= '"popupContent": "'.str_replace('"', "'", $spotter_item['name']).' : '.str_replace('"', "'", $spotter_item['city']).', '.$spotter_item['country'].'",'; |
|
36 | 36 | if ($spotter_item['type'] == 'large_airport') { |
37 | 37 | $output .= '"icon": "'.$globalURL.'/images/airport.png",'; |
38 | 38 | } elseif ($spotter_item['type'] == 'heliport') { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $output .= '}'; |
60 | 60 | $output .= '},'; |
61 | 61 | } |
62 | - $output = substr($output, 0, -1); |
|
62 | + $output = substr($output, 0, -1); |
|
63 | 63 | } |
64 | 64 | $output .= ']}'; |
65 | 65 | print $output; |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Country a flight was over"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | </div> |
23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common country a flight was over.").'</p>'; |
24 | 24 | |
25 | -$flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name); |
|
25 | +$flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name); |
|
26 | 26 | /* |
27 | 27 | require_once('require/class.Spotter.php'); |
28 | 28 | $Spotter = new Spotter(); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
32 | 32 | print 'var series = ['; |
33 | 33 | $flightover_data = ''; |
34 | -foreach($flightover_array as $flightover_item) |
|
34 | +foreach ($flightover_array as $flightover_item) |
|
35 | 35 | { |
36 | 36 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
37 | 37 | } |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | print '</thead>'; |
81 | 81 | print '<tbody>'; |
82 | 82 | $i = 1; |
83 | - array_splice($flightover_array,10); |
|
84 | - foreach($flightover_array as $flightover_item) |
|
83 | + array_splice($flightover_array, 10); |
|
84 | + foreach ($flightover_array as $flightover_item) |
|
85 | 85 | { |
86 | 86 | print '<tr>'; |
87 | 87 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -16,33 +16,33 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
37 | 37 | if (isset($flt['source'])) { |
38 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."') AND tracker_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."') AND tracker_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
39 | 39 | } else { |
40 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
40 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output WHERE tracker_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.famtrackid = tracker_live.famtrackid"; |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | } |
44 | 44 | if (isset($filter['source']) && !empty($filter['source'])) { |
45 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
45 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
46 | 46 | } |
47 | 47 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
48 | 48 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | $filter_query_date .= " AND EXTRACT(DAY FROM tracker_output.date) = '".$filter['day']."'"; |
72 | 72 | } |
73 | 73 | } |
74 | - $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
74 | + $filter_query_join .= " INNER JOIN (SELECT famtrackid FROM tracker_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.famtrackid = tracker_live.famtrackid"; |
|
75 | 75 | } |
76 | 76 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
78 | 78 | } |
79 | 79 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
80 | 80 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
81 | 81 | if ($filter_query_where != '') { |
82 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
82 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
83 | 83 | } |
84 | 84 | $filter_query = $filter_query_join.$filter_query_where; |
85 | 85 | return $filter_query; |
@@ -102,8 +102,8 @@ discard block |
||
102 | 102 | if ($limit != '') |
103 | 103 | { |
104 | 104 | $limit_array = explode(',', $limit); |
105 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
106 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
105 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
106 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
107 | 107 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
108 | 108 | { |
109 | 109 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | } else { |
127 | 127 | $query = "SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query.$orderby_query; |
128 | 128 | } |
129 | - $spotter_array = $Tracker->getDataFromDB($query.$limit_query,array(),'',true); |
|
129 | + $spotter_array = $Tracker->getDataFromDB($query.$limit_query, array(), '', true); |
|
130 | 130 | |
131 | 131 | return $spotter_array; |
132 | 132 | } |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | global $globalDBdriver, $globalLiveInterval; |
143 | 143 | date_default_timezone_set('UTC'); |
144 | 144 | |
145 | - $filter_query = $this->getFilter($filter,true,true); |
|
145 | + $filter_query = $this->getFilter($filter, true, true); |
|
146 | 146 | |
147 | 147 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
148 | 148 | if ($globalDBdriver == 'mysql') { |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | try { |
161 | 161 | $sth = $this->db->prepare($query); |
162 | 162 | $sth->execute(); |
163 | - } catch(PDOException $e) { |
|
163 | + } catch (PDOException $e) { |
|
164 | 164 | echo $e->getMessage(); |
165 | 165 | die; |
166 | 166 | } |
@@ -180,15 +180,15 @@ discard block |
||
180 | 180 | global $globalDBdriver, $globalLiveInterval; |
181 | 181 | date_default_timezone_set('UTC'); |
182 | 182 | |
183 | - $filter_query = $this->getFilter($filter,true,true); |
|
183 | + $filter_query = $this->getFilter($filter, true, true); |
|
184 | 184 | |
185 | 185 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
186 | 186 | if ($globalDBdriver == 'mysql') { |
187 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
187 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
188 | 188 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
189 | 189 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
190 | 190 | } else { |
191 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
191 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
192 | 192 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
193 | 193 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
194 | 194 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | try { |
197 | 197 | $sth = $this->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | - } catch(PDOException $e) { |
|
199 | + } catch (PDOException $e) { |
|
200 | 200 | echo $e->getMessage(); |
201 | 201 | die; |
202 | 202 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | public function getLiveTrackerCount($filter = array()) |
214 | 214 | { |
215 | 215 | global $globalDBdriver, $globalLiveInterval; |
216 | - $filter_query = $this->getFilter($filter,true,true); |
|
216 | + $filter_query = $this->getFilter($filter, true, true); |
|
217 | 217 | |
218 | 218 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
219 | 219 | if ($globalDBdriver == 'mysql') { |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -247,10 +247,10 @@ discard block |
||
247 | 247 | $filter_query = $this->getFilter($filter); |
248 | 248 | |
249 | 249 | if (is_array($coord)) { |
250 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
251 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
252 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
253 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
250 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
251 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
252 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
253 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
254 | 254 | } else return array(); |
255 | 255 | if ($globalDBdriver == 'mysql') { |
256 | 256 | $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND tracker_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY tracker_live.famtrackid'.$filter_query; |
@@ -275,17 +275,17 @@ discard block |
||
275 | 275 | $filter_query = $this->getFilter($filter); |
276 | 276 | |
277 | 277 | if (is_array($coord)) { |
278 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
279 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
280 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
281 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
278 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
279 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
280 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
281 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
282 | 282 | } else return array(); |
283 | 283 | if ($globalDBdriver == 'mysql') { |
284 | 284 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
285 | 285 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' AND tracker_live.latitude BETWEEN ".$minlat.' AND '.$maxlat.' AND tracker_live.longitude BETWEEN '.$minlong.' AND '.$maxlong." |
286 | 286 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
287 | 287 | } else { |
288 | - $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
288 | + $query = "SELECT tracker_live.ident, tracker_live.type,tracker_live.famtrackid, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
|
289 | 289 | FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date l.latitude BETWEEN ".$minlat." AND ".$maxlat." AND l.longitude BETWEEN ".$minlong." AND ".$maxlong." GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate".$filter_query." tracker_live.latitude <> '0' AND tracker_live.longitude <> '0'"; |
290 | 290 | } |
291 | 291 | $spotter_array = $Spotter->getDataFromDB($query); |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if ($interval == '1m') |
334 | 334 | { |
335 | 335 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
336 | - } else if ($interval == '15m'){ |
|
336 | + } else if ($interval == '15m') { |
|
337 | 337 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
338 | 338 | } |
339 | 339 | } |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
342 | 342 | } |
343 | 343 | |
344 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
344 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
345 | 345 | WHERE tracker_live.latitude <> '' |
346 | 346 | AND tracker_live.longitude <> '' |
347 | 347 | ".$additional_query." |
348 | 348 | HAVING distance < :radius |
349 | 349 | ORDER BY distance"; |
350 | 350 | |
351 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
351 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
352 | 352 | |
353 | 353 | return $spotter_array; |
354 | 354 | } |
@@ -366,9 +366,9 @@ discard block |
||
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
369 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
369 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
370 | 370 | |
371 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
371 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
372 | 372 | |
373 | 373 | return $spotter_array; |
374 | 374 | } |
@@ -379,16 +379,16 @@ discard block |
||
379 | 379 | * @return Array the spotter information |
380 | 380 | * |
381 | 381 | */ |
382 | - public function getDateLiveTrackerDataByIdent($ident,$date) |
|
382 | + public function getDateLiveTrackerDataByIdent($ident, $date) |
|
383 | 383 | { |
384 | 384 | $Tracker = new Tracker($this->db); |
385 | 385 | date_default_timezone_set('UTC'); |
386 | 386 | |
387 | 387 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
388 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
388 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
389 | 389 | |
390 | - $date = date('c',$date); |
|
391 | - $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
390 | + $date = date('c', $date); |
|
391 | + $spotter_array = $Tracker->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
392 | 392 | |
393 | 393 | return $spotter_array; |
394 | 394 | } |
@@ -405,9 +405,9 @@ discard block |
||
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
408 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
409 | 409 | |
410 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
|
410 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id), '', true); |
|
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
@@ -418,15 +418,15 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function getDateLiveTrackerDataById($id,$date) |
|
421 | + public function getDateLiveTrackerDataById($id, $date) |
|
422 | 422 | { |
423 | 423 | $Tracker = new Tracker($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | - $date = date('c',$date); |
|
429 | - $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
427 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | + $date = date('c', $date); |
|
429 | + $spotter_array = $Tracker->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
430 | 430 | |
431 | 431 | return $spotter_array; |
432 | 432 | } |
@@ -443,13 +443,13 @@ discard block |
||
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
446 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
446 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
447 | 447 | |
448 | 448 | try { |
449 | 449 | |
450 | 450 | $sth = $this->db->prepare($query); |
451 | 451 | $sth->execute(array(':ident' => $ident)); |
452 | - } catch(PDOException $e) { |
|
452 | + } catch (PDOException $e) { |
|
453 | 453 | echo $e->getMessage(); |
454 | 454 | die; |
455 | 455 | } |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | * @return Array the spotter information |
465 | 465 | * |
466 | 466 | */ |
467 | - public function getAllLiveTrackerDataById($id,$liveinterval = false) |
|
467 | + public function getAllLiveTrackerDataById($id, $liveinterval = false) |
|
468 | 468 | { |
469 | 469 | global $globalDBdriver, $globalLiveInterval; |
470 | 470 | date_default_timezone_set('UTC'); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | try { |
484 | 484 | $sth = $this->db->prepare($query); |
485 | 485 | $sth->execute(array(':id' => $id)); |
486 | - } catch(PDOException $e) { |
|
486 | + } catch (PDOException $e) { |
|
487 | 487 | echo $e->getMessage(); |
488 | 488 | die; |
489 | 489 | } |
@@ -501,12 +501,12 @@ discard block |
||
501 | 501 | { |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
504 | - $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
504 | + $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
|
505 | 505 | try { |
506 | 506 | |
507 | 507 | $sth = $this->db->prepare($query); |
508 | 508 | $sth->execute(array(':ident' => $ident)); |
509 | - } catch(PDOException $e) { |
|
509 | + } catch (PDOException $e) { |
|
510 | 510 | echo $e->getMessage(); |
511 | 511 | die; |
512 | 512 | } |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
539 | - } catch(PDOException $e) { |
|
539 | + } catch (PDOException $e) { |
|
540 | 540 | return "error"; |
541 | 541 | } |
542 | 542 | |
@@ -559,14 +559,14 @@ discard block |
||
559 | 559 | |
560 | 560 | $sth = $this->db->prepare($query); |
561 | 561 | $sth->execute(); |
562 | - } catch(PDOException $e) { |
|
562 | + } catch (PDOException $e) { |
|
563 | 563 | return "error"; |
564 | 564 | } |
565 | 565 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
566 | 566 | $i = 0; |
567 | - $j =0; |
|
567 | + $j = 0; |
|
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | - foreach($all as $row) |
|
569 | + foreach ($all as $row) |
|
570 | 570 | { |
571 | 571 | $i++; |
572 | 572 | $j++; |
@@ -574,9 +574,9 @@ discard block |
||
574 | 574 | if ($globalDebug) echo "."; |
575 | 575 | try { |
576 | 576 | |
577 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
577 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
578 | 578 | $sth->execute(); |
579 | - } catch(PDOException $e) { |
|
579 | + } catch (PDOException $e) { |
|
580 | 580 | return "error"; |
581 | 581 | } |
582 | 582 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
@@ -587,9 +587,9 @@ discard block |
||
587 | 587 | if ($i > 0) { |
588 | 588 | try { |
589 | 589 | |
590 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
590 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
591 | 591 | $sth->execute(); |
592 | - } catch(PDOException $e) { |
|
592 | + } catch (PDOException $e) { |
|
593 | 593 | return "error"; |
594 | 594 | } |
595 | 595 | } |
@@ -602,7 +602,7 @@ discard block |
||
602 | 602 | |
603 | 603 | $sth = $this->db->prepare($query); |
604 | 604 | $sth->execute(); |
605 | - } catch(PDOException $e) { |
|
605 | + } catch (PDOException $e) { |
|
606 | 606 | return "error"; |
607 | 607 | } |
608 | 608 | /* $query_delete = "DELETE FROM tracker_live WHERE famtrackid IN ("; |
@@ -650,13 +650,13 @@ discard block |
||
650 | 650 | public function deleteLiveTrackerDataByIdent($ident) |
651 | 651 | { |
652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
653 | - $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
653 | + $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
|
654 | 654 | |
655 | 655 | try { |
656 | 656 | |
657 | 657 | $sth = $this->db->prepare($query); |
658 | 658 | $sth->execute(array(':ident' => $ident)); |
659 | - } catch(PDOException $e) { |
|
659 | + } catch (PDOException $e) { |
|
660 | 660 | return "error"; |
661 | 661 | } |
662 | 662 | |
@@ -672,13 +672,13 @@ discard block |
||
672 | 672 | public function deleteLiveTrackerDataById($id) |
673 | 673 | { |
674 | 674 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
675 | - $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
675 | + $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
|
676 | 676 | |
677 | 677 | try { |
678 | 678 | |
679 | 679 | $sth = $this->db->prepare($query); |
680 | 680 | $sth->execute(array(':id' => $id)); |
681 | - } catch(PDOException $e) { |
|
681 | + } catch (PDOException $e) { |
|
682 | 682 | return "error"; |
683 | 683 | } |
684 | 684 | |
@@ -696,13 +696,13 @@ discard block |
||
696 | 696 | { |
697 | 697 | global $globalDBdriver, $globalTimezone; |
698 | 698 | if ($globalDBdriver == 'mysql') { |
699 | - $query = 'SELECT tracker_live.ident FROM tracker_live |
|
699 | + $query = 'SELECT tracker_live.ident FROM tracker_live |
|
700 | 700 | WHERE tracker_live.ident = :ident |
701 | 701 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
702 | 702 | AND tracker_live.date < UTC_TIMESTAMP()'; |
703 | 703 | $query_data = array(':ident' => $ident); |
704 | 704 | } else { |
705 | - $query = "SELECT tracker_live.ident FROM tracker_live |
|
705 | + $query = "SELECT tracker_live.ident FROM tracker_live |
|
706 | 706 | WHERE tracker_live.ident = :ident |
707 | 707 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
708 | 708 | AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -711,8 +711,8 @@ discard block |
||
711 | 711 | |
712 | 712 | $sth = $this->db->prepare($query); |
713 | 713 | $sth->execute($query_data); |
714 | - $ident_result=''; |
|
715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
714 | + $ident_result = ''; |
|
715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
716 | 716 | { |
717 | 717 | $ident_result = $row['ident']; |
718 | 718 | } |
@@ -729,13 +729,13 @@ discard block |
||
729 | 729 | { |
730 | 730 | global $globalDBdriver, $globalTimezone; |
731 | 731 | if ($globalDBdriver == 'mysql') { |
732 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
732 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
733 | 733 | WHERE tracker_live.ident = :ident |
734 | 734 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
735 | 735 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
736 | 736 | $query_data = array(':ident' => $ident); |
737 | 737 | } else { |
738 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
738 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
739 | 739 | WHERE tracker_live.ident = :ident |
740 | 740 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
741 | 741 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -744,8 +744,8 @@ discard block |
||
744 | 744 | |
745 | 745 | $sth = $this->db->prepare($query); |
746 | 746 | $sth->execute($query_data); |
747 | - $ident_result=''; |
|
748 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
747 | + $ident_result = ''; |
|
748 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
749 | 749 | { |
750 | 750 | $ident_result = $row['famtrackid']; |
751 | 751 | } |
@@ -762,13 +762,13 @@ discard block |
||
762 | 762 | { |
763 | 763 | global $globalDBdriver, $globalTimezone; |
764 | 764 | if ($globalDBdriver == 'mysql') { |
765 | - $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
765 | + $query = 'SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
766 | 766 | WHERE tracker_live.famtrackid = :id |
767 | 767 | AND tracker_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
768 | 768 | // AND tracker_live.date < UTC_TIMESTAMP()"; |
769 | 769 | $query_data = array(':id' => $id); |
770 | 770 | } else { |
771 | - $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
771 | + $query = "SELECT tracker_live.ident, tracker_live.famtrackid FROM tracker_live |
|
772 | 772 | WHERE tracker_live.famtrackid = :id |
773 | 773 | AND tracker_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
774 | 774 | // AND tracker_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -777,8 +777,8 @@ discard block |
||
777 | 777 | |
778 | 778 | $sth = $this->db->prepare($query); |
779 | 779 | $sth->execute($query_data); |
780 | - $ident_result=''; |
|
781 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
780 | + $ident_result = ''; |
|
781 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
782 | 782 | { |
783 | 783 | $ident_result = $row['famtrackid']; |
784 | 784 | } |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @return String success or false |
797 | 797 | * |
798 | 798 | */ |
799 | - public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
|
799 | + public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '') |
|
800 | 800 | { |
801 | 801 | global $globalURL, $globalArchive, $globalDebug; |
802 | 802 | $Common = new Common(); |
@@ -855,31 +855,31 @@ discard block |
||
855 | 855 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
856 | 856 | |
857 | 857 | |
858 | - $famtrackid = filter_var($famtrackid,FILTER_SANITIZE_STRING); |
|
859 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
860 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
861 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
862 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
863 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
864 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
865 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
866 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
867 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
868 | - $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
|
869 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
870 | - |
|
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
858 | + $famtrackid = filter_var($famtrackid, FILTER_SANITIZE_STRING); |
|
859 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
860 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
861 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
862 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
863 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
864 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
865 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
866 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
867 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
868 | + $comment = filter_var($comment, FILTER_SANITIZE_STRING); |
|
869 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
870 | + |
|
871 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
872 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
873 | 873 | |
874 | - $query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
874 | + $query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
|
875 | 875 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
876 | 876 | |
877 | - $query_values = array(':famtrackid' => $famtrackid,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':comment' => $comment,':type' => $type); |
|
877 | + $query_values = array(':famtrackid' => $famtrackid, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':comment' => $comment, ':type' => $type); |
|
878 | 878 | try { |
879 | 879 | |
880 | 880 | $sth = $this->db->prepare($query); |
881 | 881 | $sth->execute($query_values); |
882 | - } catch(PDOException $e) { |
|
882 | + } catch (PDOException $e) { |
|
883 | 883 | return "error : ".$e->getMessage(); |
884 | 884 | } |
885 | 885 | /* |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | |
897 | 897 | public function getOrderBy() |
898 | 898 | { |
899 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
899 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY tracker_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY tracker_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY tracker_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY tracker_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY tracker_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY tracker_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY tracker_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY tracker_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY tracker_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY tracker_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY tracker_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY tracker_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY tracker_live.date DESC")); |
|
900 | 900 | return $orderby; |
901 | 901 | } |
902 | 902 |
@@ -24,20 +24,20 @@ discard block |
||
24 | 24 | fclose($fp); |
25 | 25 | } |
26 | 26 | |
27 | - public static function gunzip($in_file,$out_file_name = '') { |
|
27 | + public static function gunzip($in_file, $out_file_name = '') { |
|
28 | 28 | //echo $in_file.' -> '.$out_file_name."\n"; |
29 | 29 | $buffer_size = 4096; // read 4kb at a time |
30 | 30 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
31 | 31 | if ($in_file != '' && file_exists($in_file)) { |
32 | 32 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
33 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
34 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
35 | 35 | else { |
36 | 36 | echo 'gzopen not available'; |
37 | 37 | die; |
38 | 38 | } |
39 | 39 | $out_file = fopen($out_file_name, 'wb'); |
40 | - while(!gzeof($file)) { |
|
40 | + while (!gzeof($file)) { |
|
41 | 41 | fwrite($out_file, gzread($file, $buffer_size)); |
42 | 42 | } |
43 | 43 | fclose($out_file); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | try { |
62 | 62 | self::$db_sqlite = new PDO('sqlite:'.$database); |
63 | 63 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
64 | - } catch(PDOException $e) { |
|
64 | + } catch (PDOException $e) { |
|
65 | 65 | return "error : ".$e->getMessage(); |
66 | 66 | } |
67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | //$Connection = new Connection(); |
77 | 77 | $sth = $Connection->db->prepare($query); |
78 | 78 | $sth->execute(array(':source' => $database_file)); |
79 | - } catch(PDOException $e) { |
|
79 | + } catch (PDOException $e) { |
|
80 | 80 | return "error : ".$e->getMessage(); |
81 | 81 | } |
82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | try { |
88 | 88 | $sth = update_db::$db_sqlite->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
99 | 99 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
100 | 100 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
101 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
101 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
102 | 102 | $sth_dest->execute($query_dest_values); |
103 | 103 | } |
104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
105 | - } catch(PDOException $e) { |
|
105 | + } catch (PDOException $e) { |
|
106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
107 | 107 | return "error : ".$e->getMessage(); |
108 | 108 | } |
@@ -118,26 +118,26 @@ discard block |
||
118 | 118 | //$Connection = new Connection(); |
119 | 119 | $sth = $Connection->db->prepare($query); |
120 | 120 | $sth->execute(array(':source' => 'oneworld')); |
121 | - } catch(PDOException $e) { |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | return "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | if ($globalDebug) echo " - Add routes to DB -"; |
126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
127 | 127 | $Spotter = new Spotter(); |
128 | - if ($fh = fopen($database_file,"r")) { |
|
128 | + if ($fh = fopen($database_file, "r")) { |
|
129 | 129 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
130 | 130 | $Connection = new Connection(); |
131 | 131 | $sth_dest = $Connection->db->prepare($query_dest); |
132 | 132 | if ($globalTransaction) $Connection->db->beginTransaction(); |
133 | 133 | while (!feof($fh)) { |
134 | - $line = fgetcsv($fh,9999,','); |
|
134 | + $line = fgetcsv($fh, 9999, ','); |
|
135 | 135 | if ($line[0] != '') { |
136 | 136 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
137 | 137 | try { |
138 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
138 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
139 | 139 | $sth_dest->execute($query_dest_values); |
140 | - } catch(PDOException $e) { |
|
140 | + } catch (PDOException $e) { |
|
141 | 141 | if ($globalTransaction) $Connection->db->rollBack(); |
142 | 142 | return "error : ".$e->getMessage(); |
143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | //$Connection = new Connection(); |
160 | 160 | $sth = $Connection->db->prepare($query); |
161 | 161 | $sth->execute(array(':source' => 'skyteam')); |
162 | - } catch(PDOException $e) { |
|
162 | + } catch (PDOException $e) { |
|
163 | 163 | return "error : ".$e->getMessage(); |
164 | 164 | } |
165 | 165 | |
@@ -167,24 +167,24 @@ discard block |
||
167 | 167 | |
168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
169 | 169 | $Spotter = new Spotter(); |
170 | - if ($fh = fopen($database_file,"r")) { |
|
170 | + if ($fh = fopen($database_file, "r")) { |
|
171 | 171 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
172 | 172 | $Connection = new Connection(); |
173 | 173 | $sth_dest = $Connection->db->prepare($query_dest); |
174 | 174 | try { |
175 | 175 | if ($globalTransaction) $Connection->db->beginTransaction(); |
176 | 176 | while (!feof($fh)) { |
177 | - $line = fgetcsv($fh,9999,','); |
|
177 | + $line = fgetcsv($fh, 9999, ','); |
|
178 | 178 | if ($line[0] != '') { |
179 | - $datebe = explode(' - ',$line[2]); |
|
179 | + $datebe = explode(' - ', $line[2]); |
|
180 | 180 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
181 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
181 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
182 | 182 | $sth_dest->execute($query_dest_values); |
183 | 183 | } |
184 | 184 | } |
185 | 185 | } |
186 | 186 | if ($globalTransaction) $Connection->db->commit(); |
187 | - } catch(PDOException $e) { |
|
187 | + } catch (PDOException $e) { |
|
188 | 188 | if ($globalTransaction) $Connection->db->rollBack(); |
189 | 189 | return "error : ".$e->getMessage(); |
190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $Connection = new Connection(); |
200 | 200 | $sth = $Connection->db->prepare($query); |
201 | 201 | $sth->execute(array(':source' => $database_file)); |
202 | - } catch(PDOException $e) { |
|
202 | + } catch (PDOException $e) { |
|
203 | 203 | return "error : ".$e->getMessage(); |
204 | 204 | } |
205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $Connection = new Connection(); |
208 | 208 | $sth = $Connection->db->prepare($query); |
209 | 209 | $sth->execute(array(':source' => $database_file)); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | return "error : ".$e->getMessage(); |
212 | 212 | } |
213 | 213 | |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | try { |
217 | 217 | $sth = update_db::$db_sqlite->prepare($query); |
218 | 218 | $sth->execute(); |
219 | - } catch(PDOException $e) { |
|
219 | + } catch (PDOException $e) { |
|
220 | 220 | return "error : ".$e->getMessage(); |
221 | 221 | } |
222 | 222 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -233,15 +233,15 @@ discard block |
||
233 | 233 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
235 | 235 | else $type = null; |
236 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
236 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
237 | 237 | $sth_dest->execute($query_dest_values); |
238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
239 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
240 | 240 | $sth_dest_owner->execute($query_dest_owner_values); |
241 | 241 | } |
242 | 242 | } |
243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
244 | - } catch(PDOException $e) { |
|
244 | + } catch (PDOException $e) { |
|
245 | 245 | return "error : ".$e->getMessage(); |
246 | 246 | } |
247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $Connection = new Connection(); |
252 | 252 | $sth = $Connection->db->prepare($query); |
253 | 253 | $sth->execute(array(':source' => $database_file)); |
254 | - } catch(PDOException $e) { |
|
254 | + } catch (PDOException $e) { |
|
255 | 255 | return "error : ".$e->getMessage(); |
256 | 256 | } |
257 | 257 | return ''; |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | $Connection = new Connection(); |
267 | 267 | $sth = $Connection->db->prepare($query); |
268 | 268 | $sth->execute(array(':source' => $database_file)); |
269 | - } catch(PDOException $e) { |
|
269 | + } catch (PDOException $e) { |
|
270 | 270 | return "error : ".$e->getMessage(); |
271 | 271 | } |
272 | 272 | |
273 | - if ($fh = fopen($database_file,"r")) { |
|
273 | + if ($fh = fopen($database_file, "r")) { |
|
274 | 274 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
275 | 275 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
276 | 276 | |
@@ -280,13 +280,13 @@ discard block |
||
280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
281 | 281 | while (!feof($fh)) { |
282 | 282 | $values = array(); |
283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
283 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
285 | - $values['ModeS'] = substr($line,0,6); |
|
286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
287 | - $aircraft_name = trim(substr($line,48,6)); |
|
285 | + $values['ModeS'] = substr($line, 0, 6); |
|
286 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
287 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
288 | 288 | // Check if we can find ICAO, else set it to GLID |
289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
289 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
290 | 290 | $search_more = ''; |
291 | 291 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
292 | 292 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -298,20 +298,20 @@ discard block |
||
298 | 298 | if (isset($result['icao']) && $result['icao'] != '') { |
299 | 299 | $values['ICAOTypeCode'] = $result['icao']; |
300 | 300 | } |
301 | - } catch(PDOException $e) { |
|
301 | + } catch (PDOException $e) { |
|
302 | 302 | return "error : ".$e->getMessage(); |
303 | 303 | } |
304 | 304 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
305 | 305 | // Add data to db |
306 | 306 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
307 | 307 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
308 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
308 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
309 | 309 | //print_r($query_dest_values); |
310 | 310 | $sth_dest->execute($query_dest_values); |
311 | 311 | } |
312 | 312 | } |
313 | 313 | if ($globalTransaction) $Connection->db->commit(); |
314 | - } catch(PDOException $e) { |
|
314 | + } catch (PDOException $e) { |
|
315 | 315 | return "error : ".$e->getMessage(); |
316 | 316 | } |
317 | 317 | } |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | $Connection = new Connection(); |
322 | 322 | $sth = $Connection->db->prepare($query); |
323 | 323 | $sth->execute(array(':source' => $database_file)); |
324 | - } catch(PDOException $e) { |
|
324 | + } catch (PDOException $e) { |
|
325 | 325 | return "error : ".$e->getMessage(); |
326 | 326 | } |
327 | 327 | return ''; |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | $Connection = new Connection(); |
336 | 336 | $sth = $Connection->db->prepare($query); |
337 | 337 | $sth->execute(array(':source' => $database_file)); |
338 | - } catch(PDOException $e) { |
|
338 | + } catch (PDOException $e) { |
|
339 | 339 | return "error : ".$e->getMessage(); |
340 | 340 | } |
341 | 341 | |
342 | - if ($fh = fopen($database_file,"r")) { |
|
342 | + if ($fh = fopen($database_file, "r")) { |
|
343 | 343 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
344 | 344 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
345 | 345 | |
@@ -347,9 +347,9 @@ discard block |
||
347 | 347 | $sth_dest = $Connection->db->prepare($query_dest); |
348 | 348 | try { |
349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
350 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
350 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
351 | 351 | while (!feof($fh)) { |
352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
352 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
353 | 353 | |
354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
355 | 355 | //print_r($line); |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $values['Registration'] = $line[3]; |
358 | 358 | $aircraft_name = $line[2]; |
359 | 359 | // Check if we can find ICAO, else set it to GLID |
360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
360 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
361 | 361 | $search_more = ''; |
362 | 362 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
363 | 363 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -366,20 +366,20 @@ discard block |
||
366 | 366 | $sth_search->execute(); |
367 | 367 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
368 | 368 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
369 | - } catch(PDOException $e) { |
|
369 | + } catch (PDOException $e) { |
|
370 | 370 | return "error : ".$e->getMessage(); |
371 | 371 | } |
372 | 372 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
373 | 373 | // Add data to db |
374 | 374 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
375 | 375 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
376 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
376 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
377 | 377 | //print_r($query_dest_values); |
378 | 378 | $sth_dest->execute($query_dest_values); |
379 | 379 | } |
380 | 380 | } |
381 | 381 | if ($globalTransaction) $Connection->db->commit(); |
382 | - } catch(PDOException $e) { |
|
382 | + } catch (PDOException $e) { |
|
383 | 383 | return "error : ".$e->getMessage(); |
384 | 384 | } |
385 | 385 | } |
@@ -389,13 +389,13 @@ discard block |
||
389 | 389 | $Connection = new Connection(); |
390 | 390 | $sth = $Connection->db->prepare($query); |
391 | 391 | $sth->execute(array(':source' => $database_file)); |
392 | - } catch(PDOException $e) { |
|
392 | + } catch (PDOException $e) { |
|
393 | 393 | return "error : ".$e->getMessage(); |
394 | 394 | } |
395 | 395 | return ''; |
396 | 396 | } |
397 | 397 | |
398 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
398 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
399 | 399 | global $globalTransaction, $globalMasterSource; |
400 | 400 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
401 | 401 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -403,12 +403,12 @@ discard block |
||
403 | 403 | $Connection = new Connection(); |
404 | 404 | $sth = $Connection->db->prepare($query); |
405 | 405 | $sth->execute(array(':source' => $database_file)); |
406 | - } catch(PDOException $e) { |
|
406 | + } catch (PDOException $e) { |
|
407 | 407 | return "error : ".$e->getMessage(); |
408 | 408 | } |
409 | 409 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
410 | 410 | $Spotter = new Spotter(); |
411 | - if ($fh = fopen($database_file,"r")) { |
|
411 | + if ($fh = fopen($database_file, "r")) { |
|
412 | 412 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
413 | 413 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
414 | 414 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -418,9 +418,9 @@ discard block |
||
418 | 418 | $sth_modes = $Connection->db->prepare($query_modes); |
419 | 419 | try { |
420 | 420 | if ($globalTransaction) $Connection->db->beginTransaction(); |
421 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
421 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
422 | 422 | while (!feof($fh)) { |
423 | - $line = fgetcsv($fh,9999,',','"'); |
|
423 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
424 | 424 | $values = array(); |
425 | 425 | //print_r($line); |
426 | 426 | if ($country == 'F') { |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | $values['base'] = $line[4]; |
429 | 429 | $values['owner'] = $line[5]; |
430 | 430 | if ($line[6] == '') $values['date_first_reg'] = null; |
431 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
431 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
432 | 432 | $values['cancel'] = $line[7]; |
433 | 433 | } elseif ($country == 'EI') { |
434 | 434 | // TODO : add modeS & reg to aircraft_modes |
@@ -436,7 +436,7 @@ discard block |
||
436 | 436 | $values['base'] = $line[3]; |
437 | 437 | $values['owner'] = $line[2]; |
438 | 438 | if ($line[1] == '') $values['date_first_reg'] = null; |
439 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
439 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
440 | 440 | $values['cancel'] = ''; |
441 | 441 | $values['modes'] = $line[7]; |
442 | 442 | $values['icao'] = $line[8]; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | $values['base'] = null; |
457 | 457 | $values['owner'] = $line[5]; |
458 | 458 | if ($line[18] == '') $values['date_first_reg'] = null; |
459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
459 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
460 | 460 | $values['cancel'] = ''; |
461 | 461 | } elseif ($country == 'VH') { |
462 | 462 | // TODO : add modeS & reg to aircraft_modes |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | $values['base'] = null; |
465 | 465 | $values['owner'] = $line[12]; |
466 | 466 | if ($line[28] == '') $values['date_first_reg'] = null; |
467 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
467 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
468 | 468 | |
469 | 469 | $values['cancel'] = $line[39]; |
470 | 470 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -484,28 +484,28 @@ discard block |
||
484 | 484 | $values['base'] = null; |
485 | 485 | $values['owner'] = $line[8]; |
486 | 486 | if ($line[7] == '') $values['date_first_reg'] = null; |
487 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
487 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
488 | 488 | $values['cancel'] = ''; |
489 | 489 | } elseif ($country == 'PP') { |
490 | 490 | $values['registration'] = $line[0]; |
491 | 491 | $values['base'] = null; |
492 | 492 | $values['owner'] = $line[4]; |
493 | 493 | if ($line[6] == '') $values['date_first_reg'] = null; |
494 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
494 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
495 | 495 | $values['cancel'] = $line[7]; |
496 | 496 | } elseif ($country == 'E7') { |
497 | 497 | $values['registration'] = $line[0]; |
498 | 498 | $values['base'] = null; |
499 | 499 | $values['owner'] = $line[4]; |
500 | 500 | if ($line[5] == '') $values['date_first_reg'] = null; |
501 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
501 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
502 | 502 | $values['cancel'] = ''; |
503 | 503 | } elseif ($country == '8Q') { |
504 | 504 | $values['registration'] = $line[0]; |
505 | 505 | $values['base'] = null; |
506 | 506 | $values['owner'] = $line[3]; |
507 | 507 | if ($line[7] == '') $values['date_first_reg'] = null; |
508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
508 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
509 | 509 | $values['cancel'] = ''; |
510 | 510 | } elseif ($country == 'ZK') { |
511 | 511 | $values['registration'] = $line[0]; |
@@ -519,18 +519,18 @@ discard block |
||
519 | 519 | $values['registration'] = $line[0]; |
520 | 520 | $values['base'] = null; |
521 | 521 | $values['owner'] = $line[6]; |
522 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
523 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
522 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
523 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
524 | 524 | $values['modes'] = $line[4]; |
525 | 525 | $values['icao'] = $line[10]; |
526 | 526 | } elseif ($country == 'OY') { |
527 | 527 | $values['registration'] = $line[0]; |
528 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
528 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
529 | 529 | $values['modes'] = $line[5]; |
530 | 530 | $values['icao'] = $line[6]; |
531 | 531 | } elseif ($country == 'PH') { |
532 | 532 | $values['registration'] = $line[0]; |
533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
534 | 534 | $values['modes'] = $line[4]; |
535 | 535 | $values['icao'] = $line[5]; |
536 | 536 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -541,17 +541,17 @@ discard block |
||
541 | 541 | $values['cancel'] = ''; |
542 | 542 | } |
543 | 543 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
544 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
544 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
545 | 545 | $sth_dest->execute($query_dest_values); |
546 | 546 | } |
547 | 547 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
548 | 548 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
549 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
549 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
550 | 550 | $sth_modes->execute($query_modes_values); |
551 | 551 | } |
552 | 552 | } |
553 | 553 | if ($globalTransaction) $Connection->db->commit(); |
554 | - } catch(PDOException $e) { |
|
554 | + } catch (PDOException $e) { |
|
555 | 555 | return "error : ".$e->getMessage(); |
556 | 556 | } |
557 | 557 | } |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | $Connection = new Connection(); |
667 | 667 | $sth = $Connection->db->prepare($query); |
668 | 668 | $sth->execute(); |
669 | - } catch(PDOException $e) { |
|
669 | + } catch (PDOException $e) { |
|
670 | 670 | return "error : ".$e->getMessage(); |
671 | 671 | } |
672 | 672 | |
@@ -676,7 +676,7 @@ discard block |
||
676 | 676 | $Connection = new Connection(); |
677 | 677 | $sth = $Connection->db->prepare($query); |
678 | 678 | $sth->execute(); |
679 | - } catch(PDOException $e) { |
|
679 | + } catch (PDOException $e) { |
|
680 | 680 | return "error : ".$e->getMessage(); |
681 | 681 | } |
682 | 682 | |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | if ($globalTransaction) $Connection->db->beginTransaction(); |
688 | 688 | |
689 | 689 | $i = 0; |
690 | - while($row = sparql_fetch_array($result)) |
|
690 | + while ($row = sparql_fetch_array($result)) |
|
691 | 691 | { |
692 | 692 | if ($i >= 1) { |
693 | 693 | //print_r($row); |
@@ -707,31 +707,31 @@ discard block |
||
707 | 707 | $row['image'] = ''; |
708 | 708 | $row['image_thumb'] = ''; |
709 | 709 | } else { |
710 | - $image = str_replace(' ','_',$row['image']); |
|
710 | + $image = str_replace(' ', '_', $row['image']); |
|
711 | 711 | $digest = md5($image); |
712 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
713 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
714 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
715 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
712 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
713 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
714 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
715 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
716 | 716 | } |
717 | 717 | |
718 | - $country = explode('-',$row['country']); |
|
718 | + $country = explode('-', $row['country']); |
|
719 | 719 | $row['country'] = $country[0]; |
720 | 720 | |
721 | 721 | $row['type'] = trim($row['type']); |
722 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
722 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
723 | 723 | $row['type'] = 'Military'; |
724 | 724 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
725 | 725 | $row['type'] = 'small_airport'; |
726 | 726 | } |
727 | 727 | |
728 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
729 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
728 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
729 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
730 | 730 | //print_r($query_dest_values); |
731 | 731 | |
732 | 732 | try { |
733 | 733 | $sth_dest->execute($query_dest_values); |
734 | - } catch(PDOException $e) { |
|
734 | + } catch (PDOException $e) { |
|
735 | 735 | return "error : ".$e->getMessage(); |
736 | 736 | } |
737 | 737 | } |
@@ -745,7 +745,7 @@ discard block |
||
745 | 745 | $Connection = new Connection(); |
746 | 746 | $sth = $Connection->db->prepare($query); |
747 | 747 | $sth->execute(); |
748 | - } catch(PDOException $e) { |
|
748 | + } catch (PDOException $e) { |
|
749 | 749 | return "error : ".$e->getMessage(); |
750 | 750 | } |
751 | 751 | |
@@ -753,12 +753,12 @@ discard block |
||
753 | 753 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
754 | 754 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
755 | 755 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
756 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
756 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
757 | 757 | try { |
758 | 758 | $Connection = new Connection(); |
759 | 759 | $sth = $Connection->db->prepare($query); |
760 | 760 | $sth->execute($query_values); |
761 | - } catch(PDOException $e) { |
|
761 | + } catch (PDOException $e) { |
|
762 | 762 | return "error : ".$e->getMessage(); |
763 | 763 | } |
764 | 764 | $i++; |
@@ -776,7 +776,7 @@ discard block |
||
776 | 776 | echo "Download data from ourairports.com...\n"; |
777 | 777 | $delimiter = ','; |
778 | 778 | $out_file = $tmp_dir.'airports.csv'; |
779 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
779 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
780 | 780 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
781 | 781 | echo "Add data from ourairports.com...\n"; |
782 | 782 | |
@@ -787,32 +787,32 @@ discard block |
||
787 | 787 | //$Connection->db->beginTransaction(); |
788 | 788 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
789 | 789 | { |
790 | - if(!$header) $header = $row; |
|
790 | + if (!$header) $header = $row; |
|
791 | 791 | else { |
792 | 792 | $data = array(); |
793 | 793 | $data = array_combine($header, $row); |
794 | 794 | try { |
795 | 795 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
796 | 796 | $sth->execute(array(':icao' => $data['gps_code'])); |
797 | - } catch(PDOException $e) { |
|
797 | + } catch (PDOException $e) { |
|
798 | 798 | return "error : ".$e->getMessage(); |
799 | 799 | } |
800 | 800 | if ($sth->fetchColumn() > 0) { |
801 | 801 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
802 | 802 | try { |
803 | 803 | $sth = $Connection->db->prepare($query); |
804 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
805 | - } catch(PDOException $e) { |
|
804 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
805 | + } catch (PDOException $e) { |
|
806 | 806 | return "error : ".$e->getMessage(); |
807 | 807 | } |
808 | 808 | } else { |
809 | 809 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
810 | 810 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
811 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
811 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
812 | 812 | try { |
813 | 813 | $sth = $Connection->db->prepare($query); |
814 | 814 | $sth->execute($query_values); |
815 | - } catch(PDOException $e) { |
|
815 | + } catch (PDOException $e) { |
|
816 | 816 | return "error : ".$e->getMessage(); |
817 | 817 | } |
818 | 818 | $i++; |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | |
826 | 826 | echo "Download data from another free database...\n"; |
827 | 827 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
828 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
828 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
829 | 829 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
830 | 830 | update_db::unzip($out_file); |
831 | 831 | $header = NULL; |
@@ -837,15 +837,15 @@ discard block |
||
837 | 837 | //$Connection->db->beginTransaction(); |
838 | 838 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
839 | 839 | { |
840 | - if(!$header) $header = $row; |
|
840 | + if (!$header) $header = $row; |
|
841 | 841 | else { |
842 | 842 | $data = $row; |
843 | 843 | |
844 | 844 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
845 | 845 | try { |
846 | 846 | $sth = $Connection->db->prepare($query); |
847 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
848 | - } catch(PDOException $e) { |
|
847 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
848 | + } catch (PDOException $e) { |
|
849 | 849 | return "error : ".$e->getMessage(); |
850 | 850 | } |
851 | 851 | } |
@@ -859,15 +859,15 @@ discard block |
||
859 | 859 | try { |
860 | 860 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
861 | 861 | $sth->execute(); |
862 | - } catch(PDOException $e) { |
|
862 | + } catch (PDOException $e) { |
|
863 | 863 | return "error : ".$e->getMessage(); |
864 | 864 | } |
865 | 865 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
866 | 866 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
867 | 867 | try { |
868 | 868 | $sth2 = $Connection->db->prepare($query2); |
869 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
870 | - } catch(PDOException $e) { |
|
869 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
870 | + } catch (PDOException $e) { |
|
871 | 871 | return "error : ".$e->getMessage(); |
872 | 872 | } |
873 | 873 | } |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $Connection = new Connection(); |
892 | 892 | $sth = $Connection->db->prepare($query); |
893 | 893 | $sth->execute(array(':source' => 'translation.csv')); |
894 | - } catch(PDOException $e) { |
|
894 | + } catch (PDOException $e) { |
|
895 | 895 | return "error : ".$e->getMessage(); |
896 | 896 | } |
897 | 897 | |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
909 | 909 | { |
910 | 910 | $i++; |
911 | - if($i > 12) { |
|
911 | + if ($i > 12) { |
|
912 | 912 | $data = $row; |
913 | 913 | $operator = $data[2]; |
914 | 914 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | //echo substr($operator, 0, 2)."\n";; |
917 | 917 | if (count($airline_array) > 0) { |
918 | 918 | //print_r($airline_array); |
919 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
919 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
920 | 920 | } |
921 | 921 | } |
922 | 922 | |
@@ -924,14 +924,14 @@ discard block |
||
924 | 924 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
925 | 925 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
926 | 926 | if (count($airline_array) > 0) { |
927 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
927 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
928 | 928 | } |
929 | 929 | } |
930 | 930 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
931 | 931 | try { |
932 | 932 | $sth = $Connection->db->prepare($query); |
933 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | - } catch(PDOException $e) { |
|
933 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error : ".$e->getMessage(); |
936 | 936 | } |
937 | 937 | } |
@@ -951,7 +951,7 @@ discard block |
||
951 | 951 | $Connection = new Connection(); |
952 | 952 | $sth = $Connection->db->prepare($query); |
953 | 953 | $sth->execute(array(':source' => 'website_fam')); |
954 | - } catch(PDOException $e) { |
|
954 | + } catch (PDOException $e) { |
|
955 | 955 | return "error : ".$e->getMessage(); |
956 | 956 | } |
957 | 957 | |
@@ -971,8 +971,8 @@ discard block |
||
971 | 971 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
972 | 972 | try { |
973 | 973 | $sth = $Connection->db->prepare($query); |
974 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | - } catch(PDOException $e) { |
|
974 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
975 | + } catch (PDOException $e) { |
|
976 | 976 | return "error : ".$e->getMessage(); |
977 | 977 | } |
978 | 978 | } |
@@ -995,7 +995,7 @@ discard block |
||
995 | 995 | $Connection = new Connection(); |
996 | 996 | $sth = $Connection->db->prepare($query); |
997 | 997 | $sth->execute(array(':source' => 'website_faa')); |
998 | - } catch(PDOException $e) { |
|
998 | + } catch (PDOException $e) { |
|
999 | 999 | return "error : ".$e->getMessage(); |
1000 | 1000 | } |
1001 | 1001 | |
@@ -1004,7 +1004,7 @@ discard block |
||
1004 | 1004 | $Connection = new Connection(); |
1005 | 1005 | $sth = $Connection->db->prepare($query); |
1006 | 1006 | $sth->execute(array(':source' => 'website_faa')); |
1007 | - } catch(PDOException $e) { |
|
1007 | + } catch (PDOException $e) { |
|
1008 | 1008 | return "error : ".$e->getMessage(); |
1009 | 1009 | } |
1010 | 1010 | |
@@ -1021,8 +1021,8 @@ discard block |
||
1021 | 1021 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
1022 | 1022 | try { |
1023 | 1023 | $sths = $Connection->db->prepare($query_search); |
1024 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
1025 | - } catch(PDOException $e) { |
|
1024 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
1025 | + } catch (PDOException $e) { |
|
1026 | 1026 | return "error s : ".$e->getMessage(); |
1027 | 1027 | } |
1028 | 1028 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1035,8 +1035,8 @@ discard block |
||
1035 | 1035 | //} |
1036 | 1036 | try { |
1037 | 1037 | $sthi = $Connection->db->prepare($queryi); |
1038 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | - } catch(PDOException $e) { |
|
1038 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
1039 | + } catch (PDOException $e) { |
|
1040 | 1040 | return "error u : ".$e->getMessage(); |
1041 | 1041 | } |
1042 | 1042 | } else { |
@@ -1044,7 +1044,7 @@ discard block |
||
1044 | 1044 | try { |
1045 | 1045 | $sthsm = $Connection->db->prepare($query_search_mfr); |
1046 | 1046 | $sthsm->execute(array(':mfr' => $data[2])); |
1047 | - } catch(PDOException $e) { |
|
1047 | + } catch (PDOException $e) { |
|
1048 | 1048 | return "error mfr : ".$e->getMessage(); |
1049 | 1049 | } |
1050 | 1050 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1054,8 +1054,8 @@ discard block |
||
1054 | 1054 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
1055 | 1055 | try { |
1056 | 1056 | $sthf = $Connection->db->prepare($queryf); |
1057 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
1058 | - } catch(PDOException $e) { |
|
1057 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
1058 | + } catch (PDOException $e) { |
|
1059 | 1059 | return "error f : ".$e->getMessage(); |
1060 | 1060 | } |
1061 | 1061 | } |
@@ -1065,13 +1065,13 @@ discard block |
||
1065 | 1065 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
1066 | 1066 | try { |
1067 | 1067 | $sth = $Connection->db->prepare($query); |
1068 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
1069 | - } catch(PDOException $e) { |
|
1068 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
1069 | + } catch (PDOException $e) { |
|
1070 | 1070 | return "error i : ".$e->getMessage(); |
1071 | 1071 | } |
1072 | 1072 | } |
1073 | 1073 | } |
1074 | - if ($i % 90 == 0) { |
|
1074 | + if ($i%90 == 0) { |
|
1075 | 1075 | if ($globalTransaction) $Connection->db->commit(); |
1076 | 1076 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1077 | 1077 | } |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | $Connection = new Connection(); |
1091 | 1091 | $sth = $Connection->db->prepare($query); |
1092 | 1092 | $sth->execute(array(':source' => 'website_fam')); |
1093 | - } catch(PDOException $e) { |
|
1093 | + } catch (PDOException $e) { |
|
1094 | 1094 | return "error : ".$e->getMessage(); |
1095 | 1095 | } |
1096 | 1096 | |
@@ -1111,8 +1111,8 @@ discard block |
||
1111 | 1111 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
1112 | 1112 | try { |
1113 | 1113 | $sth = $Connection->db->prepare($query); |
1114 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
1115 | - } catch(PDOException $e) { |
|
1114 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
1115 | + } catch (PDOException $e) { |
|
1116 | 1116 | return "error : ".$e->getMessage(); |
1117 | 1117 | } |
1118 | 1118 | } |
@@ -1131,7 +1131,7 @@ discard block |
||
1131 | 1131 | $Connection = new Connection(); |
1132 | 1132 | $sth = $Connection->db->prepare($query); |
1133 | 1133 | $sth->execute(array(':source' => 'website_fam')); |
1134 | - } catch(PDOException $e) { |
|
1134 | + } catch (PDOException $e) { |
|
1135 | 1135 | return "error : ".$e->getMessage(); |
1136 | 1136 | } |
1137 | 1137 | |
@@ -1147,8 +1147,8 @@ discard block |
||
1147 | 1147 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
1148 | 1148 | try { |
1149 | 1149 | $sth = $Connection->db->prepare($query); |
1150 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | - } catch(PDOException $e) { |
|
1150 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
1151 | + } catch (PDOException $e) { |
|
1152 | 1152 | print_r($data); |
1153 | 1153 | return "error : ".$e->getMessage(); |
1154 | 1154 | } |
@@ -1168,7 +1168,7 @@ discard block |
||
1168 | 1168 | $Connection = new Connection(); |
1169 | 1169 | $sth = $Connection->db->prepare($query); |
1170 | 1170 | $sth->execute(array(':source' => 'website_fam')); |
1171 | - } catch(PDOException $e) { |
|
1171 | + } catch (PDOException $e) { |
|
1172 | 1172 | return "error : ".$e->getMessage(); |
1173 | 1173 | } |
1174 | 1174 | |
@@ -1188,8 +1188,8 @@ discard block |
||
1188 | 1188 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
1189 | 1189 | try { |
1190 | 1190 | $sth = $Connection->db->prepare($query); |
1191 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
1192 | - } catch(PDOException $e) { |
|
1191 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
1192 | + } catch (PDOException $e) { |
|
1193 | 1193 | return "error : ".$e->getMessage(); |
1194 | 1194 | } |
1195 | 1195 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | $Connection = new Connection(); |
1209 | 1209 | $sth = $Connection->db->prepare($query); |
1210 | 1210 | $sth->execute(); |
1211 | - } catch(PDOException $e) { |
|
1211 | + } catch (PDOException $e) { |
|
1212 | 1212 | return "error : ".$e->getMessage(); |
1213 | 1213 | } |
1214 | 1214 | |
@@ -1228,8 +1228,8 @@ discard block |
||
1228 | 1228 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
1229 | 1229 | try { |
1230 | 1230 | $sth = $Connection->db->prepare($query); |
1231 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
1232 | - } catch(PDOException $e) { |
|
1231 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
1232 | + } catch (PDOException $e) { |
|
1233 | 1233 | return "error : ".$e->getMessage(); |
1234 | 1234 | } |
1235 | 1235 | } |
@@ -1248,7 +1248,7 @@ discard block |
||
1248 | 1248 | $Connection = new Connection(); |
1249 | 1249 | $sth = $Connection->db->prepare($query); |
1250 | 1250 | $sth->execute(); |
1251 | - } catch(PDOException $e) { |
|
1251 | + } catch (PDOException $e) { |
|
1252 | 1252 | return "error : ".$e->getMessage(); |
1253 | 1253 | } |
1254 | 1254 | |
@@ -1264,7 +1264,7 @@ discard block |
||
1264 | 1264 | try { |
1265 | 1265 | $sth = $Connection->db->prepare($query); |
1266 | 1266 | $sth->execute(array(':icao' => $icao)); |
1267 | - } catch(PDOException $e) { |
|
1267 | + } catch (PDOException $e) { |
|
1268 | 1268 | return "error : ".$e->getMessage(); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1275,7 +1275,7 @@ discard block |
||
1275 | 1275 | return ''; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - public static function tle($filename,$tletype) { |
|
1278 | + public static function tle($filename, $tletype) { |
|
1279 | 1279 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
1280 | 1280 | global $tmp_dir, $globalTransaction; |
1281 | 1281 | //$Spotter = new Spotter(); |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | $Connection = new Connection(); |
1286 | 1286 | $sth = $Connection->db->prepare($query); |
1287 | 1287 | $sth->execute(array(':source' => $filename)); |
1288 | - } catch(PDOException $e) { |
|
1288 | + } catch (PDOException $e) { |
|
1289 | 1289 | return "error : ".$e->getMessage(); |
1290 | 1290 | } |
1291 | 1291 | |
@@ -1310,8 +1310,8 @@ discard block |
||
1310 | 1310 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
1311 | 1311 | try { |
1312 | 1312 | $sth = $Connection->db->prepare($query); |
1313 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
1314 | - } catch(PDOException $e) { |
|
1313 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
1314 | + } catch (PDOException $e) { |
|
1315 | 1315 | return "error : ".$e->getMessage(); |
1316 | 1316 | } |
1317 | 1317 | |
@@ -1331,28 +1331,28 @@ discard block |
||
1331 | 1331 | */ |
1332 | 1332 | private static function table2array($data) { |
1333 | 1333 | $html = str_get_html($data); |
1334 | - $tabledata=array(); |
|
1335 | - foreach($html->find('tr') as $element) |
|
1334 | + $tabledata = array(); |
|
1335 | + foreach ($html->find('tr') as $element) |
|
1336 | 1336 | { |
1337 | 1337 | $td = array(); |
1338 | - foreach( $element->find('th') as $row) |
|
1338 | + foreach ($element->find('th') as $row) |
|
1339 | 1339 | { |
1340 | 1340 | $td [] = trim($row->plaintext); |
1341 | 1341 | } |
1342 | - $td=array_filter($td); |
|
1342 | + $td = array_filter($td); |
|
1343 | 1343 | $tabledata[] = $td; |
1344 | 1344 | |
1345 | 1345 | $td = array(); |
1346 | 1346 | $tdi = array(); |
1347 | - foreach( $element->find('td') as $row) |
|
1347 | + foreach ($element->find('td') as $row) |
|
1348 | 1348 | { |
1349 | 1349 | $td [] = trim($row->plaintext); |
1350 | 1350 | $tdi [] = trim($row->innertext); |
1351 | 1351 | } |
1352 | - $td=array_filter($td); |
|
1353 | - $tdi=array_filter($tdi); |
|
1352 | + $td = array_filter($td); |
|
1353 | + $tdi = array_filter($tdi); |
|
1354 | 1354 | // $tabledata[]=array_merge($td,$tdi); |
1355 | - $tabledata[]=$td; |
|
1355 | + $tabledata[] = $td; |
|
1356 | 1356 | } |
1357 | 1357 | return(array_filter($tabledata)); |
1358 | 1358 | } |
@@ -1425,13 +1425,13 @@ discard block |
||
1425 | 1425 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1426 | 1426 | { |
1427 | 1427 | $i++; |
1428 | - if($i > 3 && count($row) > 2) { |
|
1428 | + if ($i > 3 && count($row) > 2) { |
|
1429 | 1429 | $data = array_values(array_filter($row)); |
1430 | 1430 | $cntdata = count($data); |
1431 | 1431 | if ($cntdata > 10) { |
1432 | 1432 | $value = $data[9]; |
1433 | 1433 | |
1434 | - for ($i =10;$i < $cntdata;$i++) { |
|
1434 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1435 | 1435 | $value .= ' '.$data[$i]; |
1436 | 1436 | } |
1437 | 1437 | $data[9] = $value; |
@@ -1441,8 +1441,8 @@ discard block |
||
1441 | 1441 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
1442 | 1442 | try { |
1443 | 1443 | $sth = $Connection->db->prepare($query); |
1444 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1445 | - } catch(PDOException $e) { |
|
1444 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
1445 | + } catch (PDOException $e) { |
|
1446 | 1446 | return "error : ".$e->getMessage(); |
1447 | 1447 | } |
1448 | 1448 | } |
@@ -1463,7 +1463,7 @@ discard block |
||
1463 | 1463 | $Connection = new Connection(); |
1464 | 1464 | $sth = $Connection->db->prepare($query); |
1465 | 1465 | $sth->execute(); |
1466 | - } catch(PDOException $e) { |
|
1466 | + } catch (PDOException $e) { |
|
1467 | 1467 | return "error : ".$e->getMessage(); |
1468 | 1468 | } |
1469 | 1469 | |
@@ -1475,12 +1475,12 @@ discard block |
||
1475 | 1475 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1476 | 1476 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1477 | 1477 | { |
1478 | - if(count($row) > 1) { |
|
1478 | + if (count($row) > 1) { |
|
1479 | 1479 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1480 | 1480 | try { |
1481 | 1481 | $sth = $Connection->db->prepare($query); |
1482 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1483 | - } catch(PDOException $e) { |
|
1482 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1483 | + } catch (PDOException $e) { |
|
1484 | 1484 | return "error : ".$e->getMessage(); |
1485 | 1485 | } |
1486 | 1486 | } |
@@ -1500,21 +1500,21 @@ discard block |
||
1500 | 1500 | try { |
1501 | 1501 | $sth = $Connection->db->prepare($query); |
1502 | 1502 | $sth->execute(); |
1503 | - } catch(PDOException $e) { |
|
1503 | + } catch (PDOException $e) { |
|
1504 | 1504 | return "error : ".$e->getMessage(); |
1505 | 1505 | } |
1506 | 1506 | } |
1507 | 1507 | |
1508 | 1508 | |
1509 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1509 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1510 | 1510 | else { |
1511 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1511 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1512 | 1512 | $query = "CREATE EXTENSION postgis"; |
1513 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1513 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1514 | 1514 | try { |
1515 | 1515 | $sth = $Connection->db->prepare($query); |
1516 | 1516 | $sth->execute(); |
1517 | - } catch(PDOException $e) { |
|
1517 | + } catch (PDOException $e) { |
|
1518 | 1518 | return "error : ".$e->getMessage(); |
1519 | 1519 | } |
1520 | 1520 | } |
@@ -1527,7 +1527,7 @@ discard block |
||
1527 | 1527 | include_once('class.create_db.php'); |
1528 | 1528 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
1529 | 1529 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
1530 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
1530 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
1531 | 1531 | $error = ''; |
1532 | 1532 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
1533 | 1533 | if ($globalDebug) echo "Gunzip..."; |
@@ -1559,14 +1559,14 @@ discard block |
||
1559 | 1559 | try { |
1560 | 1560 | $sth = $Connection->db->prepare($query); |
1561 | 1561 | $sth->execute(); |
1562 | - } catch(PDOException $e) { |
|
1562 | + } catch (PDOException $e) { |
|
1563 | 1563 | echo "error : ".$e->getMessage(); |
1564 | 1564 | } |
1565 | 1565 | } |
1566 | 1566 | if ($globalDBdriver == 'mysql') { |
1567 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1567 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1568 | 1568 | } else { |
1569 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
1569 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
1570 | 1570 | } |
1571 | 1571 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
1572 | 1572 | return $error; |
@@ -1579,7 +1579,7 @@ discard block |
||
1579 | 1579 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
1580 | 1580 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
1581 | 1581 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
1582 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
1582 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
1583 | 1583 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
1584 | 1584 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
1585 | 1585 | return $error; |
@@ -1599,7 +1599,7 @@ discard block |
||
1599 | 1599 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
1600 | 1600 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
1601 | 1601 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
1602 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1602 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
1603 | 1603 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
1604 | 1604 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
1605 | 1605 | if ($error != '') { |
@@ -1612,7 +1612,7 @@ discard block |
||
1612 | 1612 | global $tmp_dir, $globalDebug; |
1613 | 1613 | $error = ''; |
1614 | 1614 | if ($globalDebug) echo "Routes : Download..."; |
1615 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
1615 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
1616 | 1616 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
1617 | 1617 | if ($globalDebug) echo "Gunzip..."; |
1618 | 1618 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1628,7 +1628,7 @@ discard block |
||
1628 | 1628 | global $tmp_dir, $globalDebug; |
1629 | 1629 | $error = ''; |
1630 | 1630 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
1631 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
1631 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
1632 | 1632 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
1633 | 1633 | if ($globalDebug) echo "Gunzip..."; |
1634 | 1634 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1644,7 +1644,7 @@ discard block |
||
1644 | 1644 | global $tmp_dir, $globalDebug; |
1645 | 1645 | $error = ''; |
1646 | 1646 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
1647 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
1647 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
1648 | 1648 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
1649 | 1649 | if ($globalDebug) echo "Gunzip..."; |
1650 | 1650 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1672,7 +1672,7 @@ discard block |
||
1672 | 1672 | */ |
1673 | 1673 | if ($globalDebug) echo "Modes : Download..."; |
1674 | 1674 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
1675 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
1675 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
1676 | 1676 | |
1677 | 1677 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
1678 | 1678 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1692,7 +1692,7 @@ discard block |
||
1692 | 1692 | public static function update_ModeS_faa() { |
1693 | 1693 | global $tmp_dir, $globalDebug; |
1694 | 1694 | if ($globalDebug) echo "Modes FAA: Download..."; |
1695 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
1695 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
1696 | 1696 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
1697 | 1697 | if ($globalDebug) echo "Unzip..."; |
1698 | 1698 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | public static function update_ModeS_flarm() { |
1709 | 1709 | global $tmp_dir, $globalDebug; |
1710 | 1710 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
1711 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
1711 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
1712 | 1712 | if (file_exists($tmp_dir.'data.fln')) { |
1713 | 1713 | if ($globalDebug) echo "Add to DB..."; |
1714 | 1714 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1722,7 +1722,7 @@ discard block |
||
1722 | 1722 | public static function update_ModeS_ogn() { |
1723 | 1723 | global $tmp_dir, $globalDebug; |
1724 | 1724 | if ($globalDebug) echo "Modes OGN: Download..."; |
1725 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
1725 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
1726 | 1726 | if (file_exists($tmp_dir.'ogn.csv')) { |
1727 | 1727 | if ($globalDebug) echo "Add to DB..."; |
1728 | 1728 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1737,201 +1737,201 @@ discard block |
||
1737 | 1737 | global $tmp_dir, $globalDebug, $globalMasterSource; |
1738 | 1738 | |
1739 | 1739 | if ($globalDebug) echo "Owner France: Download..."; |
1740 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
1740 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
1741 | 1741 | if (file_exists($tmp_dir.'owner_f.csv')) { |
1742 | 1742 | if ($globalDebug) echo "Add to DB..."; |
1743 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
1743 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
1744 | 1744 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
1745 | 1745 | if ($error != '') { |
1746 | 1746 | return $error; |
1747 | 1747 | } elseif ($globalDebug) echo "Done\n"; |
1748 | 1748 | |
1749 | 1749 | if ($globalDebug) echo "Owner Ireland: Download..."; |
1750 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
1750 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
1751 | 1751 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
1752 | 1752 | if ($globalDebug) echo "Add to DB..."; |
1753 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
1753 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
1754 | 1754 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
1755 | 1755 | if ($error != '') { |
1756 | 1756 | return $error; |
1757 | 1757 | } elseif ($globalDebug) echo "Done\n"; |
1758 | 1758 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
1759 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
1759 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
1760 | 1760 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
1761 | 1761 | if ($globalDebug) echo "Add to DB..."; |
1762 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
1762 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
1763 | 1763 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
1764 | 1764 | if ($error != '') { |
1765 | 1765 | return $error; |
1766 | 1766 | } elseif ($globalDebug) echo "Done\n"; |
1767 | 1767 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
1768 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
1768 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
1769 | 1769 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
1770 | 1770 | if ($globalDebug) echo "Add to DB..."; |
1771 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
1771 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
1772 | 1772 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
1773 | 1773 | if ($error != '') { |
1774 | 1774 | return $error; |
1775 | 1775 | } elseif ($globalDebug) echo "Done\n"; |
1776 | 1776 | if ($globalDebug) echo "Owner Australia: Download..."; |
1777 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
1777 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
1778 | 1778 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
1779 | 1779 | if ($globalDebug) echo "Add to DB..."; |
1780 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
1780 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
1781 | 1781 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
1782 | 1782 | if ($error != '') { |
1783 | 1783 | return $error; |
1784 | 1784 | } elseif ($globalDebug) echo "Done\n"; |
1785 | 1785 | if ($globalDebug) echo "Owner Austria: Download..."; |
1786 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
1786 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
1787 | 1787 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
1788 | 1788 | if ($globalDebug) echo "Add to DB..."; |
1789 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
1789 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
1790 | 1790 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
1791 | 1791 | if ($error != '') { |
1792 | 1792 | return $error; |
1793 | 1793 | } elseif ($globalDebug) echo "Done\n"; |
1794 | 1794 | if ($globalDebug) echo "Owner Chile: Download..."; |
1795 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
1795 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
1796 | 1796 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
1797 | 1797 | if ($globalDebug) echo "Add to DB..."; |
1798 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
1798 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
1799 | 1799 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
1800 | 1800 | if ($error != '') { |
1801 | 1801 | return $error; |
1802 | 1802 | } elseif ($globalDebug) echo "Done\n"; |
1803 | 1803 | if ($globalDebug) echo "Owner Colombia: Download..."; |
1804 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
1804 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
1805 | 1805 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
1806 | 1806 | if ($globalDebug) echo "Add to DB..."; |
1807 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
1807 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
1808 | 1808 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
1809 | 1809 | if ($error != '') { |
1810 | 1810 | return $error; |
1811 | 1811 | } elseif ($globalDebug) echo "Done\n"; |
1812 | 1812 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
1813 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
1813 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
1814 | 1814 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
1815 | 1815 | if ($globalDebug) echo "Add to DB..."; |
1816 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
1816 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
1817 | 1817 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
1818 | 1818 | if ($error != '') { |
1819 | 1819 | return $error; |
1820 | 1820 | } elseif ($globalDebug) echo "Done\n"; |
1821 | 1821 | if ($globalDebug) echo "Owner Brazil: Download..."; |
1822 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
1822 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
1823 | 1823 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
1824 | 1824 | if ($globalDebug) echo "Add to DB..."; |
1825 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
1825 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
1826 | 1826 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
1827 | 1827 | if ($error != '') { |
1828 | 1828 | return $error; |
1829 | 1829 | } elseif ($globalDebug) echo "Done\n"; |
1830 | 1830 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
1831 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
1831 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
1832 | 1832 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
1833 | 1833 | if ($globalDebug) echo "Add to DB..."; |
1834 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
1834 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
1835 | 1835 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
1836 | 1836 | if ($error != '') { |
1837 | 1837 | return $error; |
1838 | 1838 | } elseif ($globalDebug) echo "Done\n"; |
1839 | 1839 | if ($globalDebug) echo "Owner Croatia: Download..."; |
1840 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
1840 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
1841 | 1841 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
1842 | 1842 | if ($globalDebug) echo "Add to DB..."; |
1843 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
1843 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
1844 | 1844 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
1845 | 1845 | if ($error != '') { |
1846 | 1846 | return $error; |
1847 | 1847 | } elseif ($globalDebug) echo "Done\n"; |
1848 | 1848 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
1849 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
1849 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
1850 | 1850 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
1851 | 1851 | if ($globalDebug) echo "Add to DB..."; |
1852 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
1852 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
1853 | 1853 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
1854 | 1854 | if ($error != '') { |
1855 | 1855 | return $error; |
1856 | 1856 | } elseif ($globalDebug) echo "Done\n"; |
1857 | 1857 | if ($globalDebug) echo "Owner Maldives: Download..."; |
1858 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
1858 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
1859 | 1859 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
1860 | 1860 | if ($globalDebug) echo "Add to DB..."; |
1861 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
1861 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
1862 | 1862 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
1863 | 1863 | if ($error != '') { |
1864 | 1864 | return $error; |
1865 | 1865 | } elseif ($globalDebug) echo "Done\n"; |
1866 | 1866 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
1867 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
1867 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
1868 | 1868 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
1869 | 1869 | if ($globalDebug) echo "Add to DB..."; |
1870 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
1870 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
1871 | 1871 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
1872 | 1872 | if ($error != '') { |
1873 | 1873 | return $error; |
1874 | 1874 | } elseif ($globalDebug) echo "Done\n"; |
1875 | 1875 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
1876 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
1876 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
1877 | 1877 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
1878 | 1878 | if ($globalDebug) echo "Add to DB..."; |
1879 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
1879 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
1880 | 1880 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
1881 | 1881 | if ($error != '') { |
1882 | 1882 | return $error; |
1883 | 1883 | } elseif ($globalDebug) echo "Done\n"; |
1884 | 1884 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
1885 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
1885 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
1886 | 1886 | if (file_exists($tmp_dir.'owner_om.csv')) { |
1887 | 1887 | if ($globalDebug) echo "Add to DB..."; |
1888 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
1888 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
1889 | 1889 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
1890 | 1890 | if ($error != '') { |
1891 | 1891 | return $error; |
1892 | 1892 | } elseif ($globalDebug) echo "Done\n"; |
1893 | 1893 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
1894 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
1894 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
1895 | 1895 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
1896 | 1896 | if ($globalDebug) echo "Add to DB..."; |
1897 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
1897 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
1898 | 1898 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
1899 | 1899 | if ($error != '') { |
1900 | 1900 | return $error; |
1901 | 1901 | } elseif ($globalDebug) echo "Done\n"; |
1902 | 1902 | if ($globalDebug) echo "Owner Iceland: Download..."; |
1903 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
1903 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
1904 | 1904 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
1905 | 1905 | if ($globalDebug) echo "Add to DB..."; |
1906 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
1906 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
1907 | 1907 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
1908 | 1908 | if ($error != '') { |
1909 | 1909 | return $error; |
1910 | 1910 | } elseif ($globalDebug) echo "Done\n"; |
1911 | 1911 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
1912 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
1912 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
1913 | 1913 | if (file_exists($tmp_dir.'owner_m.csv')) { |
1914 | 1914 | if ($globalDebug) echo "Add to DB..."; |
1915 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
1915 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
1916 | 1916 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
1917 | 1917 | if ($error != '') { |
1918 | 1918 | return $error; |
1919 | 1919 | } elseif ($globalDebug) echo "Done\n"; |
1920 | 1920 | if ($globalMasterSource) { |
1921 | 1921 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
1922 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
1922 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
1923 | 1923 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
1924 | 1924 | if ($globalDebug) echo "Add to DB..."; |
1925 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
1925 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
1926 | 1926 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
1927 | 1927 | if ($error != '') { |
1928 | 1928 | return $error; |
1929 | 1929 | } elseif ($globalDebug) echo "Done\n"; |
1930 | 1930 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
1931 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
1931 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
1932 | 1932 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
1933 | 1933 | if ($globalDebug) echo "Add to DB..."; |
1934 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
1934 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
1935 | 1935 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
1936 | 1936 | if ($error != '') { |
1937 | 1937 | return $error; |
@@ -1944,7 +1944,7 @@ discard block |
||
1944 | 1944 | global $tmp_dir, $globalDebug; |
1945 | 1945 | $error = ''; |
1946 | 1946 | if ($globalDebug) echo "Translation : Download..."; |
1947 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
1947 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
1948 | 1948 | if (file_exists($tmp_dir.'translation.zip')) { |
1949 | 1949 | if ($globalDebug) echo "Unzip..."; |
1950 | 1950 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1960,7 +1960,7 @@ discard block |
||
1960 | 1960 | public static function update_translation_fam() { |
1961 | 1961 | global $tmp_dir, $globalDebug; |
1962 | 1962 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
1963 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
1963 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
1964 | 1964 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
1965 | 1965 | if ($globalDebug) echo "Gunzip..."; |
1966 | 1966 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1975,7 +1975,7 @@ discard block |
||
1975 | 1975 | public static function update_ModeS_fam() { |
1976 | 1976 | global $tmp_dir, $globalDebug; |
1977 | 1977 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
1978 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
1978 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
1979 | 1979 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
1980 | 1980 | if ($globalDebug) echo "Gunzip..."; |
1981 | 1981 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1991,9 +1991,9 @@ discard block |
||
1991 | 1991 | global $tmp_dir, $globalDebug, $globalOwner; |
1992 | 1992 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
1993 | 1993 | if ($globalOwner === TRUE) { |
1994 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1994 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1995 | 1995 | } else { |
1996 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
1996 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
1997 | 1997 | } |
1998 | 1998 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
1999 | 1999 | if ($globalDebug) echo "Gunzip..."; |
@@ -2009,7 +2009,7 @@ discard block |
||
2009 | 2009 | public static function update_routes_fam() { |
2010 | 2010 | global $tmp_dir, $globalDebug; |
2011 | 2011 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2012 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2012 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2013 | 2013 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
2014 | 2014 | if ($globalDebug) echo "Gunzip..."; |
2015 | 2015 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -2023,13 +2023,13 @@ discard block |
||
2023 | 2023 | } |
2024 | 2024 | public static function update_marine_identity_fam() { |
2025 | 2025 | global $tmp_dir, $globalDebug; |
2026 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2026 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2027 | 2027 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2028 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2028 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2029 | 2029 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2030 | 2030 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2031 | 2031 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2032 | - update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2032 | + update_db::download('http://data.flightairmap.fr/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2033 | 2033 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2034 | 2034 | if ($globalDebug) echo "Gunzip..."; |
2035 | 2035 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
@@ -2049,7 +2049,7 @@ discard block |
||
2049 | 2049 | public static function update_banned_fam() { |
2050 | 2050 | global $tmp_dir, $globalDebug; |
2051 | 2051 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2052 | - update_db::download('http://data.flightairmap.fr/data/ban_eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2052 | + update_db::download('http://data.flightairmap.fr/data/ban_eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2053 | 2053 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2054 | 2054 | //if ($globalDebug) echo "Gunzip..."; |
2055 | 2055 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2068,18 +2068,18 @@ discard block |
||
2068 | 2068 | $error = ''; |
2069 | 2069 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2070 | 2070 | if ($globalDBdriver == 'mysql') { |
2071 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2071 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2072 | 2072 | } else { |
2073 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2073 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2074 | 2074 | } |
2075 | 2075 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2076 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2076 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2077 | 2077 | $airspace_md5 = $airspace_md5_file[0]; |
2078 | 2078 | if (!update_db::check_airspace_version($airspace_md5)) { |
2079 | 2079 | if ($globalDBdriver == 'mysql') { |
2080 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2080 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2081 | 2081 | } else { |
2082 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2082 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2083 | 2083 | } |
2084 | 2084 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2085 | 2085 | if ($globalDebug) echo "Gunzip..."; |
@@ -2091,7 +2091,7 @@ discard block |
||
2091 | 2091 | try { |
2092 | 2092 | $sth = $Connection->db->prepare($query); |
2093 | 2093 | $sth->execute(); |
2094 | - } catch(PDOException $e) { |
|
2094 | + } catch (PDOException $e) { |
|
2095 | 2095 | return "error : ".$e->getMessage(); |
2096 | 2096 | } |
2097 | 2097 | } |
@@ -2109,15 +2109,15 @@ discard block |
||
2109 | 2109 | public static function update_tle() { |
2110 | 2110 | global $tmp_dir, $globalDebug; |
2111 | 2111 | if ($globalDebug) echo "Download TLE : Download..."; |
2112 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
2113 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
2114 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
2112 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
2113 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
2114 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
2115 | 2115 | foreach ($alltle as $filename) { |
2116 | 2116 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2117 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2117 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2118 | 2118 | if (file_exists($tmp_dir.$filename)) { |
2119 | 2119 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2120 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2120 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2121 | 2121 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2122 | 2122 | if ($error != '') { |
2123 | 2123 | echo $error."\n"; |
@@ -2130,32 +2130,32 @@ discard block |
||
2130 | 2130 | global $tmp_dir, $globalDebug; |
2131 | 2131 | $error = ''; |
2132 | 2132 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2133 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2133 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2134 | 2134 | if (file_exists($tmp_dir.'models.md5sum')) { |
2135 | 2135 | if ($globalDebug) echo "Check files...\n"; |
2136 | 2136 | $newmodelsdb = array(); |
2137 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2138 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2137 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2138 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2139 | 2139 | $model = trim($row[2]); |
2140 | 2140 | $newmodelsdb[$model] = trim($row[0]); |
2141 | 2141 | } |
2142 | 2142 | } |
2143 | 2143 | $modelsdb = array(); |
2144 | 2144 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2145 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2146 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2145 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2146 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2147 | 2147 | $model = trim($row[2]); |
2148 | 2148 | $modelsdb[$model] = trim($row[0]); |
2149 | 2149 | } |
2150 | 2150 | } |
2151 | 2151 | } |
2152 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2152 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2153 | 2153 | foreach ($diff as $key => $value) { |
2154 | 2154 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2155 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2155 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2156 | 2156 | |
2157 | 2157 | } |
2158 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2158 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2159 | 2159 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2160 | 2160 | if ($error != '') { |
2161 | 2161 | return $error; |
@@ -2167,32 +2167,32 @@ discard block |
||
2167 | 2167 | global $tmp_dir, $globalDebug; |
2168 | 2168 | $error = ''; |
2169 | 2169 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2170 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2170 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2171 | 2171 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2172 | 2172 | if ($globalDebug) echo "Check files...\n"; |
2173 | 2173 | $newmodelsdb = array(); |
2174 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2175 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2174 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2175 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2176 | 2176 | $model = trim($row[2]); |
2177 | 2177 | $newmodelsdb[$model] = trim($row[0]); |
2178 | 2178 | } |
2179 | 2179 | } |
2180 | 2180 | $modelsdb = array(); |
2181 | 2181 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2182 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2183 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2182 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2183 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2184 | 2184 | $model = trim($row[2]); |
2185 | 2185 | $modelsdb[$model] = trim($row[0]); |
2186 | 2186 | } |
2187 | 2187 | } |
2188 | 2188 | } |
2189 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2189 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2190 | 2190 | foreach ($diff as $key => $value) { |
2191 | 2191 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2192 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2192 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2193 | 2193 | |
2194 | 2194 | } |
2195 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2195 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2196 | 2196 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2197 | 2197 | if ($error != '') { |
2198 | 2198 | return $error; |
@@ -2204,32 +2204,32 @@ discard block |
||
2204 | 2204 | global $tmp_dir, $globalDebug; |
2205 | 2205 | $error = ''; |
2206 | 2206 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2207 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2207 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2208 | 2208 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2209 | 2209 | if ($globalDebug) echo "Check files...\n"; |
2210 | 2210 | $newmodelsdb = array(); |
2211 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2212 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2211 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2212 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2213 | 2213 | $model = trim($row[2]); |
2214 | 2214 | $newmodelsdb[$model] = trim($row[0]); |
2215 | 2215 | } |
2216 | 2216 | } |
2217 | 2217 | $modelsdb = array(); |
2218 | 2218 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2219 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2220 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2219 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2220 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2221 | 2221 | $model = trim($row[2]); |
2222 | 2222 | $modelsdb[$model] = trim($row[0]); |
2223 | 2223 | } |
2224 | 2224 | } |
2225 | 2225 | } |
2226 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2226 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2227 | 2227 | foreach ($diff as $key => $value) { |
2228 | 2228 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2229 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2229 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2230 | 2230 | |
2231 | 2231 | } |
2232 | - update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2232 | + update_db::download('http://data.flightairmap.fr/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2233 | 2233 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2234 | 2234 | if ($error != '') { |
2235 | 2235 | return $error; |
@@ -2252,8 +2252,8 @@ discard block |
||
2252 | 2252 | */ |
2253 | 2253 | if (file_exists($tmp_dir.'aircrafts.html')) { |
2254 | 2254 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
2255 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
2256 | - $result = fread($fh,100000000); |
|
2255 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
2256 | + $result = fread($fh, 100000000); |
|
2257 | 2257 | //echo $result; |
2258 | 2258 | //var_dump(str_get_html($result)); |
2259 | 2259 | //print_r(self::table2array($result)); |
@@ -2271,23 +2271,23 @@ discard block |
||
2271 | 2271 | $Connection = new Connection(); |
2272 | 2272 | $sth = $Connection->db->prepare($query); |
2273 | 2273 | $sth->execute(); |
2274 | - } catch(PDOException $e) { |
|
2274 | + } catch (PDOException $e) { |
|
2275 | 2275 | return "error : ".$e->getMessage(); |
2276 | 2276 | } |
2277 | 2277 | |
2278 | 2278 | $error = ''; |
2279 | 2279 | if ($globalDebug) echo "Notam : Download..."; |
2280 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
2280 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
2281 | 2281 | if (file_exists($tmp_dir.'notam.rss')) { |
2282 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
2282 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
2283 | 2283 | foreach ($notams['channel']['item'] as $notam) { |
2284 | - $title = explode(':',$notam['title']); |
|
2284 | + $title = explode(':', $notam['title']); |
|
2285 | 2285 | $data['ref'] = trim($title[0]); |
2286 | 2286 | unset($title[0]); |
2287 | - $data['title'] = trim(implode(':',$title)); |
|
2288 | - $description = strip_tags($notam['description'],'<pre>'); |
|
2289 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
2290 | - $q = explode('/',$match[1]); |
|
2287 | + $data['title'] = trim(implode(':', $title)); |
|
2288 | + $description = strip_tags($notam['description'], '<pre>'); |
|
2289 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
2290 | + $q = explode('/', $match[1]); |
|
2291 | 2291 | $data['fir'] = $q[0]; |
2292 | 2292 | $data['code'] = $q[1]; |
2293 | 2293 | $ifrvfr = $q[2]; |
@@ -2303,30 +2303,30 @@ discard block |
||
2303 | 2303 | $data['lower_limit'] = $q[5]; |
2304 | 2304 | $data['upper_limit'] = $q[6]; |
2305 | 2305 | $latlonrad = $q[7]; |
2306 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
2307 | - $latitude = $Common->convertDec($las,'latitude'); |
|
2308 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
2306 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
2307 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
2308 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
2309 | 2309 | if ($lac == 'S') $latitude = '-'.$latitude; |
2310 | 2310 | if ($lnc == 'W') $longitude = '-'.$longitude; |
2311 | 2311 | $data['center_latitude'] = $latitude; |
2312 | 2312 | $data['center_longitude'] = $longitude; |
2313 | 2313 | $data['radius'] = intval($radius); |
2314 | 2314 | |
2315 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
2315 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
2316 | 2316 | $data['text'] = $match[1]; |
2317 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
2317 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
2318 | 2318 | $fromto = $match[1]; |
2319 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
2319 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
2320 | 2320 | $fromall = trim($match[1]); |
2321 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
2321 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
2322 | 2322 | $from = trim($match[1]); |
2323 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
2324 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
2323 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
2324 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
2325 | 2325 | $toall = trim($match[1]); |
2326 | - if (!preg_match(':Permanent:',$toall)) { |
|
2327 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
2326 | + if (!preg_match(':Permanent:', $toall)) { |
|
2327 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
2328 | 2328 | $to = trim($match[1]); |
2329 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
2329 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
2330 | 2330 | $data['permanent'] = 0; |
2331 | 2331 | } else { |
2332 | 2332 | $data['date_end'] = NULL; |
@@ -2334,7 +2334,7 @@ discard block |
||
2334 | 2334 | } |
2335 | 2335 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
2336 | 2336 | $NOTAM = new NOTAM(); |
2337 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
2337 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
2338 | 2338 | unset($data); |
2339 | 2339 | } |
2340 | 2340 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2357,16 +2357,16 @@ discard block |
||
2357 | 2357 | $Connection = new Connection(); |
2358 | 2358 | $sth = $Connection->db->prepare($query); |
2359 | 2359 | $sth->execute(); |
2360 | - } catch(PDOException $e) { |
|
2360 | + } catch (PDOException $e) { |
|
2361 | 2361 | return "error : ".$e->getMessage(); |
2362 | 2362 | } |
2363 | 2363 | } |
2364 | 2364 | $Common = new Common(); |
2365 | 2365 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
2366 | - $airspace_json = json_decode($airspace_lst,true); |
|
2366 | + $airspace_json = json_decode($airspace_lst, true); |
|
2367 | 2367 | foreach ($airspace_json['records'] as $airspace) { |
2368 | 2368 | if ($globalDebug) echo $airspace['name']."...\n"; |
2369 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
2369 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
2370 | 2370 | if (file_exists($tmp_dir.$airspace['name'])) { |
2371 | 2371 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
2372 | 2372 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2388,7 +2388,7 @@ discard block |
||
2388 | 2388 | $Connection = new Connection(); |
2389 | 2389 | $sth = $Connection->db->prepare($query); |
2390 | 2390 | $sth->execute(array(':new' => $new, ':old' => $old)); |
2391 | - } catch(PDOException $e) { |
|
2391 | + } catch (PDOException $e) { |
|
2392 | 2392 | return "error : ".$e->getMessage(); |
2393 | 2393 | } |
2394 | 2394 | } |
@@ -2405,7 +2405,7 @@ discard block |
||
2405 | 2405 | $Connection = new Connection(); |
2406 | 2406 | $sth = $Connection->db->prepare($query); |
2407 | 2407 | $sth->execute(); |
2408 | - } catch(PDOException $e) { |
|
2408 | + } catch (PDOException $e) { |
|
2409 | 2409 | return "error : ".$e->getMessage(); |
2410 | 2410 | } |
2411 | 2411 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2420,7 +2420,7 @@ discard block |
||
2420 | 2420 | $Connection = new Connection(); |
2421 | 2421 | $sth = $Connection->db->prepare($query); |
2422 | 2422 | $sth->execute(); |
2423 | - } catch(PDOException $e) { |
|
2423 | + } catch (PDOException $e) { |
|
2424 | 2424 | return "error : ".$e->getMessage(); |
2425 | 2425 | } |
2426 | 2426 | } |
@@ -2431,7 +2431,7 @@ discard block |
||
2431 | 2431 | $Connection = new Connection(); |
2432 | 2432 | $sth = $Connection->db->prepare($query); |
2433 | 2433 | $sth->execute(array(':version' => $version)); |
2434 | - } catch(PDOException $e) { |
|
2434 | + } catch (PDOException $e) { |
|
2435 | 2435 | return "error : ".$e->getMessage(); |
2436 | 2436 | } |
2437 | 2437 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2445,7 +2445,7 @@ discard block |
||
2445 | 2445 | $Connection = new Connection(); |
2446 | 2446 | $sth = $Connection->db->prepare($query); |
2447 | 2447 | $sth->execute(array(':version' => $version)); |
2448 | - } catch(PDOException $e) { |
|
2448 | + } catch (PDOException $e) { |
|
2449 | 2449 | return "error : ".$e->getMessage(); |
2450 | 2450 | } |
2451 | 2451 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | $Connection = new Connection(); |
2462 | 2462 | $sth = $Connection->db->prepare($query); |
2463 | 2463 | $sth->execute(array(':version' => $version)); |
2464 | - } catch(PDOException $e) { |
|
2464 | + } catch (PDOException $e) { |
|
2465 | 2465 | return "error : ".$e->getMessage(); |
2466 | 2466 | } |
2467 | 2467 | } |
@@ -2473,7 +2473,7 @@ discard block |
||
2473 | 2473 | $Connection = new Connection(); |
2474 | 2474 | $sth = $Connection->db->prepare($query); |
2475 | 2475 | $sth->execute(array(':version' => $version)); |
2476 | - } catch(PDOException $e) { |
|
2476 | + } catch (PDOException $e) { |
|
2477 | 2477 | return "error : ".$e->getMessage(); |
2478 | 2478 | } |
2479 | 2479 | } |
@@ -2489,7 +2489,7 @@ discard block |
||
2489 | 2489 | $Connection = new Connection(); |
2490 | 2490 | $sth = $Connection->db->prepare($query); |
2491 | 2491 | $sth->execute(); |
2492 | - } catch(PDOException $e) { |
|
2492 | + } catch (PDOException $e) { |
|
2493 | 2493 | return "error : ".$e->getMessage(); |
2494 | 2494 | } |
2495 | 2495 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2504,7 +2504,7 @@ discard block |
||
2504 | 2504 | $Connection = new Connection(); |
2505 | 2505 | $sth = $Connection->db->prepare($query); |
2506 | 2506 | $sth->execute(); |
2507 | - } catch(PDOException $e) { |
|
2507 | + } catch (PDOException $e) { |
|
2508 | 2508 | return "error : ".$e->getMessage(); |
2509 | 2509 | } |
2510 | 2510 | } |
@@ -2519,7 +2519,7 @@ discard block |
||
2519 | 2519 | $Connection = new Connection(); |
2520 | 2520 | $sth = $Connection->db->prepare($query); |
2521 | 2521 | $sth->execute(); |
2522 | - } catch(PDOException $e) { |
|
2522 | + } catch (PDOException $e) { |
|
2523 | 2523 | return "error : ".$e->getMessage(); |
2524 | 2524 | } |
2525 | 2525 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2534,7 +2534,7 @@ discard block |
||
2534 | 2534 | $Connection = new Connection(); |
2535 | 2535 | $sth = $Connection->db->prepare($query); |
2536 | 2536 | $sth->execute(); |
2537 | - } catch(PDOException $e) { |
|
2537 | + } catch (PDOException $e) { |
|
2538 | 2538 | return "error : ".$e->getMessage(); |
2539 | 2539 | } |
2540 | 2540 | } |
@@ -2550,7 +2550,7 @@ discard block |
||
2550 | 2550 | $Connection = new Connection(); |
2551 | 2551 | $sth = $Connection->db->prepare($query); |
2552 | 2552 | $sth->execute(); |
2553 | - } catch(PDOException $e) { |
|
2553 | + } catch (PDOException $e) { |
|
2554 | 2554 | return "error : ".$e->getMessage(); |
2555 | 2555 | } |
2556 | 2556 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2565,7 +2565,7 @@ discard block |
||
2565 | 2565 | $Connection = new Connection(); |
2566 | 2566 | $sth = $Connection->db->prepare($query); |
2567 | 2567 | $sth->execute(); |
2568 | - } catch(PDOException $e) { |
|
2568 | + } catch (PDOException $e) { |
|
2569 | 2569 | return "error : ".$e->getMessage(); |
2570 | 2570 | } |
2571 | 2571 | } |
@@ -2580,7 +2580,7 @@ discard block |
||
2580 | 2580 | $Connection = new Connection(); |
2581 | 2581 | $sth = $Connection->db->prepare($query); |
2582 | 2582 | $sth->execute(); |
2583 | - } catch(PDOException $e) { |
|
2583 | + } catch (PDOException $e) { |
|
2584 | 2584 | return "error : ".$e->getMessage(); |
2585 | 2585 | } |
2586 | 2586 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2595,7 +2595,7 @@ discard block |
||
2595 | 2595 | $Connection = new Connection(); |
2596 | 2596 | $sth = $Connection->db->prepare($query); |
2597 | 2597 | $sth->execute(); |
2598 | - } catch(PDOException $e) { |
|
2598 | + } catch (PDOException $e) { |
|
2599 | 2599 | return "error : ".$e->getMessage(); |
2600 | 2600 | } |
2601 | 2601 | } |
@@ -2610,7 +2610,7 @@ discard block |
||
2610 | 2610 | $Connection = new Connection(); |
2611 | 2611 | $sth = $Connection->db->prepare($query); |
2612 | 2612 | $sth->execute(); |
2613 | - } catch(PDOException $e) { |
|
2613 | + } catch (PDOException $e) { |
|
2614 | 2614 | return "error : ".$e->getMessage(); |
2615 | 2615 | } |
2616 | 2616 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2625,7 +2625,7 @@ discard block |
||
2625 | 2625 | $Connection = new Connection(); |
2626 | 2626 | $sth = $Connection->db->prepare($query); |
2627 | 2627 | $sth->execute(); |
2628 | - } catch(PDOException $e) { |
|
2628 | + } catch (PDOException $e) { |
|
2629 | 2629 | return "error : ".$e->getMessage(); |
2630 | 2630 | } |
2631 | 2631 | } |
@@ -2640,7 +2640,7 @@ discard block |
||
2640 | 2640 | $Connection = new Connection(); |
2641 | 2641 | $sth = $Connection->db->prepare($query); |
2642 | 2642 | $sth->execute(); |
2643 | - } catch(PDOException $e) { |
|
2643 | + } catch (PDOException $e) { |
|
2644 | 2644 | return "error : ".$e->getMessage(); |
2645 | 2645 | } |
2646 | 2646 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2655,7 +2655,7 @@ discard block |
||
2655 | 2655 | $Connection = new Connection(); |
2656 | 2656 | $sth = $Connection->db->prepare($query); |
2657 | 2657 | $sth->execute(); |
2658 | - } catch(PDOException $e) { |
|
2658 | + } catch (PDOException $e) { |
|
2659 | 2659 | return "error : ".$e->getMessage(); |
2660 | 2660 | } |
2661 | 2661 | } |
@@ -2670,7 +2670,7 @@ discard block |
||
2670 | 2670 | $Connection = new Connection(); |
2671 | 2671 | $sth = $Connection->db->prepare($query); |
2672 | 2672 | $sth->execute(); |
2673 | - } catch(PDOException $e) { |
|
2673 | + } catch (PDOException $e) { |
|
2674 | 2674 | return "error : ".$e->getMessage(); |
2675 | 2675 | } |
2676 | 2676 | } |
@@ -2685,7 +2685,7 @@ discard block |
||
2685 | 2685 | $Connection = new Connection(); |
2686 | 2686 | $sth = $Connection->db->prepare($query); |
2687 | 2687 | $sth->execute(); |
2688 | - } catch(PDOException $e) { |
|
2688 | + } catch (PDOException $e) { |
|
2689 | 2689 | return "error : ".$e->getMessage(); |
2690 | 2690 | } |
2691 | 2691 | } |
@@ -13,62 +13,62 @@ discard block |
||
13 | 13 | * @param Array $filter the filter |
14 | 14 | * @return Array the SQL part |
15 | 15 | */ |
16 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
16 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
18 | 18 | $filters = array(); |
19 | 19 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
20 | 20 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
21 | 21 | $filters = $globalStatsFilters[$globalFilterName]; |
22 | 22 | } else { |
23 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
23 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | if (isset($filter[0]['source'])) { |
27 | - $filters = array_merge($filters,$filter); |
|
27 | + $filters = array_merge($filters, $filter); |
|
28 | 28 | } |
29 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
29 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
30 | 30 | $filter_query_join = ''; |
31 | 31 | $filter_query_where = ''; |
32 | - foreach($filters as $flt) { |
|
32 | + foreach ($filters as $flt) { |
|
33 | 33 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
34 | 34 | if ($flt['airlines'][0] != '') { |
35 | 35 | if (isset($flt['source'])) { |
36 | - $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'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
36 | + $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'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | 37 | } else { |
38 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | 39 | } |
40 | 40 | } |
41 | 41 | } |
42 | 42 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
43 | 43 | if (isset($flt['source'])) { |
44 | - $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'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
44 | + $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'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | 45 | } else { |
46 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | 47 | } |
48 | 48 | } |
49 | 49 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
50 | 50 | if (isset($flt['source'])) { |
51 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
51 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | 52 | } else { |
53 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | 54 | } |
55 | 55 | } |
56 | 56 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
57 | 57 | if (isset($flt['source'])) { |
58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | 59 | } else { |
60 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | 61 | } |
62 | 62 | } |
63 | 63 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
64 | 64 | if (isset($flt['source'])) { |
65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | } |
69 | 69 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
70 | 70 | if ($filter['airlines'][0] != '') { |
71 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
71 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | 72 | } |
73 | 73 | } |
74 | 74 | |
@@ -76,16 +76,16 @@ discard block |
||
76 | 76 | $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 "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
82 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
83 | 83 | } |
84 | 84 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
85 | 85 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
86 | 86 | } |
87 | 87 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
88 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
88 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
89 | 89 | } |
90 | 90 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
91 | 91 | $filter_query_date = ''; |
@@ -111,41 +111,41 @@ discard block |
||
111 | 111 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
112 | 112 | } |
113 | 113 | } |
114 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
114 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
115 | 115 | } |
116 | 116 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
117 | 117 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
118 | 118 | if ($filter_query_where != '') { |
119 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
119 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
120 | 120 | } |
121 | 121 | $filter_query = $filter_query_join.$filter_query_where; |
122 | 122 | return $filter_query; |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Spotter_archive |
126 | - 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 = '') { |
|
126 | + 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 = '') { |
|
127 | 127 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
128 | 128 | if ($over_country == '') { |
129 | 129 | $Spotter = new Spotter($this->db); |
130 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
130 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
131 | 131 | if (!empty($data_country)) $country = $data_country['iso2']; |
132 | 132 | else $country = ''; |
133 | 133 | } else $country = $over_country; |
134 | - if ($airline_type === NULL) $airline_type =''; |
|
134 | + if ($airline_type === NULL) $airline_type = ''; |
|
135 | 135 | |
136 | 136 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
137 | 137 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
138 | 138 | |
139 | 139 | // Route is not added in spotter_archive |
140 | - $query = "INSERT INTO spotter_archive (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,over_country,source_name) |
|
140 | + $query = "INSERT INTO spotter_archive (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,over_country,source_name) |
|
141 | 141 | VALUES (: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, :over_country, :source_name)"; |
142 | 142 | |
143 | - $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_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name); |
|
143 | + $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_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':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, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name); |
|
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | 146 | $sth->execute($query_values); |
147 | 147 | $sth->closeCursor(); |
148 | - } catch(PDOException $e) { |
|
148 | + } catch (PDOException $e) { |
|
149 | 149 | return "error : ".$e->getMessage(); |
150 | 150 | } |
151 | 151 | return "success"; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | |
166 | 166 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
167 | 167 | //$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"; |
168 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
168 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
169 | 169 | |
170 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
170 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
171 | 171 | |
172 | 172 | return $spotter_array; |
173 | 173 | } |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
187 | 187 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
188 | 188 | //$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"; |
189 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
189 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
190 | 190 | |
191 | 191 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
192 | 192 | /* |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | } |
200 | 200 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
201 | 201 | */ |
202 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
202 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
203 | 203 | |
204 | 204 | return $spotter_array; |
205 | 205 | } |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | { |
215 | 215 | date_default_timezone_set('UTC'); |
216 | 216 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
217 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
217 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
218 | 218 | |
219 | 219 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
220 | 220 | |
221 | 221 | try { |
222 | 222 | $sth = $this->db->prepare($query); |
223 | 223 | $sth->execute(array(':id' => $id)); |
224 | - } catch(PDOException $e) { |
|
224 | + } catch (PDOException $e) { |
|
225 | 225 | echo $e->getMessage(); |
226 | 226 | die; |
227 | 227 | } |
@@ -240,14 +240,14 @@ discard block |
||
240 | 240 | { |
241 | 241 | date_default_timezone_set('UTC'); |
242 | 242 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
243 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
243 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id"; |
|
244 | 244 | |
245 | 245 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
246 | 246 | |
247 | 247 | try { |
248 | 248 | $sth = $this->db->prepare($query); |
249 | 249 | $sth->execute(array(':id' => $id)); |
250 | - } catch(PDOException $e) { |
|
250 | + } catch (PDOException $e) { |
|
251 | 251 | echo $e->getMessage(); |
252 | 252 | die; |
253 | 253 | } |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | date_default_timezone_set('UTC'); |
270 | 270 | |
271 | 271 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
272 | - $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"; |
|
272 | + $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"; |
|
273 | 273 | |
274 | 274 | try { |
275 | 275 | $sth = $this->db->prepare($query); |
276 | 276 | $sth->execute(array(':ident' => $ident)); |
277 | - } catch(PDOException $e) { |
|
277 | + } catch (PDOException $e) { |
|
278 | 278 | echo $e->getMessage(); |
279 | 279 | die; |
280 | 280 | } |
@@ -295,12 +295,12 @@ discard block |
||
295 | 295 | date_default_timezone_set('UTC'); |
296 | 296 | |
297 | 297 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
298 | - $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"; |
|
298 | + $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"; |
|
299 | 299 | |
300 | 300 | try { |
301 | 301 | $sth = $this->db->prepare($query); |
302 | 302 | $sth->execute(array(':id' => $id)); |
303 | - } catch(PDOException $e) { |
|
303 | + } catch (PDOException $e) { |
|
304 | 304 | echo $e->getMessage(); |
305 | 305 | die; |
306 | 306 | } |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | date_default_timezone_set('UTC'); |
322 | 322 | |
323 | 323 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
324 | - $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
324 | + $query = "SELECT spotter_archive.altitude, spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
325 | 325 | |
326 | 326 | try { |
327 | 327 | $sth = $this->db->prepare($query); |
328 | 328 | $sth->execute(array(':id' => $id)); |
329 | - } catch(PDOException $e) { |
|
329 | + } catch (PDOException $e) { |
|
330 | 330 | echo $e->getMessage(); |
331 | 331 | die; |
332 | 332 | } |
@@ -348,13 +348,13 @@ discard block |
||
348 | 348 | date_default_timezone_set('UTC'); |
349 | 349 | |
350 | 350 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
351 | - $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"; |
|
351 | + $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"; |
|
352 | 352 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
353 | 353 | |
354 | 354 | try { |
355 | 355 | $sth = $this->db->prepare($query); |
356 | 356 | $sth->execute(array(':ident' => $ident)); |
357 | - } catch(PDOException $e) { |
|
357 | + } catch (PDOException $e) { |
|
358 | 358 | echo $e->getMessage(); |
359 | 359 | die; |
360 | 360 | } |
@@ -371,13 +371,13 @@ discard block |
||
371 | 371 | * @return Array the spotter information |
372 | 372 | * |
373 | 373 | */ |
374 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) |
|
374 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) |
|
375 | 375 | { |
376 | 376 | $Spotter = new Spotter($this->db); |
377 | 377 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
378 | - $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"; |
|
378 | + $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"; |
|
379 | 379 | |
380 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
380 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
381 | 381 | |
382 | 382 | return $spotter_array; |
383 | 383 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | try { |
391 | 391 | $sth = $this->db->prepare($query); |
392 | 392 | $sth->execute(); |
393 | - } catch(PDOException $e) { |
|
393 | + } catch (PDOException $e) { |
|
394 | 394 | echo $e->getMessage(); |
395 | 395 | die; |
396 | 396 | } |
@@ -402,24 +402,24 @@ discard block |
||
402 | 402 | * @return Array the spotter information |
403 | 403 | * |
404 | 404 | */ |
405 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) |
|
405 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) |
|
406 | 406 | { |
407 | 407 | global $globalDBdriver, $globalLiveInterval; |
408 | 408 | date_default_timezone_set('UTC'); |
409 | 409 | |
410 | 410 | $filter_query = ''; |
411 | 411 | if (isset($filter['source']) && !empty($filter['source'])) { |
412 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
412 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
413 | 413 | } |
414 | 414 | // Use spotter_output also ? |
415 | 415 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
416 | - $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 "; |
|
416 | + $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 "; |
|
417 | 417 | } |
418 | 418 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
419 | 419 | $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 "; |
420 | 420 | } |
421 | 421 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
422 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
422 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
423 | 423 | } |
424 | 424 | |
425 | 425 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -438,14 +438,14 @@ discard block |
||
438 | 438 | GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id |
439 | 439 | AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
440 | 440 | */ |
441 | - $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 |
|
441 | + $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 |
|
442 | 442 | FROM spotter_archive |
443 | 443 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
444 | 444 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$begindate."'".' |
445 | 445 | '.$filter_query.' ORDER BY flightaware_id'; |
446 | 446 | } else { |
447 | 447 | //$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'; |
448 | - $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 |
|
448 | + $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 |
|
449 | 449 | FROM spotter_archive |
450 | 450 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
451 | 451 | WHERE spotter_archive.date >= '."'".$begindate."'".' AND spotter_archive.date <= '."'".$enddate."'".' |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | try { |
456 | 456 | $sth = $this->db->prepare($query); |
457 | 457 | $sth->execute(); |
458 | - } catch(PDOException $e) { |
|
458 | + } catch (PDOException $e) { |
|
459 | 459 | echo $e->getMessage(); |
460 | 460 | die; |
461 | 461 | } |
@@ -470,24 +470,24 @@ discard block |
||
470 | 470 | * @return Array the spotter information |
471 | 471 | * |
472 | 472 | */ |
473 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) |
|
473 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) |
|
474 | 474 | { |
475 | 475 | global $globalDBdriver, $globalLiveInterval; |
476 | 476 | date_default_timezone_set('UTC'); |
477 | 477 | |
478 | 478 | $filter_query = ''; |
479 | 479 | if (isset($filter['source']) && !empty($filter['source'])) { |
480 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
480 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
481 | 481 | } |
482 | 482 | // Should use spotter_output also ? |
483 | 483 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
484 | - $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 "; |
|
484 | + $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 "; |
|
485 | 485 | } |
486 | 486 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
487 | 487 | $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 "; |
488 | 488 | } |
489 | 489 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
490 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
490 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
491 | 491 | } |
492 | 492 | |
493 | 493 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | FROM spotter_archive |
498 | 498 | 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'; |
499 | 499 | */ |
500 | - $query = 'SELECT a.aircraft_shadow, 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 |
|
500 | + $query = 'SELECT a.aircraft_shadow, 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 |
|
501 | 501 | FROM spotter_archive_output |
502 | 502 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
503 | 503 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
513 | 513 | '.$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'; |
514 | 514 | */ |
515 | - $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 |
|
515 | + $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 |
|
516 | 516 | FROM spotter_archive_output |
517 | 517 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
518 | 518 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | try { |
525 | 525 | $sth = $this->db->prepare($query); |
526 | 526 | $sth->execute(); |
527 | - } catch(PDOException $e) { |
|
527 | + } catch (PDOException $e) { |
|
528 | 528 | echo $e->getMessage(); |
529 | 529 | die; |
530 | 530 | } |
@@ -539,23 +539,23 @@ discard block |
||
539 | 539 | * @return Array the spotter information |
540 | 540 | * |
541 | 541 | */ |
542 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) |
|
542 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) |
|
543 | 543 | { |
544 | 544 | global $globalDBdriver, $globalLiveInterval; |
545 | 545 | date_default_timezone_set('UTC'); |
546 | 546 | |
547 | 547 | $filter_query = ''; |
548 | 548 | if (isset($filter['source']) && !empty($filter['source'])) { |
549 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
549 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
550 | 550 | } |
551 | 551 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
552 | - $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 "; |
|
552 | + $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 "; |
|
553 | 553 | } |
554 | 554 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
555 | 555 | $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 "; |
556 | 556 | } |
557 | 557 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
558 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
558 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | try { |
571 | 571 | $sth = $this->db->prepare($query); |
572 | 572 | $sth->execute(); |
573 | - } catch(PDOException $e) { |
|
573 | + } catch (PDOException $e) { |
|
574 | 574 | echo $e->getMessage(); |
575 | 575 | die; |
576 | 576 | } |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @return Array the spotter information |
591 | 591 | * |
592 | 592 | */ |
593 | - 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()) |
|
593 | + 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()) |
|
594 | 594 | { |
595 | 595 | global $globalTimezone, $globalDBdriver; |
596 | 596 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -612,7 +612,7 @@ discard block |
||
612 | 612 | |
613 | 613 | $q_array = explode(" ", $q); |
614 | 614 | |
615 | - foreach ($q_array as $q_item){ |
|
615 | + foreach ($q_array as $q_item) { |
|
616 | 616 | $additional_query .= " AND ("; |
617 | 617 | $additional_query .= "(spotter_archive_output.spotter_id like '%".$q_item."%') OR "; |
618 | 618 | $additional_query .= "(spotter_archive_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | |
645 | 645 | if ($registration != "") |
646 | 646 | { |
647 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
647 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
648 | 648 | if (!is_string($registration)) |
649 | 649 | { |
650 | 650 | return false; |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | if ($aircraft_icao != "") |
657 | 657 | { |
658 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
658 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
659 | 659 | if (!is_string($aircraft_icao)) |
660 | 660 | { |
661 | 661 | return false; |
@@ -666,7 +666,7 @@ discard block |
||
666 | 666 | |
667 | 667 | if ($aircraft_manufacturer != "") |
668 | 668 | { |
669 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
669 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
670 | 670 | if (!is_string($aircraft_manufacturer)) |
671 | 671 | { |
672 | 672 | return false; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | |
688 | 688 | if ($airline_icao != "") |
689 | 689 | { |
690 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
690 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
691 | 691 | if (!is_string($airline_icao)) |
692 | 692 | { |
693 | 693 | return false; |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | |
699 | 699 | if ($airline_country != "") |
700 | 700 | { |
701 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
701 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
702 | 702 | if (!is_string($airline_country)) |
703 | 703 | { |
704 | 704 | return false; |
@@ -709,7 +709,7 @@ discard block |
||
709 | 709 | |
710 | 710 | if ($airline_type != "") |
711 | 711 | { |
712 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
712 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
713 | 713 | if (!is_string($airline_type)) |
714 | 714 | { |
715 | 715 | return false; |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | |
732 | 732 | if ($airport != "") |
733 | 733 | { |
734 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
734 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
735 | 735 | if (!is_string($airport)) |
736 | 736 | { |
737 | 737 | return false; |
@@ -742,7 +742,7 @@ discard block |
||
742 | 742 | |
743 | 743 | if ($airport_country != "") |
744 | 744 | { |
745 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
745 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
746 | 746 | if (!is_string($airport_country)) |
747 | 747 | { |
748 | 748 | return false; |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | |
754 | 754 | if ($callsign != "") |
755 | 755 | { |
756 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
756 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
757 | 757 | if (!is_string($callsign)) |
758 | 758 | { |
759 | 759 | return false; |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | $translate = $Translation->ident2icao($callsign); |
762 | 762 | if ($translate != $callsign) { |
763 | 763 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
764 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
764 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
765 | 765 | } else { |
766 | 766 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
767 | 767 | } |
@@ -770,7 +770,7 @@ discard block |
||
770 | 770 | |
771 | 771 | if ($owner != "") |
772 | 772 | { |
773 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
773 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
774 | 774 | if (!is_string($owner)) |
775 | 775 | { |
776 | 776 | return false; |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | |
782 | 782 | if ($pilot_name != "") |
783 | 783 | { |
784 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
784 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
785 | 785 | if (!is_string($pilot_name)) |
786 | 786 | { |
787 | 787 | return false; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if ($pilot_id != "") |
794 | 794 | { |
795 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
795 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
796 | 796 | if (!is_string($pilot_id)) |
797 | 797 | { |
798 | 798 | return false; |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | |
804 | 804 | if ($departure_airport_route != "") |
805 | 805 | { |
806 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
806 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
807 | 807 | if (!is_string($departure_airport_route)) |
808 | 808 | { |
809 | 809 | return false; |
@@ -814,7 +814,7 @@ discard block |
||
814 | 814 | |
815 | 815 | if ($arrival_airport_route != "") |
816 | 816 | { |
817 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
817 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
818 | 818 | if (!is_string($arrival_airport_route)) |
819 | 819 | { |
820 | 820 | return false; |
@@ -827,8 +827,8 @@ discard block |
||
827 | 827 | { |
828 | 828 | $altitude_array = explode(",", $altitude); |
829 | 829 | |
830 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
831 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
830 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
831 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
832 | 832 | |
833 | 833 | |
834 | 834 | if ($altitude_array[1] != "") |
@@ -846,8 +846,8 @@ discard block |
||
846 | 846 | { |
847 | 847 | $date_array = explode(",", $date_posted); |
848 | 848 | |
849 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
850 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
849 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
850 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
851 | 851 | |
852 | 852 | if ($globalTimezone != '') { |
853 | 853 | date_default_timezone_set($globalTimezone); |
@@ -879,8 +879,8 @@ discard block |
||
879 | 879 | { |
880 | 880 | $limit_array = explode(",", $limit); |
881 | 881 | |
882 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
883 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
882 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
883 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
884 | 884 | |
885 | 885 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
886 | 886 | { |
@@ -891,8 +891,8 @@ discard block |
||
891 | 891 | |
892 | 892 | |
893 | 893 | if ($origLat != "" && $origLon != "" && $dist != "") { |
894 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
895 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
894 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
895 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
896 | 896 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
897 | 897 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
898 | 898 | } else { |
@@ -909,12 +909,12 @@ discard block |
||
909 | 909 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
910 | 910 | } |
911 | 911 | |
912 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
912 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
913 | 913 | WHERE spotter_archive_output.ident <> '' |
914 | 914 | ".$additional_query." |
915 | 915 | ".$filter_query.$orderby_query; |
916 | 916 | } |
917 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
917 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
918 | 918 | |
919 | 919 | return $spotter_array; |
920 | 920 | } |
@@ -931,7 +931,7 @@ discard block |
||
931 | 931 | try { |
932 | 932 | $sth = $this->db->prepare($query); |
933 | 933 | $sth->execute(); |
934 | - } catch(PDOException $e) { |
|
934 | + } catch (PDOException $e) { |
|
935 | 935 | return "error"; |
936 | 936 | } |
937 | 937 | } |
@@ -968,8 +968,8 @@ discard block |
||
968 | 968 | { |
969 | 969 | $limit_array = explode(",", $limit); |
970 | 970 | |
971 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
972 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
971 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
972 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
973 | 973 | |
974 | 974 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
975 | 975 | { |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | $query_values = array(); |
1011 | 1011 | $limit_query = ''; |
1012 | 1012 | $additional_query = ''; |
1013 | - $filter_query = $this->getFilter($filter,true,true); |
|
1013 | + $filter_query = $this->getFilter($filter, true, true); |
|
1014 | 1014 | |
1015 | 1015 | if ($owner != "") |
1016 | 1016 | { |
@@ -1027,8 +1027,8 @@ discard block |
||
1027 | 1027 | { |
1028 | 1028 | $limit_array = explode(",", $limit); |
1029 | 1029 | |
1030 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1031 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1030 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1031 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1032 | 1032 | |
1033 | 1033 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1034 | 1034 | { |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | $query_values = array(); |
1069 | 1069 | $limit_query = ''; |
1070 | 1070 | $additional_query = ''; |
1071 | - $filter_query = $this->getFilter($filter,true,true); |
|
1071 | + $filter_query = $this->getFilter($filter, true, true); |
|
1072 | 1072 | |
1073 | 1073 | if ($pilot != "") |
1074 | 1074 | { |
@@ -1080,8 +1080,8 @@ discard block |
||
1080 | 1080 | { |
1081 | 1081 | $limit_array = explode(",", $limit); |
1082 | 1082 | |
1083 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1084 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1083 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1084 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1085 | 1085 | |
1086 | 1086 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1087 | 1087 | { |
@@ -1111,7 +1111,7 @@ discard block |
||
1111 | 1111 | * @return Array the airline country list |
1112 | 1112 | * |
1113 | 1113 | */ |
1114 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1114 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1115 | 1115 | { |
1116 | 1116 | global $globalDBdriver; |
1117 | 1117 | /* |
@@ -1140,7 +1140,7 @@ discard block |
||
1140 | 1140 | $flight_array = array(); |
1141 | 1141 | $temp_array = array(); |
1142 | 1142 | |
1143 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1143 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1144 | 1144 | { |
1145 | 1145 | $temp_array['flight_count'] = $row['nb']; |
1146 | 1146 | $temp_array['flight_country'] = $row['name']; |
@@ -1157,7 +1157,7 @@ discard block |
||
1157 | 1157 | * @return Array the airline country list |
1158 | 1158 | * |
1159 | 1159 | */ |
1160 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') |
|
1160 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
|
1161 | 1161 | { |
1162 | 1162 | global $globalDBdriver; |
1163 | 1163 | /* |
@@ -1186,7 +1186,7 @@ discard block |
||
1186 | 1186 | $flight_array = array(); |
1187 | 1187 | $temp_array = array(); |
1188 | 1188 | |
1189 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1189 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1190 | 1190 | { |
1191 | 1191 | $temp_array['airline_icao'] = $row['airline_icao']; |
1192 | 1192 | $temp_array['flight_count'] = $row['nb']; |
@@ -1204,14 +1204,14 @@ discard block |
||
1204 | 1204 | * @return Array the spotter information |
1205 | 1205 | * |
1206 | 1206 | */ |
1207 | - public function getDateArchiveSpotterDataById($id,$date) |
|
1207 | + public function getDateArchiveSpotterDataById($id, $date) |
|
1208 | 1208 | { |
1209 | 1209 | $Spotter = new Spotter($this->db); |
1210 | 1210 | date_default_timezone_set('UTC'); |
1211 | 1211 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1212 | - $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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1213 | - $date = date('c',$date); |
|
1214 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1212 | + $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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1213 | + $date = date('c', $date); |
|
1214 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1215 | 1215 | return $spotter_array; |
1216 | 1216 | } |
1217 | 1217 | |
@@ -1221,14 +1221,14 @@ discard block |
||
1221 | 1221 | * @return Array the spotter information |
1222 | 1222 | * |
1223 | 1223 | */ |
1224 | - public function getDateArchiveSpotterDataByIdent($ident,$date) |
|
1224 | + public function getDateArchiveSpotterDataByIdent($ident, $date) |
|
1225 | 1225 | { |
1226 | 1226 | $Spotter = new Spotter($this->db); |
1227 | 1227 | date_default_timezone_set('UTC'); |
1228 | 1228 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1229 | - $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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1230 | - $date = date('c',$date); |
|
1231 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1229 | + $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 AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1230 | + $date = date('c', $date); |
|
1231 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1232 | 1232 | return $spotter_array; |
1233 | 1233 | } |
1234 | 1234 | |
@@ -1238,7 +1238,7 @@ discard block |
||
1238 | 1238 | * @return Array the spotter information |
1239 | 1239 | * |
1240 | 1240 | */ |
1241 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
1241 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
1242 | 1242 | { |
1243 | 1243 | global $global_query; |
1244 | 1244 | $Spotter = new Spotter(); |
@@ -1246,7 +1246,7 @@ discard block |
||
1246 | 1246 | $query_values = array(); |
1247 | 1247 | $limit_query = ''; |
1248 | 1248 | $additional_query = ''; |
1249 | - $filter_query = $this->getFilter($filters,true,true); |
|
1249 | + $filter_query = $this->getFilter($filters, true, true); |
|
1250 | 1250 | |
1251 | 1251 | if ($airport != "") |
1252 | 1252 | { |
@@ -1263,8 +1263,8 @@ discard block |
||
1263 | 1263 | { |
1264 | 1264 | $limit_array = explode(",", $limit); |
1265 | 1265 | |
1266 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1267 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1266 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1267 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1268 | 1268 | |
1269 | 1269 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
1270 | 1270 | { |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | if (isset($this->all_tracked[$key]['id'])) { |
50 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
51 | 51 | $Tracker = new Tracker($this->db); |
52 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
52 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
53 | 53 | } |
54 | 54 | } |
55 | 55 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
61 | 61 | foreach ($this->all_tracked as $key => $flight) { |
62 | 62 | if (isset($flight['lastupdate'])) { |
63 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
63 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
64 | 64 | if (isset($this->all_tracked[$key]['id'])) { |
65 | 65 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
66 | 66 | /* |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | //$real_arrival = $this->arrival($key); |
72 | 72 | $Tracker = new Tracker($this->db); |
73 | 73 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
74 | - $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
|
74 | + $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['altitude'], $this->all_tracked[$key]['speed']); |
|
75 | 75 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
76 | 76 | } |
77 | 77 | // Put in archive |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $send = false; |
92 | 92 | |
93 | 93 | // SBS format is CSV format |
94 | - if(is_array($line) && isset($line['ident'])) { |
|
94 | + if (is_array($line) && isset($line['ident'])) { |
|
95 | 95 | //print_r($line); |
96 | 96 | if (isset($line['ident'])) { |
97 | 97 | |
@@ -114,33 +114,33 @@ discard block |
||
114 | 114 | |
115 | 115 | if (!isset($this->all_tracked[$id])) { |
116 | 116 | $this->all_tracked[$id] = array(); |
117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
119 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedTracker' => 0)); |
|
118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '')); |
|
119 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
120 | 120 | if (!isset($line['id'])) { |
121 | 121 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
122 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
123 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
122 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
123 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
124 | 124 | if ($globalAllTracked !== FALSE) $dataFound = true; |
125 | 125 | } |
126 | 126 | |
127 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60) { |
|
127 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60) { |
|
128 | 128 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
130 | 130 | } else { |
131 | 131 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
132 | 132 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
133 | 133 | return ''; |
134 | 134 | } |
135 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
135 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
136 | 136 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
137 | 137 | return ''; |
138 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
138 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
139 | 139 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
140 | 140 | return ''; |
141 | 141 | } elseif (!isset($line['datetime'])) { |
142 | 142 | date_default_timezone_set('UTC'); |
143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
144 | 144 | } else { |
145 | 145 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
146 | 146 | return ''; |
@@ -148,38 +148,38 @@ discard block |
||
148 | 148 | |
149 | 149 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
150 | 150 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
151 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
151 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
152 | 152 | if ($this->all_tracked[$id]['addedTracker'] == 1) { |
153 | 153 | $timeelapsed = microtime(true); |
154 | 154 | $Tracker = new Tracker($this->db); |
155 | 155 | $fromsource = NULL; |
156 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
156 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
157 | 157 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
158 | 158 | $Tracker->db = null; |
159 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
159 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
160 | 160 | } |
161 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
161 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | if (isset($line['speed']) && $line['speed'] != '') { |
165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
167 | 167 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
168 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
168 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
169 | 169 | if ($distance > 1000 && $distance < 10000) { |
170 | 170 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
171 | 171 | $speed = $speed*3.6; |
172 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
172 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
173 | 173 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
174 | 174 | } |
175 | 175 | } |
176 | 176 | |
177 | 177 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
178 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
178 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
179 | 179 | else unset($timediff); |
180 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
180 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
181 | 181 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
182 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
182 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
183 | 183 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
184 | 184 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
185 | 185 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -187,10 +187,10 @@ discard block |
||
187 | 187 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
188 | 188 | $timeelapsed = microtime(true); |
189 | 189 | $Tracker = new Tracker($this->db); |
190 | - $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
190 | + $all_country = $Tracker->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
191 | 191 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
192 | 192 | $Tracker->db = null; |
193 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
193 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
194 | 194 | $this->tmd = 0; |
195 | 195 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
196 | 196 | } |
@@ -198,73 +198,73 @@ discard block |
||
198 | 198 | |
199 | 199 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
200 | 200 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
201 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
201 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
202 | 202 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
203 | 203 | $dataFound = true; |
204 | 204 | $this->all_tracked[$id]['time_last_coord'] = time(); |
205 | 205 | } |
206 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
206 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
207 | 207 | } |
208 | 208 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
209 | 209 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
210 | 210 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
211 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
211 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
212 | 212 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
213 | 213 | $dataFound = true; |
214 | 214 | $this->all_tracked[$id]['time_last_coord'] = time(); |
215 | 215 | } |
216 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
216 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | } else if ($globalDebug && $timediff > 20) { |
220 | 220 | $this->tmd = $this->tmd + 1; |
221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
222 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
223 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
222 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
223 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
225 | 225 | } |
226 | 226 | } |
227 | 227 | if (isset($line['last_update']) && $line['last_update'] != '') { |
228 | 228 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
229 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
229 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
230 | 230 | } |
231 | 231 | if (isset($line['format_source']) && $line['format_source'] != '') { |
232 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
232 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
233 | 233 | } |
234 | 234 | if (isset($line['source_name']) && $line['source_name'] != '') { |
235 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
235 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
236 | 236 | } |
237 | 237 | if (isset($line['comment']) && $line['comment'] != '') { |
238 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
238 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('comment' => $line['comment'])); |
|
239 | 239 | //$dataFound = true; |
240 | 240 | } |
241 | 241 | if (isset($line['type']) && $line['type'] != '') { |
242 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
242 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
243 | 243 | //$dataFound = true; |
244 | 244 | } |
245 | 245 | |
246 | 246 | if (isset($line['altitude']) && $line['altitude'] != '') { |
247 | 247 | //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
248 | - if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
249 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
|
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
|
248 | + if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100) - $this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
|
249 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude' => round($line['altitude']/100))); |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('altitude_real' => $line['altitude'])); |
|
251 | 251 | //$dataFound = true; |
252 | 252 | //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
253 | 253 | } |
254 | 254 | |
255 | 255 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | if (isset($line['heading']) && $line['heading'] != '') { |
260 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
261 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
260 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
261 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
263 | 263 | //$dataFound = true; |
264 | 264 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
265 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
266 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
267 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
265 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
266 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
267 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
268 | 268 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
269 | 269 | } |
270 | 270 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -272,39 +272,39 @@ discard block |
||
272 | 272 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
273 | 273 | $this->all_tracked[$id]['lastupdate'] = time(); |
274 | 274 | if ($this->all_tracked[$id]['addedTracker'] == 0) { |
275 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
275 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
276 | 276 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
277 | 277 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
278 | 278 | $timeelapsed = microtime(true); |
279 | 279 | $TrackerLive = new TrackerLive($this->db); |
280 | 280 | if (isset($line['id'])) { |
281 | 281 | $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
282 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
282 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
283 | 283 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
284 | 284 | $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
285 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
285 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
286 | 286 | } else $recent_ident = ''; |
287 | - $TrackerLive->db=null; |
|
287 | + $TrackerLive->db = null; |
|
288 | 288 | |
289 | 289 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
290 | 290 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
291 | 291 | } else { |
292 | 292 | $recent_ident = ''; |
293 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
293 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
294 | 294 | } |
295 | 295 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
296 | - if($recent_ident == "") |
|
296 | + if ($recent_ident == "") |
|
297 | 297 | { |
298 | 298 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
299 | 299 | //adds the spotter data for the archive |
300 | 300 | $highlight = ''; |
301 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
301 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
302 | 302 | $timeelapsed = microtime(true); |
303 | 303 | $Tracker = new Tracker($this->db); |
304 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
304 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
305 | 305 | $Tracker->db = null; |
306 | 306 | if ($globalDebug && isset($result)) echo $result."\n"; |
307 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
307 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
308 | 308 | |
309 | 309 | /* |
310 | 310 | // Add source stat in DB |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
343 | 343 | $TrackerLive = new TrackerLive($this->db); |
344 | 344 | $TrackerLive->deleteLiveTrackerData(); |
345 | - $TrackerLive->db=null; |
|
345 | + $TrackerLive->db = null; |
|
346 | 346 | if ($globalDebug) echo " Done\n"; |
347 | 347 | $this->last_delete = time(); |
348 | 348 | } |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | $this->all_tracked[$id]['addedTracker'] = 1; |
352 | 352 | if (isset($globalDaemon) && !$globalDaemon) { |
353 | 353 | $Tracker = new Tracker($this->db); |
354 | - $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['altitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
354 | + $Tracker->updateLatestTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
355 | 355 | $Tracker->db = null; |
356 | 356 | } |
357 | 357 | |
@@ -365,14 +365,14 @@ discard block |
||
365 | 365 | $ignoreImport = false; |
366 | 366 | |
367 | 367 | if (!$ignoreImport) { |
368 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
368 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
369 | 369 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
370 | 370 | $timeelapsed = microtime(true); |
371 | 371 | $TrackerLive = new TrackerLive($this->db); |
372 | - $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
372 | + $result = $TrackerLive->addLiveTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['comment'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
373 | 373 | $TrackerLive->db = null; |
374 | 374 | $this->all_tracked[$id]['putinarchive'] = false; |
375 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
375 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
376 | 376 | |
377 | 377 | // Put statistics in $this->stats variable |
378 | 378 | /* |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | $this->all_tracked[$id]['lastupdate'] = time(); |
432 | 432 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
433 | 433 | if ($globalDebug) echo $result."\n"; |
434 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
434 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
435 | 435 | //$this->del(); |
436 | 436 | |
437 | 437 |
@@ -43,11 +43,11 @@ discard block |
||
43 | 43 | $s3 = sin($bank/2); |
44 | 44 | $c1c2 = $c1*$c2; |
45 | 45 | $s1s2 = $s1*$s2; |
46 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
47 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
48 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
46 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
47 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
48 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
49 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
50 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
51 | 51 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
52 | 52 | |
53 | 53 | } |
@@ -68,16 +68,16 @@ discard block |
||
68 | 68 | $min = false; |
69 | 69 | $allhistory = false; |
70 | 70 | $filter['source'] = array(); |
71 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
72 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
73 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
74 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
75 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
76 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
77 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
78 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
79 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
80 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
72 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
73 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
75 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
77 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
78 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
79 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
80 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
81 | 81 | /* |
82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
83 | 83 | $min = true; |
@@ -124,12 +124,12 @@ discard block |
||
124 | 124 | $from_archive = true; |
125 | 125 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
126 | 126 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
128 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
131 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
132 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
127 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
128 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
131 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
132 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
133 | 133 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
134 | 134 | $from_archive = true; |
135 | 135 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -139,11 +139,11 @@ discard block |
||
139 | 139 | $begindate = $_COOKIE['archive_begin']; |
140 | 140 | $enddate = $_COOKIE['archive_end']; |
141 | 141 | |
142 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
143 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
144 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
142 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
143 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
144 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
145 | 145 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
146 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
146 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
147 | 147 | } elseif ($tracker) { |
148 | 148 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); |
149 | 149 | } elseif ($marine) { |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | |
155 | 155 | if (!empty($spotter_array)) { |
156 | 156 | if (isset($_GET['archive'])) { |
157 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
157 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
158 | 158 | } elseif ($tracker) { |
159 | 159 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
160 | 160 | } elseif ($marine) { |
@@ -165,16 +165,16 @@ discard block |
||
165 | 165 | if ($flightcnt == '') $flightcnt = 0; |
166 | 166 | } else $flightcnt = 0; |
167 | 167 | |
168 | -$sqltime = round(microtime(true)-$begintime,2); |
|
168 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
169 | 169 | $minitime = time(); |
170 | 170 | $maxitime = 0; |
171 | 171 | |
172 | 172 | |
173 | 173 | $modelsdb = array(); |
174 | 174 | if (file_exists('models/modelsdb')) { |
175 | - if (($handle = fopen('models/modelsdb','r')) !== FALSE) { |
|
176 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
177 | - if (isset($row[1]) ){ |
|
175 | + if (($handle = fopen('models/modelsdb', 'r')) !== FALSE) { |
|
176 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
177 | + if (isset($row[1])) { |
|
178 | 178 | $model = $row[0]; |
179 | 179 | $modelsdb[$model] = $row[1]; |
180 | 180 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER","interval": "%minitime%/%maxitime%"}'; |
204 | 204 | } else { |
205 | 205 | if (isset($globalArchive) && $globalArchive === TRUE) { |
206 | - $output .= ',"clock": {"currentTime" : "'.date("c",time()-$globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
206 | + $output .= ',"clock": {"currentTime" : "'.date("c", time() - $globalLiveInterval).'","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
|
207 | 207 | } else { |
208 | 208 | $output .= ',"clock": {"currentTime" : "%minitime%","multiplier" : '.$speed.',"range" : "UNBOUNDED","step": "SYSTEM_CLOCK_MULTIPLIER"}'; |
209 | 209 | } |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | $output .= '},'; |
214 | 214 | if (!empty($spotter_array) && is_array($spotter_array)) |
215 | 215 | { |
216 | - foreach($spotter_array as $spotter_item) |
|
216 | + foreach ($spotter_array as $spotter_item) |
|
217 | 217 | { |
218 | 218 | $j++; |
219 | 219 | date_default_timezone_set('UTC'); |
@@ -501,7 +501,7 @@ discard block |
||
501 | 501 | $output .= '"cartographicDegrees": ['; |
502 | 502 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
503 | 503 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
504 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
504 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
505 | 505 | $output .= $spotter_item['longitude'].', '; |
506 | 506 | $output .= $spotter_item['latitude']; |
507 | 507 | $prevlong = $spotter_item['longitude']; |
@@ -515,7 +515,7 @@ discard block |
||
515 | 515 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
516 | 516 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
517 | 517 | } else { |
518 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
518 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
519 | 519 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
520 | 520 | if ($spotter_item['ground_speed'] == 0) { |
521 | 521 | $output .= $prevlong.', '; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | $output = substr($output, 0, -1); |
548 | 548 | } |
549 | 549 | $output .= ']'; |
550 | -$output = str_replace('%minitime%',date("c",$minitime),$output); |
|
551 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
550 | +$output = str_replace('%minitime%', date("c", $minitime), $output); |
|
551 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
552 | 552 | print $output; |
553 | 553 | ?> |
@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
37 | 37 | if ($flt['airlines'][0] != '') { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
46 | 46 | if (isset($flt['source'])) { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | 48 | } else { |
49 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
53 | 53 | if (isset($flt['source'])) { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | 55 | } else { |
56 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
60 | 60 | if (isset($flt['source'])) { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | 62 | } else { |
63 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
67 | 67 | if (isset($flt['source'])) { |
68 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
68 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
73 | 73 | if ($filter['airlines'][0] != '') { |
74 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
74 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
82 | 82 | } |
83 | 83 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
84 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
84 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | 85 | } |
86 | 86 | if (isset($filter['source']) && !empty($filter['source'])) { |
87 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
87 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
88 | 88 | } |
89 | 89 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
90 | 90 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
114 | 114 | } |
115 | 115 | } |
116 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
116 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
117 | 117 | } |
118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
119 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
120 | 120 | } |
121 | 121 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
122 | 122 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
123 | 123 | if ($filter_query_where != '') { |
124 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
124 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
125 | 125 | } |
126 | 126 | $filter_query = $filter_query_join.$filter_query_where; |
127 | 127 | return $filter_query; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ($limit != '') |
145 | 145 | { |
146 | 146 | $limit_array = explode(',', $limit); |
147 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
149 | 149 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
150 | 150 | { |
151 | 151 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | } else { |
169 | 169 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
170 | 170 | } |
171 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
171 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
172 | 172 | |
173 | 173 | return $spotter_array; |
174 | 174 | } |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | { |
184 | 184 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
185 | 185 | date_default_timezone_set('UTC'); |
186 | - $filter_query = $this->getFilter($filter,true,true); |
|
186 | + $filter_query = $this->getFilter($filter, true, true); |
|
187 | 187 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
188 | 188 | if ($globalDBdriver == 'mysql') { |
189 | 189 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | try { |
207 | 207 | $sth = $this->db->prepare($query); |
208 | 208 | $sth->execute(); |
209 | - } catch(PDOException $e) { |
|
209 | + } catch (PDOException $e) { |
|
210 | 210 | echo $e->getMessage(); |
211 | 211 | die; |
212 | 212 | } |
@@ -225,26 +225,26 @@ discard block |
||
225 | 225 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
226 | 226 | date_default_timezone_set('UTC'); |
227 | 227 | |
228 | - $filter_query = $this->getFilter($filter,true,true); |
|
228 | + $filter_query = $this->getFilter($filter, true, true); |
|
229 | 229 | |
230 | 230 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
231 | 231 | if ($globalDBdriver == 'mysql') { |
232 | 232 | if (isset($globalArchive) && $globalArchive === TRUE) { |
233 | - $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, spotter_archive.date, spotter_archive.format_source |
|
233 | + $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, spotter_archive.date, spotter_archive.format_source |
|
234 | 234 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id AND spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
235 | 235 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
236 | 236 | } else { |
237 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
237 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
238 | 238 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
239 | 239 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
240 | 240 | } |
241 | 241 | } else { |
242 | 242 | if (isset($globalArchive) && $globalArchive === TRUE) { |
243 | - $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, spotter_archive.date, spotter_archive.format_source |
|
243 | + $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, spotter_archive.date, spotter_archive.format_source |
|
244 | 244 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
245 | 245 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
246 | 246 | } else { |
247 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
247 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
248 | 248 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
249 | 249 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
250 | 250 | } |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | try { |
254 | 254 | $sth = $this->db->prepare($query); |
255 | 255 | $sth->execute(); |
256 | - } catch(PDOException $e) { |
|
256 | + } catch (PDOException $e) { |
|
257 | 257 | echo $e->getMessage(); |
258 | 258 | die; |
259 | 259 | } |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | public function getLiveSpotterCount($filter = array()) |
271 | 271 | { |
272 | 272 | global $globalDBdriver, $globalLiveInterval; |
273 | - $filter_query = $this->getFilter($filter,true,true); |
|
273 | + $filter_query = $this->getFilter($filter, true, true); |
|
274 | 274 | |
275 | 275 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
276 | 276 | if ($globalDBdriver == 'mysql') { |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | try { |
284 | 284 | $sth = $this->db->prepare($query); |
285 | 285 | $sth->execute(); |
286 | - } catch(PDOException $e) { |
|
286 | + } catch (PDOException $e) { |
|
287 | 287 | echo $e->getMessage(); |
288 | 288 | die; |
289 | 289 | } |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | $filter_query = $this->getFilter($filter); |
307 | 307 | |
308 | 308 | if (is_array($coord)) { |
309 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
310 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
311 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
312 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
309 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
310 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
311 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
312 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
313 | 313 | } else return array(); |
314 | 314 | if ($globalDBdriver == 'mysql') { |
315 | 315 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -332,23 +332,23 @@ discard block |
||
332 | 332 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
333 | 333 | $Spotter = new Spotter($this->db); |
334 | 334 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
335 | - $filter_query = $this->getFilter($filter,true,true); |
|
335 | + $filter_query = $this->getFilter($filter, true, true); |
|
336 | 336 | |
337 | 337 | if (is_array($coord)) { |
338 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
339 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
340 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
341 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
338 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
339 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
340 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
341 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
342 | 342 | } else return array(); |
343 | 343 | if ($globalDBdriver == 'mysql') { |
344 | 344 | if (isset($globalArchive) && $globalArchive === TRUE) { |
345 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
345 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
346 | 346 | FROM spotter_live |
347 | 347 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
348 | 348 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
349 | 349 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
350 | 350 | } else { |
351 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
351 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
352 | 352 | FROM spotter_live |
353 | 353 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
354 | 354 | FROM spotter_live l |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | } |
361 | 361 | } else { |
362 | 362 | if (isset($globalArchive) && $globalArchive === TRUE) { |
363 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
363 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
364 | 364 | FROM spotter_live |
365 | 365 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
366 | 366 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
367 | 367 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
368 | 368 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
369 | 369 | } else { |
370 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
370 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
371 | 371 | FROM spotter_live |
372 | 372 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
373 | 373 | FROM spotter_live l |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | try { |
383 | 383 | $sth = $this->db->prepare($query); |
384 | 384 | $sth->execute(); |
385 | - } catch(PDOException $e) { |
|
385 | + } catch (PDOException $e) { |
|
386 | 386 | echo $e->getMessage(); |
387 | 387 | die; |
388 | 388 | } |
@@ -431,7 +431,7 @@ discard block |
||
431 | 431 | if ($interval == '1m') |
432 | 432 | { |
433 | 433 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
434 | - } else if ($interval == '15m'){ |
|
434 | + } else if ($interval == '15m') { |
|
435 | 435 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
436 | 436 | } |
437 | 437 | } |
@@ -439,14 +439,14 @@ discard block |
||
439 | 439 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
440 | 440 | } |
441 | 441 | |
442 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
442 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
443 | 443 | WHERE spotter_live.latitude <> '' |
444 | 444 | AND spotter_live.longitude <> '' |
445 | 445 | ".$additional_query." |
446 | 446 | HAVING distance < :radius |
447 | 447 | ORDER BY distance"; |
448 | 448 | |
449 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
449 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
450 | 450 | |
451 | 451 | return $spotter_array; |
452 | 452 | } |
@@ -464,9 +464,9 @@ discard block |
||
464 | 464 | date_default_timezone_set('UTC'); |
465 | 465 | |
466 | 466 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
467 | - $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 GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
467 | + $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 GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
468 | 468 | |
469 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
469 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
470 | 470 | |
471 | 471 | return $spotter_array; |
472 | 472 | } |
@@ -477,16 +477,16 @@ discard block |
||
477 | 477 | * @return Array the spotter information |
478 | 478 | * |
479 | 479 | */ |
480 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
480 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
481 | 481 | { |
482 | 482 | $Spotter = new Spotter($this->db); |
483 | 483 | date_default_timezone_set('UTC'); |
484 | 484 | |
485 | 485 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
486 | - $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.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
486 | + $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.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
487 | 487 | |
488 | - $date = date('c',$date); |
|
489 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
488 | + $date = date('c', $date); |
|
489 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
490 | 490 | |
491 | 491 | return $spotter_array; |
492 | 492 | } |
@@ -503,9 +503,9 @@ discard block |
||
503 | 503 | date_default_timezone_set('UTC'); |
504 | 504 | |
505 | 505 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
506 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
506 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
507 | 507 | |
508 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
508 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
509 | 509 | |
510 | 510 | return $spotter_array; |
511 | 511 | } |
@@ -516,15 +516,15 @@ discard block |
||
516 | 516 | * @return Array the spotter information |
517 | 517 | * |
518 | 518 | */ |
519 | - public function getDateLiveSpotterDataById($id,$date) |
|
519 | + public function getDateLiveSpotterDataById($id, $date) |
|
520 | 520 | { |
521 | 521 | $Spotter = new Spotter($this->db); |
522 | 522 | date_default_timezone_set('UTC'); |
523 | 523 | |
524 | 524 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
525 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | - $date = date('c',$date); |
|
527 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
525 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
526 | + $date = date('c', $date); |
|
527 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
528 | 528 | |
529 | 529 | return $spotter_array; |
530 | 530 | } |
@@ -541,13 +541,13 @@ discard block |
||
541 | 541 | date_default_timezone_set('UTC'); |
542 | 542 | |
543 | 543 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
544 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
544 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
545 | 545 | |
546 | 546 | try { |
547 | 547 | |
548 | 548 | $sth = $this->db->prepare($query); |
549 | 549 | $sth->execute(array(':ident' => $ident)); |
550 | - } catch(PDOException $e) { |
|
550 | + } catch (PDOException $e) { |
|
551 | 551 | echo $e->getMessage(); |
552 | 552 | die; |
553 | 553 | } |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | * @return Array the spotter information |
563 | 563 | * |
564 | 564 | */ |
565 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
565 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
566 | 566 | { |
567 | 567 | global $globalDBdriver, $globalLiveInterval; |
568 | 568 | date_default_timezone_set('UTC'); |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | try { |
582 | 582 | $sth = $this->db->prepare($query); |
583 | 583 | $sth->execute(array(':id' => $id)); |
584 | - } catch(PDOException $e) { |
|
584 | + } catch (PDOException $e) { |
|
585 | 585 | echo $e->getMessage(); |
586 | 586 | die; |
587 | 587 | } |
@@ -599,12 +599,12 @@ discard block |
||
599 | 599 | { |
600 | 600 | date_default_timezone_set('UTC'); |
601 | 601 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
602 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
602 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
603 | 603 | try { |
604 | 604 | |
605 | 605 | $sth = $this->db->prepare($query); |
606 | 606 | $sth->execute(array(':ident' => $ident)); |
607 | - } catch(PDOException $e) { |
|
607 | + } catch (PDOException $e) { |
|
608 | 608 | echo $e->getMessage(); |
609 | 609 | die; |
610 | 610 | } |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | |
635 | 635 | $sth = $this->db->prepare($query); |
636 | 636 | $sth->execute(); |
637 | - } catch(PDOException $e) { |
|
637 | + } catch (PDOException $e) { |
|
638 | 638 | return "error"; |
639 | 639 | } |
640 | 640 | |
@@ -657,14 +657,14 @@ discard block |
||
657 | 657 | |
658 | 658 | $sth = $this->db->prepare($query); |
659 | 659 | $sth->execute(); |
660 | - } catch(PDOException $e) { |
|
660 | + } catch (PDOException $e) { |
|
661 | 661 | return "error"; |
662 | 662 | } |
663 | 663 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
664 | 664 | $i = 0; |
665 | - $j =0; |
|
665 | + $j = 0; |
|
666 | 666 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
667 | - foreach($all as $row) |
|
667 | + foreach ($all as $row) |
|
668 | 668 | { |
669 | 669 | $i++; |
670 | 670 | $j++; |
@@ -672,9 +672,9 @@ discard block |
||
672 | 672 | if ($globalDebug) echo "."; |
673 | 673 | try { |
674 | 674 | |
675 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
675 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
676 | 676 | $sth->execute(); |
677 | - } catch(PDOException $e) { |
|
677 | + } catch (PDOException $e) { |
|
678 | 678 | return "error"; |
679 | 679 | } |
680 | 680 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -685,9 +685,9 @@ discard block |
||
685 | 685 | if ($i > 0) { |
686 | 686 | try { |
687 | 687 | |
688 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
688 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
689 | 689 | $sth->execute(); |
690 | - } catch(PDOException $e) { |
|
690 | + } catch (PDOException $e) { |
|
691 | 691 | return "error"; |
692 | 692 | } |
693 | 693 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | |
701 | 701 | $sth = $this->db->prepare($query); |
702 | 702 | $sth->execute(); |
703 | - } catch(PDOException $e) { |
|
703 | + } catch (PDOException $e) { |
|
704 | 704 | return "error"; |
705 | 705 | } |
706 | 706 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -748,13 +748,13 @@ discard block |
||
748 | 748 | public function deleteLiveSpotterDataByIdent($ident) |
749 | 749 | { |
750 | 750 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
751 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
751 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
752 | 752 | |
753 | 753 | try { |
754 | 754 | |
755 | 755 | $sth = $this->db->prepare($query); |
756 | 756 | $sth->execute(array(':ident' => $ident)); |
757 | - } catch(PDOException $e) { |
|
757 | + } catch (PDOException $e) { |
|
758 | 758 | return "error"; |
759 | 759 | } |
760 | 760 | |
@@ -770,13 +770,13 @@ discard block |
||
770 | 770 | public function deleteLiveSpotterDataById($id) |
771 | 771 | { |
772 | 772 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
773 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
773 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
774 | 774 | |
775 | 775 | try { |
776 | 776 | |
777 | 777 | $sth = $this->db->prepare($query); |
778 | 778 | $sth->execute(array(':id' => $id)); |
779 | - } catch(PDOException $e) { |
|
779 | + } catch (PDOException $e) { |
|
780 | 780 | return "error"; |
781 | 781 | } |
782 | 782 | |
@@ -794,13 +794,13 @@ discard block |
||
794 | 794 | { |
795 | 795 | global $globalDBdriver, $globalTimezone; |
796 | 796 | if ($globalDBdriver == 'mysql') { |
797 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
797 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
798 | 798 | WHERE spotter_live.ident = :ident |
799 | 799 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
800 | 800 | AND spotter_live.date < UTC_TIMESTAMP()'; |
801 | 801 | $query_data = array(':ident' => $ident); |
802 | 802 | } else { |
803 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
803 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
804 | 804 | WHERE spotter_live.ident = :ident |
805 | 805 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
806 | 806 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -809,8 +809,8 @@ discard block |
||
809 | 809 | |
810 | 810 | $sth = $this->db->prepare($query); |
811 | 811 | $sth->execute($query_data); |
812 | - $ident_result=''; |
|
813 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
812 | + $ident_result = ''; |
|
813 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
814 | 814 | { |
815 | 815 | $ident_result = $row['ident']; |
816 | 816 | } |
@@ -827,13 +827,13 @@ discard block |
||
827 | 827 | { |
828 | 828 | global $globalDBdriver, $globalTimezone; |
829 | 829 | if ($globalDBdriver == 'mysql') { |
830 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
830 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
831 | 831 | WHERE spotter_live.ident = :ident |
832 | 832 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
833 | 833 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
834 | 834 | $query_data = array(':ident' => $ident); |
835 | 835 | } else { |
836 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
836 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
837 | 837 | WHERE spotter_live.ident = :ident |
838 | 838 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
839 | 839 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -842,8 +842,8 @@ discard block |
||
842 | 842 | |
843 | 843 | $sth = $this->db->prepare($query); |
844 | 844 | $sth->execute($query_data); |
845 | - $ident_result=''; |
|
846 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
845 | + $ident_result = ''; |
|
846 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
847 | 847 | { |
848 | 848 | $ident_result = $row['flightaware_id']; |
849 | 849 | } |
@@ -860,13 +860,13 @@ discard block |
||
860 | 860 | { |
861 | 861 | global $globalDBdriver, $globalTimezone; |
862 | 862 | if ($globalDBdriver == 'mysql') { |
863 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
863 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
864 | 864 | WHERE spotter_live.flightaware_id = :id |
865 | 865 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
866 | 866 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
867 | 867 | $query_data = array(':id' => $id); |
868 | 868 | } else { |
869 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
869 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
870 | 870 | WHERE spotter_live.flightaware_id = :id |
871 | 871 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
872 | 872 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -875,8 +875,8 @@ discard block |
||
875 | 875 | |
876 | 876 | $sth = $this->db->prepare($query); |
877 | 877 | $sth->execute($query_data); |
878 | - $ident_result=''; |
|
879 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
878 | + $ident_result = ''; |
|
879 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
880 | 880 | { |
881 | 881 | $ident_result = $row['flightaware_id']; |
882 | 882 | } |
@@ -893,13 +893,13 @@ discard block |
||
893 | 893 | { |
894 | 894 | global $globalDBdriver, $globalTimezone; |
895 | 895 | if ($globalDBdriver == 'mysql') { |
896 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
896 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
897 | 897 | WHERE spotter_live.ModeS = :modes |
898 | 898 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
899 | 899 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
900 | 900 | $query_data = array(':modes' => $modes); |
901 | 901 | } else { |
902 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
902 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
903 | 903 | WHERE spotter_live.ModeS = :modes |
904 | 904 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
905 | 905 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -908,8 +908,8 @@ discard block |
||
908 | 908 | |
909 | 909 | $sth = $this->db->prepare($query); |
910 | 910 | $sth->execute($query_data); |
911 | - $ident_result=''; |
|
912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
911 | + $ident_result = ''; |
|
912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
913 | 913 | { |
914 | 914 | //$ident_result = $row['spotter_live_id']; |
915 | 915 | $ident_result = $row['flightaware_id']; |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | * @return String success or false |
929 | 929 | * |
930 | 930 | */ |
931 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
931 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
932 | 932 | { |
933 | 933 | global $globalURL, $globalArchive, $globalDebug; |
934 | 934 | $Common = new Common(); |
@@ -1021,26 +1021,26 @@ discard block |
||
1021 | 1021 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1022 | 1022 | |
1023 | 1023 | |
1024 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1025 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1026 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1027 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1028 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1029 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1030 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1031 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1032 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1033 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1034 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1035 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1036 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1037 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1038 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1039 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1040 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1041 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1042 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1043 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1024 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1025 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1026 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1027 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1028 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1029 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1030 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1031 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1032 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1033 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1034 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1035 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1036 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1037 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1038 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1039 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1040 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1041 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1042 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1043 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1044 | 1044 | |
1045 | 1045 | $airline_name = ''; |
1046 | 1046 | $airline_icao = ''; |
@@ -1062,10 +1062,10 @@ discard block |
||
1062 | 1062 | $arrival_airport_country = ''; |
1063 | 1063 | |
1064 | 1064 | |
1065 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1066 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1067 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1068 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1065 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1066 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1067 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1068 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1069 | 1069 | |
1070 | 1070 | $query = ''; |
1071 | 1071 | if ($globalArchive) { |
@@ -1076,19 +1076,19 @@ discard block |
||
1076 | 1076 | $query .= 'INSERT INTO spotter_live (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, 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, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
1077 | 1077 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,: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,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
1078 | 1078 | |
1079 | - $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_shadow' => $aircraft_shadow,':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,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
1079 | + $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_shadow' => $aircraft_shadow, ':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, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country); |
|
1080 | 1080 | try { |
1081 | 1081 | |
1082 | 1082 | $sth = $this->db->prepare($query); |
1083 | 1083 | $sth->execute($query_values); |
1084 | 1084 | $sth->closeCursor(); |
1085 | - } catch(PDOException $e) { |
|
1085 | + } catch (PDOException $e) { |
|
1086 | 1086 | return "error : ".$e->getMessage(); |
1087 | 1087 | } |
1088 | 1088 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1089 | 1089 | if ($globalDebug) echo '(Add to SBS archive : '; |
1090 | 1090 | $SpotterArchive = new SpotterArchive($this->db); |
1091 | - $result = $SpotterArchive->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, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1091 | + $result = $SpotterArchive->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, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1092 | 1092 | if ($globalDebug) echo $result.')'; |
1093 | 1093 | } |
1094 | 1094 | return "success"; |
@@ -1097,7 +1097,7 @@ discard block |
||
1097 | 1097 | |
1098 | 1098 | public function getOrderBy() |
1099 | 1099 | { |
1100 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1100 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1101 | 1101 | return $orderby; |
1102 | 1102 | } |
1103 | 1103 |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
74 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING); |
|
96 | + $famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
100 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | if (!empty($spotter_array) || $usecoord) { |
154 | 154 | if ($usecoord) { |
155 | 155 | if (isset($_GET['archive'])) { |
156 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
156 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
157 | 157 | } else { |
158 | 158 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 159 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ($flightcnt == '') $flightcnt = 0; |
162 | 162 | } else $flightcnt = 0; |
163 | 163 | |
164 | -$sqltime = round(microtime(true)-$begintime,2); |
|
164 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
165 | 165 | |
166 | 166 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
167 | 167 | else $usenextlatlon = true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($spotter_array) && is_array($spotter_array)) |
179 | 179 | { |
180 | 180 | $output .= '"features": ['; |
181 | - foreach($spotter_array as $spotter_item) |
|
181 | + foreach ($spotter_array as $spotter_item) |
|
182 | 182 | { |
183 | 183 | $j++; |
184 | 184 | date_default_timezone_set('UTC'); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | */ |
235 | 235 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 236 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
238 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
237 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
238 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
239 | 239 | //" |
240 | 240 | } else { |
241 | 241 | if ($compress) $output .= '"c": "NA",'; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
245 | 245 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 246 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
247 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
248 | 248 | } elseif (isset($spotter_item['aircraft_type'])) { |
249 | 249 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
250 | 250 | } elseif (!$min) { |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
385 | 385 | |
386 | 386 | if (isset($archivespeed)) { |
387 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
387 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
388 | 388 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
389 | 389 | } elseif ($usenextlatlon) { |
390 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
390 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
391 | 391 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 392 | } |
393 | 393 | |
394 | 394 | if (!$min) $output .= '"image": "'.$image.'",'; |
395 | 395 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
396 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
397 | 397 | } |
398 | 398 | if (isset($spotter_item['image_source_website'])) { |
399 | 399 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
416 | 416 | } |
417 | 417 | if (isset($spotter_item['acars'])) { |
418 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
418 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
419 | 419 | } |
420 | 420 | // type when not aircraft ? |
421 | 421 | if (isset($spotter_item['type'])) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | } |
495 | 495 | */ |
496 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
496 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
497 | 497 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
498 | 498 | |
499 | 499 | if ( |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
503 | 503 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
504 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
505 | 505 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
506 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
506 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
507 | 507 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
508 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
508 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
509 | 509 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
510 | 510 | ) { |
511 | 511 | if ($tracker) { |
@@ -538,9 +538,9 @@ discard block |
||
538 | 538 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
539 | 539 | } |
540 | 540 | $output_history .= '['; |
541 | - $output_history .= $spotter_history['longitude'].', '; |
|
542 | - $output_history .= $spotter_history['latitude'].', '; |
|
543 | - $output_history .= $spotter_history['altitude']*30.48; |
|
541 | + $output_history .= $spotter_history['longitude'].', '; |
|
542 | + $output_history .= $spotter_history['latitude'].', '; |
|
543 | + $output_history .= $spotter_history['altitude']*30.48; |
|
544 | 544 | $output_history .= '],'; |
545 | 545 | /* |
546 | 546 | if ($from_archive === false) { |
@@ -558,8 +558,8 @@ discard block |
||
558 | 558 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
559 | 559 | } else $d = true; |
560 | 560 | $output_history .= '['; |
561 | - $output_history .= $spotter_history['longitude'].', '; |
|
562 | - $output_history .= $spotter_history['latitude']; |
|
561 | + $output_history .= $spotter_history['longitude'].', '; |
|
562 | + $output_history .= $spotter_history['latitude']; |
|
563 | 563 | $output_history .= '],'; |
564 | 564 | /* |
565 | 565 | if ($from_archive === false) { |
@@ -575,9 +575,9 @@ discard block |
||
575 | 575 | |
576 | 576 | if ($from_archive === false) { |
577 | 577 | $output_historyd = '['; |
578 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
579 | - $output_historyd .= $spotter_item['latitude']; |
|
580 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
578 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
579 | + $output_historyd .= $spotter_item['latitude']; |
|
580 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
581 | 581 | $output_historyd .= '],'; |
582 | 582 | //$output_history = $output_historyd.$output_history; |
583 | 583 | $output_history = $output_history.$output_historyd; |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | $output = substr($output, 0, -1); |
618 | 618 | $output .= ']'; |
619 | 619 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
620 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
620 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
621 | 621 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
622 | 622 | $output .= '"fc": "'.$j.'"'; |
623 | 623 | } else { |