@@ -17,62 +17,62 @@ discard block |
||
| 17 | 17 | * @param Array $filter the filter |
| 18 | 18 | * @return Array the SQL part |
| 19 | 19 | */ |
| 20 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 20 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 22 | 22 | $filters = array(); |
| 23 | 23 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 24 | 24 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 25 | 25 | $filters = $globalStatsFilters[$globalFilterName]; |
| 26 | 26 | } else { |
| 27 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 27 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | if (isset($filter[0]['source'])) { |
| 31 | - $filters = array_merge($filters,$filter); |
|
| 31 | + $filters = array_merge($filters, $filter); |
|
| 32 | 32 | } |
| 33 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 33 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 34 | 34 | $filter_query_join = ''; |
| 35 | 35 | $filter_query_where = ''; |
| 36 | - foreach($filters as $flt) { |
|
| 36 | + foreach ($filters as $flt) { |
|
| 37 | 37 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 38 | 38 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
| 39 | 39 | if (isset($flt['source'])) { |
| 40 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 40 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 41 | 41 | } else { |
| 42 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 42 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | } |
| 46 | 46 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 47 | 47 | if (isset($flt['source'])) { |
| 48 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 48 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 49 | 49 | } else { |
| 50 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 50 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
| 51 | 51 | } |
| 52 | 52 | } |
| 53 | 53 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 54 | 54 | if (isset($flt['source'])) { |
| 55 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 55 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 56 | 56 | } else { |
| 57 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 57 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
| 61 | 61 | if (isset($flt['source'])) { |
| 62 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 62 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 63 | 63 | } else { |
| 64 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 64 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
| 68 | 68 | if (isset($flt['source'])) { |
| 69 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 69 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 74 | 74 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
| 75 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 75 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -82,7 +82,7 @@ discard block |
||
| 82 | 82 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
| 83 | 83 | } |
| 84 | 84 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 85 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 85 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
| 86 | 86 | } |
| 87 | 87 | if (isset($filter['blocked']) && $filter['blocked'] == true) { |
| 88 | 88 | $filter_query_join .= " INNER JOIN (SELECT callsign FROM aircraft_block) cblk ON cblk.callsign = spotter_live.ident"; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | if (count($filter['source']) == 1) { |
| 92 | 92 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
| 93 | 93 | } else { |
| 94 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 94 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -124,15 +124,15 @@ discard block |
||
| 124 | 124 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 127 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
| 128 | 128 | } |
| 129 | 129 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 130 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 130 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 131 | 131 | } |
| 132 | 132 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 133 | 133 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 134 | 134 | if ($filter_query_where != '') { |
| 135 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 135 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 136 | 136 | } |
| 137 | 137 | $filter_query = $filter_query_join.$filter_query_where; |
| 138 | 138 | return $filter_query; |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | if ($limit != '') |
| 156 | 156 | { |
| 157 | 157 | $limit_array = explode(',', $limit); |
| 158 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 159 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 158 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 159 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 160 | 160 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 161 | 161 | { |
| 162 | 162 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } else { |
| 181 | 181 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
| 182 | 182 | } |
| 183 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 183 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 184 | 184 | |
| 185 | 185 | return $spotter_array; |
| 186 | 186 | } |
@@ -191,34 +191,34 @@ discard block |
||
| 191 | 191 | * @return Array the spotter information |
| 192 | 192 | * |
| 193 | 193 | */ |
| 194 | - public function getMinLiveSpotterData($limit = 0,$filter = array()) |
|
| 194 | + public function getMinLiveSpotterData($limit = 0, $filter = array()) |
|
| 195 | 195 | { |
| 196 | 196 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
| 197 | 197 | date_default_timezone_set('UTC'); |
| 198 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 198 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 199 | 199 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 200 | 200 | if ($globalDBdriver == 'mysql') { |
| 201 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 202 | 202 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 203 | 203 | // FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
| 204 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 204 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 205 | 205 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date AND'." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 206 | 206 | } else { |
| 207 | 207 | // $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 208 | 208 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC"; |
| 209 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 209 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 210 | 210 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query." spotter_live.latitude <> 0 AND spotter_live.longitude <> 0"; |
| 211 | 211 | } |
| 212 | 212 | } else { |
| 213 | 213 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 214 | 214 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 215 | 215 | // FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 216 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 216 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 217 | 217 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 218 | 218 | } else { |
| 219 | 219 | // $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 220 | 220 | // FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 221 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 221 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 222 | 222 | FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
| 223 | 223 | } |
| 224 | 224 | } |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
| 227 | 227 | $limit = $globalMap2DAircraftsLimit; |
| 228 | 228 | } |
| 229 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
| 229 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
| 230 | 230 | $query .= ' LIMIT '.$limit; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | try { |
| 234 | 234 | $sth = $this->db->prepare($query); |
| 235 | 235 | $sth->execute(); |
| 236 | - } catch(PDOException $e) { |
|
| 236 | + } catch (PDOException $e) { |
|
| 237 | 237 | echo $e->getMessage(); |
| 238 | 238 | die; |
| 239 | 239 | } |
@@ -247,20 +247,20 @@ discard block |
||
| 247 | 247 | * @return Array the spotter information |
| 248 | 248 | * |
| 249 | 249 | */ |
| 250 | - public function getMinLastLiveSpotterData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
| 250 | + public function getMinLastLiveSpotterData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
| 251 | 251 | { |
| 252 | 252 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 253 | 253 | date_default_timezone_set('UTC'); |
| 254 | 254 | $usecoord = false; |
| 255 | 255 | if (is_array($coord) && !empty($coord)) { |
| 256 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 257 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 258 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 259 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 256 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 257 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 258 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 259 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 260 | 260 | $usecoord = true; |
| 261 | 261 | } |
| 262 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 263 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 262 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 263 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 264 | 264 | |
| 265 | 265 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 266 | 266 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
| 273 | 273 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
| 274 | 274 | */ |
| 275 | - $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
| 275 | + $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
|
| 276 | 276 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id "; |
| 277 | 277 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 278 | 278 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | ORDER BY flightaware_id, date"; |
| 287 | 287 | if ($limit) $query .= " LIMIT ".$globalMap3DAircraftsLimit; |
| 288 | 288 | } else { |
| 289 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 289 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 290 | 290 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date "; |
| 291 | 291 | if ($usecoord) $query .= "AND (spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 292 | 292 | if ($id != '') $query .= "OR spotter_live.flightaware_id = :id "; |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
| 303 | 303 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
| 304 | 304 | */ |
| 305 | - $query = "SELECT * FROM ( |
|
| 305 | + $query = "SELECT * FROM ( |
|
| 306 | 306 | SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
| 307 | 307 | FROM spotter_archive |
| 308 | 308 | INNER JOIN ( |
| 309 | 309 | SELECT flightaware_id |
| 310 | 310 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date"; |
| 311 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 311 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 312 | 312 | if ($usecoord) $query .= "AND (spotter_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND spotter_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 313 | 313 | if ($id != '') $query .= "OR spotter_archive.flightaware_id = :id "; |
| 314 | 314 | $query .= "UNION |
@@ -334,7 +334,7 @@ discard block |
||
| 334 | 334 | try { |
| 335 | 335 | $sth = $this->db->prepare($query); |
| 336 | 336 | $sth->execute($query_values); |
| 337 | - } catch(PDOException $e) { |
|
| 337 | + } catch (PDOException $e) { |
|
| 338 | 338 | echo $e->getMessage(); |
| 339 | 339 | die; |
| 340 | 340 | } |
@@ -348,12 +348,12 @@ discard block |
||
| 348 | 348 | * @return Array the spotter information |
| 349 | 349 | * |
| 350 | 350 | */ |
| 351 | - public function getMinLastLiveSpotterDataByID($id = '',$filter = array(), $limit = false) |
|
| 351 | + public function getMinLastLiveSpotterDataByID($id = '', $filter = array(), $limit = false) |
|
| 352 | 352 | { |
| 353 | 353 | global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap3DAircraftsLimit; |
| 354 | 354 | date_default_timezone_set('UTC'); |
| 355 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 356 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 355 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 356 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 357 | 357 | |
| 358 | 358 | if (!isset($globalLiveInterval) || $globalLiveInterval == '') $globalLiveInterval = '200'; |
| 359 | 359 | if (!isset($globalMap3DAircraftsLimit) || $globalMap3DAircraftsLimit == '') $globalMap3DAircraftsLimit = '300'; |
@@ -377,13 +377,13 @@ discard block |
||
| 377 | 377 | } |
| 378 | 378 | } else { |
| 379 | 379 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 380 | - $query = "SELECT * FROM ( |
|
| 380 | + $query = "SELECT * FROM ( |
|
| 381 | 381 | SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source, spotter_archive.registration |
| 382 | 382 | FROM spotter_archive |
| 383 | 383 | INNER JOIN ( |
| 384 | 384 | SELECT flightaware_id |
| 385 | 385 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
| 386 | - $query.= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 386 | + $query .= ") l ON l.flightaware_id = spotter_archive.flightaware_id "; |
|
| 387 | 387 | $query .= "UNION |
| 388 | 388 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
| 389 | 389 | FROM spotter_live".$filter_query." spotter_live.flightaware_id = :id"; |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | try { |
| 404 | 404 | $sth = $this->db->prepare($query); |
| 405 | 405 | $sth->execute($query_values); |
| 406 | - } catch(PDOException $e) { |
|
| 406 | + } catch (PDOException $e) { |
|
| 407 | 407 | echo $e->getMessage(); |
| 408 | 408 | die; |
| 409 | 409 | } |
@@ -420,7 +420,7 @@ discard block |
||
| 420 | 420 | public function getLiveSpotterCount($filter = array()) |
| 421 | 421 | { |
| 422 | 422 | global $globalDBdriver, $globalLiveInterval; |
| 423 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 423 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 424 | 424 | |
| 425 | 425 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 426 | 426 | if ($globalDBdriver == 'mysql') { |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | try { |
| 434 | 434 | $sth = $this->db->prepare($query); |
| 435 | 435 | $sth->execute(); |
| 436 | - } catch(PDOException $e) { |
|
| 436 | + } catch (PDOException $e) { |
|
| 437 | 437 | echo $e->getMessage(); |
| 438 | 438 | die; |
| 439 | 439 | } |
@@ -450,16 +450,16 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 452 | 452 | { |
| 453 | - global $globalDBdriver, $globalLiveInterval,$globalMap2DAircraftsLimit; |
|
| 453 | + global $globalDBdriver, $globalLiveInterval, $globalMap2DAircraftsLimit; |
|
| 454 | 454 | $Spotter = new Spotter($this->db); |
| 455 | 455 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 456 | 456 | $filter_query = $this->getFilter($filter); |
| 457 | 457 | |
| 458 | 458 | if (is_array($coord)) { |
| 459 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 460 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 461 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 462 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 459 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 460 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 461 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 462 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 463 | 463 | } else return array(); |
| 464 | 464 | if ($globalDBdriver == 'mysql') { |
| 465 | 465 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -480,28 +480,28 @@ discard block |
||
| 480 | 480 | * @return Array the spotter information |
| 481 | 481 | * |
| 482 | 482 | */ |
| 483 | - public function getMinLiveSpotterDatabyCoord($coord,$limit = 0, $filter = array()) |
|
| 483 | + public function getMinLiveSpotterDatabyCoord($coord, $limit = 0, $filter = array()) |
|
| 484 | 484 | { |
| 485 | - global $globalDBdriver, $globalLiveInterval, $globalArchive,$globalMap2DAircraftsLimit; |
|
| 485 | + global $globalDBdriver, $globalLiveInterval, $globalArchive, $globalMap2DAircraftsLimit; |
|
| 486 | 486 | $Spotter = new Spotter($this->db); |
| 487 | 487 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 488 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 488 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 489 | 489 | |
| 490 | 490 | if (is_array($coord)) { |
| 491 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 492 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 493 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 494 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 491 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 492 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 493 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 494 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 495 | 495 | } else return array(); |
| 496 | 496 | if ($globalDBdriver == 'mysql') { |
| 497 | 497 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 498 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 498 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 499 | 499 | FROM spotter_live |
| 500 | 500 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
| 501 | 501 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 502 | 502 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0 ORDER BY date DESC'; |
| 503 | 503 | } else { |
| 504 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 504 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 505 | 505 | FROM spotter_live |
| 506 | 506 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 507 | 507 | FROM spotter_live l |
@@ -521,7 +521,7 @@ discard block |
||
| 521 | 521 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 522 | 522 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 523 | 523 | */ |
| 524 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 524 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 525 | 525 | FROM spotter_live |
| 526 | 526 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
| 527 | 527 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
@@ -540,7 +540,7 @@ discard block |
||
| 540 | 540 | ) s on spotter_live.flightaware_id = s.flightaware_id |
| 541 | 541 | AND spotter_live.date = s.maxdate".$filter_query." spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' ORDER BY date DESC"; |
| 542 | 542 | */ |
| 543 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 543 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.real_altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source, spotter_live.registration |
|
| 544 | 544 | FROM spotter_live |
| 545 | 545 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
| 546 | 546 | FROM spotter_live l |
@@ -555,13 +555,13 @@ discard block |
||
| 555 | 555 | if ($limit == 0 && isset($globalMap2DAircraftsLimit) && $globalMap2DAircraftsLimit != '') { |
| 556 | 556 | $limit = $globalMap2DAircraftsLimit; |
| 557 | 557 | } |
| 558 | - if ($limit != 0 && filter_var($limit,FILTER_VALIDATE_INT)) { |
|
| 558 | + if ($limit != 0 && filter_var($limit, FILTER_VALIDATE_INT)) { |
|
| 559 | 559 | $query .= ' LIMIT '.$limit; |
| 560 | 560 | } |
| 561 | 561 | try { |
| 562 | 562 | $sth = $this->db->prepare($query); |
| 563 | 563 | $sth->execute(); |
| 564 | - } catch(PDOException $e) { |
|
| 564 | + } catch (PDOException $e) { |
|
| 565 | 565 | echo $e->getMessage(); |
| 566 | 566 | die; |
| 567 | 567 | } |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | if ($interval == '1m') |
| 611 | 611 | { |
| 612 | 612 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 613 | - } else if ($interval == '15m'){ |
|
| 613 | + } else if ($interval == '15m') { |
|
| 614 | 614 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
| 615 | 615 | } |
| 616 | 616 | } |
@@ -618,14 +618,14 @@ discard block |
||
| 618 | 618 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 621 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 622 | 622 | WHERE spotter_live.latitude <> '' |
| 623 | 623 | AND spotter_live.longitude <> '' |
| 624 | 624 | ".$additional_query." |
| 625 | 625 | HAVING distance < :radius |
| 626 | 626 | ORDER BY distance"; |
| 627 | 627 | |
| 628 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 628 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 629 | 629 | |
| 630 | 630 | return $spotter_array; |
| 631 | 631 | } |
@@ -643,9 +643,9 @@ discard block |
||
| 643 | 643 | date_default_timezone_set('UTC'); |
| 644 | 644 | |
| 645 | 645 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 646 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 646 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 647 | 647 | |
| 648 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 648 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 649 | 649 | |
| 650 | 650 | return $spotter_array; |
| 651 | 651 | } |
@@ -656,16 +656,16 @@ discard block |
||
| 656 | 656 | * @return Array the spotter information |
| 657 | 657 | * |
| 658 | 658 | */ |
| 659 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
| 659 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
| 660 | 660 | { |
| 661 | 661 | $Spotter = new Spotter($this->db); |
| 662 | 662 | date_default_timezone_set('UTC'); |
| 663 | 663 | |
| 664 | 664 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 665 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 665 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 666 | 666 | |
| 667 | - $date = date('c',$date); |
|
| 668 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 667 | + $date = date('c', $date); |
|
| 668 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 669 | 669 | |
| 670 | 670 | return $spotter_array; |
| 671 | 671 | } |
@@ -681,8 +681,8 @@ discard block |
||
| 681 | 681 | $Spotter = new Spotter($this->db); |
| 682 | 682 | date_default_timezone_set('UTC'); |
| 683 | 683 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 684 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 685 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 684 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 685 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 686 | 686 | return $spotter_array; |
| 687 | 687 | } |
| 688 | 688 | |
@@ -692,15 +692,15 @@ discard block |
||
| 692 | 692 | * @return Array the spotter information |
| 693 | 693 | * |
| 694 | 694 | */ |
| 695 | - public function getDateLiveSpotterDataById($id,$date) |
|
| 695 | + public function getDateLiveSpotterDataById($id, $date) |
|
| 696 | 696 | { |
| 697 | 697 | $Spotter = new Spotter($this->db); |
| 698 | 698 | date_default_timezone_set('UTC'); |
| 699 | 699 | |
| 700 | 700 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 701 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 702 | - $date = date('c',$date); |
|
| 703 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 701 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 702 | + $date = date('c', $date); |
|
| 703 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 704 | 704 | return $spotter_array; |
| 705 | 705 | } |
| 706 | 706 | |
@@ -716,13 +716,13 @@ discard block |
||
| 716 | 716 | date_default_timezone_set('UTC'); |
| 717 | 717 | |
| 718 | 718 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 719 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 719 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 720 | 720 | |
| 721 | 721 | try { |
| 722 | 722 | |
| 723 | 723 | $sth = $this->db->prepare($query); |
| 724 | 724 | $sth->execute(array(':ident' => $ident)); |
| 725 | - } catch(PDOException $e) { |
|
| 725 | + } catch (PDOException $e) { |
|
| 726 | 726 | echo $e->getMessage(); |
| 727 | 727 | die; |
| 728 | 728 | } |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | * @return Array the spotter information |
| 738 | 738 | * |
| 739 | 739 | */ |
| 740 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
| 740 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
| 741 | 741 | { |
| 742 | 742 | global $globalDBdriver, $globalLiveInterval; |
| 743 | 743 | date_default_timezone_set('UTC'); |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | try { |
| 757 | 757 | $sth = $this->db->prepare($query); |
| 758 | 758 | $sth->execute(array(':id' => $id)); |
| 759 | - } catch(PDOException $e) { |
|
| 759 | + } catch (PDOException $e) { |
|
| 760 | 760 | echo $e->getMessage(); |
| 761 | 761 | die; |
| 762 | 762 | } |
@@ -774,12 +774,12 @@ discard block |
||
| 774 | 774 | { |
| 775 | 775 | date_default_timezone_set('UTC'); |
| 776 | 776 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 777 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 777 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
| 778 | 778 | try { |
| 779 | 779 | |
| 780 | 780 | $sth = $this->db->prepare($query); |
| 781 | 781 | $sth->execute(array(':ident' => $ident)); |
| 782 | - } catch(PDOException $e) { |
|
| 782 | + } catch (PDOException $e) { |
|
| 783 | 783 | echo $e->getMessage(); |
| 784 | 784 | die; |
| 785 | 785 | } |
@@ -809,7 +809,7 @@ discard block |
||
| 809 | 809 | |
| 810 | 810 | $sth = $this->db->prepare($query); |
| 811 | 811 | $sth->execute(); |
| 812 | - } catch(PDOException $e) { |
|
| 812 | + } catch (PDOException $e) { |
|
| 813 | 813 | return "error"; |
| 814 | 814 | } |
| 815 | 815 | |
@@ -832,14 +832,14 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | $sth = $this->db->prepare($query); |
| 834 | 834 | $sth->execute(); |
| 835 | - } catch(PDOException $e) { |
|
| 835 | + } catch (PDOException $e) { |
|
| 836 | 836 | return "error"; |
| 837 | 837 | } |
| 838 | 838 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 839 | 839 | $i = 0; |
| 840 | - $j =0; |
|
| 840 | + $j = 0; |
|
| 841 | 841 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 842 | - foreach($all as $row) |
|
| 842 | + foreach ($all as $row) |
|
| 843 | 843 | { |
| 844 | 844 | $i++; |
| 845 | 845 | $j++; |
@@ -847,9 +847,9 @@ discard block |
||
| 847 | 847 | if ($globalDebug) echo "."; |
| 848 | 848 | try { |
| 849 | 849 | |
| 850 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 850 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 851 | 851 | $sth->execute(); |
| 852 | - } catch(PDOException $e) { |
|
| 852 | + } catch (PDOException $e) { |
|
| 853 | 853 | return "error"; |
| 854 | 854 | } |
| 855 | 855 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -860,9 +860,9 @@ discard block |
||
| 860 | 860 | if ($i > 0) { |
| 861 | 861 | try { |
| 862 | 862 | |
| 863 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 863 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 864 | 864 | $sth->execute(); |
| 865 | - } catch(PDOException $e) { |
|
| 865 | + } catch (PDOException $e) { |
|
| 866 | 866 | return "error"; |
| 867 | 867 | } |
| 868 | 868 | } |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | |
| 876 | 876 | $sth = $this->db->prepare($query); |
| 877 | 877 | $sth->execute(); |
| 878 | - } catch(PDOException $e) { |
|
| 878 | + } catch (PDOException $e) { |
|
| 879 | 879 | return "error"; |
| 880 | 880 | } |
| 881 | 881 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -923,13 +923,13 @@ discard block |
||
| 923 | 923 | public function deleteLiveSpotterDataByIdent($ident) |
| 924 | 924 | { |
| 925 | 925 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 926 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 926 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
| 927 | 927 | |
| 928 | 928 | try { |
| 929 | 929 | |
| 930 | 930 | $sth = $this->db->prepare($query); |
| 931 | 931 | $sth->execute(array(':ident' => $ident)); |
| 932 | - } catch(PDOException $e) { |
|
| 932 | + } catch (PDOException $e) { |
|
| 933 | 933 | return "error"; |
| 934 | 934 | } |
| 935 | 935 | |
@@ -945,13 +945,13 @@ discard block |
||
| 945 | 945 | public function deleteLiveSpotterDataById($id) |
| 946 | 946 | { |
| 947 | 947 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 948 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 948 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
| 949 | 949 | |
| 950 | 950 | try { |
| 951 | 951 | |
| 952 | 952 | $sth = $this->db->prepare($query); |
| 953 | 953 | $sth->execute(array(':id' => $id)); |
| 954 | - } catch(PDOException $e) { |
|
| 954 | + } catch (PDOException $e) { |
|
| 955 | 955 | return "error"; |
| 956 | 956 | } |
| 957 | 957 | |
@@ -969,13 +969,13 @@ discard block |
||
| 969 | 969 | { |
| 970 | 970 | global $globalDBdriver, $globalTimezone; |
| 971 | 971 | if ($globalDBdriver == 'mysql') { |
| 972 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 972 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
| 973 | 973 | WHERE spotter_live.ident = :ident |
| 974 | 974 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 975 | 975 | AND spotter_live.date < UTC_TIMESTAMP()'; |
| 976 | 976 | $query_data = array(':ident' => $ident); |
| 977 | 977 | } else { |
| 978 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 978 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
| 979 | 979 | WHERE spotter_live.ident = :ident |
| 980 | 980 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 981 | 981 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -984,8 +984,8 @@ discard block |
||
| 984 | 984 | |
| 985 | 985 | $sth = $this->db->prepare($query); |
| 986 | 986 | $sth->execute($query_data); |
| 987 | - $ident_result=''; |
|
| 988 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 987 | + $ident_result = ''; |
|
| 988 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 989 | 989 | { |
| 990 | 990 | $ident_result = $row['ident']; |
| 991 | 991 | } |
@@ -1002,13 +1002,13 @@ discard block |
||
| 1002 | 1002 | { |
| 1003 | 1003 | global $globalDBdriver, $globalTimezone; |
| 1004 | 1004 | if ($globalDBdriver == 'mysql') { |
| 1005 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1005 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1006 | 1006 | WHERE spotter_live.ident = :ident |
| 1007 | 1007 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 1008 | 1008 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1009 | 1009 | $query_data = array(':ident' => $ident); |
| 1010 | 1010 | } else { |
| 1011 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1011 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1012 | 1012 | WHERE spotter_live.ident = :ident |
| 1013 | 1013 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '20 MINUTES'"; |
| 1014 | 1014 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1017,8 +1017,8 @@ discard block |
||
| 1017 | 1017 | |
| 1018 | 1018 | $sth = $this->db->prepare($query); |
| 1019 | 1019 | $sth->execute($query_data); |
| 1020 | - $ident_result=''; |
|
| 1021 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1020 | + $ident_result = ''; |
|
| 1021 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1022 | 1022 | { |
| 1023 | 1023 | $ident_result = $row['flightaware_id']; |
| 1024 | 1024 | } |
@@ -1035,13 +1035,13 @@ discard block |
||
| 1035 | 1035 | { |
| 1036 | 1036 | global $globalDBdriver, $globalTimezone; |
| 1037 | 1037 | if ($globalDBdriver == 'mysql') { |
| 1038 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1038 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1039 | 1039 | WHERE spotter_live.flightaware_id = :id |
| 1040 | 1040 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 1041 | 1041 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1042 | 1042 | $query_data = array(':id' => $id); |
| 1043 | 1043 | } else { |
| 1044 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1044 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
| 1045 | 1045 | WHERE spotter_live.flightaware_id = :id |
| 1046 | 1046 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 1047 | 1047 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1050,8 +1050,8 @@ discard block |
||
| 1050 | 1050 | |
| 1051 | 1051 | $sth = $this->db->prepare($query); |
| 1052 | 1052 | $sth->execute($query_data); |
| 1053 | - $ident_result=''; |
|
| 1054 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1053 | + $ident_result = ''; |
|
| 1054 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1055 | 1055 | { |
| 1056 | 1056 | $ident_result = $row['flightaware_id']; |
| 1057 | 1057 | } |
@@ -1068,13 +1068,13 @@ discard block |
||
| 1068 | 1068 | { |
| 1069 | 1069 | global $globalDBdriver, $globalTimezone; |
| 1070 | 1070 | if ($globalDBdriver == 'mysql') { |
| 1071 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1071 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1072 | 1072 | WHERE spotter_live.ModeS = :modes |
| 1073 | 1073 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 MINUTE)'; |
| 1074 | 1074 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1075 | 1075 | $query_data = array(':modes' => $modes); |
| 1076 | 1076 | } else { |
| 1077 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1077 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
| 1078 | 1078 | WHERE spotter_live.ModeS = :modes |
| 1079 | 1079 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 MINUTE'"; |
| 1080 | 1080 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -1083,8 +1083,8 @@ discard block |
||
| 1083 | 1083 | |
| 1084 | 1084 | $sth = $this->db->prepare($query); |
| 1085 | 1085 | $sth->execute($query_data); |
| 1086 | - $ident_result=''; |
|
| 1087 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1086 | + $ident_result = ''; |
|
| 1087 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1088 | 1088 | { |
| 1089 | 1089 | //$ident_result = $row['spotter_live_id']; |
| 1090 | 1090 | $ident_result = $row['flightaware_id']; |
@@ -1109,8 +1109,8 @@ discard block |
||
| 1109 | 1109 | return array(); |
| 1110 | 1110 | } else { |
| 1111 | 1111 | $q_array = explode(" ", $q); |
| 1112 | - foreach ($q_array as $q_item){ |
|
| 1113 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 1112 | + foreach ($q_array as $q_item) { |
|
| 1113 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 1114 | 1114 | $additional_query .= " AND ("; |
| 1115 | 1115 | $additional_query .= "(spotter_live.aircraft_icao like '%".$q_item."%') OR "; |
| 1116 | 1116 | $additional_query .= "(spotter_live.aircraft_name like '%".$q_item."%') OR "; |
@@ -1125,11 +1125,11 @@ discard block |
||
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | 1127 | if ($globalDBdriver == 'mysql') { |
| 1128 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1128 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1129 | 1129 | WHERE spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 1130 | 1130 | AND spotter_live.date < UTC_TIMESTAMP()"; |
| 1131 | 1131 | } else { |
| 1132 | - $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1132 | + $query = "SELECT spotter_live.* FROM spotter_live |
|
| 1133 | 1133 | WHERE spotter_live.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 1134 | 1134 | AND spotter_live.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 1135 | 1135 | } |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | * @return String success or false |
| 1150 | 1150 | * |
| 1151 | 1151 | */ |
| 1152 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
| 1152 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
| 1153 | 1153 | { |
| 1154 | 1154 | global $globalURL, $globalArchive, $globalDebug; |
| 1155 | 1155 | $Common = new Common(); |
@@ -1249,27 +1249,27 @@ discard block |
||
| 1249 | 1249 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1250 | 1250 | |
| 1251 | 1251 | |
| 1252 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 1253 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1254 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 1255 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1256 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1257 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1258 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1259 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 1260 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1261 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1262 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1263 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1264 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 1265 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 1266 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 1267 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 1268 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 1269 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1270 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1271 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1272 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 1252 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 1253 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1254 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 1255 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1256 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1257 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1258 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1259 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 1260 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1261 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1262 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1263 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1264 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 1265 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 1266 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 1267 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 1268 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 1269 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1270 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1271 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1272 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 1273 | 1273 | |
| 1274 | 1274 | $airline_name = ''; |
| 1275 | 1275 | $airline_icao = ''; |
@@ -1291,10 +1291,10 @@ discard block |
||
| 1291 | 1291 | $arrival_airport_country = ''; |
| 1292 | 1292 | |
| 1293 | 1293 | |
| 1294 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 1295 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 1296 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1297 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1294 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 1295 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 1296 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 1297 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1298 | 1298 | |
| 1299 | 1299 | $query = ''; |
| 1300 | 1300 | if ($globalArchive) { |
@@ -1305,19 +1305,19 @@ discard block |
||
| 1305 | 1305 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
| 1306 | 1306 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
| 1307 | 1307 | |
| 1308 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
| 1308 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
| 1309 | 1309 | try { |
| 1310 | 1310 | |
| 1311 | 1311 | $sth = $this->db->prepare($query); |
| 1312 | 1312 | $sth->execute($query_values); |
| 1313 | 1313 | $sth->closeCursor(); |
| 1314 | - } catch(PDOException $e) { |
|
| 1314 | + } catch (PDOException $e) { |
|
| 1315 | 1315 | return "error : ".$e->getMessage(); |
| 1316 | 1316 | } |
| 1317 | 1317 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1318 | 1318 | if ($globalDebug) echo '(Add to SBS archive : '; |
| 1319 | 1319 | $SpotterArchive = new SpotterArchive($this->db); |
| 1320 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1320 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
| 1321 | 1321 | if ($globalDebug) echo $result.')'; |
| 1322 | 1322 | } elseif ($globalDebug && $putinarchive !== true) { |
| 1323 | 1323 | echo '(Not adding to archive)'; |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | |
| 1331 | 1331 | public function getOrderBy() |
| 1332 | 1332 | { |
| 1333 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1333 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
| 1334 | 1334 | return $orderby; |
| 1335 | 1335 | } |
| 1336 | 1336 | |
@@ -65,18 +65,18 @@ discard block |
||
| 65 | 65 | $min = true; |
| 66 | 66 | $allhistory = false; |
| 67 | 67 | $filter['source'] = array(); |
| 68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 69 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 70 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 71 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 72 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 73 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 74 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 75 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 76 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 77 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 78 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 79 | -if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'],FILTER_SANITIZE_NUMBER_INT); |
|
| 68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 69 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 70 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 71 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 72 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 73 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 74 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 75 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 76 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 77 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 78 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 79 | +if (isset($_COOKIE['filter_race']) && $_COOKIE['filter_race'] != 'all') $filter['race'] = filter_var($_COOKIE['filter_race'], FILTER_SANITIZE_NUMBER_INT); |
|
| 80 | 80 | if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') $filter['blocked'] = true; |
| 81 | 81 | |
| 82 | 82 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | |
| 87 | 87 | if (isset($_COOKIE['map_2d_limit'])) { |
| 88 | - $limit = filter_var($_COOKIE['map_2d_limit'],FILTER_SANITIZE_NUMBER_INT); |
|
| 88 | + $limit = filter_var($_COOKIE['map_2d_limit'], FILTER_SANITIZE_NUMBER_INT); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $spotter_array = array(); |
| 92 | 92 | |
| 93 | 93 | if (isset($_GET['ident'])) { |
| 94 | - $ident = urldecode(filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING)); |
|
| 94 | + $ident = urldecode(filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING)); |
|
| 95 | 95 | if ($tracker) { |
| 96 | 96 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
| 97 | 97 | } elseif ($marine) { |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | $allhistory = true; |
| 107 | 107 | } elseif (isset($_GET['flightaware_id'])) { |
| 108 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 108 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 109 | 109 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
| 110 | 110 | if (empty($spotter_array)) { |
| 111 | 111 | $from_archive = true; |
@@ -113,11 +113,11 @@ discard block |
||
| 113 | 113 | } |
| 114 | 114 | $allhistory = true; |
| 115 | 115 | } elseif (isset($_GET['famtrack_id'])) { |
| 116 | - $famtrack_id = urldecode(filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING)); |
|
| 116 | + $famtrack_id = urldecode(filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING)); |
|
| 117 | 117 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
| 118 | 118 | $allhistory = true; |
| 119 | 119 | } elseif (isset($_GET['fammarine_id'])) { |
| 120 | - $fammarine_id = urldecode(filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING)); |
|
| 120 | + $fammarine_id = urldecode(filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING)); |
|
| 121 | 121 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
| 122 | 122 | $allhistory = true; |
| 123 | 123 | /* |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | */ |
| 138 | 138 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min && !isset($_GET['archive'])) { |
| 139 | 139 | $usecoord = true; |
| 140 | - $coord = explode(',',$_GET['coord']); |
|
| 141 | - if (filter_var($coord[0],FILTER_VALIDATE_FLOAT) && filter_var($coord[1],FILTER_VALIDATE_FLOAT) && filter_var($coord[2],FILTER_VALIDATE_FLOAT) && filter_var($coord[3],FILTER_VALIDATE_FLOAT) |
|
| 140 | + $coord = explode(',', $_GET['coord']); |
|
| 141 | + if (filter_var($coord[0], FILTER_VALIDATE_FLOAT) && filter_var($coord[1], FILTER_VALIDATE_FLOAT) && filter_var($coord[2], FILTER_VALIDATE_FLOAT) && filter_var($coord[3], FILTER_VALIDATE_FLOAT) |
|
| 142 | 142 | && $coord[0] > -180.0 && $coord[0] < 180.0 && $coord[1] > -90.0 && $coord[1] < 90.0 && $coord[2] > -180.0 && $coord[2] < 180.0 && $coord[3] > -90.0 && $coord[3] < 90.0) { |
| 143 | 143 | if ($tracker) { |
| 144 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
| 144 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
| 145 | 145 | } elseif ($marine) { |
| 146 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
| 146 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
| 147 | 147 | } else { |
| 148 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$limit,$filter); |
|
| 148 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $limit, $filter); |
|
| 149 | 149 | } |
| 150 | 150 | } else { |
| 151 | 151 | if ($tracker) { |
@@ -153,19 +153,19 @@ discard block |
||
| 153 | 153 | } elseif ($marine) { |
| 154 | 154 | $spotter_array = $MarineLive->getMinLiveMarineData($filter); |
| 155 | 155 | } else { |
| 156 | - $spotter_array = $SpotterLive->getMinLiveSpotterData($limit,$filter); |
|
| 156 | + $spotter_array = $SpotterLive->getMinLiveSpotterData($limit, $filter); |
|
| 157 | 157 | } |
| 158 | 158 | } |
| 159 | 159 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
| 160 | 160 | $from_archive = true; |
| 161 | 161 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 162 | 162 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
| 163 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 164 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 165 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 166 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 167 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 168 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
| 163 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 164 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 165 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 166 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 167 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 168 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
| 169 | 169 | } elseif ($min) { |
| 170 | 170 | if ($tracker) { |
| 171 | 171 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -177,17 +177,17 @@ discard block |
||
| 177 | 177 | # $min = true; |
| 178 | 178 | } else { |
| 179 | 179 | if ($tracker) { |
| 180 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
| 180 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
| 181 | 181 | } elseif ($marine) { |
| 182 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
| 182 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
| 183 | 183 | } else { |
| 184 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
| 184 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if ($usecoord) { |
| 189 | 189 | if (isset($_GET['archive'])) { |
| 190 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
| 190 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
| 191 | 191 | } else { |
| 192 | 192 | if ($tracker) { |
| 193 | 193 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
@@ -200,9 +200,9 @@ discard block |
||
| 200 | 200 | if ($flightcnt == '') $flightcnt = 0; |
| 201 | 201 | } else $flightcnt = 0; |
| 202 | 202 | |
| 203 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 203 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 204 | 204 | |
| 205 | -$currenttime = filter_input(INPUT_GET,'currenttime',FILTER_SANITIZE_NUMBER_INT); |
|
| 205 | +$currenttime = filter_input(INPUT_GET, 'currenttime', FILTER_SANITIZE_NUMBER_INT); |
|
| 206 | 206 | if ($currenttime != '') $currenttime = round($currenttime/1000); |
| 207 | 207 | |
| 208 | 208 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | if (!empty($spotter_array) && is_array($spotter_array)) |
| 222 | 222 | { |
| 223 | 223 | $output .= '"features": ['; |
| 224 | - foreach($spotter_array as $spotter_item) |
|
| 224 | + foreach ($spotter_array as $spotter_item) |
|
| 225 | 225 | { |
| 226 | 226 | $j++; |
| 227 | 227 | unset($idistance); |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
| 280 | 280 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 281 | - if ($compress) $output .= '"c": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
| 282 | - else $output .= '"callsign": '.json_encode(str_replace('\\','',$spotter_item['ident'])).','; |
|
| 281 | + if ($compress) $output .= '"c": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
| 282 | + else $output .= '"callsign": '.json_encode(str_replace('\\', '', $spotter_item['ident'])).','; |
|
| 283 | 283 | //' |
| 284 | 284 | } else { |
| 285 | 285 | if ($compress) $output .= '"c": "NA",'; |
@@ -291,7 +291,7 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
| 293 | 293 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
| 294 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
| 294 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
| 295 | 295 | } elseif (isset($spotter_item['aircraft_type'])) { |
| 296 | 296 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
| 297 | 297 | } elseif (!$min) { |
@@ -377,19 +377,19 @@ discard block |
||
| 377 | 377 | else $output .= '"aircraft_shadow": "car.png",'; |
| 378 | 378 | } |
| 379 | 379 | } elseif ($marine) { |
| 380 | - if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
| 380 | + if (isset($spotter_item['type']) && ($spotter_item['type'] == '50' Performance Cruiser' || $spotter_item['type'] == '50\' Performance Cruiser' || $spotter_item['type'] == 'Sail')) { |
|
| 381 | 381 | if ($compress) $output .= '"as": "50perfcruiser.png",'; |
| 382 | 382 | else $output .= '"aircraft_shadow": "50perfcruiser.png",'; |
| 383 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
| 383 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Sailaway Cruiser 38') { |
|
| 384 | 384 | if ($compress) $output .= '"as": "cruiser38.png",'; |
| 385 | 385 | else $output .= '"aircraft_shadow": "cruiser38.png",'; |
| 386 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
| 386 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Mini Transat') { |
|
| 387 | 387 | if ($compress) $output .= '"as": "transat.png",'; |
| 388 | 388 | else $output .= '"aircraft_shadow": "transat.png",'; |
| 389 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
| 389 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == '52' Cruising Cat') { |
|
| 390 | 390 | if ($compress) $output .= '"as": "catamaran.png",'; |
| 391 | 391 | else $output .= '"aircraft_shadow": "catamaran.png",'; |
| 392 | - } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
| 392 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Caribbean Rose') { |
|
| 393 | 393 | if ($compress) $output .= '"as": "carib.png",'; |
| 394 | 394 | else $output .= '"aircraft_shadow": "carib.png",'; |
| 395 | 395 | } else { |
@@ -455,15 +455,15 @@ discard block |
||
| 455 | 455 | if (isset($archivespeed) || $usenextlatlon) { |
| 456 | 456 | if (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
| 457 | 457 | if (isset($spotter_item['arrival_airport_latitude'])) { |
| 458 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
| 459 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['arrival_airport_latitude'],$spotter_item['arrival_airport_longitude']); |
|
| 458 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
| 459 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['arrival_airport_latitude'], $spotter_item['arrival_airport_longitude']); |
|
| 460 | 460 | $farr_lat = $spotter_item['arrival_airport_latitude']; |
| 461 | 461 | $farr_lon = $spotter_item['arrival_airport_longitude']; |
| 462 | 462 | } else { |
| 463 | 463 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
| 464 | 464 | if (isset($aairport[0]['latitude'])) { |
| 465 | - $cheading = $Common->getHeading($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
| 466 | - $idistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$aairport[0]['latitude'],$aairport[0]['longitude']); |
|
| 465 | + $cheading = $Common->getHeading($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
| 466 | + $idistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $aairport[0]['latitude'], $aairport[0]['longitude']); |
|
| 467 | 467 | $farr_lat = $aairport[0]['latitude']; |
| 468 | 468 | $farr_lon = $aairport[0]['longitude']; |
| 469 | 469 | } |
@@ -476,59 +476,59 @@ discard block |
||
| 476 | 476 | if ($currenttime != '') { |
| 477 | 477 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 478 | 478 | if (isset($archivespeed)) { |
| 479 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 480 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 479 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 480 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 481 | 481 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 482 | 482 | else { |
| 483 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 484 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 483 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 484 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 485 | 485 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 486 | 486 | else { |
| 487 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 487 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 488 | 488 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 489 | 489 | } |
| 490 | 490 | } |
| 491 | 491 | } elseif ($usenextlatlon) { |
| 492 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 493 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 492 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 493 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 494 | 494 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 495 | 495 | else { |
| 496 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,1,($currenttime-strtotime($spotter_item['date'])+$globalMapRefresh)); |
|
| 497 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 496 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, 1, ($currenttime - strtotime($spotter_item['date']) + $globalMapRefresh)); |
|
| 497 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 498 | 498 | if (!isset($idistance) || $fdistance < $idistance) $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 499 | 499 | else { |
| 500 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 500 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 501 | 501 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 502 | 502 | } |
| 503 | 503 | } |
| 504 | 504 | } |
| 505 | 505 | } else { |
| 506 | 506 | if (isset($archivespeed)) { |
| 507 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 507 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 508 | 508 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 509 | 509 | } elseif ($usenextlatlon) { |
| 510 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 510 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 511 | 511 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | } else { |
| 515 | 515 | if (isset($archivespeed)) { |
| 516 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed); |
|
| 517 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 516 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed); |
|
| 517 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 518 | 518 | if (!isset($idistance) || $fdistance < $idistance) { |
| 519 | 519 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 520 | 520 | } else { |
| 521 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed); |
|
| 521 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed); |
|
| 522 | 522 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 523 | 523 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 524 | 524 | } |
| 525 | 525 | } elseif ($usenextlatlon) { |
| 526 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading); |
|
| 527 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 526 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading); |
|
| 527 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 528 | 528 | if (!isset($idistance) || $fdistance < $idistance) { |
| 529 | 529 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 530 | 530 | } else { |
| 531 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading); |
|
| 531 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading); |
|
| 532 | 532 | //$fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
| 533 | 533 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
| 534 | 534 | } |
@@ -537,7 +537,7 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | if (!$min) $output .= '"image": "'.$image.'",'; |
| 539 | 539 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
| 540 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
| 540 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
| 541 | 541 | } |
| 542 | 542 | if (isset($spotter_item['image_source_website'])) { |
| 543 | 543 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
| 572 | 572 | } |
| 573 | 573 | if (isset($spotter_item['acars'])) { |
| 574 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
| 574 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
| 575 | 575 | } |
| 576 | 576 | // type when not aircraft ? |
| 577 | 577 | if (isset($spotter_item['type'])) { |
@@ -591,12 +591,12 @@ discard block |
||
| 591 | 591 | if ($currenttime != '') { |
| 592 | 592 | if (strtotime($spotter_item['date']) < $currenttime) { |
| 593 | 593 | if (!isset($archivespeed)) $archivespeed = 1; |
| 594 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$heading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
| 595 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 594 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $heading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
| 595 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 596 | 596 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 597 | 597 | else { |
| 598 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$cheading,$archivespeed,($currenttime-strtotime($spotter_item['date']))); |
|
| 599 | - $fdistance = $Common->distance($spotter_item['latitude'],$spotter_item['longitude'],$nextcoord['latitude'],$nextcoord['longitude']); |
|
| 598 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $cheading, $archivespeed, ($currenttime - strtotime($spotter_item['date']))); |
|
| 599 | + $fdistance = $Common->distance($spotter_item['latitude'], $spotter_item['longitude'], $nextcoord['latitude'], $nextcoord['longitude']); |
|
| 600 | 600 | if (!isset($idistance) || $fdistance < $idistance) $output .= $nextcoord['longitude'].','.$nextcoord['latitude']; |
| 601 | 601 | else { |
| 602 | 602 | $output .= $spotter_item['longitude'].', '; |
@@ -675,7 +675,7 @@ discard block |
||
| 675 | 675 | |
| 676 | 676 | } |
| 677 | 677 | */ |
| 678 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
| 678 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
| 679 | 679 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
| 680 | 680 | |
| 681 | 681 | if ( |
@@ -683,11 +683,11 @@ discard block |
||
| 683 | 683 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
| 684 | 684 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
| 685 | 685 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
| 686 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 686 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 687 | 687 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
| 688 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
| 688 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
| 689 | 689 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
| 690 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
| 690 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
| 691 | 691 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
| 692 | 692 | ) { |
| 693 | 693 | if ($tracker) { |
@@ -716,9 +716,9 @@ discard block |
||
| 716 | 716 | require(dirname(__FILE__).'/require/class.MapMatching.php'); |
| 717 | 717 | $MapMatching = new MapMatching(); |
| 718 | 718 | if (isset($spotter_item['date_iso_8601'])) { |
| 719 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date_iso_8601']))))); |
|
| 719 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date_iso_8601']))))); |
|
| 720 | 720 | } else { |
| 721 | - $spotter_history_array_mm = array_merge($spotter_history_array,array(array('latitude' => $spotter_item['latitude'],'longitude' => $spotter_item['longitude'],'date' => date('c',strtotime($spotter_item['date']))))); |
|
| 721 | + $spotter_history_array_mm = array_merge($spotter_history_array, array(array('latitude' => $spotter_item['latitude'], 'longitude' => $spotter_item['longitude'], 'date' => date('c', strtotime($spotter_item['date']))))); |
|
| 722 | 722 | } |
| 723 | 723 | $spotter_history_array = $MapMatching->match($spotter_history_array_mm); |
| 724 | 724 | } |
@@ -750,9 +750,9 @@ discard block |
||
| 750 | 750 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
| 751 | 751 | } |
| 752 | 752 | $output_history .= '['; |
| 753 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 754 | - $output_history .= $spotter_history['latitude'].', '; |
|
| 755 | - $output_history .= $spotter_history['altitude']*30.48; |
|
| 753 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 754 | + $output_history .= $spotter_history['latitude'].', '; |
|
| 755 | + $output_history .= $spotter_history['altitude']*30.48; |
|
| 756 | 756 | $output_history .= '],'; |
| 757 | 757 | /* |
| 758 | 758 | if ($from_archive === false) { |
@@ -775,8 +775,8 @@ discard block |
||
| 775 | 775 | $d = true; |
| 776 | 776 | } |
| 777 | 777 | $output_history .= '['; |
| 778 | - $output_history .= $spotter_history['longitude'].', '; |
|
| 779 | - $output_history .= $spotter_history['latitude']; |
|
| 778 | + $output_history .= $spotter_history['longitude'].', '; |
|
| 779 | + $output_history .= $spotter_history['latitude']; |
|
| 780 | 780 | $output_history .= '],'; |
| 781 | 781 | /* |
| 782 | 782 | if ($from_archive === false) { |
@@ -792,9 +792,9 @@ discard block |
||
| 792 | 792 | //echo $output_history; |
| 793 | 793 | if ($from_archive === false && !isset($spotter_history_array[0]['mapmatching_engine'])) { |
| 794 | 794 | $output_historyd = '['; |
| 795 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
| 796 | - $output_historyd .= $spotter_item['latitude']; |
|
| 797 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 795 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
| 796 | + $output_historyd .= $spotter_item['latitude']; |
|
| 797 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
| 798 | 798 | $output_historyd .= '],'; |
| 799 | 799 | //$output_history = $output_historyd.$output_history; |
| 800 | 800 | $output_history = $output_history.$output_historyd; |
@@ -802,7 +802,7 @@ discard block |
||
| 802 | 802 | $last = array_pop($spotter_history_array); |
| 803 | 803 | $latitude = $last['latitude']; |
| 804 | 804 | $longitude = $last['longitude']; |
| 805 | - $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}','"coordinates": ['.$longitude.', '.$latitude.']}',$output); |
|
| 805 | + $output = str_replace('"coordinates": ['.$spotter_item['longitude'].', '.$spotter_item['latitude'].']}', '"coordinates": ['.$longitude.', '.$latitude.']}', $output); |
|
| 806 | 806 | } |
| 807 | 807 | |
| 808 | 808 | $output_history = substr($output_history, 0, -1); |
@@ -814,7 +814,7 @@ discard block |
||
| 814 | 814 | |
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 817 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 818 | 818 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 819 | 819 | && (isset($spotter_item['departure_airport']) |
| 820 | 820 | && $spotter_item['departure_airport'] != 'NA' |
@@ -848,7 +848,7 @@ discard block |
||
| 848 | 848 | |
| 849 | 849 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 850 | 850 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
| 851 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
| 851 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
| 852 | 852 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
| 853 | 853 | && (isset($spotter_item['arrival_airport']) |
| 854 | 854 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -875,11 +875,11 @@ discard block |
||
| 875 | 875 | } |
| 876 | 876 | } |
| 877 | 877 | if ($havedata) { |
| 878 | - $line = $Common->greatCircle($spotter_item['latitude'],$spotter_item['longitude'],$end_lat,$end_lon); |
|
| 878 | + $line = $Common->greatCircle($spotter_item['latitude'], $spotter_item['longitude'], $end_lat, $end_lon); |
|
| 879 | 879 | foreach ($line[0] as $coord) { |
| 880 | 880 | $output_dest .= '['.$coord[0].','.$coord[1].'],'; |
| 881 | 881 | } |
| 882 | - $output_dest = substr($output_dest, 0, -1); |
|
| 882 | + $output_dest = substr($output_dest, 0, -1); |
|
| 883 | 883 | } |
| 884 | 884 | $output_dest .= ']}},'; |
| 885 | 885 | if ($havedata) $output .= $output_dest; |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | $output = substr($output, 0, -1); |
| 890 | 890 | $output .= ']'; |
| 891 | 891 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 892 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 892 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 893 | 893 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 894 | 894 | $output .= '"fc": "'.$j.'"'; |
| 895 | 895 | } else { |