@@ -14,75 +14,75 @@ discard block |
||
| 14 | 14 | * @param Array $filter the filter |
| 15 | 15 | * @return Array the SQL part |
| 16 | 16 | */ |
| 17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 19 | 19 | $filters = array(); |
| 20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
| 23 | 23 | } else { |
| 24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | if (isset($filter[0]['source'])) { |
| 28 | - $filters = array_merge($filters,$filter); |
|
| 28 | + $filters = array_merge($filters, $filter); |
|
| 29 | 29 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 31 | 31 | $filter_query_join = ''; |
| 32 | 32 | $filter_query_where = ''; |
| 33 | - foreach($filters as $flt) { |
|
| 33 | + foreach ($filters as $flt) { |
|
| 34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
| 36 | 36 | if (isset($flt['source'])) { |
| 37 | - $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 | + $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"; |
|
| 38 | 38 | } else { |
| 39 | - $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 | + $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"; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 44 | 44 | if (isset($flt['source'])) { |
| 45 | - $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 | + $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"; |
|
| 46 | 46 | } else { |
| 47 | - $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 | + $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"; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 51 | 51 | if (isset($flt['source'])) { |
| 52 | - $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 | + $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"; |
|
| 53 | 53 | } else { |
| 54 | - $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 | + $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"; |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 58 | 58 | if (isset($flt['source'])) { |
| 59 | - $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 | + $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"; |
|
| 60 | 60 | } else { |
| 61 | - $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 | + $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"; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | 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']))) { |
| 65 | 65 | if (isset($flt['source'])) { |
| 66 | - $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 | + $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"; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
| 70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
| 72 | - $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 | + $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"; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 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 | 82 | if (count($filter['source']) == 1) { |
| 83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
| 84 | 84 | } else { |
| 85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
| 93 | 93 | } |
| 94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 96 | 96 | } |
| 97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
| 98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
| 117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
| 118 | 118 | } |
| 119 | 119 | } |
| 120 | - $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"; |
|
| 120 | + $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"; |
|
| 121 | 121 | } |
| 122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 124 | 124 | if ($filter_query_where != '') { |
| 125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 126 | 126 | } |
| 127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
| 128 | 128 | return $filter_query; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | // Spotter_archive |
| 132 | - 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 = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
| 132 | + 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 = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
| 133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
| 134 | 134 | if ($over_country == '') { |
| 135 | 135 | $Spotter = new Spotter($this->db); |
| 136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
| 136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
| 137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
| 138 | 138 | else $country = ''; |
| 139 | 139 | } else $country = $over_country; |
| 140 | - if ($airline_type === NULL) $airline_type =''; |
|
| 140 | + if ($airline_type === NULL) $airline_type = ''; |
|
| 141 | 141 | |
| 142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
| 143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
| 144 | 144 | |
| 145 | 145 | // Route is not added in spotter_archive |
| 146 | - $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,real_altitude) |
|
| 146 | + $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,real_altitude) |
|
| 147 | 147 | 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,:real_altitude)"; |
| 148 | 148 | |
| 149 | - $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,':real_altitude' => $real_altitude); |
|
| 149 | + $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, ':real_altitude' => $real_altitude); |
|
| 150 | 150 | try { |
| 151 | 151 | $sth = $this->db->prepare($query); |
| 152 | 152 | $sth->execute($query_values); |
| 153 | 153 | $sth->closeCursor(); |
| 154 | - } catch(PDOException $e) { |
|
| 154 | + } catch (PDOException $e) { |
|
| 155 | 155 | return "error : ".$e->getMessage(); |
| 156 | 156 | } |
| 157 | 157 | return "success"; |
@@ -170,9 +170,9 @@ discard block |
||
| 170 | 170 | |
| 171 | 171 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 172 | 172 | //$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"; |
| 173 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 173 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
| 174 | 174 | |
| 175 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
| 175 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
| 176 | 176 | |
| 177 | 177 | return $spotter_array; |
| 178 | 178 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 191 | 191 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
| 192 | 192 | //$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"; |
| 193 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
| 193 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
| 194 | 194 | |
| 195 | 195 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
| 196 | 196 | /* |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
| 205 | 205 | */ |
| 206 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
| 206 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
| 207 | 207 | |
| 208 | 208 | return $spotter_array; |
| 209 | 209 | } |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | public function getAllArchiveSpotterDataById($id) { |
| 218 | 218 | date_default_timezone_set('UTC'); |
| 219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 220 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 220 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 221 | 221 | |
| 222 | 222 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
| 223 | 223 | |
| 224 | 224 | try { |
| 225 | 225 | $sth = $this->db->prepare($query); |
| 226 | 226 | $sth->execute(array(':id' => $id)); |
| 227 | - } catch(PDOException $e) { |
|
| 227 | + } catch (PDOException $e) { |
|
| 228 | 228 | echo $e->getMessage(); |
| 229 | 229 | die; |
| 230 | 230 | } |
@@ -242,11 +242,11 @@ discard block |
||
| 242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
| 243 | 243 | date_default_timezone_set('UTC'); |
| 244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 245 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
| 245 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
| 246 | 246 | try { |
| 247 | 247 | $sth = $this->db->prepare($query); |
| 248 | 248 | $sth->execute(array(':id' => $id)); |
| 249 | - } catch(PDOException $e) { |
|
| 249 | + } catch (PDOException $e) { |
|
| 250 | 250 | echo $e->getMessage(); |
| 251 | 251 | die; |
| 252 | 252 | } |
@@ -260,14 +260,14 @@ discard block |
||
| 260 | 260 | * @return Array the spotter information |
| 261 | 261 | * |
| 262 | 262 | */ |
| 263 | - public function getCoordArchiveSpotterDataByIdDate($id,$begindate,$enddate) { |
|
| 263 | + public function getCoordArchiveSpotterDataByIdDate($id, $begindate, $enddate) { |
|
| 264 | 264 | date_default_timezone_set('UTC'); |
| 265 | 265 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 266 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
| 266 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
| 267 | 267 | try { |
| 268 | 268 | $sth = $this->db->prepare($query); |
| 269 | - $sth->execute(array(':id' => $id,':begindate' => $begindate,':enddate' => $enddate)); |
|
| 270 | - } catch(PDOException $e) { |
|
| 269 | + $sth->execute(array(':id' => $id, ':begindate' => $begindate, ':enddate' => $enddate)); |
|
| 270 | + } catch (PDOException $e) { |
|
| 271 | 271 | echo $e->getMessage(); |
| 272 | 272 | die; |
| 273 | 273 | } |
@@ -287,12 +287,12 @@ discard block |
||
| 287 | 287 | date_default_timezone_set('UTC'); |
| 288 | 288 | |
| 289 | 289 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 290 | - $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"; |
|
| 290 | + $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"; |
|
| 291 | 291 | |
| 292 | 292 | try { |
| 293 | 293 | $sth = $this->db->prepare($query); |
| 294 | 294 | $sth->execute(array(':ident' => $ident)); |
| 295 | - } catch(PDOException $e) { |
|
| 295 | + } catch (PDOException $e) { |
|
| 296 | 296 | echo $e->getMessage(); |
| 297 | 297 | die; |
| 298 | 298 | } |
@@ -312,12 +312,12 @@ discard block |
||
| 312 | 312 | date_default_timezone_set('UTC'); |
| 313 | 313 | |
| 314 | 314 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 315 | - $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"; |
|
| 315 | + $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"; |
|
| 316 | 316 | |
| 317 | 317 | try { |
| 318 | 318 | $sth = $this->db->prepare($query); |
| 319 | 319 | $sth->execute(array(':id' => $id)); |
| 320 | - } catch(PDOException $e) { |
|
| 320 | + } catch (PDOException $e) { |
|
| 321 | 321 | echo $e->getMessage(); |
| 322 | 322 | die; |
| 323 | 323 | } |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
| 336 | 336 | date_default_timezone_set('UTC'); |
| 337 | 337 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 338 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 338 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
| 339 | 339 | try { |
| 340 | 340 | $sth = $this->db->prepare($query); |
| 341 | 341 | $sth->execute(array(':id' => $id)); |
| 342 | - } catch(PDOException $e) { |
|
| 342 | + } catch (PDOException $e) { |
|
| 343 | 343 | echo $e->getMessage(); |
| 344 | 344 | die; |
| 345 | 345 | } |
@@ -356,12 +356,12 @@ discard block |
||
| 356 | 356 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
| 357 | 357 | date_default_timezone_set('UTC'); |
| 358 | 358 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 359 | - $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"; |
|
| 359 | + $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"; |
|
| 360 | 360 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
| 361 | 361 | try { |
| 362 | 362 | $sth = $this->db->prepare($query); |
| 363 | 363 | $sth->execute(array(':ident' => $ident)); |
| 364 | - } catch(PDOException $e) { |
|
| 364 | + } catch (PDOException $e) { |
|
| 365 | 365 | echo $e->getMessage(); |
| 366 | 366 | die; |
| 367 | 367 | } |
@@ -377,11 +377,11 @@ discard block |
||
| 377 | 377 | * @return Array the spotter information |
| 378 | 378 | * |
| 379 | 379 | */ |
| 380 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) { |
|
| 380 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) { |
|
| 381 | 381 | $Spotter = new Spotter($this->db); |
| 382 | 382 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 383 | - $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"; |
|
| 384 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
| 383 | + $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"; |
|
| 384 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
| 385 | 385 | return $spotter_array; |
| 386 | 386 | } |
| 387 | 387 | |
@@ -395,7 +395,7 @@ discard block |
||
| 395 | 395 | try { |
| 396 | 396 | $sth = $this->db->prepare($query); |
| 397 | 397 | $sth->execute(); |
| 398 | - } catch(PDOException $e) { |
|
| 398 | + } catch (PDOException $e) { |
|
| 399 | 399 | echo $e->getMessage(); |
| 400 | 400 | die; |
| 401 | 401 | } |
@@ -407,34 +407,34 @@ discard block |
||
| 407 | 407 | * @return Array the spotter information |
| 408 | 408 | * |
| 409 | 409 | */ |
| 410 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array()) { |
|
| 410 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array()) { |
|
| 411 | 411 | global $globalDBdriver, $globalLiveInterval; |
| 412 | 412 | date_default_timezone_set('UTC'); |
| 413 | 413 | //$filter_query = $this->getFilter($filter,true,true); |
| 414 | 414 | |
| 415 | 415 | $filter_query = ''; |
| 416 | 416 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 417 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 417 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 418 | 418 | } |
| 419 | 419 | // Use spotter_output also ? |
| 420 | 420 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 421 | - $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 "; |
|
| 421 | + $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 "; |
|
| 422 | 422 | } |
| 423 | 423 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 424 | 424 | $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 "; |
| 425 | 425 | } |
| 426 | 426 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 427 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 427 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | if ($globalDBdriver == 'mysql') { |
| 431 | - $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 |
|
| 431 | + $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 |
|
| 432 | 432 | FROM spotter_archive |
| 433 | 433 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
| 434 | 434 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
| 435 | 435 | '.$filter_query.' ORDER BY flightaware_id'; |
| 436 | 436 | } else { |
| 437 | - $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, 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 |
|
| 437 | + $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, 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 |
|
| 438 | 438 | FROM spotter_archive |
| 439 | 439 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive.aircraft_icao = a.icao |
| 440 | 440 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
@@ -444,7 +444,7 @@ discard block |
||
| 444 | 444 | try { |
| 445 | 445 | $sth = $this->db->prepare($query); |
| 446 | 446 | $sth->execute(); |
| 447 | - } catch(PDOException $e) { |
|
| 447 | + } catch (PDOException $e) { |
|
| 448 | 448 | echo $e->getMessage(); |
| 449 | 449 | die; |
| 450 | 450 | } |
@@ -458,7 +458,7 @@ discard block |
||
| 458 | 458 | * @return Array the spotter information |
| 459 | 459 | * |
| 460 | 460 | */ |
| 461 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
|
| 461 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) { |
|
| 462 | 462 | global $globalDBdriver, $globalLiveInterval; |
| 463 | 463 | date_default_timezone_set('UTC'); |
| 464 | 464 | |
@@ -466,17 +466,17 @@ discard block |
||
| 466 | 466 | |
| 467 | 467 | $filter_query = ''; |
| 468 | 468 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 469 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 469 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 470 | 470 | } |
| 471 | 471 | // Use spotter_output also ? |
| 472 | 472 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 473 | - $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 "; |
|
| 473 | + $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 "; |
|
| 474 | 474 | } |
| 475 | 475 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 476 | 476 | $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 "; |
| 477 | 477 | } |
| 478 | 478 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 479 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 479 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | FROM spotter_archive |
| 488 | 488 | 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'; |
| 489 | 489 | */ |
| 490 | - $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 |
|
| 490 | + $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 |
|
| 491 | 491 | FROM spotter_archive_output |
| 492 | 492 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
| 493 | 493 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -502,7 +502,7 @@ discard block |
||
| 502 | 502 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
| 503 | 503 | '.$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'; |
| 504 | 504 | */ |
| 505 | - $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 |
|
| 505 | + $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 |
|
| 506 | 506 | FROM spotter_archive_output |
| 507 | 507 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
| 508 | 508 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | try { |
| 515 | 515 | $sth = $this->db->prepare($query); |
| 516 | 516 | $sth->execute(); |
| 517 | - } catch(PDOException $e) { |
|
| 517 | + } catch (PDOException $e) { |
|
| 518 | 518 | echo $e->getMessage(); |
| 519 | 519 | die; |
| 520 | 520 | } |
@@ -529,22 +529,22 @@ discard block |
||
| 529 | 529 | * @return Array the spotter information |
| 530 | 530 | * |
| 531 | 531 | */ |
| 532 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
|
| 532 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) { |
|
| 533 | 533 | global $globalDBdriver, $globalLiveInterval; |
| 534 | 534 | date_default_timezone_set('UTC'); |
| 535 | 535 | |
| 536 | 536 | $filter_query = ''; |
| 537 | 537 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 538 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
| 538 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
| 539 | 539 | } |
| 540 | 540 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 541 | - $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 "; |
|
| 541 | + $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 "; |
|
| 542 | 542 | } |
| 543 | 543 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 544 | 544 | $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 "; |
| 545 | 545 | } |
| 546 | 546 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 547 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 547 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 548 | 548 | } |
| 549 | 549 | |
| 550 | 550 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -559,7 +559,7 @@ discard block |
||
| 559 | 559 | try { |
| 560 | 560 | $sth = $this->db->prepare($query); |
| 561 | 561 | $sth->execute(); |
| 562 | - } catch(PDOException $e) { |
|
| 562 | + } catch (PDOException $e) { |
|
| 563 | 563 | echo $e->getMessage(); |
| 564 | 564 | die; |
| 565 | 565 | } |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | * @return Array the spotter information |
| 580 | 580 | * |
| 581 | 581 | */ |
| 582 | - 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()) { |
|
| 582 | + 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()) { |
|
| 583 | 583 | global $globalTimezone, $globalDBdriver; |
| 584 | 584 | require_once(dirname(__FILE__).'/class.Translation.php'); |
| 585 | 585 | $Translation = new Translation($this->db); |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | } |
| 630 | 630 | |
| 631 | 631 | if ($registration != "") { |
| 632 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 632 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 633 | 633 | if (!is_string($registration)) { |
| 634 | 634 | return array(); |
| 635 | 635 | } else { |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | } |
| 639 | 639 | |
| 640 | 640 | if ($aircraft_icao != "") { |
| 641 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 641 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 642 | 642 | if (!is_string($aircraft_icao)) { |
| 643 | 643 | return array(); |
| 644 | 644 | } else { |
@@ -647,7 +647,7 @@ discard block |
||
| 647 | 647 | } |
| 648 | 648 | |
| 649 | 649 | if ($aircraft_manufacturer != "") { |
| 650 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 650 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 651 | 651 | if (!is_string($aircraft_manufacturer)) { |
| 652 | 652 | return array(); |
| 653 | 653 | } else { |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | if ($airline_icao != "") { |
| 667 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 667 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 668 | 668 | if (!is_string($airline_icao)) { |
| 669 | 669 | return array(); |
| 670 | 670 | } else { |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | if ($airline_country != "") { |
| 676 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 676 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 677 | 677 | if (!is_string($airline_country)) { |
| 678 | 678 | return array(); |
| 679 | 679 | } else { |
@@ -682,7 +682,7 @@ discard block |
||
| 682 | 682 | } |
| 683 | 683 | |
| 684 | 684 | if ($airline_type != "") { |
| 685 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 685 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 686 | 686 | if (!is_string($airline_type)) { |
| 687 | 687 | return array(); |
| 688 | 688 | } else { |
@@ -699,7 +699,7 @@ discard block |
||
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | if ($airport != "") { |
| 702 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 702 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 703 | 703 | if (!is_string($airport)) { |
| 704 | 704 | return array(); |
| 705 | 705 | } else { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | } |
| 709 | 709 | |
| 710 | 710 | if ($airport_country != "") { |
| 711 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 711 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 712 | 712 | if (!is_string($airport_country)) { |
| 713 | 713 | return array(); |
| 714 | 714 | } else { |
@@ -717,14 +717,14 @@ discard block |
||
| 717 | 717 | } |
| 718 | 718 | |
| 719 | 719 | if ($callsign != "") { |
| 720 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 720 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 721 | 721 | if (!is_string($callsign)) { |
| 722 | 722 | return array(); |
| 723 | 723 | } else { |
| 724 | 724 | $translate = $Translation->ident2icao($callsign); |
| 725 | 725 | if ($translate != $callsign) { |
| 726 | 726 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
| 727 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 727 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 728 | 728 | } else { |
| 729 | 729 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
| 730 | 730 | } |
@@ -732,7 +732,7 @@ discard block |
||
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | if ($owner != "") { |
| 735 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 735 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 736 | 736 | if (!is_string($owner)) { |
| 737 | 737 | return array(); |
| 738 | 738 | } else { |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | if ($pilot_name != "") { |
| 744 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 744 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 745 | 745 | if (!is_string($pilot_name)) { |
| 746 | 746 | return array(); |
| 747 | 747 | } else { |
@@ -750,7 +750,7 @@ discard block |
||
| 750 | 750 | } |
| 751 | 751 | |
| 752 | 752 | if ($pilot_id != "") { |
| 753 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 753 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 754 | 754 | if (!is_string($pilot_id)) { |
| 755 | 755 | return array(); |
| 756 | 756 | } else { |
@@ -759,7 +759,7 @@ discard block |
||
| 759 | 759 | } |
| 760 | 760 | |
| 761 | 761 | if ($departure_airport_route != "") { |
| 762 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 762 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 763 | 763 | if (!is_string($departure_airport_route)) { |
| 764 | 764 | return array(); |
| 765 | 765 | } else { |
@@ -768,7 +768,7 @@ discard block |
||
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | if ($arrival_airport_route != "") { |
| 771 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 771 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 772 | 772 | if (!is_string($arrival_airport_route)) { |
| 773 | 773 | return array(); |
| 774 | 774 | } else { |
@@ -779,8 +779,8 @@ discard block |
||
| 779 | 779 | if ($altitude != "") { |
| 780 | 780 | $altitude_array = explode(",", $altitude); |
| 781 | 781 | |
| 782 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 783 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 782 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 783 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | if ($altitude_array[1] != "") { |
@@ -795,8 +795,8 @@ discard block |
||
| 795 | 795 | |
| 796 | 796 | if ($date_posted != "") { |
| 797 | 797 | $date_array = explode(",", $date_posted); |
| 798 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 799 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 798 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 799 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 800 | 800 | if ($globalTimezone != '') { |
| 801 | 801 | date_default_timezone_set($globalTimezone); |
| 802 | 802 | $datetime = new DateTime(); |
@@ -821,16 +821,16 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | if ($limit != "") { |
| 823 | 823 | $limit_array = explode(",", $limit); |
| 824 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 825 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 824 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 825 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 826 | 826 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
| 827 | 827 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
| 828 | 828 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | 831 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 832 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
| 833 | - $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 |
|
| 832 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
| 833 | + $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 |
|
| 834 | 834 | 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)) |
| 835 | 835 | 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"; |
| 836 | 836 | } else { |
@@ -844,12 +844,12 @@ discard block |
||
| 844 | 844 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
| 847 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
| 848 | 848 | WHERE spotter_archive_output.ident <> '' |
| 849 | 849 | ".$additional_query." |
| 850 | 850 | ".$filter_query.$orderby_query; |
| 851 | 851 | } |
| 852 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
| 852 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
| 853 | 853 | return $spotter_array; |
| 854 | 854 | } |
| 855 | 855 | |
@@ -864,7 +864,7 @@ discard block |
||
| 864 | 864 | try { |
| 865 | 865 | $sth = $this->db->prepare($query); |
| 866 | 866 | $sth->execute(); |
| 867 | - } catch(PDOException $e) { |
|
| 867 | + } catch (PDOException $e) { |
|
| 868 | 868 | return "error"; |
| 869 | 869 | } |
| 870 | 870 | } |
@@ -897,8 +897,8 @@ discard block |
||
| 897 | 897 | if ($limit != "") { |
| 898 | 898 | $limit_array = explode(",", $limit); |
| 899 | 899 | |
| 900 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 901 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 900 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 901 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 902 | 902 | |
| 903 | 903 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
| 904 | 904 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | $query_values = array(); |
| 937 | 937 | $limit_query = ''; |
| 938 | 938 | $additional_query = ''; |
| 939 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 939 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 940 | 940 | |
| 941 | 941 | if ($owner != "") { |
| 942 | 942 | if (!is_string($owner)) { |
@@ -950,8 +950,8 @@ discard block |
||
| 950 | 950 | if ($limit != "") { |
| 951 | 951 | $limit_array = explode(",", $limit); |
| 952 | 952 | |
| 953 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 954 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 953 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 954 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 955 | 955 | |
| 956 | 956 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
| 957 | 957 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -988,7 +988,7 @@ discard block |
||
| 988 | 988 | $query_values = array(); |
| 989 | 989 | $limit_query = ''; |
| 990 | 990 | $additional_query = ''; |
| 991 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 991 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 992 | 992 | |
| 993 | 993 | if ($pilot != "") { |
| 994 | 994 | $additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)"; |
@@ -998,8 +998,8 @@ discard block |
||
| 998 | 998 | if ($limit != "") { |
| 999 | 999 | $limit_array = explode(",", $limit); |
| 1000 | 1000 | |
| 1001 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1002 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1001 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1002 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1003 | 1003 | |
| 1004 | 1004 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
| 1005 | 1005 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | * @return Array the airline country list |
| 1028 | 1028 | * |
| 1029 | 1029 | */ |
| 1030 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
| 1030 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
| 1031 | 1031 | global $globalDBdriver; |
| 1032 | 1032 | /* |
| 1033 | 1033 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1055,7 +1055,7 @@ discard block |
||
| 1055 | 1055 | $flight_array = array(); |
| 1056 | 1056 | $temp_array = array(); |
| 1057 | 1057 | |
| 1058 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 1058 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 1059 | 1059 | $temp_array['flight_count'] = $row['nb']; |
| 1060 | 1060 | $temp_array['flight_country'] = $row['name']; |
| 1061 | 1061 | $temp_array['flight_country_iso3'] = $row['iso3']; |
@@ -1071,7 +1071,7 @@ discard block |
||
| 1071 | 1071 | * @return Array the airline country list |
| 1072 | 1072 | * |
| 1073 | 1073 | */ |
| 1074 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
| 1074 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
| 1075 | 1075 | global $globalDBdriver; |
| 1076 | 1076 | /* |
| 1077 | 1077 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1099,7 +1099,7 @@ discard block |
||
| 1099 | 1099 | $flight_array = array(); |
| 1100 | 1100 | $temp_array = array(); |
| 1101 | 1101 | |
| 1102 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 1102 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 1103 | 1103 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 1104 | 1104 | $temp_array['flight_count'] = $row['nb']; |
| 1105 | 1105 | $temp_array['flight_country'] = $row['name']; |
@@ -1116,13 +1116,13 @@ discard block |
||
| 1116 | 1116 | * @return Array the spotter information |
| 1117 | 1117 | * |
| 1118 | 1118 | */ |
| 1119 | - public function getDateArchiveSpotterDataById($id,$date) { |
|
| 1119 | + public function getDateArchiveSpotterDataById($id, $date) { |
|
| 1120 | 1120 | $Spotter = new Spotter($this->db); |
| 1121 | 1121 | date_default_timezone_set('UTC'); |
| 1122 | 1122 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 1123 | - $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'; |
|
| 1124 | - $date = date('c',$date); |
|
| 1125 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
| 1123 | + $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'; |
|
| 1124 | + $date = date('c', $date); |
|
| 1125 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
| 1126 | 1126 | return $spotter_array; |
| 1127 | 1127 | } |
| 1128 | 1128 | |
@@ -1132,13 +1132,13 @@ discard block |
||
| 1132 | 1132 | * @return Array the spotter information |
| 1133 | 1133 | * |
| 1134 | 1134 | */ |
| 1135 | - public function getDateArchiveSpotterDataByIdent($ident,$date) { |
|
| 1135 | + public function getDateArchiveSpotterDataByIdent($ident, $date) { |
|
| 1136 | 1136 | $Spotter = new Spotter($this->db); |
| 1137 | 1137 | date_default_timezone_set('UTC'); |
| 1138 | 1138 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 1139 | - $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'; |
|
| 1140 | - $date = date('c',$date); |
|
| 1141 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 1139 | + $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'; |
|
| 1140 | + $date = date('c', $date); |
|
| 1141 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 1142 | 1142 | return $spotter_array; |
| 1143 | 1143 | } |
| 1144 | 1144 | |
@@ -1148,14 +1148,14 @@ discard block |
||
| 1148 | 1148 | * @return Array the spotter information |
| 1149 | 1149 | * |
| 1150 | 1150 | */ |
| 1151 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
|
| 1151 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) { |
|
| 1152 | 1152 | global $global_query; |
| 1153 | 1153 | $Spotter = new Spotter($this->db); |
| 1154 | 1154 | date_default_timezone_set('UTC'); |
| 1155 | 1155 | $query_values = array(); |
| 1156 | 1156 | $limit_query = ''; |
| 1157 | 1157 | $additional_query = ''; |
| 1158 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1158 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1159 | 1159 | |
| 1160 | 1160 | if ($airport != "") { |
| 1161 | 1161 | if (!is_string($airport)) { |
@@ -1169,8 +1169,8 @@ discard block |
||
| 1169 | 1169 | if ($limit != "") { |
| 1170 | 1170 | $limit_array = explode(",", $limit); |
| 1171 | 1171 | |
| 1172 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1173 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1172 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1173 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1174 | 1174 | |
| 1175 | 1175 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
| 1176 | 1176 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -60,24 +60,24 @@ discard block |
||
| 60 | 60 | $min = false; |
| 61 | 61 | $allhistory = false; |
| 62 | 62 | $filter['source'] = array(); |
| 63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 63 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 66 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 67 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 68 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 69 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 70 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 71 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 72 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 73 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 74 | 74 | |
| 75 | 75 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 76 | 76 | $min = true; |
| 77 | 77 | } else $min = false; |
| 78 | 78 | |
| 79 | 79 | if (isset($_GET['ident'])) { |
| 80 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 80 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 81 | 81 | $from_archive = true; |
| 82 | 82 | if ($tracker) { |
| 83 | 83 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | $allhistory = true; |
| 92 | 92 | } |
| 93 | 93 | elseif (isset($_GET['flightaware_id'])) { |
| 94 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 94 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 95 | 95 | $from_archive = true; |
| 96 | 96 | if ($tracker) { |
| 97 | 97 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -106,23 +106,23 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
| 108 | 108 | $from_archive = true; |
| 109 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 109 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 110 | 110 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
| 111 | 111 | else $begindate = $begindate - 3000; |
| 112 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 113 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 112 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 113 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 114 | 114 | if ($begindate != '' && $enddate != '') { |
| 115 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 116 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 115 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 116 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 117 | 117 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
| 118 | 118 | if ($tracker) { |
| 119 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
| 119 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
| 120 | 120 | } |
| 121 | 121 | elseif ($marine) { |
| 122 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
| 122 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
| 123 | 123 | } |
| 124 | 124 | else { |
| 125 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 125 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | if ($flightcnt == '') $flightcnt = 0; |
| 134 | 134 | } else $flightcnt = 0; |
| 135 | 135 | |
| 136 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 136 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 137 | 137 | |
| 138 | 138 | $pfi = ''; |
| 139 | 139 | //var_dump($spotter_array); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | if (!empty($spotter_array) && is_array($spotter_array)) { |
| 150 | 150 | $output .= '"features": ['; |
| 151 | - foreach($spotter_array as $spotter_item) { |
|
| 151 | + foreach ($spotter_array as $spotter_item) { |
|
| 152 | 152 | $j++; |
| 153 | 153 | date_default_timezone_set('UTC'); |
| 154 | 154 | if ($tracker) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | else { |
| 167 | 167 | if ($pfi != $spotter_item['flightaware_id']) { |
| 168 | 168 | //$spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']); |
| 169 | - $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataByIdDate($spotter_item['flightaware_id'],$begindate,$enddate); |
|
| 169 | + $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataByIdDate($spotter_item['flightaware_id'], $begindate, $enddate); |
|
| 170 | 170 | $pfi = $spotter_item['flightaware_id']; |
| 171 | 171 | } else $spotter_history_array = 0; |
| 172 | 172 | } |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } |
| 319 | 319 | } |
| 320 | 320 | if (isset($output_time)) { |
| 321 | - $output_time = substr($output_time, 0, -1); |
|
| 321 | + $output_time = substr($output_time, 0, -1); |
|
| 322 | 322 | $output .= '"time": ['.$output_time.'],'; |
| 323 | 323 | } |
| 324 | 324 | /* |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | $output .= '"coordinates": ['; |
| 338 | 338 | |
| 339 | 339 | if (isset($output_history)) { |
| 340 | - $output_history = substr($output_history, 0, -1); |
|
| 340 | + $output_history = substr($output_history, 0, -1); |
|
| 341 | 341 | $output .= $output_history; |
| 342 | 342 | } |
| 343 | 343 | $output .= ']'; |
@@ -348,7 +348,7 @@ discard block |
||
| 348 | 348 | $output = substr($output, 0, -1); |
| 349 | 349 | $output .= ']'; |
| 350 | 350 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 351 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 351 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 352 | 352 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 353 | 353 | $output .= '"fc": "'.$flightcnt.'"'; |
| 354 | 354 | } else { |
@@ -22,12 +22,10 @@ discard block |
||
| 22 | 22 | if ($tracker) { |
| 23 | 23 | require_once('require/class.Tracker.php'); |
| 24 | 24 | require_once('require/class.TrackerArchive.php'); |
| 25 | -} |
|
| 26 | -elseif ($marine) { |
|
| 25 | +} elseif ($marine) { |
|
| 27 | 26 | require_once('require/class.Marine.php'); |
| 28 | 27 | require_once('require/class.MarineArchive.php'); |
| 29 | -} |
|
| 30 | -else { |
|
| 28 | +} else { |
|
| 31 | 29 | require_once('require/class.Spotter.php'); |
| 32 | 30 | require_once('require/class.SpotterArchive.php'); |
| 33 | 31 | } |
@@ -35,12 +33,10 @@ discard block |
||
| 35 | 33 | if ($tracker) { |
| 36 | 34 | $Tracker = new Tracker(); |
| 37 | 35 | $TrackerArchive = new TrackerArchive(); |
| 38 | -} |
|
| 39 | -elseif ($marine) { |
|
| 36 | +} elseif ($marine) { |
|
| 40 | 37 | $Marine = new Marine(); |
| 41 | 38 | $MarineArchive = new MarineArchive(); |
| 42 | -} |
|
| 43 | -else { |
|
| 39 | +} else { |
|
| 44 | 40 | $Spotter = new Spotter(); |
| 45 | 41 | $SpotterArchive = new SpotterArchive(); |
| 46 | 42 | } |
@@ -53,62 +49,86 @@ discard block |
||
| 53 | 49 | } |
| 54 | 50 | header('Content-Type: text/javascript'); |
| 55 | 51 | |
| 56 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 57 | -else $compress = $globalJsonCompress; |
|
| 52 | +if (!isset($globalJsonCompress)) { |
|
| 53 | + $compress = true; |
|
| 54 | +} else { |
|
| 55 | + $compress = $globalJsonCompress; |
|
| 56 | +} |
|
| 58 | 57 | |
| 59 | 58 | $from_archive = false; |
| 60 | 59 | $min = false; |
| 61 | 60 | $allhistory = false; |
| 62 | 61 | $filter['source'] = array(); |
| 63 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 64 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 65 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 66 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 67 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 68 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 69 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 70 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 71 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 72 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 62 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 63 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 64 | +} |
|
| 65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 66 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 67 | +} |
|
| 68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 69 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 70 | +} |
|
| 71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 72 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 73 | +} |
|
| 74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 75 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 76 | +} |
|
| 77 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 78 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 79 | +} |
|
| 80 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 81 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 82 | +} |
|
| 83 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 84 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 85 | +} |
|
| 86 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 87 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 88 | +} |
|
| 89 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 90 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 91 | +} |
|
| 92 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 93 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 94 | +} |
|
| 74 | 95 | |
| 75 | 96 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 76 | 97 | $min = true; |
| 77 | -} else $min = false; |
|
| 98 | +} else { |
|
| 99 | + $min = false; |
|
| 100 | +} |
|
| 78 | 101 | |
| 79 | 102 | if (isset($_GET['ident'])) { |
| 80 | 103 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
| 81 | 104 | $from_archive = true; |
| 82 | 105 | if ($tracker) { |
| 83 | 106 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
| 84 | - } |
|
| 85 | - elseif ($marine) { |
|
| 107 | + } elseif ($marine) { |
|
| 86 | 108 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
| 87 | - } |
|
| 88 | - else { |
|
| 109 | + } else { |
|
| 89 | 110 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
| 90 | 111 | } |
| 91 | 112 | $allhistory = true; |
| 92 | -} |
|
| 93 | -elseif (isset($_GET['flightaware_id'])) { |
|
| 113 | +} elseif (isset($_GET['flightaware_id'])) { |
|
| 94 | 114 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
| 95 | 115 | $from_archive = true; |
| 96 | 116 | if ($tracker) { |
| 97 | 117 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
| 98 | - } |
|
| 99 | - elseif ($marine) { |
|
| 118 | + } elseif ($marine) { |
|
| 100 | 119 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
| 101 | - } |
|
| 102 | - else { |
|
| 120 | + } else { |
|
| 103 | 121 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
| 104 | 122 | } |
| 105 | 123 | $allhistory = true; |
| 106 | -} |
|
| 107 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 124 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 108 | 125 | $from_archive = true; |
| 109 | 126 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
| 110 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 111 | - else $begindate = $begindate - 3000; |
|
| 127 | + if (isset($globalAircraftMaxUpdate)) { |
|
| 128 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 129 | + } else { |
|
| 130 | + $begindate = $begindate - 3000; |
|
| 131 | + } |
|
| 112 | 132 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
| 113 | 133 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
| 114 | 134 | if ($begindate != '' && $enddate != '') { |
@@ -117,11 +137,9 @@ discard block |
||
| 117 | 137 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
| 118 | 138 | if ($tracker) { |
| 119 | 139 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
| 120 | - } |
|
| 121 | - elseif ($marine) { |
|
| 140 | + } elseif ($marine) { |
|
| 122 | 141 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
| 123 | - } |
|
| 124 | - else { |
|
| 142 | + } else { |
|
| 125 | 143 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
| 126 | 144 | } |
| 127 | 145 | } |
@@ -130,8 +148,12 @@ discard block |
||
| 130 | 148 | if (!empty($spotter_array)) { |
| 131 | 149 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
| 132 | 150 | $flightcnt = 0; |
| 133 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 134 | -} else $flightcnt = 0; |
|
| 151 | + if ($flightcnt == '') { |
|
| 152 | + $flightcnt = 0; |
|
| 153 | + } |
|
| 154 | + } else { |
|
| 155 | + $flightcnt = 0; |
|
| 156 | +} |
|
| 135 | 157 | |
| 136 | 158 | $sqltime = round(microtime(true)-$begintime,2); |
| 137 | 159 | |
@@ -141,8 +163,11 @@ discard block |
||
| 141 | 163 | $aircrafts_shadow = array(); |
| 142 | 164 | $output = '{'; |
| 143 | 165 | $output .= '"type": "FeatureCollection",'; |
| 144 | -if ($min) $output .= '"minimal": "true",'; |
|
| 145 | -else $output .= '"minimal": "false",'; |
|
| 166 | +if ($min) { |
|
| 167 | + $output .= '"minimal": "true",'; |
|
| 168 | +} else { |
|
| 169 | + $output .= '"minimal": "false",'; |
|
| 170 | +} |
|
| 146 | 171 | $output .= '"fc": "'.$flightcnt.'",'; |
| 147 | 172 | $output .= '"sqt": "'.$sqltime.'",'; |
| 148 | 173 | |
@@ -155,20 +180,24 @@ discard block |
||
| 155 | 180 | if ($pfi != $spotter_item['famtrackid']) { |
| 156 | 181 | $spotter_history_array = $TrackerArchive->getCoordArchiveTrackerDataById($spotter_item['famtrackid']); |
| 157 | 182 | $pfi = $spotter_item['famtrackid']; |
| 158 | - } else $spotter_history_array = 0; |
|
| 159 | - } |
|
| 160 | - elseif ($marine) { |
|
| 183 | + } else { |
|
| 184 | + $spotter_history_array = 0; |
|
| 185 | + } |
|
| 186 | + } elseif ($marine) { |
|
| 161 | 187 | if ($pfi != $spotter_item['fammarine_d']) { |
| 162 | 188 | $spotter_history_array = $MarineArchive->getCoordArchiveMarineDataById($spotter_item['fammarine_id']); |
| 163 | 189 | $pfi = $spotter_item['fammarine_id']; |
| 164 | - } else $spotter_history_array = 0; |
|
| 165 | - } |
|
| 166 | - else { |
|
| 190 | + } else { |
|
| 191 | + $spotter_history_array = 0; |
|
| 192 | + } |
|
| 193 | + } else { |
|
| 167 | 194 | if ($pfi != $spotter_item['flightaware_id']) { |
| 168 | 195 | //$spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataById($spotter_item['flightaware_id']); |
| 169 | 196 | $spotter_history_array = $SpotterArchive->getCoordArchiveSpotterDataByIdDate($spotter_item['flightaware_id'],$begindate,$enddate); |
| 170 | 197 | $pfi = $spotter_item['flightaware_id']; |
| 171 | - } else $spotter_history_array = 0; |
|
| 198 | + } else { |
|
| 199 | + $spotter_history_array = 0; |
|
| 200 | + } |
|
| 172 | 201 | } |
| 173 | 202 | if (count($spotter_history_array) > 1) { |
| 174 | 203 | //location of aircraft |
@@ -176,21 +205,29 @@ discard block |
||
| 176 | 205 | $output .= '"type": "Feature",'; |
| 177 | 206 | $output .= '"properties": {'; |
| 178 | 207 | $output .= '"fi": "'.$pfi.'",'; |
| 179 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 208 | + if (isset($begindate)) { |
|
| 209 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 210 | + } |
|
| 180 | 211 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 181 | 212 | $output .= '"c": "'.$spotter_item['ident'].'",'; |
| 182 | 213 | } else { |
| 183 | 214 | $output .= '"c": "NA",'; |
| 184 | 215 | } |
| 185 | 216 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 186 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 187 | - else { |
|
| 217 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 218 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 219 | + } else { |
|
| 188 | 220 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 189 | 221 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 190 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 191 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 192 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 193 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 222 | + if (count($aircraft_info) > 0) { |
|
| 223 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 224 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 225 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 226 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 227 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 228 | + } else { |
|
| 229 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 230 | + } |
|
| 194 | 231 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 195 | 232 | } |
| 196 | 233 | } |
@@ -198,93 +235,139 @@ discard block |
||
| 198 | 235 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 199 | 236 | if ($tracker) { |
| 200 | 237 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 201 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 202 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 203 | - } |
|
| 204 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 205 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 206 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 207 | - } |
|
| 208 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 209 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 210 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 211 | - } |
|
| 212 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 213 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 214 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 215 | - } |
|
| 216 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 217 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 218 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 219 | - } |
|
| 220 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 221 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 222 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 223 | - } |
|
| 224 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 225 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 226 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 238 | + if ($compress) { |
|
| 239 | + $output .= '"as": "ambulance.png",'; |
|
| 240 | + } else { |
|
| 241 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 242 | + } |
|
| 243 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 244 | + if ($compress) { |
|
| 245 | + $output .= '"as": "police.png",'; |
|
| 246 | + } else { |
|
| 247 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 248 | + } |
|
| 249 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 250 | + if ($compress) { |
|
| 251 | + $output .= '"as": "ship.png",'; |
|
| 252 | + } else { |
|
| 253 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 254 | + } |
|
| 255 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 256 | + if ($compress) { |
|
| 257 | + $output .= '"as": "ship.png",'; |
|
| 258 | + } else { |
|
| 259 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 260 | + } |
|
| 261 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 262 | + if ($compress) { |
|
| 263 | + $output .= '"as": "ship.png",'; |
|
| 264 | + } else { |
|
| 265 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 266 | + } |
|
| 267 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 268 | + if ($compress) { |
|
| 269 | + $output .= '"as": "truck.png",'; |
|
| 270 | + } else { |
|
| 271 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 272 | + } |
|
| 273 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 274 | + if ($compress) { |
|
| 275 | + $output .= '"as": "truck.png",'; |
|
| 276 | + } else { |
|
| 277 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 278 | + } |
|
| 279 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 280 | + if ($compress) { |
|
| 281 | + $output .= '"as": "aircraft.png",'; |
|
| 282 | + } else { |
|
| 283 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 284 | + } |
|
| 285 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 286 | + if ($compress) { |
|
| 287 | + $output .= '"as": "aircraft.png",'; |
|
| 288 | + } else { |
|
| 289 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 290 | + } |
|
| 291 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 292 | + if ($compress) { |
|
| 293 | + $output .= '"as": "helico.png",'; |
|
| 294 | + } else { |
|
| 295 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 296 | + } |
|
| 297 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 298 | + if ($compress) { |
|
| 299 | + $output .= '"as": "rail.png",'; |
|
| 300 | + } else { |
|
| 301 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 302 | + } |
|
| 303 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 304 | + if ($compress) { |
|
| 305 | + $output .= '"as": "firetruck.png",'; |
|
| 306 | + } else { |
|
| 307 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 308 | + } |
|
| 309 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 310 | + if ($compress) { |
|
| 311 | + $output .= '"as": "bus.png",'; |
|
| 312 | + } else { |
|
| 313 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 314 | + } |
|
| 315 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 316 | + if ($compress) { |
|
| 317 | + $output .= '"as": "phone.png",'; |
|
| 318 | + } else { |
|
| 319 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 320 | + } |
|
| 321 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 322 | + if ($compress) { |
|
| 323 | + $output .= '"as": "jogger.png",'; |
|
| 324 | + } else { |
|
| 325 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 326 | + } |
|
| 327 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 328 | + if ($compress) { |
|
| 329 | + $output .= '"as": "bike.png",'; |
|
| 330 | + } else { |
|
| 331 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 332 | + } |
|
| 333 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 334 | + if ($compress) { |
|
| 335 | + $output .= '"as": "motorcycle.png",'; |
|
| 336 | + } else { |
|
| 337 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 338 | + } |
|
| 339 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 340 | + if ($compress) { |
|
| 341 | + $output .= '"as": "balloon.png",'; |
|
| 342 | + } else { |
|
| 343 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 344 | + } |
|
| 345 | + } else { |
|
| 346 | + if ($compress) { |
|
| 347 | + $output .= '"as": "car.png",'; |
|
| 348 | + } else { |
|
| 349 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 350 | + } |
|
| 227 | 351 | } |
| 228 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 229 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 230 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 352 | + } elseif ($marine) { |
|
| 353 | + if ($compress) { |
|
| 354 | + $output .= '"as": "ship.png",'; |
|
| 355 | + } else { |
|
| 356 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 231 | 357 | } |
| 232 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 233 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 234 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 358 | + } else { |
|
| 359 | + if ($compress) { |
|
| 360 | + $output .= '"as": "default.png",'; |
|
| 361 | + } else { |
|
| 362 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 235 | 363 | } |
| 236 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 237 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 238 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 239 | - } |
|
| 240 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 241 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 242 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 243 | - } |
|
| 244 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 245 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 246 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 247 | - } |
|
| 248 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 249 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 250 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 251 | - } |
|
| 252 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 253 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 254 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 255 | - } |
|
| 256 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 257 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 258 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 259 | - } |
|
| 260 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 261 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 262 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 263 | - } |
|
| 264 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 265 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 266 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 267 | - } |
|
| 268 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 269 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 270 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 271 | - } |
|
| 272 | - else { |
|
| 273 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 274 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 275 | - } |
|
| 276 | - } |
|
| 277 | - elseif ($marine) { |
|
| 278 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 279 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 280 | - } |
|
| 281 | - else { |
|
| 282 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 283 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 284 | 364 | } |
| 285 | 365 | } else { |
| 286 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 287 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 366 | + if ($compress) { |
|
| 367 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 368 | + } else { |
|
| 369 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 370 | + } |
|
| 288 | 371 | } |
| 289 | 372 | |
| 290 | 373 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -314,7 +397,9 @@ discard block |
||
| 314 | 397 | $output_time .= (strtotime($spotter_history['date'])*1000).','; |
| 315 | 398 | //if ($previousts != 0) $output_timediff .= (strtotime($spotter_history['date'])-$previousts).','; |
| 316 | 399 | $previousts = strtotime($spotter_history['date']); |
| 317 | - if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) $end = true; |
|
| 400 | + if ($k > 1 && (strtotime($spotter_history['date'])*1000 > $enddate)) { |
|
| 401 | + $end = true; |
|
| 402 | + } |
|
| 318 | 403 | } |
| 319 | 404 | } |
| 320 | 405 | if (isset($output_time)) { |
@@ -328,8 +413,11 @@ discard block |
||
| 328 | 413 | } |
| 329 | 414 | */ |
| 330 | 415 | // FIXME : type when not aircraft ? |
| 331 | - if ($compress) $output .= '"t": "aircraft"'; |
|
| 332 | - else $output .= '"type": "aircraft"'; |
|
| 416 | + if ($compress) { |
|
| 417 | + $output .= '"t": "aircraft"'; |
|
| 418 | + } else { |
|
| 419 | + $output .= '"type": "aircraft"'; |
|
| 420 | + } |
|
| 333 | 421 | $output .= '},'; |
| 334 | 422 | $output .= '"geometry": {'; |
| 335 | 423 | //$output .= '"type": "MultiPoint",'; |
@@ -349,7 +437,9 @@ discard block |
||
| 349 | 437 | $output .= ']'; |
| 350 | 438 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 351 | 439 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 352 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 440 | + if (isset($begindate)) { |
|
| 441 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 442 | + } |
|
| 353 | 443 | $output .= '"fc": "'.$flightcnt.'"'; |
| 354 | 444 | } else { |
| 355 | 445 | $output .= '"features": '; |