@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Get SQL query part for filter used |
| 17 | 17 | * @param Array $filter the filter |
| 18 | - * @return Array the SQL part |
|
| 18 | + * @return string the SQL part |
|
| 19 | 19 | */ |
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName; |
@@ -2198,7 +2198,7 @@ discard block |
||
| 2198 | 2198 | /** |
| 2199 | 2199 | * Gets the aircraft info based on the aircraft registration |
| 2200 | 2200 | * |
| 2201 | - * @param String $aircraft_registration the aircraft registration |
|
| 2201 | + * @param String $registration the aircraft registration |
|
| 2202 | 2202 | * @return String aircraft type |
| 2203 | 2203 | * |
| 2204 | 2204 | */ |
@@ -8663,6 +8663,7 @@ discard block |
||
| 8663 | 8663 | /** |
| 8664 | 8664 | * Counts all hours |
| 8665 | 8665 | * |
| 8666 | + * @param string $orderby |
|
| 8666 | 8667 | * @return Array the hour list |
| 8667 | 8668 | * |
| 8668 | 8669 | */ |
@@ -8728,6 +8729,7 @@ discard block |
||
| 8728 | 8729 | /** |
| 8729 | 8730 | * Counts all hours |
| 8730 | 8731 | * |
| 8732 | + * @param string $orderby |
|
| 8731 | 8733 | * @return Array the hour list |
| 8732 | 8734 | * |
| 8733 | 8735 | */ |
@@ -9540,7 +9542,7 @@ discard block |
||
| 9540 | 9542 | /** |
| 9541 | 9543 | * Parses the direction degrees to working |
| 9542 | 9544 | * |
| 9543 | - * @param Float $direction the direction in degrees |
|
| 9545 | + * @param integer $direction the direction in degrees |
|
| 9544 | 9546 | * @return Array the direction information |
| 9545 | 9547 | * |
| 9546 | 9548 | */ |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once(dirname(__FILE__).'/class.Image.php'); |
| 5 | 5 | $global_query = "SELECT spotter_output.* FROM spotter_output"; |
| 6 | 6 | |
| 7 | -class Spotter{ |
|
| 7 | +class Spotter { |
|
| 8 | 8 | public $db; |
| 9 | 9 | |
| 10 | 10 | public function __construct($dbc = null) { |
@@ -17,64 +17,64 @@ 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; |
| 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 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 31 | 31 | $filter_query_join = ''; |
| 32 | 32 | $filter_query_where = ''; |
| 33 | - foreach($filters as $flt) { |
|
| 33 | + foreach ($filters as $flt) { |
|
| 34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
| 35 | 35 | if ($flt['airlines'][0] != '') { |
| 36 | 36 | if (isset($flt['source'])) { |
| 37 | - $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 37 | + $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 38 | 38 | } else { |
| 39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | } |
| 43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
| 44 | 44 | if (isset($flt['source'])) { |
| 45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 45 | + $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'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 46 | 46 | } else { |
| 47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']))) { |
| 51 | 51 | if (isset($flt['source'])) { |
| 52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | 56 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
| 57 | 57 | if ($filter['airlines'][0] != '') { |
| 58 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 58 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
| 62 | 62 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_output.flightaware_id "; |
| 63 | 63 | } |
| 64 | 64 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
| 65 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 65 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) so ON so.flightaware_id = spotter_output.flightaware_id"; |
|
| 66 | 66 | } |
| 67 | 67 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 68 | - $filter_query_where = " WHERE format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 68 | + $filter_query_where = " WHERE format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 69 | 69 | } |
| 70 | 70 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 71 | 71 | $filter_query_where = " WHERE ident = '".$filter['ident']."'"; |
| 72 | 72 | } |
| 73 | 73 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 74 | 74 | if ($filter_query_where == '') { |
| 75 | - $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 75 | + $filter_query_where = " WHERE format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 76 | 76 | } else { |
| 77 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 77 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 78 | 78 | } |
| 79 | 79 | } |
| 80 | 80 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | * @return Array the spotter information |
| 93 | 93 | * |
| 94 | 94 | */ |
| 95 | - public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
|
| 95 | + public function getDataFromDB($query, $params = array(), $limitQuery = '', $schedules = false) |
|
| 96 | 96 | { |
| 97 | 97 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
| 98 | 98 | $Image = new Image($this->db); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | $sth = $this->db->prepare($query.$limitQuery); |
| 123 | 123 | $sth->execute($params); |
| 124 | 124 | } catch (PDOException $e) { |
| 125 | - printf("Invalid query : %s\nWhole query: %s\n",$e->getMessage(), $query.$limitQuery); |
|
| 125 | + printf("Invalid query : %s\nWhole query: %s\n", $e->getMessage(), $query.$limitQuery); |
|
| 126 | 126 | exit(); |
| 127 | 127 | } |
| 128 | 128 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $spotter_array = array(); |
| 133 | 133 | |
| 134 | 134 | |
| 135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 136 | 136 | { |
| 137 | 137 | $num_rows++; |
| 138 | 138 | $temp_array = array(); |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | if (isset($row['route_stop'])) { |
| 178 | 178 | $temp_array['route_stop'] = $row['route_stop']; |
| 179 | 179 | if ($row['route_stop'] != '') { |
| 180 | - $allroute = explode(' ',$row['route_stop']); |
|
| 180 | + $allroute = explode(' ', $row['route_stop']); |
|
| 181 | 181 | |
| 182 | 182 | foreach ($allroute as $route) { |
| 183 | 183 | $route_airport_array = $this->getAllAirportInfo($route); |
@@ -232,11 +232,11 @@ discard block |
||
| 232 | 232 | { |
| 233 | 233 | $temp_array['date'] = "about ".$dateArray['hours']." hours ago"; |
| 234 | 234 | } else { |
| 235 | - $temp_array['date'] = date("M j Y, g:i a",strtotime($row['date']." UTC")); |
|
| 235 | + $temp_array['date'] = date("M j Y, g:i a", strtotime($row['date']." UTC")); |
|
| 236 | 236 | } |
| 237 | 237 | $temp_array['date_minutes_past'] = $dateArray['minutes']; |
| 238 | - $temp_array['date_iso_8601'] = date("c",strtotime($row['date']." UTC")); |
|
| 239 | - $temp_array['date_rfc_2822'] = date("r",strtotime($row['date']." UTC")); |
|
| 238 | + $temp_array['date_iso_8601'] = date("c", strtotime($row['date']." UTC")); |
|
| 239 | + $temp_array['date_rfc_2822'] = date("r", strtotime($row['date']." UTC")); |
|
| 240 | 240 | $temp_array['date_unix'] = strtotime($row['date']." UTC"); |
| 241 | 241 | } |
| 242 | 242 | |
@@ -270,9 +270,9 @@ discard block |
||
| 270 | 270 | if (!isset($row['airline_name']) || $row['airline_name'] == '') { |
| 271 | 271 | if (!is_numeric(substr($row['ident'], 0, 3))) { |
| 272 | 272 | if (is_numeric(substr($row['ident'], 2, 1))) { |
| 273 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2),$fromsource); |
|
| 273 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 2), $fromsource); |
|
| 274 | 274 | } elseif (is_numeric(substr($row['ident'], 3, 1))) { |
| 275 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 275 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 276 | 276 | } else { |
| 277 | 277 | $airline_array = $this->getAllAirlineInfo('NA'); |
| 278 | 278 | } |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | if (isset($temp_array['airline_iata']) && $temp_array['airline_iata'] != '') { |
| 312 | - $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'],3)); |
|
| 312 | + $acars_array = $ACARS->getLiveAcarsData($temp_array['airline_iata'].substr($temp_array['ident'], 3)); |
|
| 313 | 313 | //$acars_array = ACARS->getLiveAcarsData('BA40YL'); |
| 314 | 314 | if (count($acars_array) > 0) { |
| 315 | 315 | $temp_array['acars'] = $acars_array; |
@@ -326,11 +326,11 @@ discard block |
||
| 326 | 326 | $temp_array['aircraft_date_first_reg'] = $owner_info['date_first_reg']; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - if($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 329 | + if ($temp_array['registration'] != "" || ($globalIVAO && isset($temp_array['aircraft_type']) && $temp_array['aircraft_type'] != '')) |
|
| 330 | 330 | { |
| 331 | 331 | if ($globalIVAO) { |
| 332 | - if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type'],$temp_array['airline_icao']); |
|
| 333 | - else $image_array = $Image->getSpotterImage('',$temp_array['aircraft_type']); |
|
| 332 | + if (isset($temp_array['airline_icao'])) $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type'], $temp_array['airline_icao']); |
|
| 333 | + else $image_array = $Image->getSpotterImage('', $temp_array['aircraft_type']); |
|
| 334 | 334 | } else $image_array = $Image->getSpotterImage($temp_array['registration']); |
| 335 | 335 | if (count($image_array) > 0) { |
| 336 | 336 | $temp_array['image'] = $image_array[0]['image']; |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | $temp_array['arrival_airport_time'] = $row['arrival_airport_time']; |
| 355 | 355 | } |
| 356 | 356 | |
| 357 | - if ((!isset($globalIVAO) || ! $globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 357 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 358 | 358 | if ($schedules === true) { |
| 359 | 359 | $schedule_array = $Schedule->getSchedule($temp_array['ident']); |
| 360 | 360 | //print_r($schedule_array); |
@@ -436,12 +436,12 @@ discard block |
||
| 436 | 436 | if (isset($row['squawk'])) { |
| 437 | 437 | $temp_array['squawk'] = $row['squawk']; |
| 438 | 438 | if ($row['squawk'] != '' && isset($temp_array['country_iso2'])) { |
| 439 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['country_iso2']); |
|
| 440 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 439 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['country_iso2']); |
|
| 440 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 441 | 441 | } elseif ($row['squawk'] != '' && isset($temp_array['over_country'])) { |
| 442 | - $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$temp_array['over_country']); |
|
| 443 | - if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 444 | - } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'],$globalSquawkCountry); |
|
| 442 | + $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $temp_array['over_country']); |
|
| 443 | + if ($temp_array['squawk_usage'] == '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 444 | + } elseif ($row['squawk'] != '' && isset($globalSquawkCountry)) $temp_array['squawk_usage'] = $this->getSquawkUsage($row['squawk'], $globalSquawkCountry); |
|
| 445 | 445 | } |
| 446 | 446 | |
| 447 | 447 | $temp_array['query_number_rows'] = $num_rows; |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | * @return Array the spotter information |
| 461 | 461 | * |
| 462 | 462 | */ |
| 463 | - public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
|
| 463 | + public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '', $pilot_id = '', $pilot_name = '', $altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '', $origLat = '', $origLon = '', $dist = '', $filters = array()) |
|
| 464 | 464 | { |
| 465 | 465 | global $globalTimezone, $globalDBdriver; |
| 466 | 466 | require_once(dirname(__FILE__).'/class.Translation.php'); |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | |
| 471 | 471 | $query_values = array(); |
| 472 | 472 | $additional_query = ''; |
| 473 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 473 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 474 | 474 | if ($q != "") |
| 475 | 475 | { |
| 476 | 476 | if (!is_string($q)) |
@@ -478,8 +478,8 @@ discard block |
||
| 478 | 478 | return false; |
| 479 | 479 | } else { |
| 480 | 480 | $q_array = explode(" ", $q); |
| 481 | - foreach ($q_array as $q_item){ |
|
| 482 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 481 | + foreach ($q_array as $q_item) { |
|
| 482 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 483 | 483 | $additional_query .= " AND ("; |
| 484 | 484 | if (is_int($q_item)) $additional_query .= "(spotter_output.spotter_id like '%".$q_item."%') OR "; |
| 485 | 485 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
@@ -511,37 +511,37 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | if ($registration != "") |
| 513 | 513 | { |
| 514 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 514 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 515 | 515 | if (!is_string($registration)) |
| 516 | 516 | { |
| 517 | 517 | return false; |
| 518 | 518 | } else { |
| 519 | 519 | $additional_query .= " AND spotter_output.registration = :registration"; |
| 520 | - $query_values = array_merge($query_values,array(':registration' => $registration)); |
|
| 520 | + $query_values = array_merge($query_values, array(':registration' => $registration)); |
|
| 521 | 521 | } |
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | if ($aircraft_icao != "") |
| 525 | 525 | { |
| 526 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 526 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 527 | 527 | if (!is_string($aircraft_icao)) |
| 528 | 528 | { |
| 529 | 529 | return false; |
| 530 | 530 | } else { |
| 531 | 531 | $additional_query .= " AND spotter_output.aircraft_icao = :aircraft_icao"; |
| 532 | - $query_values = array_merge($query_values,array(':aircraft_icao' => $aircraft_icao)); |
|
| 532 | + $query_values = array_merge($query_values, array(':aircraft_icao' => $aircraft_icao)); |
|
| 533 | 533 | } |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | if ($aircraft_manufacturer != "") |
| 537 | 537 | { |
| 538 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 538 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 539 | 539 | if (!is_string($aircraft_manufacturer)) |
| 540 | 540 | { |
| 541 | 541 | return false; |
| 542 | 542 | } else { |
| 543 | 543 | $additional_query .= " AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer"; |
| 544 | - $query_values = array_merge($query_values,array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 544 | + $query_values = array_merge($query_values, array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
|
| 545 | 545 | } |
| 546 | 546 | } |
| 547 | 547 | |
@@ -557,25 +557,25 @@ discard block |
||
| 557 | 557 | |
| 558 | 558 | if ($airline_icao != "") |
| 559 | 559 | { |
| 560 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 560 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 561 | 561 | if (!is_string($airline_icao)) |
| 562 | 562 | { |
| 563 | 563 | return false; |
| 564 | 564 | } else { |
| 565 | 565 | $additional_query .= " AND spotter_output.airline_icao = :airline_icao"; |
| 566 | - $query_values = array_merge($query_values,array(':airline_icao' => $airline_icao)); |
|
| 566 | + $query_values = array_merge($query_values, array(':airline_icao' => $airline_icao)); |
|
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | 570 | if ($airline_country != "") |
| 571 | 571 | { |
| 572 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
| 572 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
| 573 | 573 | if (!is_string($airline_country)) |
| 574 | 574 | { |
| 575 | 575 | return false; |
| 576 | 576 | } else { |
| 577 | 577 | $additional_query .= " AND spotter_output.airline_country = :airline_country"; |
| 578 | - $query_values = array_merge($query_values,array(':airline_country' => $airline_country)); |
|
| 578 | + $query_values = array_merge($query_values, array(':airline_country' => $airline_country)); |
|
| 579 | 579 | } |
| 580 | 580 | } |
| 581 | 581 | |
@@ -602,31 +602,31 @@ discard block |
||
| 602 | 602 | |
| 603 | 603 | if ($airport != "") |
| 604 | 604 | { |
| 605 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 605 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 606 | 606 | if (!is_string($airport)) |
| 607 | 607 | { |
| 608 | 608 | return false; |
| 609 | 609 | } else { |
| 610 | 610 | $additional_query .= " AND (spotter_output.departure_airport_icao = :airport OR spotter_output.arrival_airport_icao = :airport)"; |
| 611 | - $query_values = array_merge($query_values,array(':airport' => $airport)); |
|
| 611 | + $query_values = array_merge($query_values, array(':airport' => $airport)); |
|
| 612 | 612 | } |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | if ($airport_country != "") |
| 616 | 616 | { |
| 617 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
| 617 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
| 618 | 618 | if (!is_string($airport_country)) |
| 619 | 619 | { |
| 620 | 620 | return false; |
| 621 | 621 | } else { |
| 622 | 622 | $additional_query .= " AND (spotter_output.departure_airport_country = :airport_country OR spotter_output.arrival_airport_country = :airport_country)"; |
| 623 | - $query_values = array_merge($query_values,array(':airport_country' => $airport_country)); |
|
| 623 | + $query_values = array_merge($query_values, array(':airport_country' => $airport_country)); |
|
| 624 | 624 | } |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | if ($callsign != "") |
| 628 | 628 | { |
| 629 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 629 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 630 | 630 | if (!is_string($callsign)) |
| 631 | 631 | { |
| 632 | 632 | return false; |
@@ -634,79 +634,79 @@ discard block |
||
| 634 | 634 | $translate = $Translation->ident2icao($callsign); |
| 635 | 635 | if ($translate != $callsign) { |
| 636 | 636 | $additional_query .= " AND (spotter_output.ident = :callsign OR spotter_output.ident = :translate)"; |
| 637 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
| 637 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
| 638 | 638 | } else { |
| 639 | 639 | $additional_query .= " AND spotter_output.ident = :callsign"; |
| 640 | - $query_values = array_merge($query_values,array(':callsign' => $callsign)); |
|
| 640 | + $query_values = array_merge($query_values, array(':callsign' => $callsign)); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | if ($owner != "") |
| 646 | 646 | { |
| 647 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
| 647 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
| 648 | 648 | if (!is_string($owner)) |
| 649 | 649 | { |
| 650 | 650 | return false; |
| 651 | 651 | } else { |
| 652 | 652 | $additional_query .= " AND spotter_output.owner_name = :owner"; |
| 653 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
| 653 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
| 654 | 654 | } |
| 655 | 655 | } |
| 656 | 656 | |
| 657 | 657 | if ($pilot_name != "") |
| 658 | 658 | { |
| 659 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 659 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 660 | 660 | if (!is_string($pilot_name)) |
| 661 | 661 | { |
| 662 | 662 | return false; |
| 663 | 663 | } else { |
| 664 | 664 | $additional_query .= " AND spotter_output.pilot_name = :pilot_name"; |
| 665 | - $query_values = array_merge($query_values,array(':pilot_name' => $pilot_name)); |
|
| 665 | + $query_values = array_merge($query_values, array(':pilot_name' => $pilot_name)); |
|
| 666 | 666 | } |
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | if ($pilot_id != "") |
| 670 | 670 | { |
| 671 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
| 671 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
| 672 | 672 | if (!is_string($pilot_id)) |
| 673 | 673 | { |
| 674 | 674 | return false; |
| 675 | 675 | } else { |
| 676 | 676 | $additional_query .= " AND spotter_output.pilot_id = :pilot_id"; |
| 677 | - $query_values = array_merge($query_values,array(':pilot_id' => $pilot_id)); |
|
| 677 | + $query_values = array_merge($query_values, array(':pilot_id' => $pilot_id)); |
|
| 678 | 678 | } |
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | if ($departure_airport_route != "") |
| 682 | 682 | { |
| 683 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
| 683 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
| 684 | 684 | if (!is_string($departure_airport_route)) |
| 685 | 685 | { |
| 686 | 686 | return false; |
| 687 | 687 | } else { |
| 688 | 688 | $additional_query .= " AND spotter_output.departure_airport_icao = :departure_airport_route"; |
| 689 | - $query_values = array_merge($query_values,array(':departure_airport_route' => $departure_airport_route)); |
|
| 689 | + $query_values = array_merge($query_values, array(':departure_airport_route' => $departure_airport_route)); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | if ($arrival_airport_route != "") |
| 694 | 694 | { |
| 695 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
| 695 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
| 696 | 696 | if (!is_string($arrival_airport_route)) |
| 697 | 697 | { |
| 698 | 698 | return false; |
| 699 | 699 | } else { |
| 700 | 700 | $additional_query .= " AND spotter_output.arrival_airport_icao = :arrival_airport_route"; |
| 701 | - $query_values = array_merge($query_values,array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 701 | + $query_values = array_merge($query_values, array(':arrival_airport_route' => $arrival_airport_route)); |
|
| 702 | 702 | } |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | 705 | if ($altitude != "") |
| 706 | 706 | { |
| 707 | 707 | $altitude_array = explode(",", $altitude); |
| 708 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 709 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 708 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 709 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 710 | 710 | |
| 711 | 711 | if ($altitude_array[1] != "") |
| 712 | 712 | { |
@@ -722,8 +722,8 @@ discard block |
||
| 722 | 722 | if ($date_posted != "") |
| 723 | 723 | { |
| 724 | 724 | $date_array = explode(",", $date_posted); |
| 725 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
| 726 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
| 725 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
| 726 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
| 727 | 727 | |
| 728 | 728 | if ($globalTimezone != '') { |
| 729 | 729 | date_default_timezone_set($globalTimezone); |
@@ -754,8 +754,8 @@ discard block |
||
| 754 | 754 | { |
| 755 | 755 | $limit_array = explode(",", $limit); |
| 756 | 756 | |
| 757 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 758 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 757 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 758 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 759 | 759 | |
| 760 | 760 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 761 | 761 | { |
@@ -784,23 +784,23 @@ discard block |
||
| 784 | 784 | |
| 785 | 785 | |
| 786 | 786 | if ($origLat != "" && $origLon != "" && $dist != "") { |
| 787 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 787 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 788 | 788 | |
| 789 | 789 | if ($globalDBdriver == 'mysql') { |
| 790 | - $query="SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 790 | + $query = "SELECT spotter_output.*, 1.60935*3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2))) as distance |
|
| 791 | 791 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND spotter_archive.longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and spotter_archive.latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 792 | 792 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - spotter_archive.latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(spotter_archive.latitude*pi()/180)*POWER(SIN(($origLon-spotter_archive.longitude)*pi()/180/2),2)))) < $dist".$orderby_query; |
| 793 | 793 | } else { |
| 794 | - $query="SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 794 | + $query = "SELECT spotter_output.*, 1.60935 * 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
| 795 | 795 | FROM spotter_archive,spotter_output".$filter_query." spotter_output.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 796 | 796 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(spotter_archive.latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(spotter_archive.latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query.$orderby_query; |
| 797 | 797 | } |
| 798 | 798 | } else { |
| 799 | - $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 799 | + $query = "SELECT spotter_output.* FROM spotter_output".$filter_query." spotter_output.ident <> '' |
|
| 800 | 800 | ".$additional_query." |
| 801 | 801 | ".$orderby_query; |
| 802 | 802 | } |
| 803 | - $spotter_array = $this->getDataFromDB($query, $query_values,$limit_query); |
|
| 803 | + $spotter_array = $this->getDataFromDB($query, $query_values, $limit_query); |
|
| 804 | 804 | return $spotter_array; |
| 805 | 805 | } |
| 806 | 806 | |
@@ -823,8 +823,8 @@ discard block |
||
| 823 | 823 | { |
| 824 | 824 | $limit_array = explode(",", $limit); |
| 825 | 825 | |
| 826 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 827 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 826 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 827 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 828 | 828 | |
| 829 | 829 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 830 | 830 | { |
@@ -841,9 +841,9 @@ discard block |
||
| 841 | 841 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 842 | 842 | } |
| 843 | 843 | |
| 844 | - $query = $global_query.$filter_query." ".$orderby_query; |
|
| 844 | + $query = $global_query.$filter_query." ".$orderby_query; |
|
| 845 | 845 | |
| 846 | - $spotter_array = $this->getDataFromDB($query, array(),$limit_query,true); |
|
| 846 | + $spotter_array = $this->getDataFromDB($query, array(), $limit_query, true); |
|
| 847 | 847 | |
| 848 | 848 | return $spotter_array; |
| 849 | 849 | } |
@@ -889,34 +889,34 @@ discard block |
||
| 889 | 889 | { |
| 890 | 890 | return false; |
| 891 | 891 | } else { |
| 892 | - if ($interval == "30m"){ |
|
| 892 | + if ($interval == "30m") { |
|
| 893 | 893 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) <= $this_output.date '; |
| 894 | - } else if ($interval == "1h"){ |
|
| 894 | + } else if ($interval == "1h") { |
|
| 895 | 895 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) <= $this_output.date '; |
| 896 | - } else if ($interval == "3h"){ |
|
| 896 | + } else if ($interval == "3h") { |
|
| 897 | 897 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 3 HOUR) <= $this_output.date '; |
| 898 | - } else if ($interval == "6h"){ |
|
| 898 | + } else if ($interval == "6h") { |
|
| 899 | 899 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 6 HOUR) <= $this_output.date '; |
| 900 | - } else if ($interval == "12h"){ |
|
| 900 | + } else if ($interval == "12h") { |
|
| 901 | 901 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) <= $this_output.date '; |
| 902 | - } else if ($interval == "24h"){ |
|
| 902 | + } else if ($interval == "24h") { |
|
| 903 | 903 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 24 HOUR) <= $this_output.date '; |
| 904 | - } else if ($interval == "7d"){ |
|
| 904 | + } else if ($interval == "7d") { |
|
| 905 | 905 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY) <= $this_output.date '; |
| 906 | - } else if ($interval == "30d"){ |
|
| 906 | + } else if ($interval == "30d") { |
|
| 907 | 907 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 DAY) <= $this_output.date '; |
| 908 | 908 | } |
| 909 | 909 | } |
| 910 | 910 | } |
| 911 | 911 | |
| 912 | - $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 912 | + $query = "SELECT spotter_output.*, ( 6371 * acos( cos( radians($lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians($lng) ) + sin( radians($lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_output |
|
| 913 | 913 | WHERE spotter_output.latitude <> '' |
| 914 | 914 | AND spotter_output.longitude <> '' |
| 915 | 915 | ".$additional_query." |
| 916 | 916 | HAVING distance < :radius |
| 917 | 917 | ORDER BY distance"; |
| 918 | 918 | |
| 919 | - $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius),$limit_query); |
|
| 919 | + $spotter_array = $this->getDataFromDB($query, array(':radius' => $radius), $limit_query); |
|
| 920 | 920 | |
| 921 | 921 | return $spotter_array; |
| 922 | 922 | } |
@@ -928,21 +928,21 @@ discard block |
||
| 928 | 928 | * @return Array the spotter information |
| 929 | 929 | * |
| 930 | 930 | */ |
| 931 | - public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
|
| 931 | + public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '', $filter = array()) |
|
| 932 | 932 | { |
| 933 | 933 | global $global_query; |
| 934 | 934 | |
| 935 | 935 | date_default_timezone_set('UTC'); |
| 936 | 936 | |
| 937 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 937 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 938 | 938 | |
| 939 | 939 | $limit_query = ''; |
| 940 | 940 | if ($limit != "") |
| 941 | 941 | { |
| 942 | 942 | $limit_array = explode(",", $limit); |
| 943 | 943 | |
| 944 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 945 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 944 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 945 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 946 | 946 | |
| 947 | 947 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 948 | 948 | { |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 960 | 960 | } |
| 961 | 961 | |
| 962 | - $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 962 | + $query = $global_query." ".$filter_query." spotter_output.aircraft_name <> '' GROUP BY spotter_output.aircraft_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 963 | 963 | |
| 964 | 964 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 965 | 965 | |
@@ -978,15 +978,15 @@ discard block |
||
| 978 | 978 | global $global_query; |
| 979 | 979 | |
| 980 | 980 | date_default_timezone_set('UTC'); |
| 981 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 981 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 982 | 982 | |
| 983 | 983 | $limit_query = ''; |
| 984 | 984 | if ($limit != "") |
| 985 | 985 | { |
| 986 | 986 | $limit_array = explode(",", $limit); |
| 987 | 987 | |
| 988 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 988 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 989 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 990 | 990 | |
| 991 | 991 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 992 | 992 | { |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1004 | 1004 | } |
| 1005 | 1005 | |
| 1006 | - $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1006 | + $query = $global_query." ".$filter_query." spotter_output.registration <> '' GROUP BY spotter_output.registration,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1007 | 1007 | |
| 1008 | 1008 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1009 | 1009 | |
@@ -1017,20 +1017,20 @@ discard block |
||
| 1017 | 1017 | * @return Array the spotter information |
| 1018 | 1018 | * |
| 1019 | 1019 | */ |
| 1020 | - public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
|
| 1020 | + public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '', $filter = array()) |
|
| 1021 | 1021 | { |
| 1022 | 1022 | global $global_query; |
| 1023 | 1023 | |
| 1024 | 1024 | date_default_timezone_set('UTC'); |
| 1025 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1025 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1026 | 1026 | |
| 1027 | 1027 | $limit_query = ''; |
| 1028 | 1028 | if ($limit != "") |
| 1029 | 1029 | { |
| 1030 | 1030 | $limit_array = explode(",", $limit); |
| 1031 | 1031 | |
| 1032 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1032 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1033 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1034 | 1034 | |
| 1035 | 1035 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1036 | 1036 | { |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1048 | 1048 | } |
| 1049 | 1049 | |
| 1050 | - $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1050 | + $query = $global_query." ".$filter_query." spotter_output.airline_name <> '' GROUP BY spotter_output.airline_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1051 | 1051 | |
| 1052 | 1052 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1053 | 1053 | |
@@ -1067,7 +1067,7 @@ discard block |
||
| 1067 | 1067 | |
| 1068 | 1068 | date_default_timezone_set('UTC'); |
| 1069 | 1069 | |
| 1070 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1070 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1071 | 1071 | |
| 1072 | 1072 | $limit_query = ''; |
| 1073 | 1073 | |
@@ -1075,8 +1075,8 @@ discard block |
||
| 1075 | 1075 | { |
| 1076 | 1076 | $limit_array = explode(",", $limit); |
| 1077 | 1077 | |
| 1078 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1078 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1079 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1080 | 1080 | |
| 1081 | 1081 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1082 | 1082 | { |
@@ -1093,7 +1093,7 @@ discard block |
||
| 1093 | 1093 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | - $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1096 | + $query = $global_query." ".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' GROUP BY spotter_output.departure_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1097 | 1097 | |
| 1098 | 1098 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1099 | 1099 | |
@@ -1112,14 +1112,14 @@ discard block |
||
| 1112 | 1112 | global $global_query; |
| 1113 | 1113 | |
| 1114 | 1114 | date_default_timezone_set('UTC'); |
| 1115 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1115 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1116 | 1116 | $limit_query = ''; |
| 1117 | 1117 | if ($limit != "") |
| 1118 | 1118 | { |
| 1119 | 1119 | $limit_array = explode(",", $limit); |
| 1120 | 1120 | |
| 1121 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1122 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1121 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1122 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1123 | 1123 | |
| 1124 | 1124 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1125 | 1125 | { |
@@ -1136,7 +1136,7 @@ discard block |
||
| 1136 | 1136 | $orderby_query = " ORDER BY spotter_output.date DESC "; |
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | - $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1139 | + $query = $global_query.$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' GROUP BY spotter_output.arrival_airport_icao,spotter_output.ident,spotter_output.spotter_id, spotter_output.flightaware_id, spotter_output.registration,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.aircraft_icao,spotter_output.aircraft_name,spotter_output.aircraft_manufacturer,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time,spotter_output.route_stop,spotter_output.date,spotter_output.latitude,spotter_output.longitude,spotter_output.waypoints,spotter_output.altitude,spotter_output.heading,spotter_output.ground_speed,spotter_output.highlight,spotter_output.squawk,spotter_output.ModeS,spotter_output.pilot_id,spotter_output.pilot_name,spotter_output.verticalrate,spotter_output.owner_name,spotter_output.format_source,spotter_output.source_name,spotter_output.ground,spotter_output.last_ground,spotter_output.last_seen,spotter_output.last_latitude,spotter_output.last_longitude,spotter_output.last_altitude,spotter_output.last_ground_speed,spotter_output.real_arrival_airport_icao,spotter_output.real_arrival_airport_time ".$orderby_query; |
|
| 1140 | 1140 | |
| 1141 | 1141 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1142 | 1142 | |
@@ -1160,9 +1160,9 @@ discard block |
||
| 1160 | 1160 | $query_values = array(':id' => $id); |
| 1161 | 1161 | |
| 1162 | 1162 | //$query = $global_query." WHERE spotter_output.ident <> '' ".$additional_query." "; |
| 1163 | - $query = $global_query." WHERE ".$additional_query." "; |
|
| 1163 | + $query = $global_query." WHERE ".$additional_query." "; |
|
| 1164 | 1164 | |
| 1165 | - $spotter_array = $this->getDataFromDB($query,$query_values); |
|
| 1165 | + $spotter_array = $this->getDataFromDB($query, $query_values); |
|
| 1166 | 1166 | |
| 1167 | 1167 | return $spotter_array; |
| 1168 | 1168 | } |
@@ -1200,8 +1200,8 @@ discard block |
||
| 1200 | 1200 | { |
| 1201 | 1201 | $limit_array = explode(",", $limit); |
| 1202 | 1202 | |
| 1203 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1204 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1203 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1204 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1205 | 1205 | |
| 1206 | 1206 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1207 | 1207 | { |
@@ -1242,7 +1242,7 @@ discard block |
||
| 1242 | 1242 | $query_values = array(); |
| 1243 | 1243 | $limit_query = ''; |
| 1244 | 1244 | $additional_query = ''; |
| 1245 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1245 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1246 | 1246 | |
| 1247 | 1247 | if ($aircraft_type != "") |
| 1248 | 1248 | { |
@@ -1259,8 +1259,8 @@ discard block |
||
| 1259 | 1259 | { |
| 1260 | 1260 | $limit_array = explode(",", $limit); |
| 1261 | 1261 | |
| 1262 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1263 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1262 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1263 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1264 | 1264 | |
| 1265 | 1265 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1266 | 1266 | { |
@@ -1316,8 +1316,8 @@ discard block |
||
| 1316 | 1316 | { |
| 1317 | 1317 | $limit_array = explode(",", $limit); |
| 1318 | 1318 | |
| 1319 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1320 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1319 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1320 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1321 | 1321 | |
| 1322 | 1322 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1323 | 1323 | { |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | } else { |
| 1334 | 1334 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1335 | 1335 | } |
| 1336 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1336 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1337 | 1337 | |
| 1338 | 1338 | //$query = $global_query.$filter_query." spotter_output.ident <> '' ".$additional_query." ".$orderby_query; |
| 1339 | 1339 | $query = $global_query.$filter_query." ".$additional_query." ".$orderby_query; |
@@ -1352,7 +1352,7 @@ discard block |
||
| 1352 | 1352 | * @return Array the spotter information |
| 1353 | 1353 | * |
| 1354 | 1354 | */ |
| 1355 | - public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
|
| 1355 | + public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '', $filters = array()) |
|
| 1356 | 1356 | { |
| 1357 | 1357 | global $global_query; |
| 1358 | 1358 | |
@@ -1361,7 +1361,7 @@ discard block |
||
| 1361 | 1361 | $query_values = array(); |
| 1362 | 1362 | $limit_query = ''; |
| 1363 | 1363 | $additional_query = ''; |
| 1364 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1364 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1365 | 1365 | |
| 1366 | 1366 | if ($airline != "") |
| 1367 | 1367 | { |
@@ -1378,8 +1378,8 @@ discard block |
||
| 1378 | 1378 | { |
| 1379 | 1379 | $limit_array = explode(",", $limit); |
| 1380 | 1380 | |
| 1381 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1382 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1381 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1382 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1383 | 1383 | |
| 1384 | 1384 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1385 | 1385 | { |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | * @return Array the spotter information |
| 1410 | 1410 | * |
| 1411 | 1411 | */ |
| 1412 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
|
| 1412 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) |
|
| 1413 | 1413 | { |
| 1414 | 1414 | global $global_query; |
| 1415 | 1415 | |
@@ -1417,7 +1417,7 @@ discard block |
||
| 1417 | 1417 | $query_values = array(); |
| 1418 | 1418 | $limit_query = ''; |
| 1419 | 1419 | $additional_query = ''; |
| 1420 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1420 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1421 | 1421 | |
| 1422 | 1422 | if ($airport != "") |
| 1423 | 1423 | { |
@@ -1434,8 +1434,8 @@ discard block |
||
| 1434 | 1434 | { |
| 1435 | 1435 | $limit_array = explode(",", $limit); |
| 1436 | 1436 | |
| 1437 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1438 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1437 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1438 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1439 | 1439 | |
| 1440 | 1440 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1441 | 1441 | { |
@@ -1467,7 +1467,7 @@ discard block |
||
| 1467 | 1467 | * @return Array the spotter information |
| 1468 | 1468 | * |
| 1469 | 1469 | */ |
| 1470 | - public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
|
| 1470 | + public function getSpotterDataByDate($date = '', $limit = '', $sort = '', $filter = array()) |
|
| 1471 | 1471 | { |
| 1472 | 1472 | global $global_query, $globalTimezone, $globalDBdriver; |
| 1473 | 1473 | |
@@ -1475,7 +1475,7 @@ discard block |
||
| 1475 | 1475 | $limit_query = ''; |
| 1476 | 1476 | $additional_query = ''; |
| 1477 | 1477 | |
| 1478 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1478 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1479 | 1479 | |
| 1480 | 1480 | if ($date != "") |
| 1481 | 1481 | { |
@@ -1501,8 +1501,8 @@ discard block |
||
| 1501 | 1501 | { |
| 1502 | 1502 | $limit_array = explode(",", $limit); |
| 1503 | 1503 | |
| 1504 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1505 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1504 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1505 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1506 | 1506 | |
| 1507 | 1507 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1508 | 1508 | { |
@@ -1532,7 +1532,7 @@ discard block |
||
| 1532 | 1532 | * @return Array the spotter information |
| 1533 | 1533 | * |
| 1534 | 1534 | */ |
| 1535 | - public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
|
| 1535 | + public function getSpotterDataByCountry($country = '', $limit = '', $sort = '', $filters = array()) |
|
| 1536 | 1536 | { |
| 1537 | 1537 | global $global_query; |
| 1538 | 1538 | |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | $query_values = array(); |
| 1542 | 1542 | $limit_query = ''; |
| 1543 | 1543 | $additional_query = ''; |
| 1544 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1544 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1545 | 1545 | if ($country != "") |
| 1546 | 1546 | { |
| 1547 | 1547 | if (!is_string($country)) |
@@ -1558,8 +1558,8 @@ discard block |
||
| 1558 | 1558 | { |
| 1559 | 1559 | $limit_array = explode(",", $limit); |
| 1560 | 1560 | |
| 1561 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1562 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1561 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1562 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1563 | 1563 | |
| 1564 | 1564 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1565 | 1565 | { |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | $query_values = array(); |
| 1600 | 1600 | $additional_query = ''; |
| 1601 | 1601 | $limit_query = ''; |
| 1602 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1602 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1603 | 1603 | |
| 1604 | 1604 | if ($aircraft_manufacturer != "") |
| 1605 | 1605 | { |
@@ -1616,8 +1616,8 @@ discard block |
||
| 1616 | 1616 | { |
| 1617 | 1617 | $limit_array = explode(",", $limit); |
| 1618 | 1618 | |
| 1619 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1620 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1619 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1620 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1621 | 1621 | |
| 1622 | 1622 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1623 | 1623 | { |
@@ -1659,14 +1659,14 @@ discard block |
||
| 1659 | 1659 | $query_values = array(); |
| 1660 | 1660 | $additional_query = ''; |
| 1661 | 1661 | $limit_query = ''; |
| 1662 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 1662 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 1663 | 1663 | if ($departure_airport_icao != "") |
| 1664 | 1664 | { |
| 1665 | 1665 | if (!is_string($departure_airport_icao)) |
| 1666 | 1666 | { |
| 1667 | 1667 | return false; |
| 1668 | 1668 | } else { |
| 1669 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1669 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1670 | 1670 | $additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao)"; |
| 1671 | 1671 | //$additional_query .= " AND (spotter_output.departure_airport_icao = :departure_airport_icao AND spotter_output.real_departure_airport_icao IS NULL) OR spotter_output.real_departure_airport_icao = :departure_airport_icao"; |
| 1672 | 1672 | $query_values = array(':departure_airport_icao' => $departure_airport_icao); |
@@ -1679,10 +1679,10 @@ discard block |
||
| 1679 | 1679 | { |
| 1680 | 1680 | return false; |
| 1681 | 1681 | } else { |
| 1682 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 1682 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 1683 | 1683 | $additional_query .= " AND (spotter_output.arrival_airport_icao = :arrival_airport_icao)"; |
| 1684 | 1684 | //$additional_query .= " AND ((spotter_output.arrival_airport_icao = :arrival_airport_icao AND spotter_output.real_arrival_airport_icao IS NULL) OR spotter_output.real_arrival_airport_icao = :arrival_airport_icao)"; |
| 1685 | - $query_values = array_merge($query_values,array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1685 | + $query_values = array_merge($query_values, array(':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 1686 | 1686 | } |
| 1687 | 1687 | } |
| 1688 | 1688 | |
@@ -1690,8 +1690,8 @@ discard block |
||
| 1690 | 1690 | { |
| 1691 | 1691 | $limit_array = explode(",", $limit); |
| 1692 | 1692 | |
| 1693 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1694 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1693 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1694 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1695 | 1695 | |
| 1696 | 1696 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1697 | 1697 | { |
@@ -1730,15 +1730,15 @@ discard block |
||
| 1730 | 1730 | global $global_query; |
| 1731 | 1731 | |
| 1732 | 1732 | date_default_timezone_set('UTC'); |
| 1733 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1733 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1734 | 1734 | $limit_query = ''; |
| 1735 | 1735 | |
| 1736 | 1736 | if ($limit != "") |
| 1737 | 1737 | { |
| 1738 | 1738 | $limit_array = explode(",", $limit); |
| 1739 | 1739 | |
| 1740 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 1741 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 1740 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 1741 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 1742 | 1742 | |
| 1743 | 1743 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 1744 | 1744 | { |
@@ -1755,7 +1755,7 @@ discard block |
||
| 1755 | 1755 | $orderby_query = " ORDER BY spotter_output.date DESC"; |
| 1756 | 1756 | } |
| 1757 | 1757 | |
| 1758 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1758 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' ".$orderby_query; |
|
| 1759 | 1759 | |
| 1760 | 1760 | $spotter_array = $this->getDataFromDB($query, array(), $limit_query); |
| 1761 | 1761 | |
@@ -1768,19 +1768,19 @@ discard block |
||
| 1768 | 1768 | * @return String the highlight text |
| 1769 | 1769 | * |
| 1770 | 1770 | */ |
| 1771 | - public function getHighlightByRegistration($registration,$filter = array()) |
|
| 1771 | + public function getHighlightByRegistration($registration, $filter = array()) |
|
| 1772 | 1772 | { |
| 1773 | 1773 | global $global_query; |
| 1774 | 1774 | |
| 1775 | 1775 | date_default_timezone_set('UTC'); |
| 1776 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 1777 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 1776 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 1777 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 1778 | 1778 | |
| 1779 | - $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1779 | + $query = $global_query.$filter_query." spotter_output.highlight <> '' AND spotter_output.registration = :registration"; |
|
| 1780 | 1780 | $sth = $this->db->prepare($query); |
| 1781 | 1781 | $sth->execute(array(':registration' => $registration)); |
| 1782 | 1782 | |
| 1783 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1783 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1784 | 1784 | { |
| 1785 | 1785 | $highlight = $row['highlight']; |
| 1786 | 1786 | } |
@@ -1796,14 +1796,14 @@ discard block |
||
| 1796 | 1796 | * @return String usage |
| 1797 | 1797 | * |
| 1798 | 1798 | */ |
| 1799 | - public function getSquawkUsage($squawk = '',$country = 'FR') |
|
| 1799 | + public function getSquawkUsage($squawk = '', $country = 'FR') |
|
| 1800 | 1800 | { |
| 1801 | 1801 | |
| 1802 | - $squawk = filter_var($squawk,FILTER_SANITIZE_STRING); |
|
| 1803 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1802 | + $squawk = filter_var($squawk, FILTER_SANITIZE_STRING); |
|
| 1803 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1804 | 1804 | |
| 1805 | 1805 | $query = "SELECT squawk.* FROM squawk WHERE squawk.code = :squawk AND squawk.country = :country LIMIT 1"; |
| 1806 | - $query_values = array(':squawk' => ltrim($squawk,'0'), ':country' => $country); |
|
| 1806 | + $query_values = array(':squawk' => ltrim($squawk, '0'), ':country' => $country); |
|
| 1807 | 1807 | |
| 1808 | 1808 | $sth = $this->db->prepare($query); |
| 1809 | 1809 | $sth->execute($query_values); |
@@ -1825,9 +1825,9 @@ discard block |
||
| 1825 | 1825 | public function getAirportIcao($airport_iata = '') |
| 1826 | 1826 | { |
| 1827 | 1827 | |
| 1828 | - $airport_iata = filter_var($airport_iata,FILTER_SANITIZE_STRING); |
|
| 1828 | + $airport_iata = filter_var($airport_iata, FILTER_SANITIZE_STRING); |
|
| 1829 | 1829 | |
| 1830 | - $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1830 | + $query = "SELECT airport.* FROM airport WHERE airport.iata = :airport LIMIT 1"; |
|
| 1831 | 1831 | $query_values = array(':airport' => $airport_iata); |
| 1832 | 1832 | |
| 1833 | 1833 | $sth = $this->db->prepare($query); |
@@ -1849,12 +1849,12 @@ discard block |
||
| 1849 | 1849 | * @return Float distance to the airport |
| 1850 | 1850 | * |
| 1851 | 1851 | */ |
| 1852 | - public function getAirportDistance($airport_icao,$latitude,$longitude) |
|
| 1852 | + public function getAirportDistance($airport_icao, $latitude, $longitude) |
|
| 1853 | 1853 | { |
| 1854 | 1854 | |
| 1855 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 1855 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 1856 | 1856 | |
| 1857 | - $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1857 | + $query = "SELECT airport.latitude, airport.longitude FROM airport WHERE airport.icao = :airport LIMIT 1"; |
|
| 1858 | 1858 | $query_values = array(':airport' => $airport_icao); |
| 1859 | 1859 | $sth = $this->db->prepare($query); |
| 1860 | 1860 | $sth->execute($query_values); |
@@ -1864,7 +1864,7 @@ discard block |
||
| 1864 | 1864 | $airport_latitude = $row['latitude']; |
| 1865 | 1865 | $airport_longitude = $row['longitude']; |
| 1866 | 1866 | $Common = new Common(); |
| 1867 | - return $Common->distance($latitude,$longitude,$airport_latitude,$airport_longitude); |
|
| 1867 | + return $Common->distance($latitude, $longitude, $airport_latitude, $airport_longitude); |
|
| 1868 | 1868 | } else return ''; |
| 1869 | 1869 | } |
| 1870 | 1870 | |
@@ -1878,11 +1878,11 @@ discard block |
||
| 1878 | 1878 | public function getAllAirportInfo($airport = '') |
| 1879 | 1879 | { |
| 1880 | 1880 | |
| 1881 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
| 1881 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
| 1882 | 1882 | |
| 1883 | 1883 | $query_values = array(); |
| 1884 | 1884 | if ($airport == 'NA') { |
| 1885 | - return array(array('name' => 'Not available','city' => 'N/A', 'country' => 'N/A','iata' => 'NA','icao' => 'NA','altitude' => NULL,'latitude' => 0,'longitude' => 0,'type' => 'NA','home_link' => '','wikipedia_link' => '','image_thumb' => '', 'image' => '')); |
|
| 1885 | + return array(array('name' => 'Not available', 'city' => 'N/A', 'country' => 'N/A', 'iata' => 'NA', 'icao' => 'NA', 'altitude' => NULL, 'latitude' => 0, 'longitude' => 0, 'type' => 'NA', 'home_link' => '', 'wikipedia_link' => '', 'image_thumb' => '', 'image' => '')); |
|
| 1886 | 1886 | } elseif ($airport == '') { |
| 1887 | 1887 | $query = "SELECT airport.name, airport.city, airport.country, airport.iata, airport.icao, airport.latitude, airport.longitude, airport.altitude, airport.type, airport.home_link, airport.wikipedia_link, airport.image_thumb, airport.image FROM airport"; |
| 1888 | 1888 | } else { |
@@ -1930,14 +1930,14 @@ discard block |
||
| 1930 | 1930 | { |
| 1931 | 1931 | $lst_countries = ''; |
| 1932 | 1932 | foreach ($countries as $country) { |
| 1933 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 1933 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 1934 | 1934 | if ($lst_countries == '') { |
| 1935 | 1935 | $lst_countries = "'".$country."'"; |
| 1936 | 1936 | } else { |
| 1937 | 1937 | $lst_countries .= ",'".$country."'"; |
| 1938 | 1938 | } |
| 1939 | 1939 | } |
| 1940 | - $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1940 | + $query = "SELECT airport.* FROM airport WHERE airport.country IN (".$lst_countries.")"; |
|
| 1941 | 1941 | |
| 1942 | 1942 | $sth = $this->db->prepare($query); |
| 1943 | 1943 | $sth->execute(); |
@@ -1945,7 +1945,7 @@ discard block |
||
| 1945 | 1945 | $airport_array = array(); |
| 1946 | 1946 | $temp_array = array(); |
| 1947 | 1947 | |
| 1948 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1948 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1949 | 1949 | { |
| 1950 | 1950 | $temp_array['name'] = $row['name']; |
| 1951 | 1951 | $temp_array['city'] = $row['city']; |
@@ -1973,10 +1973,10 @@ discard block |
||
| 1973 | 1973 | { |
| 1974 | 1974 | global $globalDBdriver; |
| 1975 | 1975 | if (is_array($coord)) { |
| 1976 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1977 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1978 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1979 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1976 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1977 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1978 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1979 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1980 | 1980 | } else return array(); |
| 1981 | 1981 | if ($globalDBdriver == 'mysql') { |
| 1982 | 1982 | $query = "SELECT airport.* FROM airport WHERE airport.latitude BETWEEN ".$minlat." AND ".$maxlat." AND airport.longitude BETWEEN ".$minlong." AND ".$maxlong." AND airport.type != 'closed'"; |
@@ -1988,7 +1988,7 @@ discard block |
||
| 1988 | 1988 | |
| 1989 | 1989 | $airport_array = array(); |
| 1990 | 1990 | |
| 1991 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1991 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1992 | 1992 | { |
| 1993 | 1993 | $temp_array = $row; |
| 1994 | 1994 | |
@@ -2008,13 +2008,13 @@ discard block |
||
| 2008 | 2008 | public function getAllWaypointsInfobyCoord($coord) |
| 2009 | 2009 | { |
| 2010 | 2010 | if (is_array($coord)) { |
| 2011 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2012 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2013 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2014 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 2011 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2012 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2013 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2014 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 2015 | 2015 | } else return array(); |
| 2016 | 2016 | //$query = "SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
| 2017 | - $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2017 | + $query = "SELECT waypoints.* FROM waypoints WHERE (waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") OR (waypoints.latitude_end BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_end BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 2018 | 2018 | //$query = "SELECT waypoints.* FROM waypoints"; |
| 2019 | 2019 | //$query = "SELECT waypoints.* FROM waypoints INNER JOIN (SELECT waypoints.* FROM waypoints WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong.") w ON w.name_end = waypoints.name_begin OR w.name_begin = waypoints.name_begin OR w.name_begin = waypoints.name_end OR w.name_end = waypoints.name_end"; |
| 2020 | 2020 | //$query = "SELECT * FROM waypoints LEFT JOIN waypoints w ON waypoints.name_end = w.name_begin WHERE waypoints.latitude_begin BETWEEN ".$minlat." AND ".$maxlat." AND waypoints.longitude_begin BETWEEN ".$minlong." AND ".$maxlong; |
@@ -2026,7 +2026,7 @@ discard block |
||
| 2026 | 2026 | |
| 2027 | 2027 | $waypoints_array = array(); |
| 2028 | 2028 | |
| 2029 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2029 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2030 | 2030 | { |
| 2031 | 2031 | $temp_array = $row; |
| 2032 | 2032 | |
@@ -2048,10 +2048,10 @@ discard block |
||
| 2048 | 2048 | { |
| 2049 | 2049 | global $globalUseRealAirlines; |
| 2050 | 2050 | if (isset($globalUseRealAirlines) && $globalUseRealAirlines) $fromsource = NULL; |
| 2051 | - $airline_icao = strtoupper(filter_var($airline_icao,FILTER_SANITIZE_STRING)); |
|
| 2051 | + $airline_icao = strtoupper(filter_var($airline_icao, FILTER_SANITIZE_STRING)); |
|
| 2052 | 2052 | if ($airline_icao == 'NA') { |
| 2053 | 2053 | $airline_array = array(); |
| 2054 | - $airline_array[] = array('name' => 'Not Available','iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2054 | + $airline_array[] = array('name' => 'Not Available', 'iata' => 'NA', 'icao' => 'NA', 'callsign' => '', 'country' => 'NA', 'type' =>''); |
|
| 2055 | 2055 | return $airline_array; |
| 2056 | 2056 | } else { |
| 2057 | 2057 | if (strlen($airline_icao) == 2) { |
@@ -2072,7 +2072,7 @@ discard block |
||
| 2072 | 2072 | if ($fromsource === NULL) { |
| 2073 | 2073 | $sth->execute(array(':airline_icao' => $airline_icao)); |
| 2074 | 2074 | } else { |
| 2075 | - $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
|
| 2075 | + $sth->execute(array(':airline_icao' => $airline_icao, ':fromsource' => $fromsource)); |
|
| 2076 | 2076 | } |
| 2077 | 2077 | /* |
| 2078 | 2078 | $airline_array = array(); |
@@ -2114,12 +2114,12 @@ discard block |
||
| 2114 | 2114 | */ |
| 2115 | 2115 | public function getAllAircraftInfo($aircraft_type) |
| 2116 | 2116 | { |
| 2117 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2117 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2118 | 2118 | |
| 2119 | 2119 | if ($aircraft_type == 'NA') { |
| 2120 | - return array(array('icao' => 'NA','type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2120 | + return array(array('icao' => 'NA', 'type' => 'Not Available', 'manufacturer' => 'Not Available', 'aircraft_shadow' => NULL)); |
|
| 2121 | 2121 | } |
| 2122 | - $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2122 | + $query = "SELECT aircraft.icao, aircraft.type,aircraft.manufacturer,aircraft.aircraft_shadow, aircraft.official_page, aircraft.aircraft_description, aircraft.engine_type, aircraft.engine_count, aircraft.wake_category FROM aircraft WHERE aircraft.icao = :aircraft_type"; |
|
| 2123 | 2123 | |
| 2124 | 2124 | $sth = $this->db->prepare($query); |
| 2125 | 2125 | $sth->execute(array(':aircraft_type' => $aircraft_type)); |
@@ -2151,7 +2151,7 @@ discard block |
||
| 2151 | 2151 | */ |
| 2152 | 2152 | public function getAircraftIcao($aircraft_type) |
| 2153 | 2153 | { |
| 2154 | - $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
|
| 2154 | + $aircraft_type = filter_var($aircraft_type, FILTER_SANITIZE_STRING); |
|
| 2155 | 2155 | $all_aircraft = array('737-300' => 'B733', |
| 2156 | 2156 | '777-200' => 'B772', |
| 2157 | 2157 | '777-200ER' => 'B772', |
@@ -2163,10 +2163,10 @@ discard block |
||
| 2163 | 2163 | 'A380' => 'A388'); |
| 2164 | 2164 | if (isset($all_aircraft[$aircraft_type])) return $all_aircraft[$aircraft_type]; |
| 2165 | 2165 | |
| 2166 | - $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2166 | + $query = "SELECT aircraft.icao FROM aircraft WHERE aircraft.type LIKE :saircraft_type OR aircraft.type = :aircraft_type OR aircraft.icao = :aircraft_type LIMIT 1"; |
|
| 2167 | 2167 | $aircraft_type = strtoupper($aircraft_type); |
| 2168 | 2168 | $sth = $this->db->prepare($query); |
| 2169 | - $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%',':aircraft_type' => $aircraft_type,)); |
|
| 2169 | + $sth->execute(array(':saircraft_type' => '%'.$aircraft_type.'%', ':aircraft_type' => $aircraft_type,)); |
|
| 2170 | 2170 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 2171 | 2171 | if (isset($result[0]['icao'])) return $result[0]['icao']; |
| 2172 | 2172 | else return ''; |
@@ -2181,9 +2181,9 @@ discard block |
||
| 2181 | 2181 | */ |
| 2182 | 2182 | public function getAllAircraftType($aircraft_modes) |
| 2183 | 2183 | { |
| 2184 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 2184 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 2185 | 2185 | |
| 2186 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2186 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2187 | 2187 | |
| 2188 | 2188 | $sth = $this->db->prepare($query); |
| 2189 | 2189 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -2204,9 +2204,9 @@ discard block |
||
| 2204 | 2204 | */ |
| 2205 | 2205 | public function getAllAircraftTypeByRegistration($registration) |
| 2206 | 2206 | { |
| 2207 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2207 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2208 | 2208 | |
| 2209 | - $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2209 | + $query = "SELECT aircraft_modes.ICAOTypeCode FROM aircraft_modes WHERE aircraft_modes.registration = :registration ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 2210 | 2210 | |
| 2211 | 2211 | $sth = $this->db->prepare($query); |
| 2212 | 2212 | $sth->execute(array(':registration' => $registration)); |
@@ -2227,8 +2227,8 @@ discard block |
||
| 2227 | 2227 | */ |
| 2228 | 2228 | public function getOperator($operator) |
| 2229 | 2229 | { |
| 2230 | - $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
|
| 2231 | - $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2230 | + $operator = filter_var($operator, FILTER_SANITIZE_STRING); |
|
| 2231 | + $query = "SELECT translation.operator_correct FROM translation WHERE translation.operator = :operator LIMIT 1"; |
|
| 2232 | 2232 | |
| 2233 | 2233 | $sth = $this->db->prepare($query); |
| 2234 | 2234 | $sth->execute(array(':operator' => $operator)); |
@@ -2249,9 +2249,9 @@ discard block |
||
| 2249 | 2249 | */ |
| 2250 | 2250 | public function getRouteInfo($callsign) |
| 2251 | 2251 | { |
| 2252 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 2252 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 2253 | 2253 | if ($callsign == '') return array(); |
| 2254 | - $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2254 | + $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
|
| 2255 | 2255 | |
| 2256 | 2256 | $sth = $this->db->prepare($query); |
| 2257 | 2257 | $sth->execute(array(':callsign' => $callsign)); |
@@ -2272,9 +2272,9 @@ discard block |
||
| 2272 | 2272 | */ |
| 2273 | 2273 | public function getAircraftInfoByRegistration($registration) |
| 2274 | 2274 | { |
| 2275 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2275 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2276 | 2276 | |
| 2277 | - $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2277 | + $query = "SELECT spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer, spotter_output.airline_icao FROM spotter_output WHERE spotter_output.registration = :registration"; |
|
| 2278 | 2278 | |
| 2279 | 2279 | $sth = $this->db->prepare($query); |
| 2280 | 2280 | $sth->execute(array(':registration' => $registration)); |
@@ -2282,7 +2282,7 @@ discard block |
||
| 2282 | 2282 | $aircraft_array = array(); |
| 2283 | 2283 | $temp_array = array(); |
| 2284 | 2284 | |
| 2285 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2285 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2286 | 2286 | { |
| 2287 | 2287 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2288 | 2288 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -2304,7 +2304,7 @@ discard block |
||
| 2304 | 2304 | */ |
| 2305 | 2305 | public function getAircraftOwnerByRegistration($registration) |
| 2306 | 2306 | { |
| 2307 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 2307 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 2308 | 2308 | $Connection = new Connection($this->db); |
| 2309 | 2309 | if ($Connection->tableExists('aircraft_owner')) { |
| 2310 | 2310 | $query = "SELECT aircraft_owner.base, aircraft_owner.owner, aircraft_owner.date_first_reg FROM aircraft_owner WHERE registration = :registration LIMIT 1"; |
@@ -2326,7 +2326,7 @@ discard block |
||
| 2326 | 2326 | public function getAllFlightsforSitemap() |
| 2327 | 2327 | { |
| 2328 | 2328 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
| 2329 | - $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2329 | + $query = "SELECT spotter_output.spotter_id FROM spotter_output ORDER BY spotter_id DESC LIMIT 200 OFFSET 0"; |
|
| 2330 | 2330 | |
| 2331 | 2331 | $sth = $this->db->prepare($query); |
| 2332 | 2332 | $sth->execute(); |
@@ -2373,7 +2373,7 @@ discard block |
||
| 2373 | 2373 | $manufacturer_array = array(); |
| 2374 | 2374 | $temp_array = array(); |
| 2375 | 2375 | |
| 2376 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2376 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2377 | 2377 | { |
| 2378 | 2378 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 2379 | 2379 | |
@@ -2399,7 +2399,7 @@ discard block |
||
| 2399 | 2399 | ORDER BY spotter_output.aircraft_name ASC"; |
| 2400 | 2400 | |
| 2401 | 2401 | */ |
| 2402 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2402 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2403 | 2403 | $query = "SELECT DISTINCT icao AS aircraft_icao, type AS aircraft_name, manufacturer AS aircraft_manufacturer FROM aircraft".$filter_query." icao <> '' ORDER BY aircraft_manufacturer ASC"; |
| 2404 | 2404 | |
| 2405 | 2405 | $sth = $this->db->prepare($query); |
@@ -2408,7 +2408,7 @@ discard block |
||
| 2408 | 2408 | $aircraft_array = array(); |
| 2409 | 2409 | $temp_array = array(); |
| 2410 | 2410 | |
| 2411 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2411 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2412 | 2412 | { |
| 2413 | 2413 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 2414 | 2414 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
@@ -2429,8 +2429,8 @@ discard block |
||
| 2429 | 2429 | */ |
| 2430 | 2430 | public function getAllAircraftRegistrations($filters = array()) |
| 2431 | 2431 | { |
| 2432 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2433 | - $query = "SELECT DISTINCT spotter_output.registration |
|
| 2432 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2433 | + $query = "SELECT DISTINCT spotter_output.registration |
|
| 2434 | 2434 | FROM spotter_output".$filter_query." spotter_output.registration <> '' |
| 2435 | 2435 | ORDER BY spotter_output.registration ASC"; |
| 2436 | 2436 | |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | $aircraft_array = array(); |
| 2441 | 2441 | $temp_array = array(); |
| 2442 | 2442 | |
| 2443 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2443 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2444 | 2444 | { |
| 2445 | 2445 | $temp_array['registration'] = $row['registration']; |
| 2446 | 2446 | |
@@ -2457,11 +2457,11 @@ discard block |
||
| 2457 | 2457 | * @return Array list of source name |
| 2458 | 2458 | * |
| 2459 | 2459 | */ |
| 2460 | - public function getAllSourceName($type = '',$filters = array()) |
|
| 2460 | + public function getAllSourceName($type = '', $filters = array()) |
|
| 2461 | 2461 | { |
| 2462 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2462 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2463 | 2463 | $query_values = array(); |
| 2464 | - $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2464 | + $query = "SELECT DISTINCT spotter_output.source_name |
|
| 2465 | 2465 | FROM spotter_output".$filter_query." spotter_output.source_name <> ''"; |
| 2466 | 2466 | if ($type != '') { |
| 2467 | 2467 | $query_values = array(':type' => $type); |
@@ -2476,7 +2476,7 @@ discard block |
||
| 2476 | 2476 | $source_array = array(); |
| 2477 | 2477 | $temp_array = array(); |
| 2478 | 2478 | |
| 2479 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2479 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2480 | 2480 | { |
| 2481 | 2481 | $temp_array['source_name'] = $row['source_name']; |
| 2482 | 2482 | $source_array[] = $temp_array; |
@@ -2492,11 +2492,11 @@ discard block |
||
| 2492 | 2492 | * @return Array list of airline names |
| 2493 | 2493 | * |
| 2494 | 2494 | */ |
| 2495 | - public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
|
| 2495 | + public function getAllAirlineNames($airline_type = '', $forsource = NULL, $filters = array()) |
|
| 2496 | 2496 | { |
| 2497 | - global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
|
| 2498 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2499 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
| 2497 | + global $globalAirlinesSource, $globalVATSIM, $globalIVAO; |
|
| 2498 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2499 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
| 2500 | 2500 | if ($airline_type == '' || $airline_type == 'all') { |
| 2501 | 2501 | /* |
| 2502 | 2502 | $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
@@ -2515,7 +2515,7 @@ discard block |
||
| 2515 | 2515 | $query_data = array(':forsource' => $forsource); |
| 2516 | 2516 | } |
| 2517 | 2517 | } else { |
| 2518 | - $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2518 | + $query = "SELECT DISTINCT spotter_output.airline_icao AS airline_icao, spotter_output.airline_name AS airline_name, spotter_output.airline_type AS airline_type |
|
| 2519 | 2519 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 2520 | 2520 | AND spotter_output.airline_type = :airline_type |
| 2521 | 2521 | ORDER BY spotter_output.airline_icao ASC"; |
@@ -2528,7 +2528,7 @@ discard block |
||
| 2528 | 2528 | $airline_array = array(); |
| 2529 | 2529 | $temp_array = array(); |
| 2530 | 2530 | |
| 2531 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2531 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2532 | 2532 | { |
| 2533 | 2533 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 2534 | 2534 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -2548,8 +2548,8 @@ discard block |
||
| 2548 | 2548 | */ |
| 2549 | 2549 | public function getAllAirlineCountries($filters = array()) |
| 2550 | 2550 | { |
| 2551 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2552 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2551 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2552 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2553 | 2553 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2554 | 2554 | ORDER BY spotter_output.airline_country ASC"; |
| 2555 | 2555 | |
@@ -2560,7 +2560,7 @@ discard block |
||
| 2560 | 2560 | $airline_array = array(); |
| 2561 | 2561 | $temp_array = array(); |
| 2562 | 2562 | |
| 2563 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2563 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2564 | 2564 | { |
| 2565 | 2565 | $temp_array['airline_country'] = $row['airline_country']; |
| 2566 | 2566 | |
@@ -2580,9 +2580,9 @@ discard block |
||
| 2580 | 2580 | */ |
| 2581 | 2581 | public function getAllAirportNames($filters = array()) |
| 2582 | 2582 | { |
| 2583 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2583 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2584 | 2584 | $airport_array = array(); |
| 2585 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2585 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao AS airport_icao, spotter_output.departure_airport_name AS airport_name, spotter_output.departure_airport_city AS airport_city, spotter_output.departure_airport_country AS airport_country |
|
| 2586 | 2586 | FROM spotter_output".$filter_query." spotter_output.departure_airport_icao <> '' AND spotter_output.departure_airport_icao <> 'NA' |
| 2587 | 2587 | ORDER BY spotter_output.departure_airport_city ASC"; |
| 2588 | 2588 | |
@@ -2591,7 +2591,7 @@ discard block |
||
| 2591 | 2591 | $sth->execute(); |
| 2592 | 2592 | |
| 2593 | 2593 | $temp_array = array(); |
| 2594 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2594 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2595 | 2595 | { |
| 2596 | 2596 | $temp_array['airport_icao'] = $row['airport_icao']; |
| 2597 | 2597 | $temp_array['airport_name'] = $row['airport_name']; |
@@ -2601,14 +2601,14 @@ discard block |
||
| 2601 | 2601 | $airport_array[$row['airport_city'].",".$row['airport_name']] = $temp_array; |
| 2602 | 2602 | } |
| 2603 | 2603 | |
| 2604 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2604 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao AS airport_icao, spotter_output.arrival_airport_name AS airport_name, spotter_output.arrival_airport_city AS airport_city, spotter_output.arrival_airport_country AS airport_country |
|
| 2605 | 2605 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> '' AND spotter_output.arrival_airport_icao <> 'NA' |
| 2606 | 2606 | ORDER BY spotter_output.arrival_airport_city ASC"; |
| 2607 | 2607 | |
| 2608 | 2608 | $sth = $this->db->prepare($query); |
| 2609 | 2609 | $sth->execute(); |
| 2610 | 2610 | |
| 2611 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2611 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2612 | 2612 | { |
| 2613 | 2613 | // if ($airport_array[$row['airport_city'].",".$row['airport_name']]['airport_icao'] != $row['airport_icao']) |
| 2614 | 2614 | // { |
@@ -2648,21 +2648,21 @@ discard block |
||
| 2648 | 2648 | |
| 2649 | 2649 | $temp_array = array(); |
| 2650 | 2650 | |
| 2651 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2651 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2652 | 2652 | { |
| 2653 | 2653 | $temp_array['airport_country'] = $row['airport_country']; |
| 2654 | 2654 | |
| 2655 | 2655 | $airport_array[$row['airport_country']] = $temp_array; |
| 2656 | 2656 | } |
| 2657 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2658 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2657 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2658 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2659 | 2659 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2660 | 2660 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2661 | 2661 | |
| 2662 | 2662 | $sth = $this->db->prepare($query); |
| 2663 | 2663 | $sth->execute(); |
| 2664 | 2664 | |
| 2665 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2665 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2666 | 2666 | { |
| 2667 | 2667 | if (isset($airport_array[$row['airport_country']]['airport_country']) && $airport_array[$row['airport_country']]['airport_country'] != $row['airport_country']) |
| 2668 | 2668 | { |
@@ -2685,9 +2685,9 @@ discard block |
||
| 2685 | 2685 | */ |
| 2686 | 2686 | public function getAllCountries($filters = array()) |
| 2687 | 2687 | { |
| 2688 | - $Connection= new Connection($this->db); |
|
| 2688 | + $Connection = new Connection($this->db); |
|
| 2689 | 2689 | if ($Connection->tableExists('countries')) { |
| 2690 | - $query = "SELECT countries.name AS airport_country |
|
| 2690 | + $query = "SELECT countries.name AS airport_country |
|
| 2691 | 2691 | FROM countries |
| 2692 | 2692 | ORDER BY countries.name ASC"; |
| 2693 | 2693 | $sth = $this->db->prepare($query); |
@@ -2696,14 +2696,14 @@ discard block |
||
| 2696 | 2696 | $temp_array = array(); |
| 2697 | 2697 | $country_array = array(); |
| 2698 | 2698 | |
| 2699 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2699 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2700 | 2700 | { |
| 2701 | 2701 | $temp_array['country'] = $row['airport_country']; |
| 2702 | 2702 | $country_array[$row['airport_country']] = $temp_array; |
| 2703 | 2703 | } |
| 2704 | 2704 | } else { |
| 2705 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2706 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2705 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2706 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country AS airport_country |
|
| 2707 | 2707 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' |
| 2708 | 2708 | ORDER BY spotter_output.departure_airport_country ASC"; |
| 2709 | 2709 | |
@@ -2712,20 +2712,20 @@ discard block |
||
| 2712 | 2712 | |
| 2713 | 2713 | $temp_array = array(); |
| 2714 | 2714 | $country_array = array(); |
| 2715 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2715 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2716 | 2716 | { |
| 2717 | 2717 | $temp_array['country'] = $row['airport_country']; |
| 2718 | 2718 | $country_array[$row['airport_country']] = $temp_array; |
| 2719 | 2719 | } |
| 2720 | 2720 | |
| 2721 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2721 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country AS airport_country |
|
| 2722 | 2722 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' |
| 2723 | 2723 | ORDER BY spotter_output.arrival_airport_country ASC"; |
| 2724 | 2724 | |
| 2725 | 2725 | $sth = $this->db->prepare($query); |
| 2726 | 2726 | $sth->execute(); |
| 2727 | 2727 | |
| 2728 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2728 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2729 | 2729 | { |
| 2730 | 2730 | if ($country_array[$row['airport_country']]['country'] != $row['airport_country']) |
| 2731 | 2731 | { |
@@ -2735,14 +2735,14 @@ discard block |
||
| 2735 | 2735 | } |
| 2736 | 2736 | } |
| 2737 | 2737 | |
| 2738 | - $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2738 | + $query = "SELECT DISTINCT spotter_output.airline_country AS airline_country |
|
| 2739 | 2739 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' |
| 2740 | 2740 | ORDER BY spotter_output.airline_country ASC"; |
| 2741 | 2741 | |
| 2742 | 2742 | $sth = $this->db->prepare($query); |
| 2743 | 2743 | $sth->execute(); |
| 2744 | 2744 | |
| 2745 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2745 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2746 | 2746 | { |
| 2747 | 2747 | if (isset($country_array[$row['airline_country']]['country']) && $country_array[$row['airline_country']]['country'] != $row['airline_country']) |
| 2748 | 2748 | { |
@@ -2766,8 +2766,8 @@ discard block |
||
| 2766 | 2766 | */ |
| 2767 | 2767 | public function getAllIdents($filters = array()) |
| 2768 | 2768 | { |
| 2769 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2770 | - $query = "SELECT DISTINCT spotter_output.ident |
|
| 2769 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2770 | + $query = "SELECT DISTINCT spotter_output.ident |
|
| 2771 | 2771 | FROM spotter_output".$filter_query." spotter_output.ident <> '' |
| 2772 | 2772 | ORDER BY spotter_output.date ASC LIMIT 700 OFFSET 0"; |
| 2773 | 2773 | |
@@ -2777,7 +2777,7 @@ discard block |
||
| 2777 | 2777 | $ident_array = array(); |
| 2778 | 2778 | $temp_array = array(); |
| 2779 | 2779 | |
| 2780 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2780 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 2781 | 2781 | { |
| 2782 | 2782 | $temp_array['ident'] = $row['ident']; |
| 2783 | 2783 | $ident_array[] = $temp_array; |
@@ -2791,9 +2791,9 @@ discard block |
||
| 2791 | 2791 | * @return Array number, icao, name and city of airports |
| 2792 | 2792 | */ |
| 2793 | 2793 | |
| 2794 | - public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
|
| 2794 | + public function getLast7DaysAirportsDeparture($airport_icao = '', $filters = array()) { |
|
| 2795 | 2795 | global $globalTimezone, $globalDBdriver; |
| 2796 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2796 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2797 | 2797 | if ($globalTimezone != '') { |
| 2798 | 2798 | date_default_timezone_set($globalTimezone); |
| 2799 | 2799 | $datetime = new DateTime(); |
@@ -2858,7 +2858,7 @@ discard block |
||
| 2858 | 2858 | |
| 2859 | 2859 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 2860 | 2860 | global $globalTimezone, $globalDBdriver; |
| 2861 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2861 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2862 | 2862 | if ($globalTimezone != '') { |
| 2863 | 2863 | date_default_timezone_set($globalTimezone); |
| 2864 | 2864 | $datetime = new DateTime(); |
@@ -2942,7 +2942,7 @@ discard block |
||
| 2942 | 2942 | |
| 2943 | 2943 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 2944 | 2944 | global $globalTimezone, $globalDBdriver; |
| 2945 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2945 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2946 | 2946 | if ($globalTimezone != '') { |
| 2947 | 2947 | date_default_timezone_set($globalTimezone); |
| 2948 | 2948 | $datetime = new DateTime(); |
@@ -2975,9 +2975,9 @@ discard block |
||
| 2975 | 2975 | * @return Array number, icao, name and city of airports |
| 2976 | 2976 | */ |
| 2977 | 2977 | |
| 2978 | - public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
|
| 2978 | + public function getLast7DaysDetectedAirportsArrival($airport_icao = '', $filters = array()) { |
|
| 2979 | 2979 | global $globalTimezone, $globalDBdriver; |
| 2980 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 2980 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 2981 | 2981 | if ($globalTimezone != '') { |
| 2982 | 2982 | date_default_timezone_set($globalTimezone); |
| 2983 | 2983 | $datetime = new DateTime(); |
@@ -3109,12 +3109,12 @@ discard block |
||
| 3109 | 3109 | } else $offset = '+00:00'; |
| 3110 | 3110 | |
| 3111 | 3111 | if ($globalDBdriver == 'mysql') { |
| 3112 | - $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3112 | + $query = "SELECT DISTINCT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) as date |
|
| 3113 | 3113 | FROM spotter_output |
| 3114 | 3114 | WHERE spotter_output.date <> '' |
| 3115 | 3115 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
| 3116 | 3116 | } else { |
| 3117 | - $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3117 | + $query = "SELECT DISTINCT to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') as date |
|
| 3118 | 3118 | FROM spotter_output |
| 3119 | 3119 | WHERE spotter_output.date <> '' |
| 3120 | 3120 | ORDER BY spotter_output.date ASC LIMIT 0,200"; |
@@ -3126,7 +3126,7 @@ discard block |
||
| 3126 | 3126 | $date_array = array(); |
| 3127 | 3127 | $temp_array = array(); |
| 3128 | 3128 | |
| 3129 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3129 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3130 | 3130 | { |
| 3131 | 3131 | $temp_array['date'] = $row['date']; |
| 3132 | 3132 | |
@@ -3146,7 +3146,7 @@ discard block |
||
| 3146 | 3146 | */ |
| 3147 | 3147 | public function getAllRoutes() |
| 3148 | 3148 | { |
| 3149 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3149 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
|
| 3150 | 3150 | FROM spotter_output |
| 3151 | 3151 | WHERE spotter_output.ident <> '' |
| 3152 | 3152 | GROUP BY route |
@@ -3157,7 +3157,7 @@ discard block |
||
| 3157 | 3157 | |
| 3158 | 3158 | $routes_array = array(); |
| 3159 | 3159 | $temp_array = array(); |
| 3160 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3160 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3161 | 3161 | { |
| 3162 | 3162 | $temp_array['route'] = $row['route']; |
| 3163 | 3163 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -3176,21 +3176,21 @@ discard block |
||
| 3176 | 3176 | * @return String success or false |
| 3177 | 3177 | * |
| 3178 | 3178 | */ |
| 3179 | - public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
|
| 3179 | + public function updateIdentSpotterData($flightaware_id = '', $ident = '', $fromsource = NULL) |
|
| 3180 | 3180 | { |
| 3181 | 3181 | if (!is_numeric(substr($ident, 0, 3))) |
| 3182 | 3182 | { |
| 3183 | 3183 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3184 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3184 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3185 | 3185 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3186 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3186 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3187 | 3187 | } else { |
| 3188 | 3188 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3189 | 3189 | } |
| 3190 | 3190 | if (count($airline_array) == 0) { |
| 3191 | 3191 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3192 | 3192 | } |
| 3193 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3193 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3194 | 3194 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3195 | 3195 | } |
| 3196 | 3196 | } else { |
@@ -3203,7 +3203,7 @@ discard block |
||
| 3203 | 3203 | |
| 3204 | 3204 | |
| 3205 | 3205 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3206 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3206 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type); |
|
| 3207 | 3207 | |
| 3208 | 3208 | try { |
| 3209 | 3209 | $sth = $this->db->prepare($query); |
@@ -3224,11 +3224,11 @@ discard block |
||
| 3224 | 3224 | * @return String success or false |
| 3225 | 3225 | * |
| 3226 | 3226 | */ |
| 3227 | - public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
|
| 3227 | + public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '', $arrival_airport_time = '') |
|
| 3228 | 3228 | { |
| 3229 | 3229 | if ($groundspeed == '') $groundspeed = NULL; |
| 3230 | 3230 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3231 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3231 | + $query_values = array(':flightaware_id' => $flightaware_id, ':real_arrival_airport_icao' => $arrival_airport_icao, ':last_latitude' => $latitude, ':last_longitude' => $longitude, ':last_altitude' => $altitude, ':last_ground_speed' => $groundspeed, ':last_seen' => $date, ':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3232 | 3232 | |
| 3233 | 3233 | try { |
| 3234 | 3234 | $sth = $this->db->prepare($query); |
@@ -3268,7 +3268,7 @@ discard block |
||
| 3268 | 3268 | * @param String $verticalrate vertival rate of flight |
| 3269 | 3269 | * @return String success or false |
| 3270 | 3270 | */ |
| 3271 | - public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
|
| 3271 | + public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false, $format_source = '', $source_name = '') |
|
| 3272 | 3272 | { |
| 3273 | 3273 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
| 3274 | 3274 | |
@@ -3292,13 +3292,13 @@ discard block |
||
| 3292 | 3292 | if ($ModeS != '') { |
| 3293 | 3293 | $timeelapsed = microtime(true); |
| 3294 | 3294 | $registration = $this->getAircraftRegistrationBymodeS($ModeS); |
| 3295 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3295 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3296 | 3296 | } else { |
| 3297 | - $myhex = explode('-',$flightaware_id); |
|
| 3297 | + $myhex = explode('-', $flightaware_id); |
|
| 3298 | 3298 | if (count($myhex) > 0) { |
| 3299 | 3299 | $timeelapsed = microtime(true); |
| 3300 | 3300 | $registration = $this->getAircraftRegistrationBymodeS($myhex[0]); |
| 3301 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3301 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftRegistrationBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3302 | 3302 | } |
| 3303 | 3303 | } |
| 3304 | 3304 | } |
@@ -3320,24 +3320,24 @@ discard block |
||
| 3320 | 3320 | { |
| 3321 | 3321 | $timeelapsed = microtime(true); |
| 3322 | 3322 | if (is_numeric(substr(substr($ident, 0, 3), -1, 1))) { |
| 3323 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2),$fromsource); |
|
| 3323 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 2), $fromsource); |
|
| 3324 | 3324 | } elseif (is_numeric(substr(substr($ident, 0, 4), -1, 1))) { |
| 3325 | - $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3),$fromsource); |
|
| 3325 | + $airline_array = $this->getAllAirlineInfo(substr($ident, 0, 3), $fromsource); |
|
| 3326 | 3326 | } else { |
| 3327 | 3327 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3328 | 3328 | } |
| 3329 | 3329 | if (count($airline_array) == 0) { |
| 3330 | 3330 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3331 | 3331 | } |
| 3332 | - if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == ""){ |
|
| 3332 | + if (!isset($airline_array[0]['icao']) || $airline_array[0]['icao'] == "") { |
|
| 3333 | 3333 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3334 | 3334 | } |
| 3335 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3335 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3336 | 3336 | |
| 3337 | 3337 | } else { |
| 3338 | 3338 | $timeelapsed = microtime(true); |
| 3339 | 3339 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3340 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3340 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAirlineInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3341 | 3341 | } |
| 3342 | 3342 | } |
| 3343 | 3343 | } else $airline_array = array(); |
@@ -3354,27 +3354,27 @@ discard block |
||
| 3354 | 3354 | { |
| 3355 | 3355 | $timeelapsed = microtime(true); |
| 3356 | 3356 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3357 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3357 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3358 | 3358 | } else { |
| 3359 | 3359 | $timeelapsed = microtime(true); |
| 3360 | 3360 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3361 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3361 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3362 | 3362 | } |
| 3363 | 3363 | } |
| 3364 | 3364 | } else { |
| 3365 | 3365 | if ($ModeS != '') { |
| 3366 | 3366 | $timeelapsed = microtime(true); |
| 3367 | 3367 | $aircraft_icao = $this->getAllAircraftType($ModeS); |
| 3368 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3368 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAircraftType : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3369 | 3369 | if ($aircraft_icao == "" || $aircraft_icao == "XXXX") |
| 3370 | 3370 | { |
| 3371 | 3371 | $timeelapsed = microtime(true); |
| 3372 | 3372 | $aircraft_array = $this->getAllAircraftInfo("NA"); |
| 3373 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3373 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo(NA) : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3374 | 3374 | } else { |
| 3375 | 3375 | $timeelapsed = microtime(true); |
| 3376 | 3376 | $aircraft_array = $this->getAllAircraftInfo($aircraft_icao); |
| 3377 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3377 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3378 | 3378 | } |
| 3379 | 3379 | } |
| 3380 | 3380 | } |
@@ -3389,7 +3389,7 @@ discard block |
||
| 3389 | 3389 | } else { |
| 3390 | 3390 | $timeelapsed = microtime(true); |
| 3391 | 3391 | $departure_airport_array = $this->getAllAirportInfo($departure_airport_icao); |
| 3392 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3392 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3393 | 3393 | } |
| 3394 | 3394 | } |
| 3395 | 3395 | |
@@ -3403,7 +3403,7 @@ discard block |
||
| 3403 | 3403 | } else { |
| 3404 | 3404 | $timeelapsed = microtime(true); |
| 3405 | 3405 | $arrival_airport_array = $this->getAllAirportInfo($arrival_airport_icao); |
| 3406 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3406 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAllAirportInfo : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3407 | 3407 | } |
| 3408 | 3408 | } |
| 3409 | 3409 | |
@@ -3467,7 +3467,7 @@ discard block |
||
| 3467 | 3467 | { |
| 3468 | 3468 | $timeelapsed = microtime(true); |
| 3469 | 3469 | $image_array = $Image->getSpotterImage($registration); |
| 3470 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3470 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getSpotterImage : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3471 | 3471 | if (!isset($image_array[0]['registration'])) |
| 3472 | 3472 | { |
| 3473 | 3473 | //echo "Add image !!!! \n"; |
@@ -3475,7 +3475,7 @@ discard block |
||
| 3475 | 3475 | } |
| 3476 | 3476 | $timeelapsed = microtime(true); |
| 3477 | 3477 | $owner_info = $this->getAircraftOwnerByRegistration($registration); |
| 3478 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3478 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftOwnerByRegistration : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3479 | 3479 | if ($owner_info['owner'] != '') $aircraft_owner = ucwords(strtolower($owner_info['owner'])); |
| 3480 | 3480 | } |
| 3481 | 3481 | |
@@ -3483,33 +3483,33 @@ discard block |
||
| 3483 | 3483 | { |
| 3484 | 3484 | if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
| 3485 | 3485 | else $airline_icao = ''; |
| 3486 | - $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3486 | + $image_array = $Image->getSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3487 | 3487 | if (!isset($image_array[0]['registration'])) |
| 3488 | 3488 | { |
| 3489 | 3489 | //echo "Add image !!!! \n"; |
| 3490 | - $Image->addSpotterImage('',$aircraft_icao,$airline_icao); |
|
| 3490 | + $Image->addSpotterImage('', $aircraft_icao, $airline_icao); |
|
| 3491 | 3491 | } |
| 3492 | 3492 | } |
| 3493 | 3493 | |
| 3494 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 3495 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 3496 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 3497 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3498 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3499 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 3500 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3501 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3502 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
| 3503 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3504 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 3505 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 3506 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
| 3507 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
| 3508 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
| 3509 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
| 3510 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
| 3511 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 3512 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
| 3494 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 3495 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 3496 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 3497 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3498 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3499 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 3500 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3501 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3502 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
| 3503 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3504 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 3505 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 3506 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
| 3507 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
| 3508 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
| 3509 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
| 3510 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
| 3511 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 3512 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
| 3513 | 3513 | |
| 3514 | 3514 | if (count($airline_array) == 0) |
| 3515 | 3515 | { |
@@ -3537,7 +3537,7 @@ discard block |
||
| 3537 | 3537 | if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
| 3538 | 3538 | if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
| 3539 | 3539 | if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
| 3540 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3540 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3541 | 3541 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3542 | 3542 | |
| 3543 | 3543 | $airline_name = $airline_array[0]['name']; |
@@ -3547,7 +3547,7 @@ discard block |
||
| 3547 | 3547 | if ($airline_type == '') { |
| 3548 | 3548 | $timeelapsed = microtime(true); |
| 3549 | 3549 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3550 | - if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 3550 | + if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 3551 | 3551 | } |
| 3552 | 3552 | if ($airline_type == null) $airline_type = ''; |
| 3553 | 3553 | $aircraft_type = $aircraft_array[0]['type']; |
@@ -3558,7 +3558,7 @@ discard block |
||
| 3558 | 3558 | $arrival_airport_name = $arrival_airport_array[0]['name']; |
| 3559 | 3559 | $arrival_airport_city = $arrival_airport_array[0]['city']; |
| 3560 | 3560 | $arrival_airport_country = $arrival_airport_array[0]['country']; |
| 3561 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3561 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3562 | 3562 | |
| 3563 | 3563 | try { |
| 3564 | 3564 | |
@@ -3584,13 +3584,13 @@ discard block |
||
| 3584 | 3584 | { |
| 3585 | 3585 | global $globalDBdriver, $globalTimezone; |
| 3586 | 3586 | if ($globalDBdriver == 'mysql') { |
| 3587 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3587 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3588 | 3588 | WHERE spotter_output.ident = :ident |
| 3589 | 3589 | AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 3590 | 3590 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3591 | 3591 | $query_data = array(':ident' => $ident); |
| 3592 | 3592 | } else { |
| 3593 | - $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3593 | + $query = "SELECT spotter_output.ident FROM spotter_output |
|
| 3594 | 3594 | WHERE spotter_output.ident = :ident |
| 3595 | 3595 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3596 | 3596 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
@@ -3599,8 +3599,8 @@ discard block |
||
| 3599 | 3599 | |
| 3600 | 3600 | $sth = $this->db->prepare($query); |
| 3601 | 3601 | $sth->execute($query_data); |
| 3602 | - $ident_result=''; |
|
| 3603 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3602 | + $ident_result = ''; |
|
| 3603 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3604 | 3604 | { |
| 3605 | 3605 | $ident_result = $row['ident']; |
| 3606 | 3606 | } |
@@ -3626,8 +3626,8 @@ discard block |
||
| 3626 | 3626 | return false; |
| 3627 | 3627 | } else { |
| 3628 | 3628 | $q_array = explode(" ", $q); |
| 3629 | - foreach ($q_array as $q_item){ |
|
| 3630 | - $q_item = filter_var($q_item,FILTER_SANITIZE_STRING); |
|
| 3629 | + foreach ($q_array as $q_item) { |
|
| 3630 | + $q_item = filter_var($q_item, FILTER_SANITIZE_STRING); |
|
| 3631 | 3631 | $additional_query .= " AND ("; |
| 3632 | 3632 | $additional_query .= "(spotter_output.aircraft_icao like '%".$q_item."%') OR "; |
| 3633 | 3633 | $additional_query .= "(spotter_output.aircraft_name like '%".$q_item."%') OR "; |
@@ -3642,11 +3642,11 @@ discard block |
||
| 3642 | 3642 | } |
| 3643 | 3643 | } |
| 3644 | 3644 | if ($globalDBdriver == 'mysql') { |
| 3645 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3645 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3646 | 3646 | WHERE spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 20 SECOND) ".$additional_query." |
| 3647 | 3647 | AND spotter_output.date < UTC_TIMESTAMP()"; |
| 3648 | 3648 | } else { |
| 3649 | - $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3649 | + $query = "SELECT spotter_output.* FROM spotter_output |
|
| 3650 | 3650 | WHERE spotter_output.date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '20 SECONDS' ".$additional_query." |
| 3651 | 3651 | AND spotter_output.date::timestamp < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
| 3652 | 3652 | } |
@@ -3663,11 +3663,11 @@ discard block |
||
| 3663 | 3663 | * @return Array the airline list |
| 3664 | 3664 | * |
| 3665 | 3665 | */ |
| 3666 | - public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3666 | + public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3667 | 3667 | { |
| 3668 | 3668 | global $globalDBdriver; |
| 3669 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3670 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3669 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3670 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3671 | 3671 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.airline_icao <> 'NA' "; |
| 3672 | 3672 | if ($olderthanmonths > 0) { |
| 3673 | 3673 | if ($globalDBdriver == 'mysql') { |
@@ -3691,7 +3691,7 @@ discard block |
||
| 3691 | 3691 | |
| 3692 | 3692 | $airline_array = array(); |
| 3693 | 3693 | $temp_array = array(); |
| 3694 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3694 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3695 | 3695 | { |
| 3696 | 3696 | $temp_array['airline_name'] = $row['airline_name']; |
| 3697 | 3697 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3708,11 +3708,11 @@ discard block |
||
| 3708 | 3708 | * @return Array the pilots list |
| 3709 | 3709 | * |
| 3710 | 3710 | */ |
| 3711 | - public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3711 | + public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3712 | 3712 | { |
| 3713 | 3713 | global $globalDBdriver; |
| 3714 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3715 | - $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3714 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3715 | + $query = "SELECT DISTINCT spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3716 | 3716 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> '' "; |
| 3717 | 3717 | if ($olderthanmonths > 0) { |
| 3718 | 3718 | if ($globalDBdriver == 'mysql') { |
@@ -3738,7 +3738,7 @@ discard block |
||
| 3738 | 3738 | $airline_array = array(); |
| 3739 | 3739 | $temp_array = array(); |
| 3740 | 3740 | |
| 3741 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3741 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3742 | 3742 | { |
| 3743 | 3743 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3744 | 3744 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3758,7 +3758,7 @@ discard block |
||
| 3758 | 3758 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 3759 | 3759 | { |
| 3760 | 3760 | global $globalDBdriver; |
| 3761 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3761 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
|
| 3762 | 3762 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 3763 | 3763 | if ($olderthanmonths > 0) { |
| 3764 | 3764 | if ($globalDBdriver == 'mysql') { |
@@ -3784,7 +3784,7 @@ discard block |
||
| 3784 | 3784 | $airline_array = array(); |
| 3785 | 3785 | $temp_array = array(); |
| 3786 | 3786 | |
| 3787 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3787 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3788 | 3788 | { |
| 3789 | 3789 | $temp_array['pilot_name'] = $row['pilot_name']; |
| 3790 | 3790 | $temp_array['pilot_id'] = $row['pilot_id']; |
@@ -3802,11 +3802,11 @@ discard block |
||
| 3802 | 3802 | * @return Array the pilots list |
| 3803 | 3803 | * |
| 3804 | 3804 | */ |
| 3805 | - public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3805 | + public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3806 | 3806 | { |
| 3807 | 3807 | global $globalDBdriver; |
| 3808 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3809 | - $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3808 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3809 | + $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3810 | 3810 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3811 | 3811 | if ($olderthanmonths > 0) { |
| 3812 | 3812 | if ($globalDBdriver == 'mysql') { |
@@ -3832,7 +3832,7 @@ discard block |
||
| 3832 | 3832 | $airline_array = array(); |
| 3833 | 3833 | $temp_array = array(); |
| 3834 | 3834 | |
| 3835 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3835 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3836 | 3836 | { |
| 3837 | 3837 | $temp_array['owner_name'] = $row['owner_name']; |
| 3838 | 3838 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3847,11 +3847,11 @@ discard block |
||
| 3847 | 3847 | * @return Array the pilots list |
| 3848 | 3848 | * |
| 3849 | 3849 | */ |
| 3850 | - public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 3850 | + public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 3851 | 3851 | { |
| 3852 | 3852 | global $globalDBdriver; |
| 3853 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3854 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3853 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3854 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
|
| 3855 | 3855 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 3856 | 3856 | if ($olderthanmonths > 0) { |
| 3857 | 3857 | if ($globalDBdriver == 'mysql') { |
@@ -3877,7 +3877,7 @@ discard block |
||
| 3877 | 3877 | $airline_array = array(); |
| 3878 | 3878 | $temp_array = array(); |
| 3879 | 3879 | |
| 3880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3881 | 3881 | { |
| 3882 | 3882 | $temp_array['owner_name'] = $row['owner_name']; |
| 3883 | 3883 | $temp_array['owner_count'] = $row['owner_count']; |
@@ -3893,11 +3893,11 @@ discard block |
||
| 3893 | 3893 | * @return Array the airline list |
| 3894 | 3894 | * |
| 3895 | 3895 | */ |
| 3896 | - public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
|
| 3896 | + public function countAllAirlinesByAircraft($aircraft_icao, $filters = array()) |
|
| 3897 | 3897 | { |
| 3898 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3899 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3900 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3898 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3899 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3900 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3901 | 3901 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3902 | 3902 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 3903 | 3903 | ORDER BY airline_count DESC"; |
@@ -3909,7 +3909,7 @@ discard block |
||
| 3909 | 3909 | $airline_array = array(); |
| 3910 | 3910 | $temp_array = array(); |
| 3911 | 3911 | |
| 3912 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3912 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3913 | 3913 | { |
| 3914 | 3914 | $temp_array['airline_name'] = $row['airline_name']; |
| 3915 | 3915 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -3929,11 +3929,11 @@ discard block |
||
| 3929 | 3929 | * @return Array the airline country list |
| 3930 | 3930 | * |
| 3931 | 3931 | */ |
| 3932 | - public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 3932 | + public function countAllAirlineCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 3933 | 3933 | { |
| 3934 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 3935 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3936 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3934 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 3935 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3936 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 3937 | 3937 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 3938 | 3938 | GROUP BY spotter_output.airline_country |
| 3939 | 3939 | ORDER BY airline_country_count DESC |
@@ -3946,7 +3946,7 @@ discard block |
||
| 3946 | 3946 | $airline_country_array = array(); |
| 3947 | 3947 | $temp_array = array(); |
| 3948 | 3948 | |
| 3949 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3949 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3950 | 3950 | { |
| 3951 | 3951 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 3952 | 3952 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -3965,11 +3965,11 @@ discard block |
||
| 3965 | 3965 | * @return Array the airline list |
| 3966 | 3966 | * |
| 3967 | 3967 | */ |
| 3968 | - public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
|
| 3968 | + public function countAllAirlinesByAirport($airport_icao, $filters = array()) |
|
| 3969 | 3969 | { |
| 3970 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 3971 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 3972 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3970 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 3971 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 3972 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 3973 | 3973 | FROM spotter_output".$filter_query." spotter_output.airline_name <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 3974 | 3974 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 3975 | 3975 | ORDER BY airline_count DESC"; |
@@ -3981,7 +3981,7 @@ discard block |
||
| 3981 | 3981 | $airline_array = array(); |
| 3982 | 3982 | $temp_array = array(); |
| 3983 | 3983 | |
| 3984 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3984 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 3985 | 3985 | { |
| 3986 | 3986 | $temp_array['airline_name'] = $row['airline_name']; |
| 3987 | 3987 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4000,11 +4000,11 @@ discard block |
||
| 4000 | 4000 | * @return Array the airline country list |
| 4001 | 4001 | * |
| 4002 | 4002 | */ |
| 4003 | - public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
|
| 4003 | + public function countAllAirlineCountriesByAirport($airport_icao, $filters = array()) |
|
| 4004 | 4004 | { |
| 4005 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4006 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4007 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4005 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4006 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4007 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4008 | 4008 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao ) |
| 4009 | 4009 | GROUP BY spotter_output.airline_country |
| 4010 | 4010 | ORDER BY airline_country_count DESC |
@@ -4017,7 +4017,7 @@ discard block |
||
| 4017 | 4017 | $airline_country_array = array(); |
| 4018 | 4018 | $temp_array = array(); |
| 4019 | 4019 | |
| 4020 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4020 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4021 | 4021 | { |
| 4022 | 4022 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4023 | 4023 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4034,11 +4034,11 @@ discard block |
||
| 4034 | 4034 | * @return Array the airline list |
| 4035 | 4035 | * |
| 4036 | 4036 | */ |
| 4037 | - public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4037 | + public function countAllAirlinesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4038 | 4038 | { |
| 4039 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4040 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4041 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4039 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4040 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4041 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4042 | 4042 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4043 | 4043 | GROUP BY spotter_output.airline_name |
| 4044 | 4044 | ORDER BY airline_count DESC"; |
@@ -4049,7 +4049,7 @@ discard block |
||
| 4049 | 4049 | $airline_array = array(); |
| 4050 | 4050 | $temp_array = array(); |
| 4051 | 4051 | |
| 4052 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4052 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4053 | 4053 | { |
| 4054 | 4054 | $temp_array['airline_name'] = $row['airline_name']; |
| 4055 | 4055 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4069,11 +4069,11 @@ discard block |
||
| 4069 | 4069 | * @return Array the airline country list |
| 4070 | 4070 | * |
| 4071 | 4071 | */ |
| 4072 | - public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4072 | + public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4073 | 4073 | { |
| 4074 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4075 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4076 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4074 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4075 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4076 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4077 | 4077 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4078 | 4078 | GROUP BY spotter_output.airline_country |
| 4079 | 4079 | ORDER BY airline_country_count DESC |
@@ -4086,7 +4086,7 @@ discard block |
||
| 4086 | 4086 | $airline_country_array = array(); |
| 4087 | 4087 | $temp_array = array(); |
| 4088 | 4088 | |
| 4089 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4089 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4090 | 4090 | { |
| 4091 | 4091 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4092 | 4092 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4102,11 +4102,11 @@ discard block |
||
| 4102 | 4102 | * @return Array the airline list |
| 4103 | 4103 | * |
| 4104 | 4104 | */ |
| 4105 | - public function countAllAirlinesByDate($date,$filters = array()) |
|
| 4105 | + public function countAllAirlinesByDate($date, $filters = array()) |
|
| 4106 | 4106 | { |
| 4107 | 4107 | global $globalTimezone, $globalDBdriver; |
| 4108 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4109 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4108 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4109 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4110 | 4110 | if ($globalTimezone != '') { |
| 4111 | 4111 | date_default_timezone_set($globalTimezone); |
| 4112 | 4112 | $datetime = new DateTime($date); |
@@ -4114,12 +4114,12 @@ discard block |
||
| 4114 | 4114 | } else $offset = '+00:00'; |
| 4115 | 4115 | |
| 4116 | 4116 | if ($globalDBdriver == 'mysql') { |
| 4117 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4117 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4118 | 4118 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4119 | 4119 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4120 | 4120 | ORDER BY airline_count DESC"; |
| 4121 | 4121 | } else { |
| 4122 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4122 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4123 | 4123 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4124 | 4124 | GROUP BY spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country |
| 4125 | 4125 | ORDER BY airline_count DESC"; |
@@ -4130,7 +4130,7 @@ discard block |
||
| 4130 | 4130 | |
| 4131 | 4131 | $airline_array = array(); |
| 4132 | 4132 | $temp_array = array(); |
| 4133 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4133 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4134 | 4134 | { |
| 4135 | 4135 | $temp_array['airline_name'] = $row['airline_name']; |
| 4136 | 4136 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4150,11 +4150,11 @@ discard block |
||
| 4150 | 4150 | * @return Array the airline country list |
| 4151 | 4151 | * |
| 4152 | 4152 | */ |
| 4153 | - public function countAllAirlineCountriesByDate($date,$filters = array()) |
|
| 4153 | + public function countAllAirlineCountriesByDate($date, $filters = array()) |
|
| 4154 | 4154 | { |
| 4155 | 4155 | global $globalTimezone, $globalDBdriver; |
| 4156 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4157 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4156 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4157 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4158 | 4158 | if ($globalTimezone != '') { |
| 4159 | 4159 | date_default_timezone_set($globalTimezone); |
| 4160 | 4160 | $datetime = new DateTime($date); |
@@ -4162,13 +4162,13 @@ discard block |
||
| 4162 | 4162 | } else $offset = '+00:00'; |
| 4163 | 4163 | |
| 4164 | 4164 | if ($globalDBdriver == 'mysql') { |
| 4165 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4165 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4166 | 4166 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4167 | 4167 | GROUP BY spotter_output.airline_country |
| 4168 | 4168 | ORDER BY airline_country_count DESC |
| 4169 | 4169 | LIMIT 10 OFFSET 0"; |
| 4170 | 4170 | } else { |
| 4171 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4171 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4172 | 4172 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4173 | 4173 | GROUP BY spotter_output.airline_country |
| 4174 | 4174 | ORDER BY airline_country_count DESC |
@@ -4180,7 +4180,7 @@ discard block |
||
| 4180 | 4180 | |
| 4181 | 4181 | $airline_country_array = array(); |
| 4182 | 4182 | $temp_array = array(); |
| 4183 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4183 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4184 | 4184 | { |
| 4185 | 4185 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4186 | 4186 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4197,11 +4197,11 @@ discard block |
||
| 4197 | 4197 | * @return Array the airline list |
| 4198 | 4198 | * |
| 4199 | 4199 | */ |
| 4200 | - public function countAllAirlinesByIdent($ident,$filters = array()) |
|
| 4200 | + public function countAllAirlinesByIdent($ident, $filters = array()) |
|
| 4201 | 4201 | { |
| 4202 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 4203 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4204 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4202 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 4203 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4204 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4205 | 4205 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 4206 | 4206 | GROUP BY spotter_output.airline_name |
| 4207 | 4207 | ORDER BY airline_count DESC"; |
@@ -4213,7 +4213,7 @@ discard block |
||
| 4213 | 4213 | $airline_array = array(); |
| 4214 | 4214 | $temp_array = array(); |
| 4215 | 4215 | |
| 4216 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4216 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4217 | 4217 | { |
| 4218 | 4218 | $temp_array['airline_name'] = $row['airline_name']; |
| 4219 | 4219 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4231,25 +4231,25 @@ discard block |
||
| 4231 | 4231 | * @return Array the airline list |
| 4232 | 4232 | * |
| 4233 | 4233 | */ |
| 4234 | - public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 4234 | + public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4235 | 4235 | { |
| 4236 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4237 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4238 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4236 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4237 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4238 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4239 | 4239 | |
| 4240 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4240 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4241 | 4241 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4242 | 4242 | GROUP BY spotter_output.airline_name |
| 4243 | 4243 | ORDER BY airline_count DESC"; |
| 4244 | 4244 | |
| 4245 | 4245 | |
| 4246 | 4246 | $sth = $this->db->prepare($query); |
| 4247 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4247 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4248 | 4248 | |
| 4249 | 4249 | $airline_array = array(); |
| 4250 | 4250 | $temp_array = array(); |
| 4251 | 4251 | |
| 4252 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4252 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4253 | 4253 | { |
| 4254 | 4254 | $temp_array['airline_name'] = $row['airline_name']; |
| 4255 | 4255 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4267,13 +4267,13 @@ discard block |
||
| 4267 | 4267 | * @return Array the airline country list |
| 4268 | 4268 | * |
| 4269 | 4269 | */ |
| 4270 | - public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
|
| 4270 | + public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 4271 | 4271 | { |
| 4272 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4273 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4274 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 4272 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4273 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4274 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 4275 | 4275 | |
| 4276 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4276 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4277 | 4277 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 4278 | 4278 | GROUP BY spotter_output.airline_country |
| 4279 | 4279 | ORDER BY airline_country_count DESC |
@@ -4281,11 +4281,11 @@ discard block |
||
| 4281 | 4281 | |
| 4282 | 4282 | |
| 4283 | 4283 | $sth = $this->db->prepare($query); |
| 4284 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4284 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 4285 | 4285 | |
| 4286 | 4286 | $airline_country_array = array(); |
| 4287 | 4287 | $temp_array = array(); |
| 4288 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4288 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4289 | 4289 | { |
| 4290 | 4290 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4291 | 4291 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4303,11 +4303,11 @@ discard block |
||
| 4303 | 4303 | * @return Array the airline list |
| 4304 | 4304 | * |
| 4305 | 4305 | */ |
| 4306 | - public function countAllAirlinesByCountry($country,$filters = array()) |
|
| 4306 | + public function countAllAirlinesByCountry($country, $filters = array()) |
|
| 4307 | 4307 | { |
| 4308 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4309 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4310 | - $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4308 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4309 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4310 | + $query = "SELECT DISTINCT spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country, COUNT(spotter_output.airline_name) AS airline_count |
|
| 4311 | 4311 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4312 | 4312 | GROUP BY spotter_output.airline_name, spotter_output.airline_icao, spotter_output.airline_country |
| 4313 | 4313 | ORDER BY airline_count DESC"; |
@@ -4318,7 +4318,7 @@ discard block |
||
| 4318 | 4318 | |
| 4319 | 4319 | $airline_array = array(); |
| 4320 | 4320 | $temp_array = array(); |
| 4321 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4321 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4322 | 4322 | { |
| 4323 | 4323 | $temp_array['airline_name'] = $row['airline_name']; |
| 4324 | 4324 | $temp_array['airline_icao'] = $row['airline_icao']; |
@@ -4337,11 +4337,11 @@ discard block |
||
| 4337 | 4337 | * @return Array the airline country list |
| 4338 | 4338 | * |
| 4339 | 4339 | */ |
| 4340 | - public function countAllAirlineCountriesByCountry($country,$filters = array()) |
|
| 4340 | + public function countAllAirlineCountriesByCountry($country, $filters = array()) |
|
| 4341 | 4341 | { |
| 4342 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4343 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 4344 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4342 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4343 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 4344 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4345 | 4345 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 4346 | 4346 | GROUP BY spotter_output.airline_country |
| 4347 | 4347 | ORDER BY airline_country_count DESC |
@@ -4353,7 +4353,7 @@ discard block |
||
| 4353 | 4353 | |
| 4354 | 4354 | $airline_country_array = array(); |
| 4355 | 4355 | $temp_array = array(); |
| 4356 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4356 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4357 | 4357 | { |
| 4358 | 4358 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4359 | 4359 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4372,8 +4372,8 @@ discard block |
||
| 4372 | 4372 | */ |
| 4373 | 4373 | public function countAllAirlineCountries($limit = true, $filters = array()) |
| 4374 | 4374 | { |
| 4375 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4376 | - $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4375 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4376 | + $query = "SELECT DISTINCT spotter_output.airline_country, COUNT(spotter_output.airline_country) AS airline_country_count |
|
| 4377 | 4377 | FROM spotter_output".$filter_query." spotter_output.airline_country <> '' AND spotter_output.airline_country <> 'NA' |
| 4378 | 4378 | GROUP BY spotter_output.airline_country |
| 4379 | 4379 | ORDER BY airline_country_count DESC"; |
@@ -4384,7 +4384,7 @@ discard block |
||
| 4384 | 4384 | |
| 4385 | 4385 | $airline_array = array(); |
| 4386 | 4386 | $temp_array = array(); |
| 4387 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4387 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4388 | 4388 | { |
| 4389 | 4389 | $temp_array['airline_country_count'] = $row['airline_country_count']; |
| 4390 | 4390 | $temp_array['airline_country'] = $row['airline_country']; |
@@ -4400,11 +4400,11 @@ discard block |
||
| 4400 | 4400 | * @return Array the airline country list |
| 4401 | 4401 | * |
| 4402 | 4402 | */ |
| 4403 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4403 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4404 | 4404 | { |
| 4405 | 4405 | global $globalDBdriver; |
| 4406 | 4406 | //$filter_query = $this->getFilter($filters,true,true); |
| 4407 | - $Connection= new Connection($this->db); |
|
| 4407 | + $Connection = new Connection($this->db); |
|
| 4408 | 4408 | if (!$Connection->tableExists('countries')) return array(); |
| 4409 | 4409 | /* |
| 4410 | 4410 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -4419,7 +4419,7 @@ discard block |
||
| 4419 | 4419 | */ |
| 4420 | 4420 | require_once('class.SpotterLive.php'); |
| 4421 | 4421 | $SpotterLive = new SpotterLive(); |
| 4422 | - $filter_query = $SpotterLive->getFilter($filters,true,true); |
|
| 4422 | + $filter_query = $SpotterLive->getFilter($filters, true, true); |
|
| 4423 | 4423 | $filter_query .= ' over_country IS NOT NULL'; |
| 4424 | 4424 | if ($olderthanmonths > 0) { |
| 4425 | 4425 | if ($globalDBdriver == 'mysql') { |
@@ -4446,7 +4446,7 @@ discard block |
||
| 4446 | 4446 | $flight_array = array(); |
| 4447 | 4447 | $temp_array = array(); |
| 4448 | 4448 | |
| 4449 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4449 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4450 | 4450 | { |
| 4451 | 4451 | $temp_array['flight_count'] = $row['nb']; |
| 4452 | 4452 | $temp_array['flight_country'] = $row['name']; |
@@ -4464,12 +4464,12 @@ discard block |
||
| 4464 | 4464 | * @return Array the aircraft list |
| 4465 | 4465 | * |
| 4466 | 4466 | */ |
| 4467 | - public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4467 | + public function countAllAircraftTypes($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4468 | 4468 | { |
| 4469 | 4469 | global $globalDBdriver; |
| 4470 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4470 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4471 | 4471 | |
| 4472 | - $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4472 | + $query = "SELECT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4473 | 4473 | FROM spotter_output ".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> ''"; |
| 4474 | 4474 | if ($olderthanmonths > 0) { |
| 4475 | 4475 | if ($globalDBdriver == 'mysql') { |
@@ -4494,7 +4494,7 @@ discard block |
||
| 4494 | 4494 | |
| 4495 | 4495 | $aircraft_array = array(); |
| 4496 | 4496 | $temp_array = array(); |
| 4497 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4497 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4498 | 4498 | { |
| 4499 | 4499 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4500 | 4500 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4511,11 +4511,11 @@ discard block |
||
| 4511 | 4511 | * @return Array the aircraft list |
| 4512 | 4512 | * |
| 4513 | 4513 | */ |
| 4514 | - public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4514 | + public function countAllAircraftTypesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4515 | 4515 | { |
| 4516 | 4516 | global $globalDBdriver; |
| 4517 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4518 | - $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4517 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4518 | + $query = "SELECT spotter_output.airline_icao, spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4519 | 4519 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4520 | 4520 | if ($olderthanmonths > 0) { |
| 4521 | 4521 | if ($globalDBdriver == 'mysql') { |
@@ -4540,7 +4540,7 @@ discard block |
||
| 4540 | 4540 | |
| 4541 | 4541 | $aircraft_array = array(); |
| 4542 | 4542 | $temp_array = array(); |
| 4543 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4543 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4544 | 4544 | { |
| 4545 | 4545 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 4546 | 4546 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4558,11 +4558,11 @@ discard block |
||
| 4558 | 4558 | * @return Array the aircraft list |
| 4559 | 4559 | * |
| 4560 | 4560 | */ |
| 4561 | - public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 4561 | + public function countAllAircraftTypesByMonths($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 4562 | 4562 | { |
| 4563 | 4563 | global $globalDBdriver; |
| 4564 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4565 | - $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4564 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4565 | + $query = "SELECT EXTRACT(month from spotter_output.date) as month, EXTRACT(year from spotter_output.date) as year,spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name, spotter_output.aircraft_manufacturer |
|
| 4566 | 4566 | FROM spotter_output".$filter_query." spotter_output.aircraft_name <> '' AND spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao <>'' AND spotter_output.airline_icao <> 'NA' "; |
| 4567 | 4567 | if ($olderthanmonths > 0) { |
| 4568 | 4568 | if ($globalDBdriver == 'mysql') { |
@@ -4587,7 +4587,7 @@ discard block |
||
| 4587 | 4587 | |
| 4588 | 4588 | $aircraft_array = array(); |
| 4589 | 4589 | $temp_array = array(); |
| 4590 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4590 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4591 | 4591 | { |
| 4592 | 4592 | //$temp_array['airline_icao'] = $row['airline_icao']; |
| 4593 | 4593 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
@@ -4606,13 +4606,13 @@ discard block |
||
| 4606 | 4606 | * @return Array the aircraft list |
| 4607 | 4607 | * |
| 4608 | 4608 | */ |
| 4609 | - public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
|
| 4609 | + public function countAllAircraftRegistrationByAircraft($aircraft_icao, $filters = array()) |
|
| 4610 | 4610 | { |
| 4611 | 4611 | $Image = new Image($this->db); |
| 4612 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4613 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 4612 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4613 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 4614 | 4614 | |
| 4615 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4615 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4616 | 4616 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 4617 | 4617 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
| 4618 | 4618 | ORDER BY registration_count DESC"; |
@@ -4623,14 +4623,14 @@ discard block |
||
| 4623 | 4623 | $aircraft_array = array(); |
| 4624 | 4624 | $temp_array = array(); |
| 4625 | 4625 | |
| 4626 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4626 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4627 | 4627 | { |
| 4628 | 4628 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4629 | 4629 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4630 | 4630 | $temp_array['registration'] = $row['registration']; |
| 4631 | 4631 | $temp_array['airline_name'] = $row['airline_name']; |
| 4632 | 4632 | $temp_array['image_thumbnail'] = ""; |
| 4633 | - if($row['registration'] != "") |
|
| 4633 | + if ($row['registration'] != "") |
|
| 4634 | 4634 | { |
| 4635 | 4635 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4636 | 4636 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4649,11 +4649,11 @@ discard block |
||
| 4649 | 4649 | * @return Array the aircraft list |
| 4650 | 4650 | * |
| 4651 | 4651 | */ |
| 4652 | - public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
|
| 4652 | + public function countAllAircraftTypesByAirline($airline_icao, $filters = array()) |
|
| 4653 | 4653 | { |
| 4654 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4655 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4656 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4654 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4655 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4656 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4657 | 4657 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND spotter_output.airline_icao = :airline_icao |
| 4658 | 4658 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4659 | 4659 | ORDER BY aircraft_icao_count DESC"; |
@@ -4664,7 +4664,7 @@ discard block |
||
| 4664 | 4664 | $aircraft_array = array(); |
| 4665 | 4665 | $temp_array = array(); |
| 4666 | 4666 | |
| 4667 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4667 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4668 | 4668 | { |
| 4669 | 4669 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4670 | 4670 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4682,13 +4682,13 @@ discard block |
||
| 4682 | 4682 | * @return Array the aircraft list |
| 4683 | 4683 | * |
| 4684 | 4684 | */ |
| 4685 | - public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
|
| 4685 | + public function countAllAircraftRegistrationByAirline($airline_icao, $filters = array()) |
|
| 4686 | 4686 | { |
| 4687 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4687 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4688 | 4688 | $Image = new Image($this->db); |
| 4689 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4689 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4690 | 4690 | |
| 4691 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4691 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4692 | 4692 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.airline_icao = :airline_icao |
| 4693 | 4693 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4694 | 4694 | ORDER BY registration_count DESC"; |
@@ -4698,14 +4698,14 @@ discard block |
||
| 4698 | 4698 | |
| 4699 | 4699 | $aircraft_array = array(); |
| 4700 | 4700 | $temp_array = array(); |
| 4701 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4701 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4702 | 4702 | { |
| 4703 | 4703 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4704 | 4704 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4705 | 4705 | $temp_array['registration'] = $row['registration']; |
| 4706 | 4706 | $temp_array['airline_name'] = $row['airline_name']; |
| 4707 | 4707 | $temp_array['image_thumbnail'] = ""; |
| 4708 | - if($row['registration'] != "") |
|
| 4708 | + if ($row['registration'] != "") |
|
| 4709 | 4709 | { |
| 4710 | 4710 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4711 | 4711 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4724,11 +4724,11 @@ discard block |
||
| 4724 | 4724 | * @return Array the aircraft list |
| 4725 | 4725 | * |
| 4726 | 4726 | */ |
| 4727 | - public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
|
| 4727 | + public function countAllAircraftManufacturerByAirline($airline_icao, $filters = array()) |
|
| 4728 | 4728 | { |
| 4729 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4730 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 4731 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4729 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4730 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 4731 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4732 | 4732 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.airline_icao = :airline_icao |
| 4733 | 4733 | GROUP BY spotter_output.aircraft_manufacturer |
| 4734 | 4734 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4739,7 +4739,7 @@ discard block |
||
| 4739 | 4739 | $aircraft_array = array(); |
| 4740 | 4740 | $temp_array = array(); |
| 4741 | 4741 | |
| 4742 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4742 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4743 | 4743 | { |
| 4744 | 4744 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4745 | 4745 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4756,12 +4756,12 @@ discard block |
||
| 4756 | 4756 | * @return Array the aircraft list |
| 4757 | 4757 | * |
| 4758 | 4758 | */ |
| 4759 | - public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
|
| 4759 | + public function countAllAircraftTypesByAirport($airport_icao, $filters = array()) |
|
| 4760 | 4760 | { |
| 4761 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4762 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4761 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4762 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4763 | 4763 | |
| 4764 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4764 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4765 | 4765 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4766 | 4766 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4767 | 4767 | ORDER BY aircraft_icao_count DESC"; |
@@ -4771,7 +4771,7 @@ discard block |
||
| 4771 | 4771 | |
| 4772 | 4772 | $aircraft_array = array(); |
| 4773 | 4773 | $temp_array = array(); |
| 4774 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4774 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4775 | 4775 | { |
| 4776 | 4776 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4777 | 4777 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4789,13 +4789,13 @@ discard block |
||
| 4789 | 4789 | * @return Array the aircraft list |
| 4790 | 4790 | * |
| 4791 | 4791 | */ |
| 4792 | - public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
|
| 4792 | + public function countAllAircraftRegistrationByAirport($airport_icao, $filters = array()) |
|
| 4793 | 4793 | { |
| 4794 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4794 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4795 | 4795 | $Image = new Image($this->db); |
| 4796 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4796 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4797 | 4797 | |
| 4798 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4798 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4799 | 4799 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4800 | 4800 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4801 | 4801 | ORDER BY registration_count DESC"; |
@@ -4805,14 +4805,14 @@ discard block |
||
| 4805 | 4805 | |
| 4806 | 4806 | $aircraft_array = array(); |
| 4807 | 4807 | $temp_array = array(); |
| 4808 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4808 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4809 | 4809 | { |
| 4810 | 4810 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4811 | 4811 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4812 | 4812 | $temp_array['registration'] = $row['registration']; |
| 4813 | 4813 | $temp_array['airline_name'] = $row['airline_name']; |
| 4814 | 4814 | $temp_array['image_thumbnail'] = ""; |
| 4815 | - if($row['registration'] != "") |
|
| 4815 | + if ($row['registration'] != "") |
|
| 4816 | 4816 | { |
| 4817 | 4817 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4818 | 4818 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4830,11 +4830,11 @@ discard block |
||
| 4830 | 4830 | * @return Array the aircraft list |
| 4831 | 4831 | * |
| 4832 | 4832 | */ |
| 4833 | - public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
|
| 4833 | + public function countAllAircraftManufacturerByAirport($airport_icao, $filters = array()) |
|
| 4834 | 4834 | { |
| 4835 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4836 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 4837 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4835 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4836 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 4837 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 4838 | 4838 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 4839 | 4839 | GROUP BY spotter_output.aircraft_manufacturer |
| 4840 | 4840 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -4845,7 +4845,7 @@ discard block |
||
| 4845 | 4845 | |
| 4846 | 4846 | $aircraft_array = array(); |
| 4847 | 4847 | $temp_array = array(); |
| 4848 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4848 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4849 | 4849 | { |
| 4850 | 4850 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 4851 | 4851 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -4860,12 +4860,12 @@ discard block |
||
| 4860 | 4860 | * @return Array the aircraft list |
| 4861 | 4861 | * |
| 4862 | 4862 | */ |
| 4863 | - public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 4863 | + public function countAllAircraftTypesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 4864 | 4864 | { |
| 4865 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4866 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4865 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4866 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4867 | 4867 | |
| 4868 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4868 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4869 | 4869 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4870 | 4870 | GROUP BY spotter_output.aircraft_name |
| 4871 | 4871 | ORDER BY aircraft_icao_count DESC"; |
@@ -4874,7 +4874,7 @@ discard block |
||
| 4874 | 4874 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4875 | 4875 | $aircraft_array = array(); |
| 4876 | 4876 | $temp_array = array(); |
| 4877 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4877 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4878 | 4878 | { |
| 4879 | 4879 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4880 | 4880 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4893,11 +4893,11 @@ discard block |
||
| 4893 | 4893 | */ |
| 4894 | 4894 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 4895 | 4895 | { |
| 4896 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4896 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4897 | 4897 | $Image = new Image($this->db); |
| 4898 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 4898 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 4899 | 4899 | |
| 4900 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4900 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4901 | 4901 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 4902 | 4902 | GROUP BY spotter_output.registration |
| 4903 | 4903 | ORDER BY registration_count DESC"; |
@@ -4907,14 +4907,14 @@ discard block |
||
| 4907 | 4907 | $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer)); |
| 4908 | 4908 | $aircraft_array = array(); |
| 4909 | 4909 | $temp_array = array(); |
| 4910 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4910 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4911 | 4911 | { |
| 4912 | 4912 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4913 | 4913 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 4914 | 4914 | $temp_array['registration'] = $row['registration']; |
| 4915 | 4915 | $temp_array['airline_name'] = $row['airline_name']; |
| 4916 | 4916 | $temp_array['image_thumbnail'] = ""; |
| 4917 | - if($row['registration'] != "") |
|
| 4917 | + if ($row['registration'] != "") |
|
| 4918 | 4918 | { |
| 4919 | 4919 | $image_array = $Image->getSpotterImage($row['registration']); |
| 4920 | 4920 | $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -4931,11 +4931,11 @@ discard block |
||
| 4931 | 4931 | * @return Array the aircraft list |
| 4932 | 4932 | * |
| 4933 | 4933 | */ |
| 4934 | - public function countAllAircraftTypesByDate($date,$filters = array()) |
|
| 4934 | + public function countAllAircraftTypesByDate($date, $filters = array()) |
|
| 4935 | 4935 | { |
| 4936 | 4936 | global $globalTimezone, $globalDBdriver; |
| 4937 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4938 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4937 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4938 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4939 | 4939 | if ($globalTimezone != '') { |
| 4940 | 4940 | date_default_timezone_set($globalTimezone); |
| 4941 | 4941 | $datetime = new DateTime($date); |
@@ -4943,12 +4943,12 @@ discard block |
||
| 4943 | 4943 | } else $offset = '+00:00'; |
| 4944 | 4944 | |
| 4945 | 4945 | if ($globalDBdriver == 'mysql') { |
| 4946 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4946 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4947 | 4947 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4948 | 4948 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4949 | 4949 | ORDER BY aircraft_icao_count DESC"; |
| 4950 | 4950 | } else { |
| 4951 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4951 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 4952 | 4952 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 4953 | 4953 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 4954 | 4954 | ORDER BY aircraft_icao_count DESC"; |
@@ -4959,7 +4959,7 @@ discard block |
||
| 4959 | 4959 | |
| 4960 | 4960 | $aircraft_array = array(); |
| 4961 | 4961 | $temp_array = array(); |
| 4962 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4962 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 4963 | 4963 | { |
| 4964 | 4964 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 4965 | 4965 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -4977,12 +4977,12 @@ discard block |
||
| 4977 | 4977 | * @return Array the aircraft list |
| 4978 | 4978 | * |
| 4979 | 4979 | */ |
| 4980 | - public function countAllAircraftRegistrationByDate($date,$filters = array()) |
|
| 4980 | + public function countAllAircraftRegistrationByDate($date, $filters = array()) |
|
| 4981 | 4981 | { |
| 4982 | 4982 | global $globalTimezone, $globalDBdriver; |
| 4983 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 4983 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 4984 | 4984 | $Image = new Image($this->db); |
| 4985 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 4985 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 4986 | 4986 | if ($globalTimezone != '') { |
| 4987 | 4987 | date_default_timezone_set($globalTimezone); |
| 4988 | 4988 | $datetime = new DateTime($date); |
@@ -4990,12 +4990,12 @@ discard block |
||
| 4990 | 4990 | } else $offset = '+00:00'; |
| 4991 | 4991 | |
| 4992 | 4992 | if ($globalDBdriver == 'mysql') { |
| 4993 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4993 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4994 | 4994 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 4995 | 4995 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 4996 | 4996 | ORDER BY registration_count DESC"; |
| 4997 | 4997 | } else { |
| 4998 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4998 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 4999 | 4999 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5000 | 5000 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5001 | 5001 | ORDER BY registration_count DESC"; |
@@ -5006,14 +5006,14 @@ discard block |
||
| 5006 | 5006 | |
| 5007 | 5007 | $aircraft_array = array(); |
| 5008 | 5008 | $temp_array = array(); |
| 5009 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5009 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5010 | 5010 | { |
| 5011 | 5011 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5012 | 5012 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5013 | 5013 | $temp_array['registration'] = $row['registration']; |
| 5014 | 5014 | $temp_array['airline_name'] = $row['airline_name']; |
| 5015 | 5015 | $temp_array['image_thumbnail'] = ""; |
| 5016 | - if($row['registration'] != "") |
|
| 5016 | + if ($row['registration'] != "") |
|
| 5017 | 5017 | { |
| 5018 | 5018 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5019 | 5019 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5032,11 +5032,11 @@ discard block |
||
| 5032 | 5032 | * @return Array the aircraft manufacturer list |
| 5033 | 5033 | * |
| 5034 | 5034 | */ |
| 5035 | - public function countAllAircraftManufacturerByDate($date,$filters = array()) |
|
| 5035 | + public function countAllAircraftManufacturerByDate($date, $filters = array()) |
|
| 5036 | 5036 | { |
| 5037 | 5037 | global $globalTimezone, $globalDBdriver; |
| 5038 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5039 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 5038 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5039 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 5040 | 5040 | if ($globalTimezone != '') { |
| 5041 | 5041 | date_default_timezone_set($globalTimezone); |
| 5042 | 5042 | $datetime = new DateTime($date); |
@@ -5044,12 +5044,12 @@ discard block |
||
| 5044 | 5044 | } else $offset = '+00:00'; |
| 5045 | 5045 | |
| 5046 | 5046 | if ($globalDBdriver == 'mysql') { |
| 5047 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5047 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5048 | 5048 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 5049 | 5049 | GROUP BY spotter_output.aircraft_manufacturer |
| 5050 | 5050 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5051 | 5051 | } else { |
| 5052 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5052 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5053 | 5053 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 5054 | 5054 | GROUP BY spotter_output.aircraft_manufacturer |
| 5055 | 5055 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5061,7 +5061,7 @@ discard block |
||
| 5061 | 5061 | $aircraft_array = array(); |
| 5062 | 5062 | $temp_array = array(); |
| 5063 | 5063 | |
| 5064 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5064 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5065 | 5065 | { |
| 5066 | 5066 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5067 | 5067 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5078,11 +5078,11 @@ discard block |
||
| 5078 | 5078 | * @return Array the aircraft list |
| 5079 | 5079 | * |
| 5080 | 5080 | */ |
| 5081 | - public function countAllAircraftTypesByIdent($ident,$filters = array()) |
|
| 5081 | + public function countAllAircraftTypesByIdent($ident, $filters = array()) |
|
| 5082 | 5082 | { |
| 5083 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5084 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5085 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5083 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5084 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5085 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5086 | 5086 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 5087 | 5087 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5088 | 5088 | ORDER BY aircraft_icao_count DESC"; |
@@ -5093,7 +5093,7 @@ discard block |
||
| 5093 | 5093 | $aircraft_array = array(); |
| 5094 | 5094 | $temp_array = array(); |
| 5095 | 5095 | |
| 5096 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5096 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5097 | 5097 | { |
| 5098 | 5098 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5099 | 5099 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5111,13 +5111,13 @@ discard block |
||
| 5111 | 5111 | * @return Array the aircraft list |
| 5112 | 5112 | * |
| 5113 | 5113 | */ |
| 5114 | - public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
|
| 5114 | + public function countAllAircraftRegistrationByIdent($ident, $filters = array()) |
|
| 5115 | 5115 | { |
| 5116 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5116 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5117 | 5117 | $Image = new Image($this->db); |
| 5118 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5118 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5119 | 5119 | |
| 5120 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5120 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5121 | 5121 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND spotter_output.ident = :ident |
| 5122 | 5122 | GROUP BY spotter_output.registration,spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5123 | 5123 | ORDER BY registration_count DESC"; |
@@ -5129,14 +5129,14 @@ discard block |
||
| 5129 | 5129 | $aircraft_array = array(); |
| 5130 | 5130 | $temp_array = array(); |
| 5131 | 5131 | |
| 5132 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5132 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5133 | 5133 | { |
| 5134 | 5134 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5135 | 5135 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5136 | 5136 | $temp_array['registration'] = $row['registration']; |
| 5137 | 5137 | $temp_array['airline_name'] = $row['airline_name']; |
| 5138 | 5138 | $temp_array['image_thumbnail'] = ""; |
| 5139 | - if($row['registration'] != "") |
|
| 5139 | + if ($row['registration'] != "") |
|
| 5140 | 5140 | { |
| 5141 | 5141 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5142 | 5142 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5155,11 +5155,11 @@ discard block |
||
| 5155 | 5155 | * @return Array the aircraft manufacturer list |
| 5156 | 5156 | * |
| 5157 | 5157 | */ |
| 5158 | - public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
|
| 5158 | + public function countAllAircraftManufacturerByIdent($ident, $filters = array()) |
|
| 5159 | 5159 | { |
| 5160 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5161 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 5162 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5160 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5161 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 5162 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5163 | 5163 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.ident = :ident |
| 5164 | 5164 | GROUP BY spotter_output.aircraft_manufacturer |
| 5165 | 5165 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5169,7 +5169,7 @@ discard block |
||
| 5169 | 5169 | $sth->execute(array(':ident' => $ident)); |
| 5170 | 5170 | $aircraft_array = array(); |
| 5171 | 5171 | $temp_array = array(); |
| 5172 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5172 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5173 | 5173 | { |
| 5174 | 5174 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5175 | 5175 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5185,24 +5185,24 @@ discard block |
||
| 5185 | 5185 | * @return Array the aircraft list |
| 5186 | 5186 | * |
| 5187 | 5187 | */ |
| 5188 | - public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5188 | + public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5189 | 5189 | { |
| 5190 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5191 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5192 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5190 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5191 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5192 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5193 | 5193 | |
| 5194 | 5194 | |
| 5195 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5195 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5196 | 5196 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5197 | 5197 | GROUP BY spotter_output.aircraft_name |
| 5198 | 5198 | ORDER BY aircraft_icao_count DESC"; |
| 5199 | 5199 | |
| 5200 | 5200 | |
| 5201 | 5201 | $sth = $this->db->prepare($query); |
| 5202 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5202 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5203 | 5203 | $aircraft_array = array(); |
| 5204 | 5204 | $temp_array = array(); |
| 5205 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5205 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5206 | 5206 | { |
| 5207 | 5207 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5208 | 5208 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5218,33 +5218,33 @@ discard block |
||
| 5218 | 5218 | * @return Array the aircraft list |
| 5219 | 5219 | * |
| 5220 | 5220 | */ |
| 5221 | - public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5221 | + public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5222 | 5222 | { |
| 5223 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5223 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5224 | 5224 | $Image = new Image($this->db); |
| 5225 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5226 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5225 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5226 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5227 | 5227 | |
| 5228 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5228 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5229 | 5229 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5230 | 5230 | GROUP BY spotter_output.registration |
| 5231 | 5231 | ORDER BY registration_count DESC"; |
| 5232 | 5232 | |
| 5233 | 5233 | |
| 5234 | 5234 | $sth = $this->db->prepare($query); |
| 5235 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5235 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5236 | 5236 | |
| 5237 | 5237 | $aircraft_array = array(); |
| 5238 | 5238 | $temp_array = array(); |
| 5239 | 5239 | |
| 5240 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5240 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5241 | 5241 | { |
| 5242 | 5242 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5243 | 5243 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5244 | 5244 | $temp_array['registration'] = $row['registration']; |
| 5245 | 5245 | $temp_array['airline_name'] = $row['airline_name']; |
| 5246 | 5246 | $temp_array['image_thumbnail'] = ""; |
| 5247 | - if($row['registration'] != "") |
|
| 5247 | + if ($row['registration'] != "") |
|
| 5248 | 5248 | { |
| 5249 | 5249 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5250 | 5250 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5264,25 +5264,25 @@ discard block |
||
| 5264 | 5264 | * @return Array the aircraft manufacturer list |
| 5265 | 5265 | * |
| 5266 | 5266 | */ |
| 5267 | - public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
|
| 5267 | + public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 5268 | 5268 | { |
| 5269 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5270 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5271 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 5269 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5270 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5271 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 5272 | 5272 | |
| 5273 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5273 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5274 | 5274 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 5275 | 5275 | GROUP BY spotter_output.aircraft_manufacturer |
| 5276 | 5276 | ORDER BY aircraft_manufacturer_count DESC"; |
| 5277 | 5277 | |
| 5278 | 5278 | |
| 5279 | 5279 | $sth = $this->db->prepare($query); |
| 5280 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5280 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao)); |
|
| 5281 | 5281 | |
| 5282 | 5282 | $aircraft_array = array(); |
| 5283 | 5283 | $temp_array = array(); |
| 5284 | 5284 | |
| 5285 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5285 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5286 | 5286 | { |
| 5287 | 5287 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5288 | 5288 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5302,11 +5302,11 @@ discard block |
||
| 5302 | 5302 | * @return Array the aircraft list |
| 5303 | 5303 | * |
| 5304 | 5304 | */ |
| 5305 | - public function countAllAircraftTypesByCountry($country,$filters = array()) |
|
| 5305 | + public function countAllAircraftTypesByCountry($country, $filters = array()) |
|
| 5306 | 5306 | { |
| 5307 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5308 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5309 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5307 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5308 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5309 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.aircraft_icao) AS aircraft_icao_count, spotter_output.aircraft_name |
|
| 5310 | 5310 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 5311 | 5311 | GROUP BY spotter_output.aircraft_name, spotter_output.aircraft_icao |
| 5312 | 5312 | ORDER BY aircraft_icao_count DESC"; |
@@ -5318,7 +5318,7 @@ discard block |
||
| 5318 | 5318 | $aircraft_array = array(); |
| 5319 | 5319 | $temp_array = array(); |
| 5320 | 5320 | |
| 5321 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5321 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5322 | 5322 | { |
| 5323 | 5323 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5324 | 5324 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -5337,12 +5337,12 @@ discard block |
||
| 5337 | 5337 | * @return Array the aircraft list |
| 5338 | 5338 | * |
| 5339 | 5339 | */ |
| 5340 | - public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
|
| 5340 | + public function countAllAircraftRegistrationByCountry($country, $filters = array()) |
|
| 5341 | 5341 | { |
| 5342 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5342 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5343 | 5343 | $Image = new Image($this->db); |
| 5344 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5345 | - $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5344 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5345 | + $query = "SELECT DISTINCT spotter_output.aircraft_icao, COUNT(spotter_output.registration) AS registration_count, spotter_output.aircraft_name, spotter_output.registration, spotter_output.airline_name |
|
| 5346 | 5346 | FROM spotter_output".$filter_query." spotter_output.registration <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5347 | 5347 | GROUP BY spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 5348 | 5348 | ORDER BY registration_count DESC"; |
@@ -5354,14 +5354,14 @@ discard block |
||
| 5354 | 5354 | $aircraft_array = array(); |
| 5355 | 5355 | $temp_array = array(); |
| 5356 | 5356 | |
| 5357 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5357 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5358 | 5358 | { |
| 5359 | 5359 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
| 5360 | 5360 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5361 | 5361 | $temp_array['registration'] = $row['registration']; |
| 5362 | 5362 | $temp_array['airline_name'] = $row['airline_name']; |
| 5363 | 5363 | $temp_array['image_thumbnail'] = ""; |
| 5364 | - if($row['registration'] != "") |
|
| 5364 | + if ($row['registration'] != "") |
|
| 5365 | 5365 | { |
| 5366 | 5366 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5367 | 5367 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5381,11 +5381,11 @@ discard block |
||
| 5381 | 5381 | * @return Array the aircraft manufacturer list |
| 5382 | 5382 | * |
| 5383 | 5383 | */ |
| 5384 | - public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
|
| 5384 | + public function countAllAircraftManufacturerByCountry($country, $filters = array()) |
|
| 5385 | 5385 | { |
| 5386 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5387 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 5388 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5386 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5387 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 5388 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5389 | 5389 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer <> '' AND (((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country) |
| 5390 | 5390 | GROUP BY spotter_output.aircraft_manufacturer |
| 5391 | 5391 | ORDER BY aircraft_manufacturer_count DESC"; |
@@ -5397,7 +5397,7 @@ discard block |
||
| 5397 | 5397 | $aircraft_array = array(); |
| 5398 | 5398 | $temp_array = array(); |
| 5399 | 5399 | |
| 5400 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5400 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5401 | 5401 | { |
| 5402 | 5402 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5403 | 5403 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5418,8 +5418,8 @@ discard block |
||
| 5418 | 5418 | */ |
| 5419 | 5419 | public function countAllAircraftManufacturers($filters = array()) |
| 5420 | 5420 | { |
| 5421 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5422 | - $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5421 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5422 | + $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
| 5423 | 5423 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 5424 | 5424 | $query .= " GROUP BY spotter_output.aircraft_manufacturer |
| 5425 | 5425 | ORDER BY aircraft_manufacturer_count DESC |
@@ -5432,7 +5432,7 @@ discard block |
||
| 5432 | 5432 | $manufacturer_array = array(); |
| 5433 | 5433 | $temp_array = array(); |
| 5434 | 5434 | |
| 5435 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5435 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5436 | 5436 | { |
| 5437 | 5437 | $temp_array['aircraft_manufacturer'] = $row['aircraft_manufacturer']; |
| 5438 | 5438 | $temp_array['aircraft_manufacturer_count'] = $row['aircraft_manufacturer_count']; |
@@ -5451,12 +5451,12 @@ discard block |
||
| 5451 | 5451 | * @return Array the aircraft list |
| 5452 | 5452 | * |
| 5453 | 5453 | */ |
| 5454 | - public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5454 | + public function countAllAircraftRegistrations($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5455 | 5455 | { |
| 5456 | 5456 | global $globalDBdriver; |
| 5457 | 5457 | $Image = new Image($this->db); |
| 5458 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5459 | - $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5458 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5459 | + $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5460 | 5460 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 5461 | 5461 | if ($olderthanmonths > 0) { |
| 5462 | 5462 | if ($globalDBdriver == 'mysql') { |
@@ -5484,7 +5484,7 @@ discard block |
||
| 5484 | 5484 | $aircraft_array = array(); |
| 5485 | 5485 | $temp_array = array(); |
| 5486 | 5486 | |
| 5487 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5487 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5488 | 5488 | { |
| 5489 | 5489 | $temp_array['registration'] = $row['registration']; |
| 5490 | 5490 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5492,7 +5492,7 @@ discard block |
||
| 5492 | 5492 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5493 | 5493 | $temp_array['airline_name'] = $row['airline_name']; |
| 5494 | 5494 | $temp_array['image_thumbnail'] = ""; |
| 5495 | - if($row['registration'] != "") |
|
| 5495 | + if ($row['registration'] != "") |
|
| 5496 | 5496 | { |
| 5497 | 5497 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5498 | 5498 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5511,12 +5511,12 @@ discard block |
||
| 5511 | 5511 | * @return Array the aircraft list |
| 5512 | 5512 | * |
| 5513 | 5513 | */ |
| 5514 | - public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
|
| 5514 | + public function countAllAircraftRegistrationsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5515 | 5515 | { |
| 5516 | 5516 | global $globalDBdriver; |
| 5517 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5517 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5518 | 5518 | $Image = new Image($this->db); |
| 5519 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5519 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
|
| 5520 | 5520 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 5521 | 5521 | if ($olderthanmonths > 0) { |
| 5522 | 5522 | if ($globalDBdriver == 'mysql') { |
@@ -5544,7 +5544,7 @@ discard block |
||
| 5544 | 5544 | $aircraft_array = array(); |
| 5545 | 5545 | $temp_array = array(); |
| 5546 | 5546 | |
| 5547 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5547 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5548 | 5548 | { |
| 5549 | 5549 | $temp_array['registration'] = $row['registration']; |
| 5550 | 5550 | $temp_array['aircraft_registration_count'] = $row['aircraft_registration_count']; |
@@ -5553,7 +5553,7 @@ discard block |
||
| 5553 | 5553 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
| 5554 | 5554 | $temp_array['airline_name'] = $row['airline_name']; |
| 5555 | 5555 | $temp_array['image_thumbnail'] = ""; |
| 5556 | - if($row['registration'] != "") |
|
| 5556 | + if ($row['registration'] != "") |
|
| 5557 | 5557 | { |
| 5558 | 5558 | $image_array = $Image->getSpotterImage($row['registration']); |
| 5559 | 5559 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -5572,11 +5572,11 @@ discard block |
||
| 5572 | 5572 | * @return Array the airport list |
| 5573 | 5573 | * |
| 5574 | 5574 | */ |
| 5575 | - public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5575 | + public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5576 | 5576 | { |
| 5577 | 5577 | global $globalDBdriver; |
| 5578 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5579 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5578 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5579 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5580 | 5580 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 5581 | 5581 | if ($olderthanmonths > 0) { |
| 5582 | 5582 | if ($globalDBdriver == 'mysql') { |
@@ -5605,7 +5605,7 @@ discard block |
||
| 5605 | 5605 | $airport_array = array(); |
| 5606 | 5606 | $temp_array = array(); |
| 5607 | 5607 | |
| 5608 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5608 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5609 | 5609 | { |
| 5610 | 5610 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5611 | 5611 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5624,11 +5624,11 @@ discard block |
||
| 5624 | 5624 | * @return Array the airport list |
| 5625 | 5625 | * |
| 5626 | 5626 | */ |
| 5627 | - public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5627 | + public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5628 | 5628 | { |
| 5629 | 5629 | global $globalDBdriver; |
| 5630 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5631 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5630 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5631 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5632 | 5632 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' "; |
| 5633 | 5633 | if ($olderthanmonths > 0) { |
| 5634 | 5634 | if ($globalDBdriver == 'mysql') { |
@@ -5657,7 +5657,7 @@ discard block |
||
| 5657 | 5657 | $airport_array = array(); |
| 5658 | 5658 | $temp_array = array(); |
| 5659 | 5659 | |
| 5660 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5660 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5661 | 5661 | { |
| 5662 | 5662 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5663 | 5663 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5677,11 +5677,11 @@ discard block |
||
| 5677 | 5677 | * @return Array the airport list |
| 5678 | 5678 | * |
| 5679 | 5679 | */ |
| 5680 | - public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5680 | + public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5681 | 5681 | { |
| 5682 | 5682 | global $globalDBdriver; |
| 5683 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5684 | - $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5683 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5684 | + $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5685 | 5685 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 5686 | 5686 | if ($olderthanmonths > 0) { |
| 5687 | 5687 | if ($globalDBdriver == 'mysql') { |
@@ -5709,7 +5709,7 @@ discard block |
||
| 5709 | 5709 | $airport_array = array(); |
| 5710 | 5710 | $temp_array = array(); |
| 5711 | 5711 | |
| 5712 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5712 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5713 | 5713 | { |
| 5714 | 5714 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5715 | 5715 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5728,11 +5728,11 @@ discard block |
||
| 5728 | 5728 | * @return Array the airport list |
| 5729 | 5729 | * |
| 5730 | 5730 | */ |
| 5731 | - public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 5731 | + public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 5732 | 5732 | { |
| 5733 | 5733 | global $globalDBdriver; |
| 5734 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5735 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5734 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5735 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
|
| 5736 | 5736 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 5737 | 5737 | if ($olderthanmonths > 0) { |
| 5738 | 5738 | if ($globalDBdriver == 'mysql') { |
@@ -5761,7 +5761,7 @@ discard block |
||
| 5761 | 5761 | $airport_array = array(); |
| 5762 | 5762 | $temp_array = array(); |
| 5763 | 5763 | |
| 5764 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5764 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5765 | 5765 | { |
| 5766 | 5766 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 5767 | 5767 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -5781,11 +5781,11 @@ discard block |
||
| 5781 | 5781 | * @return Array the airport list |
| 5782 | 5782 | * |
| 5783 | 5783 | */ |
| 5784 | - public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
|
| 5784 | + public function countAllDepartureAirportsByAirline($airline_icao, $filters = array()) |
|
| 5785 | 5785 | { |
| 5786 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5787 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5788 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5786 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5787 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5788 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5789 | 5789 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 5790 | 5790 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5791 | 5791 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5797,7 +5797,7 @@ discard block |
||
| 5797 | 5797 | $airport_array = array(); |
| 5798 | 5798 | $temp_array = array(); |
| 5799 | 5799 | |
| 5800 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5800 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5801 | 5801 | { |
| 5802 | 5802 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5803 | 5803 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5819,11 +5819,11 @@ discard block |
||
| 5819 | 5819 | * @return Array the airport list |
| 5820 | 5820 | * |
| 5821 | 5821 | */ |
| 5822 | - public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 5822 | + public function countAllDepartureAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 5823 | 5823 | { |
| 5824 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5825 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 5826 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5824 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5825 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 5826 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5827 | 5827 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 5828 | 5828 | GROUP BY spotter_output.departure_airport_country |
| 5829 | 5829 | ORDER BY airport_departure_country_count DESC"; |
@@ -5835,7 +5835,7 @@ discard block |
||
| 5835 | 5835 | $airport_array = array(); |
| 5836 | 5836 | $temp_array = array(); |
| 5837 | 5837 | |
| 5838 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5838 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5839 | 5839 | { |
| 5840 | 5840 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5841 | 5841 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5854,11 +5854,11 @@ discard block |
||
| 5854 | 5854 | * @return Array the airport list |
| 5855 | 5855 | * |
| 5856 | 5856 | */ |
| 5857 | - public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 5857 | + public function countAllDepartureAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 5858 | 5858 | { |
| 5859 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5860 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5861 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5859 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5860 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5861 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5862 | 5862 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5863 | 5863 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 5864 | 5864 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5870,7 +5870,7 @@ discard block |
||
| 5870 | 5870 | $airport_array = array(); |
| 5871 | 5871 | $temp_array = array(); |
| 5872 | 5872 | |
| 5873 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5873 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5874 | 5874 | { |
| 5875 | 5875 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5876 | 5876 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5891,11 +5891,11 @@ discard block |
||
| 5891 | 5891 | * @return Array the airport list |
| 5892 | 5892 | * |
| 5893 | 5893 | */ |
| 5894 | - public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 5894 | + public function countAllDepartureAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 5895 | 5895 | { |
| 5896 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5897 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 5898 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5896 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5897 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 5898 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5899 | 5899 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 5900 | 5900 | GROUP BY spotter_output.departure_airport_country |
| 5901 | 5901 | ORDER BY airport_departure_country_count DESC"; |
@@ -5907,7 +5907,7 @@ discard block |
||
| 5907 | 5907 | $airport_array = array(); |
| 5908 | 5908 | $temp_array = array(); |
| 5909 | 5909 | |
| 5910 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5910 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5911 | 5911 | { |
| 5912 | 5912 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5913 | 5913 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5925,11 +5925,11 @@ discard block |
||
| 5925 | 5925 | * @return Array the airport list |
| 5926 | 5926 | * |
| 5927 | 5927 | */ |
| 5928 | - public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
|
| 5928 | + public function countAllDepartureAirportsByRegistration($registration, $filters = array()) |
|
| 5929 | 5929 | { |
| 5930 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5931 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5932 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5930 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5931 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5932 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 5933 | 5933 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 5934 | 5934 | GROUP BY spotter_output.departure_airport_icao |
| 5935 | 5935 | ORDER BY airport_departure_icao_count DESC"; |
@@ -5941,7 +5941,7 @@ discard block |
||
| 5941 | 5941 | $airport_array = array(); |
| 5942 | 5942 | $temp_array = array(); |
| 5943 | 5943 | |
| 5944 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5944 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5945 | 5945 | { |
| 5946 | 5946 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 5947 | 5947 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -5962,11 +5962,11 @@ discard block |
||
| 5962 | 5962 | * @return Array the airport list |
| 5963 | 5963 | * |
| 5964 | 5964 | */ |
| 5965 | - public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
|
| 5965 | + public function countAllDepartureAirportCountriesByRegistration($registration, $filters = array()) |
|
| 5966 | 5966 | { |
| 5967 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 5968 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 5969 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5967 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 5968 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 5969 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 5970 | 5970 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.registration = :registration |
| 5971 | 5971 | GROUP BY spotter_output.departure_airport_country |
| 5972 | 5972 | ORDER BY airport_departure_country_count DESC"; |
@@ -5978,7 +5978,7 @@ discard block |
||
| 5978 | 5978 | $airport_array = array(); |
| 5979 | 5979 | $temp_array = array(); |
| 5980 | 5980 | |
| 5981 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5981 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 5982 | 5982 | { |
| 5983 | 5983 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 5984 | 5984 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -5996,11 +5996,11 @@ discard block |
||
| 5996 | 5996 | * @return Array the airport list |
| 5997 | 5997 | * |
| 5998 | 5998 | */ |
| 5999 | - public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
|
| 5999 | + public function countAllDepartureAirportsByAirport($airport_icao, $filters = array()) |
|
| 6000 | 6000 | { |
| 6001 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6002 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6003 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6001 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6002 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6003 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6004 | 6004 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6005 | 6005 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6006 | 6006 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6012,7 +6012,7 @@ discard block |
||
| 6012 | 6012 | $airport_array = array(); |
| 6013 | 6013 | $temp_array = array(); |
| 6014 | 6014 | |
| 6015 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6015 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6016 | 6016 | { |
| 6017 | 6017 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6018 | 6018 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6033,11 +6033,11 @@ discard block |
||
| 6033 | 6033 | * @return Array the airport list |
| 6034 | 6034 | * |
| 6035 | 6035 | */ |
| 6036 | - public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6036 | + public function countAllDepartureAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6037 | 6037 | { |
| 6038 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6039 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6040 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6038 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6039 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6040 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6041 | 6041 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.arrival_airport_icao = :airport_icao |
| 6042 | 6042 | GROUP BY spotter_output.departure_airport_country |
| 6043 | 6043 | ORDER BY airport_departure_country_count DESC"; |
@@ -6049,7 +6049,7 @@ discard block |
||
| 6049 | 6049 | $airport_array = array(); |
| 6050 | 6050 | $temp_array = array(); |
| 6051 | 6051 | |
| 6052 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6052 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6053 | 6053 | { |
| 6054 | 6054 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6055 | 6055 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6068,11 +6068,11 @@ discard block |
||
| 6068 | 6068 | * @return Array the airport list |
| 6069 | 6069 | * |
| 6070 | 6070 | */ |
| 6071 | - public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6071 | + public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6072 | 6072 | { |
| 6073 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6074 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6075 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6073 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6074 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6075 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6076 | 6076 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6077 | 6077 | GROUP BY spotter_output.departure_airport_icao |
| 6078 | 6078 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6084,7 +6084,7 @@ discard block |
||
| 6084 | 6084 | $airport_array = array(); |
| 6085 | 6085 | $temp_array = array(); |
| 6086 | 6086 | |
| 6087 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6087 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6088 | 6088 | { |
| 6089 | 6089 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6090 | 6090 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6105,11 +6105,11 @@ discard block |
||
| 6105 | 6105 | * @return Array the airport list |
| 6106 | 6106 | * |
| 6107 | 6107 | */ |
| 6108 | - public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6108 | + public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6109 | 6109 | { |
| 6110 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6111 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6112 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6110 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6111 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6112 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6113 | 6113 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6114 | 6114 | GROUP BY spotter_output.departure_airport_country |
| 6115 | 6115 | ORDER BY airport_departure_country_count DESC"; |
@@ -6121,7 +6121,7 @@ discard block |
||
| 6121 | 6121 | $airport_array = array(); |
| 6122 | 6122 | $temp_array = array(); |
| 6123 | 6123 | |
| 6124 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6124 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6125 | 6125 | { |
| 6126 | 6126 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6127 | 6127 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6139,11 +6139,11 @@ discard block |
||
| 6139 | 6139 | * @return Array the airport list |
| 6140 | 6140 | * |
| 6141 | 6141 | */ |
| 6142 | - public function countAllDepartureAirportsByDate($date,$filters = array()) |
|
| 6142 | + public function countAllDepartureAirportsByDate($date, $filters = array()) |
|
| 6143 | 6143 | { |
| 6144 | 6144 | global $globalTimezone, $globalDBdriver; |
| 6145 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6146 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6145 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6146 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6147 | 6147 | if ($globalTimezone != '') { |
| 6148 | 6148 | date_default_timezone_set($globalTimezone); |
| 6149 | 6149 | $datetime = new DateTime($date); |
@@ -6151,12 +6151,12 @@ discard block |
||
| 6151 | 6151 | } else $offset = '+00:00'; |
| 6152 | 6152 | |
| 6153 | 6153 | if ($globalDBdriver == 'mysql') { |
| 6154 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6154 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6155 | 6155 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6156 | 6156 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6157 | 6157 | ORDER BY airport_departure_icao_count DESC"; |
| 6158 | 6158 | } else { |
| 6159 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6159 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6160 | 6160 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6161 | 6161 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6162 | 6162 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6168,7 +6168,7 @@ discard block |
||
| 6168 | 6168 | $airport_array = array(); |
| 6169 | 6169 | $temp_array = array(); |
| 6170 | 6170 | |
| 6171 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6171 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6172 | 6172 | { |
| 6173 | 6173 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6174 | 6174 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6189,11 +6189,11 @@ discard block |
||
| 6189 | 6189 | * @return Array the airport list |
| 6190 | 6190 | * |
| 6191 | 6191 | */ |
| 6192 | - public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
|
| 6192 | + public function countAllDepartureAirportCountriesByDate($date, $filters = array()) |
|
| 6193 | 6193 | { |
| 6194 | 6194 | global $globalTimezone, $globalDBdriver; |
| 6195 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6196 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6195 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6196 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6197 | 6197 | if ($globalTimezone != '') { |
| 6198 | 6198 | date_default_timezone_set($globalTimezone); |
| 6199 | 6199 | $datetime = new DateTime($date); |
@@ -6201,12 +6201,12 @@ discard block |
||
| 6201 | 6201 | } else $offset = '+00:00'; |
| 6202 | 6202 | |
| 6203 | 6203 | if ($globalDBdriver == 'mysql') { |
| 6204 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6204 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6205 | 6205 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 6206 | 6206 | GROUP BY spotter_output.departure_airport_country |
| 6207 | 6207 | ORDER BY airport_departure_country_count DESC"; |
| 6208 | 6208 | } else { |
| 6209 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6209 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6210 | 6210 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 6211 | 6211 | GROUP BY spotter_output.departure_airport_country |
| 6212 | 6212 | ORDER BY airport_departure_country_count DESC"; |
@@ -6218,7 +6218,7 @@ discard block |
||
| 6218 | 6218 | $airport_array = array(); |
| 6219 | 6219 | $temp_array = array(); |
| 6220 | 6220 | |
| 6221 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6221 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6222 | 6222 | { |
| 6223 | 6223 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6224 | 6224 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6236,11 +6236,11 @@ discard block |
||
| 6236 | 6236 | * @return Array the airport list |
| 6237 | 6237 | * |
| 6238 | 6238 | */ |
| 6239 | - public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
|
| 6239 | + public function countAllDepartureAirportsByIdent($ident, $filters = array()) |
|
| 6240 | 6240 | { |
| 6241 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6242 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6243 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6241 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6242 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6243 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6244 | 6244 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 6245 | 6245 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6246 | 6246 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6252,7 +6252,7 @@ discard block |
||
| 6252 | 6252 | $airport_array = array(); |
| 6253 | 6253 | $temp_array = array(); |
| 6254 | 6254 | |
| 6255 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6255 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6256 | 6256 | { |
| 6257 | 6257 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6258 | 6258 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6274,11 +6274,11 @@ discard block |
||
| 6274 | 6274 | * @return Array the airport list |
| 6275 | 6275 | * |
| 6276 | 6276 | */ |
| 6277 | - public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
|
| 6277 | + public function countAllDepartureAirportCountriesByIdent($ident, $filters = array()) |
|
| 6278 | 6278 | { |
| 6279 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6280 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 6281 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6279 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6280 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 6281 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6282 | 6282 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.ident = :ident |
| 6283 | 6283 | GROUP BY spotter_output.departure_airport_country |
| 6284 | 6284 | ORDER BY airport_departure_country_count DESC"; |
@@ -6290,7 +6290,7 @@ discard block |
||
| 6290 | 6290 | $airport_array = array(); |
| 6291 | 6291 | $temp_array = array(); |
| 6292 | 6292 | |
| 6293 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6293 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6294 | 6294 | { |
| 6295 | 6295 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6296 | 6296 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6309,12 +6309,12 @@ discard block |
||
| 6309 | 6309 | * @return Array the airport list |
| 6310 | 6310 | * |
| 6311 | 6311 | */ |
| 6312 | - public function countAllDepartureAirportsByCountry($country,$filters = array()) |
|
| 6312 | + public function countAllDepartureAirportsByCountry($country, $filters = array()) |
|
| 6313 | 6313 | { |
| 6314 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6315 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6314 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6315 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6316 | 6316 | |
| 6317 | - $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6317 | + $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6318 | 6318 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6319 | 6319 | GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6320 | 6320 | ORDER BY airport_departure_icao_count DESC"; |
@@ -6326,7 +6326,7 @@ discard block |
||
| 6326 | 6326 | $airport_array = array(); |
| 6327 | 6327 | $temp_array = array(); |
| 6328 | 6328 | |
| 6329 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6329 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6330 | 6330 | { |
| 6331 | 6331 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
| 6332 | 6332 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -6347,11 +6347,11 @@ discard block |
||
| 6347 | 6347 | * @return Array the airport list |
| 6348 | 6348 | * |
| 6349 | 6349 | */ |
| 6350 | - public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
|
| 6350 | + public function countAllDepartureAirportCountriesByCountry($country, $filters = array()) |
|
| 6351 | 6351 | { |
| 6352 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6353 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 6354 | - $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6352 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6353 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 6354 | + $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
|
| 6355 | 6355 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 6356 | 6356 | GROUP BY spotter_output.departure_airport_country |
| 6357 | 6357 | ORDER BY airport_departure_country_count DESC"; |
@@ -6363,7 +6363,7 @@ discard block |
||
| 6363 | 6363 | $airport_array = array(); |
| 6364 | 6364 | $temp_array = array(); |
| 6365 | 6365 | |
| 6366 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6366 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6367 | 6367 | { |
| 6368 | 6368 | $temp_array['departure_airport_country'] = $row['departure_airport_country']; |
| 6369 | 6369 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
@@ -6381,11 +6381,11 @@ discard block |
||
| 6381 | 6381 | * @return Array the airport list |
| 6382 | 6382 | * |
| 6383 | 6383 | */ |
| 6384 | - public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6384 | + public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6385 | 6385 | { |
| 6386 | 6386 | global $globalDBdriver; |
| 6387 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6388 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6387 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6388 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6389 | 6389 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 6390 | 6390 | if ($olderthanmonths > 0) { |
| 6391 | 6391 | if ($globalDBdriver == 'mysql') { |
@@ -6420,7 +6420,7 @@ discard block |
||
| 6420 | 6420 | $airport_array = array(); |
| 6421 | 6421 | $temp_array = array(); |
| 6422 | 6422 | |
| 6423 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6423 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6424 | 6424 | { |
| 6425 | 6425 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6426 | 6426 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6443,11 +6443,11 @@ discard block |
||
| 6443 | 6443 | * @return Array the airport list |
| 6444 | 6444 | * |
| 6445 | 6445 | */ |
| 6446 | - public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
|
| 6446 | + public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6447 | 6447 | { |
| 6448 | 6448 | global $globalDBdriver; |
| 6449 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6450 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6449 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6450 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6451 | 6451 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' "; |
| 6452 | 6452 | if ($olderthanmonths > 0) { |
| 6453 | 6453 | if ($globalDBdriver == 'mysql') { |
@@ -6482,7 +6482,7 @@ discard block |
||
| 6482 | 6482 | $airport_array = array(); |
| 6483 | 6483 | $temp_array = array(); |
| 6484 | 6484 | |
| 6485 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6485 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6486 | 6486 | { |
| 6487 | 6487 | $temp_array['airline_icao'] = $row['airline_icao']; |
| 6488 | 6488 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
@@ -6507,11 +6507,11 @@ discard block |
||
| 6507 | 6507 | * @return Array the airport list |
| 6508 | 6508 | * |
| 6509 | 6509 | */ |
| 6510 | - public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6510 | + public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6511 | 6511 | { |
| 6512 | 6512 | global $globalDBdriver; |
| 6513 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6514 | - $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6513 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6514 | + $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6515 | 6515 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 6516 | 6516 | if ($olderthanmonths > 0) { |
| 6517 | 6517 | if ($globalDBdriver == 'mysql') { |
@@ -6545,7 +6545,7 @@ discard block |
||
| 6545 | 6545 | $airport_array = array(); |
| 6546 | 6546 | $temp_array = array(); |
| 6547 | 6547 | |
| 6548 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6548 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6549 | 6549 | { |
| 6550 | 6550 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6551 | 6551 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6568,11 +6568,11 @@ discard block |
||
| 6568 | 6568 | * @return Array the airport list |
| 6569 | 6569 | * |
| 6570 | 6570 | */ |
| 6571 | - public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
|
| 6571 | + public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false, $filters = array()) |
|
| 6572 | 6572 | { |
| 6573 | 6573 | global $globalDBdriver; |
| 6574 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6575 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6574 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6575 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
|
| 6576 | 6576 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 6577 | 6577 | if ($olderthanmonths > 0) { |
| 6578 | 6578 | if ($globalDBdriver == 'mysql') { |
@@ -6607,7 +6607,7 @@ discard block |
||
| 6607 | 6607 | $airport_array = array(); |
| 6608 | 6608 | $temp_array = array(); |
| 6609 | 6609 | |
| 6610 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6610 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6611 | 6611 | { |
| 6612 | 6612 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6613 | 6613 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6633,9 +6633,9 @@ discard block |
||
| 6633 | 6633 | */ |
| 6634 | 6634 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 6635 | 6635 | { |
| 6636 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6637 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6638 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6636 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6637 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6638 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6639 | 6639 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.airline_icao = :airline_icao |
| 6640 | 6640 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6641 | 6641 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6646,7 +6646,7 @@ discard block |
||
| 6646 | 6646 | $airport_array = array(); |
| 6647 | 6647 | $temp_array = array(); |
| 6648 | 6648 | |
| 6649 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6649 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6650 | 6650 | { |
| 6651 | 6651 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6652 | 6652 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6667,12 +6667,12 @@ discard block |
||
| 6667 | 6667 | * @return Array the airport list |
| 6668 | 6668 | * |
| 6669 | 6669 | */ |
| 6670 | - public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
|
| 6670 | + public function countAllArrivalAirportCountriesByAirline($airline_icao, $filters = array()) |
|
| 6671 | 6671 | { |
| 6672 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6673 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 6672 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6673 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 6674 | 6674 | |
| 6675 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6675 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6676 | 6676 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.airline_icao = :airline_icao |
| 6677 | 6677 | GROUP BY spotter_output.arrival_airport_country |
| 6678 | 6678 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6684,7 +6684,7 @@ discard block |
||
| 6684 | 6684 | $airport_array = array(); |
| 6685 | 6685 | $temp_array = array(); |
| 6686 | 6686 | |
| 6687 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6687 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6688 | 6688 | { |
| 6689 | 6689 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6690 | 6690 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6702,11 +6702,11 @@ discard block |
||
| 6702 | 6702 | * @return Array the airport list |
| 6703 | 6703 | * |
| 6704 | 6704 | */ |
| 6705 | - public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
|
| 6705 | + public function countAllArrivalAirportsByAircraft($aircraft_icao, $filters = array()) |
|
| 6706 | 6706 | { |
| 6707 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6708 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6709 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6707 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6708 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6709 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6710 | 6710 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6711 | 6711 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6712 | 6712 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6718,7 +6718,7 @@ discard block |
||
| 6718 | 6718 | $airport_array = array(); |
| 6719 | 6719 | $temp_array = array(); |
| 6720 | 6720 | |
| 6721 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6721 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6722 | 6722 | { |
| 6723 | 6723 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6724 | 6724 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6740,11 +6740,11 @@ discard block |
||
| 6740 | 6740 | * @return Array the airport list |
| 6741 | 6741 | * |
| 6742 | 6742 | */ |
| 6743 | - public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
|
| 6743 | + public function countAllArrivalAirportCountriesByAircraft($aircraft_icao, $filters = array()) |
|
| 6744 | 6744 | { |
| 6745 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6746 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 6747 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6745 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6746 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 6747 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6748 | 6748 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 6749 | 6749 | GROUP BY spotter_output.arrival_airport_country |
| 6750 | 6750 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6756,7 +6756,7 @@ discard block |
||
| 6756 | 6756 | $airport_array = array(); |
| 6757 | 6757 | $temp_array = array(); |
| 6758 | 6758 | |
| 6759 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6759 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6760 | 6760 | { |
| 6761 | 6761 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6762 | 6762 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6774,12 +6774,12 @@ discard block |
||
| 6774 | 6774 | * @return Array the airport list |
| 6775 | 6775 | * |
| 6776 | 6776 | */ |
| 6777 | - public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
|
| 6777 | + public function countAllArrivalAirportsByRegistration($registration, $filters = array()) |
|
| 6778 | 6778 | { |
| 6779 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6780 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6779 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6780 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6781 | 6781 | |
| 6782 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6782 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6783 | 6783 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.registration = :registration |
| 6784 | 6784 | GROUP BY spotter_output.arrival_airport_icao |
| 6785 | 6785 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6791,7 +6791,7 @@ discard block |
||
| 6791 | 6791 | $airport_array = array(); |
| 6792 | 6792 | $temp_array = array(); |
| 6793 | 6793 | |
| 6794 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6794 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6795 | 6795 | { |
| 6796 | 6796 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6797 | 6797 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6812,11 +6812,11 @@ discard block |
||
| 6812 | 6812 | * @return Array the airport list |
| 6813 | 6813 | * |
| 6814 | 6814 | */ |
| 6815 | - public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
|
| 6815 | + public function countAllArrivalAirportCountriesByRegistration($registration, $filters = array()) |
|
| 6816 | 6816 | { |
| 6817 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6818 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 6819 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6817 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6818 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 6819 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6820 | 6820 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.registration = :registration |
| 6821 | 6821 | GROUP BY spotter_output.arrival_airport_country |
| 6822 | 6822 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6828,7 +6828,7 @@ discard block |
||
| 6828 | 6828 | $airport_array = array(); |
| 6829 | 6829 | $temp_array = array(); |
| 6830 | 6830 | |
| 6831 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6831 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6832 | 6832 | { |
| 6833 | 6833 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6834 | 6834 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6847,11 +6847,11 @@ discard block |
||
| 6847 | 6847 | * @return Array the airport list |
| 6848 | 6848 | * |
| 6849 | 6849 | */ |
| 6850 | - public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
|
| 6850 | + public function countAllArrivalAirportsByAirport($airport_icao, $filters = array()) |
|
| 6851 | 6851 | { |
| 6852 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6853 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6854 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6852 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6853 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6854 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6855 | 6855 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.departure_airport_icao = :airport_icao |
| 6856 | 6856 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 6857 | 6857 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6863,7 +6863,7 @@ discard block |
||
| 6863 | 6863 | $airport_array = array(); |
| 6864 | 6864 | $temp_array = array(); |
| 6865 | 6865 | |
| 6866 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6866 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6867 | 6867 | { |
| 6868 | 6868 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6869 | 6869 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6884,11 +6884,11 @@ discard block |
||
| 6884 | 6884 | * @return Array the airport list |
| 6885 | 6885 | * |
| 6886 | 6886 | */ |
| 6887 | - public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
|
| 6887 | + public function countAllArrivalAirportCountriesByAirport($airport_icao, $filters = array()) |
|
| 6888 | 6888 | { |
| 6889 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6890 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 6891 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6889 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6890 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 6891 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6892 | 6892 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.departure_airport_icao = :airport_icao |
| 6893 | 6893 | GROUP BY spotter_output.arrival_airport_country |
| 6894 | 6894 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6900,7 +6900,7 @@ discard block |
||
| 6900 | 6900 | $airport_array = array(); |
| 6901 | 6901 | $temp_array = array(); |
| 6902 | 6902 | |
| 6903 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6903 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6904 | 6904 | { |
| 6905 | 6905 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6906 | 6906 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6918,11 +6918,11 @@ discard block |
||
| 6918 | 6918 | * @return Array the airport list |
| 6919 | 6919 | * |
| 6920 | 6920 | */ |
| 6921 | - public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6921 | + public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6922 | 6922 | { |
| 6923 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6924 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6925 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6923 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6924 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6925 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 6926 | 6926 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6927 | 6927 | GROUP BY spotter_output.arrival_airport_icao |
| 6928 | 6928 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -6934,7 +6934,7 @@ discard block |
||
| 6934 | 6934 | $airport_array = array(); |
| 6935 | 6935 | $temp_array = array(); |
| 6936 | 6936 | |
| 6937 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6937 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6938 | 6938 | { |
| 6939 | 6939 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 6940 | 6940 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -6956,11 +6956,11 @@ discard block |
||
| 6956 | 6956 | * @return Array the airport list |
| 6957 | 6957 | * |
| 6958 | 6958 | */ |
| 6959 | - public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
|
| 6959 | + public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 6960 | 6960 | { |
| 6961 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6962 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 6963 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6961 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6962 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 6963 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 6964 | 6964 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 6965 | 6965 | GROUP BY spotter_output.arrival_airport_country |
| 6966 | 6966 | ORDER BY airport_arrival_country_count DESC"; |
@@ -6972,7 +6972,7 @@ discard block |
||
| 6972 | 6972 | $airport_array = array(); |
| 6973 | 6973 | $temp_array = array(); |
| 6974 | 6974 | |
| 6975 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6975 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 6976 | 6976 | { |
| 6977 | 6977 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 6978 | 6978 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -6991,11 +6991,11 @@ discard block |
||
| 6991 | 6991 | * @return Array the airport list |
| 6992 | 6992 | * |
| 6993 | 6993 | */ |
| 6994 | - public function countAllArrivalAirportsByDate($date,$filters = array()) |
|
| 6994 | + public function countAllArrivalAirportsByDate($date, $filters = array()) |
|
| 6995 | 6995 | { |
| 6996 | 6996 | global $globalTimezone, $globalDBdriver; |
| 6997 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 6998 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 6997 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 6998 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 6999 | 6999 | if ($globalTimezone != '') { |
| 7000 | 7000 | date_default_timezone_set($globalTimezone); |
| 7001 | 7001 | $datetime = new DateTime($date); |
@@ -7003,12 +7003,12 @@ discard block |
||
| 7003 | 7003 | } else $offset = '+00:00'; |
| 7004 | 7004 | |
| 7005 | 7005 | if ($globalDBdriver == 'mysql') { |
| 7006 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7006 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7007 | 7007 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7008 | 7008 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7009 | 7009 | ORDER BY airport_arrival_icao_count DESC"; |
| 7010 | 7010 | } else { |
| 7011 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7011 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7012 | 7012 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7013 | 7013 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7014 | 7014 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7020,7 +7020,7 @@ discard block |
||
| 7020 | 7020 | $airport_array = array(); |
| 7021 | 7021 | $temp_array = array(); |
| 7022 | 7022 | |
| 7023 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7023 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7024 | 7024 | { |
| 7025 | 7025 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7026 | 7026 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7044,8 +7044,8 @@ discard block |
||
| 7044 | 7044 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 7045 | 7045 | { |
| 7046 | 7046 | global $globalTimezone, $globalDBdriver; |
| 7047 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7048 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7047 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7048 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7049 | 7049 | if ($globalTimezone != '') { |
| 7050 | 7050 | date_default_timezone_set($globalTimezone); |
| 7051 | 7051 | $datetime = new DateTime($date); |
@@ -7053,12 +7053,12 @@ discard block |
||
| 7053 | 7053 | } else $offset = '+00:00'; |
| 7054 | 7054 | |
| 7055 | 7055 | if ($globalDBdriver == 'mysql') { |
| 7056 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7056 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7057 | 7057 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7058 | 7058 | GROUP BY spotter_output.arrival_airport_country |
| 7059 | 7059 | ORDER BY airport_arrival_country_count DESC"; |
| 7060 | 7060 | } else { |
| 7061 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7061 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7062 | 7062 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7063 | 7063 | GROUP BY spotter_output.arrival_airport_country |
| 7064 | 7064 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7070,7 +7070,7 @@ discard block |
||
| 7070 | 7070 | $airport_array = array(); |
| 7071 | 7071 | $temp_array = array(); |
| 7072 | 7072 | |
| 7073 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7073 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7074 | 7074 | { |
| 7075 | 7075 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7076 | 7076 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7088,11 +7088,11 @@ discard block |
||
| 7088 | 7088 | * @return Array the airport list |
| 7089 | 7089 | * |
| 7090 | 7090 | */ |
| 7091 | - public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
|
| 7091 | + public function countAllArrivalAirportsByIdent($ident, $filters = array()) |
|
| 7092 | 7092 | { |
| 7093 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7094 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7095 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7093 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7094 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7095 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7096 | 7096 | FROM spotter_output".$filter_query." WHERE spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.ident = :ident |
| 7097 | 7097 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7098 | 7098 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7104,7 +7104,7 @@ discard block |
||
| 7104 | 7104 | $airport_array = array(); |
| 7105 | 7105 | $temp_array = array(); |
| 7106 | 7106 | |
| 7107 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7107 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7108 | 7108 | { |
| 7109 | 7109 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7110 | 7110 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7127,9 +7127,9 @@ discard block |
||
| 7127 | 7127 | */ |
| 7128 | 7128 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 7129 | 7129 | { |
| 7130 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7131 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7132 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7130 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7131 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7132 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7133 | 7133 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.ident = :ident |
| 7134 | 7134 | GROUP BY spotter_output.arrival_airport_country |
| 7135 | 7135 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7141,7 +7141,7 @@ discard block |
||
| 7141 | 7141 | $airport_array = array(); |
| 7142 | 7142 | $temp_array = array(); |
| 7143 | 7143 | |
| 7144 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7144 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7145 | 7145 | { |
| 7146 | 7146 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7147 | 7147 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7160,11 +7160,11 @@ discard block |
||
| 7160 | 7160 | * @return Array the airport list |
| 7161 | 7161 | * |
| 7162 | 7162 | */ |
| 7163 | - public function countAllArrivalAirportsByCountry($country,$filters = array()) |
|
| 7163 | + public function countAllArrivalAirportsByCountry($country, $filters = array()) |
|
| 7164 | 7164 | { |
| 7165 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7166 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7167 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7165 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7166 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7167 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7168 | 7168 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7169 | 7169 | GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7170 | 7170 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -7176,7 +7176,7 @@ discard block |
||
| 7176 | 7176 | $airport_array = array(); |
| 7177 | 7177 | $temp_array = array(); |
| 7178 | 7178 | |
| 7179 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7179 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7180 | 7180 | { |
| 7181 | 7181 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
| 7182 | 7182 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -7197,11 +7197,11 @@ discard block |
||
| 7197 | 7197 | * @return Array the airport list |
| 7198 | 7198 | * |
| 7199 | 7199 | */ |
| 7200 | - public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
|
| 7200 | + public function countAllArrivalAirportCountriesByCountry($country, $filters = array()) |
|
| 7201 | 7201 | { |
| 7202 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7203 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7204 | - $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7202 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7203 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7204 | + $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
|
| 7205 | 7205 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7206 | 7206 | GROUP BY spotter_output.arrival_airport_country |
| 7207 | 7207 | ORDER BY airport_arrival_country_count DESC"; |
@@ -7213,7 +7213,7 @@ discard block |
||
| 7213 | 7213 | $airport_array = array(); |
| 7214 | 7214 | $temp_array = array(); |
| 7215 | 7215 | |
| 7216 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7216 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7217 | 7217 | { |
| 7218 | 7218 | $temp_array['arrival_airport_country'] = $row['arrival_airport_country']; |
| 7219 | 7219 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
@@ -7234,7 +7234,7 @@ discard block |
||
| 7234 | 7234 | */ |
| 7235 | 7235 | public function countAllDepartureCountries($filters = array()) |
| 7236 | 7236 | { |
| 7237 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7237 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7238 | 7238 | $query = "SELECT DISTINCT spotter_output.departure_airport_country, COUNT(spotter_output.departure_airport_country) AS airport_departure_country_count |
| 7239 | 7239 | FROM spotter_output".$filter_query." spotter_output.departure_airport_country <> '' AND spotter_output.departure_airport_icao <> 'NA'"; |
| 7240 | 7240 | $query .= " GROUP BY spotter_output.departure_airport_country |
@@ -7248,7 +7248,7 @@ discard block |
||
| 7248 | 7248 | $airport_array = array(); |
| 7249 | 7249 | $temp_array = array(); |
| 7250 | 7250 | |
| 7251 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7251 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7252 | 7252 | { |
| 7253 | 7253 | $temp_array['airport_departure_country_count'] = $row['airport_departure_country_count']; |
| 7254 | 7254 | $temp_array['airport_departure_country'] = $row['departure_airport_country']; |
@@ -7266,9 +7266,9 @@ discard block |
||
| 7266 | 7266 | * @return Array the airport arrival list |
| 7267 | 7267 | * |
| 7268 | 7268 | */ |
| 7269 | - public function countAllArrivalCountries($limit = true,$filters = array()) |
|
| 7269 | + public function countAllArrivalCountries($limit = true, $filters = array()) |
|
| 7270 | 7270 | { |
| 7271 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7271 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7272 | 7272 | $query = "SELECT DISTINCT spotter_output.arrival_airport_country, COUNT(spotter_output.arrival_airport_country) AS airport_arrival_country_count |
| 7273 | 7273 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_country <> '' AND spotter_output.arrival_airport_icao <> 'NA'"; |
| 7274 | 7274 | $query .= " GROUP BY spotter_output.arrival_airport_country |
@@ -7282,7 +7282,7 @@ discard block |
||
| 7282 | 7282 | $airport_array = array(); |
| 7283 | 7283 | $temp_array = array(); |
| 7284 | 7284 | |
| 7285 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7285 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7286 | 7286 | { |
| 7287 | 7287 | $temp_array['airport_arrival_country_count'] = $row['airport_arrival_country_count']; |
| 7288 | 7288 | $temp_array['airport_arrival_country'] = $row['arrival_airport_country']; |
@@ -7305,8 +7305,8 @@ discard block |
||
| 7305 | 7305 | */ |
| 7306 | 7306 | public function countAllRoutes($filters = array()) |
| 7307 | 7307 | { |
| 7308 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7309 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7308 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7309 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7310 | 7310 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> 'NA' |
| 7311 | 7311 | GROUP BY route,spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 7312 | 7312 | ORDER BY route_count DESC |
@@ -7319,7 +7319,7 @@ discard block |
||
| 7319 | 7319 | $routes_array = array(); |
| 7320 | 7320 | $temp_array = array(); |
| 7321 | 7321 | |
| 7322 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7322 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7323 | 7323 | { |
| 7324 | 7324 | $temp_array['route_count'] = $row['route_count']; |
| 7325 | 7325 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7346,11 +7346,11 @@ discard block |
||
| 7346 | 7346 | * @return Array the route list |
| 7347 | 7347 | * |
| 7348 | 7348 | */ |
| 7349 | - public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
|
| 7349 | + public function countAllRoutesByAircraft($aircraft_icao, $filters = array()) |
|
| 7350 | 7350 | { |
| 7351 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7352 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 7353 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7351 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7352 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 7353 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7354 | 7354 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_icao = :aircraft_icao |
| 7355 | 7355 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7356 | 7356 | ORDER BY route_count DESC"; |
@@ -7361,7 +7361,7 @@ discard block |
||
| 7361 | 7361 | $routes_array = array(); |
| 7362 | 7362 | $temp_array = array(); |
| 7363 | 7363 | |
| 7364 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7364 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7365 | 7365 | { |
| 7366 | 7366 | $temp_array['route_count'] = $row['route_count']; |
| 7367 | 7367 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7388,9 +7388,9 @@ discard block |
||
| 7388 | 7388 | */ |
| 7389 | 7389 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 7390 | 7390 | { |
| 7391 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7391 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7392 | 7392 | $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
| 7393 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7393 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7394 | 7394 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.registration = :registration |
| 7395 | 7395 | GROUP BY route |
| 7396 | 7396 | ORDER BY route_count DESC"; |
@@ -7402,7 +7402,7 @@ discard block |
||
| 7402 | 7402 | $routes_array = array(); |
| 7403 | 7403 | $temp_array = array(); |
| 7404 | 7404 | |
| 7405 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7405 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7406 | 7406 | { |
| 7407 | 7407 | $temp_array['route_count'] = $row['route_count']; |
| 7408 | 7408 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7430,9 +7430,9 @@ discard block |
||
| 7430 | 7430 | */ |
| 7431 | 7431 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 7432 | 7432 | { |
| 7433 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7434 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 7435 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7433 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7434 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 7435 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7436 | 7436 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao = :airline_icao |
| 7437 | 7437 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7438 | 7438 | ORDER BY route_count DESC"; |
@@ -7444,7 +7444,7 @@ discard block |
||
| 7444 | 7444 | $routes_array = array(); |
| 7445 | 7445 | $temp_array = array(); |
| 7446 | 7446 | |
| 7447 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7447 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7448 | 7448 | { |
| 7449 | 7449 | $temp_array['route_count'] = $row['route_count']; |
| 7450 | 7450 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7472,9 +7472,9 @@ discard block |
||
| 7472 | 7472 | */ |
| 7473 | 7473 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 7474 | 7474 | { |
| 7475 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7476 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 7477 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7475 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7476 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 7477 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7478 | 7478 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 7479 | 7479 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7480 | 7480 | ORDER BY route_count DESC"; |
@@ -7485,7 +7485,7 @@ discard block |
||
| 7485 | 7485 | $routes_array = array(); |
| 7486 | 7486 | $temp_array = array(); |
| 7487 | 7487 | |
| 7488 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7488 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7489 | 7489 | { |
| 7490 | 7490 | $temp_array['route_count'] = $row['route_count']; |
| 7491 | 7491 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7513,9 +7513,9 @@ discard block |
||
| 7513 | 7513 | */ |
| 7514 | 7514 | public function countAllRoutesByCountry($country, $filters = array()) |
| 7515 | 7515 | { |
| 7516 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7517 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 7518 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7516 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7517 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 7518 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7519 | 7519 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 7520 | 7520 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7521 | 7521 | ORDER BY route_count DESC"; |
@@ -7526,7 +7526,7 @@ discard block |
||
| 7526 | 7526 | $routes_array = array(); |
| 7527 | 7527 | $temp_array = array(); |
| 7528 | 7528 | |
| 7529 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7529 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7530 | 7530 | { |
| 7531 | 7531 | $temp_array['route_count'] = $row['route_count']; |
| 7532 | 7532 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7554,8 +7554,8 @@ discard block |
||
| 7554 | 7554 | public function countAllRoutesByDate($date, $filters = array()) |
| 7555 | 7555 | { |
| 7556 | 7556 | global $globalTimezone, $globalDBdriver; |
| 7557 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7558 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 7557 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7558 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 7559 | 7559 | if ($globalTimezone != '') { |
| 7560 | 7560 | date_default_timezone_set($globalTimezone); |
| 7561 | 7561 | $datetime = new DateTime($date); |
@@ -7563,12 +7563,12 @@ discard block |
||
| 7563 | 7563 | } else $offset = '+00:00'; |
| 7564 | 7564 | |
| 7565 | 7565 | if ($globalDBdriver == 'mysql') { |
| 7566 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7566 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7567 | 7567 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 7568 | 7568 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7569 | 7569 | ORDER BY route_count DESC"; |
| 7570 | 7570 | } else { |
| 7571 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7571 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7572 | 7572 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = :date |
| 7573 | 7573 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7574 | 7574 | ORDER BY route_count DESC"; |
@@ -7580,7 +7580,7 @@ discard block |
||
| 7580 | 7580 | $routes_array = array(); |
| 7581 | 7581 | $temp_array = array(); |
| 7582 | 7582 | |
| 7583 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7583 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7584 | 7584 | { |
| 7585 | 7585 | $temp_array['route_count'] = $row['route_count']; |
| 7586 | 7586 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7607,9 +7607,9 @@ discard block |
||
| 7607 | 7607 | */ |
| 7608 | 7608 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 7609 | 7609 | { |
| 7610 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7611 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 7612 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7610 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7611 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 7612 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7613 | 7613 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.ident = :ident |
| 7614 | 7614 | GROUP BY route, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7615 | 7615 | ORDER BY route_count DESC"; |
@@ -7621,7 +7621,7 @@ discard block |
||
| 7621 | 7621 | $routes_array = array(); |
| 7622 | 7622 | $temp_array = array(); |
| 7623 | 7623 | |
| 7624 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7624 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7625 | 7625 | { |
| 7626 | 7626 | $temp_array['route_count'] = $row['route_count']; |
| 7627 | 7627 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7648,9 +7648,9 @@ discard block |
||
| 7648 | 7648 | */ |
| 7649 | 7649 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 7650 | 7650 | { |
| 7651 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7652 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 7653 | - $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7651 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7652 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 7653 | + $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, count(concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao)) AS route_count, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7654 | 7654 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 7655 | 7655 | GROUP BY route |
| 7656 | 7656 | ORDER BY route_count DESC"; |
@@ -7662,7 +7662,7 @@ discard block |
||
| 7662 | 7662 | $routes_array = array(); |
| 7663 | 7663 | $temp_array = array(); |
| 7664 | 7664 | |
| 7665 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7665 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7666 | 7666 | { |
| 7667 | 7667 | $temp_array['route_count'] = $row['route_count']; |
| 7668 | 7668 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -7690,8 +7690,8 @@ discard block |
||
| 7690 | 7690 | */ |
| 7691 | 7691 | public function countAllRoutesWithWaypoints($filters = array()) |
| 7692 | 7692 | { |
| 7693 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7694 | - $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7693 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7694 | + $query = "SELECT DISTINCT spotter_output.waypoints AS route, count(spotter_output.waypoints) AS route_count, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name AS airport_departure_name, spotter_output.departure_airport_city AS airport_departure_city, spotter_output.departure_airport_country AS airport_departure_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name AS airport_arrival_name, spotter_output.arrival_airport_city AS airport_arrival_city, spotter_output.arrival_airport_country AS airport_arrival_country |
|
| 7695 | 7695 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.waypoints <> '' |
| 7696 | 7696 | GROUP BY route, spotter_output.spotter_id, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country, spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7697 | 7697 | ORDER BY route_count DESC |
@@ -7704,7 +7704,7 @@ discard block |
||
| 7704 | 7704 | $routes_array = array(); |
| 7705 | 7705 | $temp_array = array(); |
| 7706 | 7706 | |
| 7707 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7707 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7708 | 7708 | { |
| 7709 | 7709 | $temp_array['spotter_id'] = $row['spotter_id']; |
| 7710 | 7710 | $temp_array['route_count'] = $row['route_count']; |
@@ -7729,11 +7729,11 @@ discard block |
||
| 7729 | 7729 | * @return Array the callsign list |
| 7730 | 7730 | * |
| 7731 | 7731 | */ |
| 7732 | - public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
|
| 7732 | + public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
|
| 7733 | 7733 | { |
| 7734 | 7734 | global $globalDBdriver; |
| 7735 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7736 | - $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7735 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7736 | + $query = "SELECT DISTINCT spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name, spotter_output.airline_icao |
|
| 7737 | 7737 | FROM spotter_output".$filter_query." spotter_output.ident <> '' "; |
| 7738 | 7738 | if ($olderthanmonths > 0) { |
| 7739 | 7739 | if ($globalDBdriver == 'mysql') $query .= ' AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH)'; |
@@ -7752,7 +7752,7 @@ discard block |
||
| 7752 | 7752 | $callsign_array = array(); |
| 7753 | 7753 | $temp_array = array(); |
| 7754 | 7754 | |
| 7755 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7755 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7756 | 7756 | { |
| 7757 | 7757 | $temp_array['callsign_icao'] = $row['ident']; |
| 7758 | 7758 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7774,8 +7774,8 @@ discard block |
||
| 7774 | 7774 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 7775 | 7775 | { |
| 7776 | 7776 | global $globalDBdriver; |
| 7777 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7778 | - $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7777 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7778 | + $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.ident, COUNT(spotter_output.ident) AS callsign_icao_count, spotter_output.airline_name |
|
| 7779 | 7779 | FROM spotter_output".$filter_query." spotter_output.ident <> '' AND spotter_output.airline_icao <> '' "; |
| 7780 | 7780 | if ($olderthanmonths > 0) { |
| 7781 | 7781 | if ($globalDBdriver == 'mysql') $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
@@ -7794,7 +7794,7 @@ discard block |
||
| 7794 | 7794 | $callsign_array = array(); |
| 7795 | 7795 | $temp_array = array(); |
| 7796 | 7796 | |
| 7797 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7797 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7798 | 7798 | { |
| 7799 | 7799 | $temp_array['callsign_icao'] = $row['ident']; |
| 7800 | 7800 | $temp_array['airline_name'] = $row['airline_name']; |
@@ -7848,7 +7848,7 @@ discard block |
||
| 7848 | 7848 | $date_array = array(); |
| 7849 | 7849 | $temp_array = array(); |
| 7850 | 7850 | |
| 7851 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7851 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7852 | 7852 | { |
| 7853 | 7853 | $temp_array['date_name'] = $row['date_name']; |
| 7854 | 7854 | $temp_array['date_count'] = $row['date_count']; |
@@ -7873,15 +7873,15 @@ discard block |
||
| 7873 | 7873 | $datetime = new DateTime(); |
| 7874 | 7874 | $offset = $datetime->format('P'); |
| 7875 | 7875 | } else $offset = '+00:00'; |
| 7876 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7876 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7877 | 7877 | if ($globalDBdriver == 'mysql') { |
| 7878 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7878 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 7879 | 7879 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 7880 | 7880 | GROUP BY spotter_output.airline_icao, date_name |
| 7881 | 7881 | ORDER BY date_count DESC |
| 7882 | 7882 | LIMIT 10 OFFSET 0"; |
| 7883 | 7883 | } else { |
| 7884 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7884 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 7885 | 7885 | FROM spotter_output |
| 7886 | 7886 | WHERE spotter_output.airline_icao <> '' |
| 7887 | 7887 | GROUP BY spotter_output.airline_icao, date_name |
@@ -7896,7 +7896,7 @@ discard block |
||
| 7896 | 7896 | $date_array = array(); |
| 7897 | 7897 | $temp_array = array(); |
| 7898 | 7898 | |
| 7899 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7899 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7900 | 7900 | { |
| 7901 | 7901 | $temp_array['date_name'] = $row['date_name']; |
| 7902 | 7902 | $temp_array['date_count'] = $row['date_count']; |
@@ -7922,7 +7922,7 @@ discard block |
||
| 7922 | 7922 | $datetime = new DateTime(); |
| 7923 | 7923 | $offset = $datetime->format('P'); |
| 7924 | 7924 | } else $offset = '+00:00'; |
| 7925 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7925 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7926 | 7926 | if ($globalDBdriver == 'mysql') { |
| 7927 | 7927 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7928 | 7928 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 7 DAY)"; |
@@ -7943,7 +7943,7 @@ discard block |
||
| 7943 | 7943 | $date_array = array(); |
| 7944 | 7944 | $temp_array = array(); |
| 7945 | 7945 | |
| 7946 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7946 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7947 | 7947 | { |
| 7948 | 7948 | $temp_array['date_name'] = $row['date_name']; |
| 7949 | 7949 | $temp_array['date_count'] = $row['date_count']; |
@@ -7968,7 +7968,7 @@ discard block |
||
| 7968 | 7968 | $datetime = new DateTime(); |
| 7969 | 7969 | $offset = $datetime->format('P'); |
| 7970 | 7970 | } else $offset = '+00:00'; |
| 7971 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 7971 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 7972 | 7972 | if ($globalDBdriver == 'mysql') { |
| 7973 | 7973 | $query = "SELECT DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
| 7974 | 7974 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH)"; |
@@ -7989,7 +7989,7 @@ discard block |
||
| 7989 | 7989 | $date_array = array(); |
| 7990 | 7990 | $temp_array = array(); |
| 7991 | 7991 | |
| 7992 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7992 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 7993 | 7993 | { |
| 7994 | 7994 | $temp_array['date_name'] = $row['date_name']; |
| 7995 | 7995 | $temp_array['date_count'] = $row['date_count']; |
@@ -8010,7 +8010,7 @@ discard block |
||
| 8010 | 8010 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 8011 | 8011 | { |
| 8012 | 8012 | global $globalTimezone, $globalDBdriver; |
| 8013 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8013 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8014 | 8014 | if ($globalTimezone != '') { |
| 8015 | 8015 | date_default_timezone_set($globalTimezone); |
| 8016 | 8016 | $datetime = new DateTime(); |
@@ -8018,13 +8018,13 @@ discard block |
||
| 8018 | 8018 | } else $offset = '+00:00'; |
| 8019 | 8019 | |
| 8020 | 8020 | if ($globalDBdriver == 'mysql') { |
| 8021 | - $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8021 | + $query = "SELECT spotter_output.airline_icao, DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS date_name, count(*) as date_count |
|
| 8022 | 8022 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MONTH) |
| 8023 | 8023 | GROUP BY spotter_output.airline_icao, date_name |
| 8024 | 8024 | ORDER BY spotter_output.date ASC"; |
| 8025 | 8025 | $query_data = array(':offset' => $offset); |
| 8026 | 8026 | } else { |
| 8027 | - $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8027 | + $query = "SELECT spotter_output.airline_icao, to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') AS date_name, count(*) as date_count |
|
| 8028 | 8028 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.date >= CURRENT_TIMESTAMP AT TIME ZONE INTERVAL :offset - INTERVAL '1 MONTHS' |
| 8029 | 8029 | GROUP BY spotter_output.airline_icao, date_name |
| 8030 | 8030 | ORDER BY date_name ASC"; |
@@ -8037,7 +8037,7 @@ discard block |
||
| 8037 | 8037 | $date_array = array(); |
| 8038 | 8038 | $temp_array = array(); |
| 8039 | 8039 | |
| 8040 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8040 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8041 | 8041 | { |
| 8042 | 8042 | $temp_array['date_name'] = $row['date_name']; |
| 8043 | 8043 | $temp_array['date_count'] = $row['date_count']; |
@@ -8084,7 +8084,7 @@ discard block |
||
| 8084 | 8084 | $date_array = array(); |
| 8085 | 8085 | $temp_array = array(); |
| 8086 | 8086 | |
| 8087 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8087 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8088 | 8088 | { |
| 8089 | 8089 | $temp_array['month_name'] = $row['month_name']; |
| 8090 | 8090 | $temp_array['year_name'] = $row['year_name']; |
@@ -8105,7 +8105,7 @@ discard block |
||
| 8105 | 8105 | public function countAllMonthsByAirlines($filters = array()) |
| 8106 | 8106 | { |
| 8107 | 8107 | global $globalTimezone, $globalDBdriver; |
| 8108 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8108 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8109 | 8109 | if ($globalTimezone != '') { |
| 8110 | 8110 | date_default_timezone_set($globalTimezone); |
| 8111 | 8111 | $datetime = new DateTime(); |
@@ -8113,12 +8113,12 @@ discard block |
||
| 8113 | 8113 | } else $offset = '+00:00'; |
| 8114 | 8114 | |
| 8115 | 8115 | if ($globalDBdriver == 'mysql') { |
| 8116 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8116 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8117 | 8117 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8118 | 8118 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8119 | 8119 | ORDER BY date_count DESC"; |
| 8120 | 8120 | } else { |
| 8121 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8121 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8122 | 8122 | FROM spotter_output |
| 8123 | 8123 | WHERE spotter_output.airline_icao <> '' |
| 8124 | 8124 | GROUP BY spotter_output.airline_icao, year_name, month_name |
@@ -8132,7 +8132,7 @@ discard block |
||
| 8132 | 8132 | $date_array = array(); |
| 8133 | 8133 | $temp_array = array(); |
| 8134 | 8134 | |
| 8135 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8135 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8136 | 8136 | { |
| 8137 | 8137 | $temp_array['month_name'] = $row['month_name']; |
| 8138 | 8138 | $temp_array['year_name'] = $row['year_name']; |
@@ -8159,14 +8159,14 @@ discard block |
||
| 8159 | 8159 | $datetime = new DateTime(); |
| 8160 | 8160 | $offset = $datetime->format('P'); |
| 8161 | 8161 | } else $offset = '+00:00'; |
| 8162 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8162 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8163 | 8163 | if ($globalDBdriver == 'mysql') { |
| 8164 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8164 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(*) as date_count |
|
| 8165 | 8165 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8166 | 8166 | GROUP BY year_name, month_name |
| 8167 | 8167 | ORDER BY date_count DESC"; |
| 8168 | 8168 | } else { |
| 8169 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8169 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(*) as date_count |
|
| 8170 | 8170 | FROM spotter_output".$filter_query." spotter_output.airline_type = 'military' |
| 8171 | 8171 | GROUP BY year_name, month_name |
| 8172 | 8172 | ORDER BY date_count DESC"; |
@@ -8178,7 +8178,7 @@ discard block |
||
| 8178 | 8178 | $date_array = array(); |
| 8179 | 8179 | $temp_array = array(); |
| 8180 | 8180 | |
| 8181 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8181 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8182 | 8182 | { |
| 8183 | 8183 | $temp_array['month_name'] = $row['month_name']; |
| 8184 | 8184 | $temp_array['year_name'] = $row['year_name']; |
@@ -8204,15 +8204,15 @@ discard block |
||
| 8204 | 8204 | $datetime = new DateTime(); |
| 8205 | 8205 | $offset = $datetime->format('P'); |
| 8206 | 8206 | } else $offset = '+00:00'; |
| 8207 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8207 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8208 | 8208 | |
| 8209 | 8209 | if ($globalDBdriver == 'mysql') { |
| 8210 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8210 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8211 | 8211 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8212 | 8212 | GROUP BY year_name, month_name |
| 8213 | 8213 | ORDER BY date_count DESC"; |
| 8214 | 8214 | } else { |
| 8215 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8215 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8216 | 8216 | FROM spotter_output".$filter_query." owner_name <> '' |
| 8217 | 8217 | GROUP BY year_name, month_name |
| 8218 | 8218 | ORDER BY date_count DESC"; |
@@ -8224,7 +8224,7 @@ discard block |
||
| 8224 | 8224 | $date_array = array(); |
| 8225 | 8225 | $temp_array = array(); |
| 8226 | 8226 | |
| 8227 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8227 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8228 | 8228 | { |
| 8229 | 8229 | $temp_array['month_name'] = $row['month_name']; |
| 8230 | 8230 | $temp_array['year_name'] = $row['year_name']; |
@@ -8245,7 +8245,7 @@ discard block |
||
| 8245 | 8245 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 8246 | 8246 | { |
| 8247 | 8247 | global $globalTimezone, $globalDBdriver; |
| 8248 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8248 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8249 | 8249 | if ($globalTimezone != '') { |
| 8250 | 8250 | date_default_timezone_set($globalTimezone); |
| 8251 | 8251 | $datetime = new DateTime(); |
@@ -8253,12 +8253,12 @@ discard block |
||
| 8253 | 8253 | } else $offset = '+00:00'; |
| 8254 | 8254 | |
| 8255 | 8255 | if ($globalDBdriver == 'mysql') { |
| 8256 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8256 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct owner_name) as date_count |
|
| 8257 | 8257 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8258 | 8258 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8259 | 8259 | ORDER BY date_count DESC"; |
| 8260 | 8260 | } else { |
| 8261 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8261 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct owner_name) as date_count |
|
| 8262 | 8262 | FROM spotter_output".$filter_query." owner_name <> '' AND spotter_output.airline_icao <> '' |
| 8263 | 8263 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8264 | 8264 | ORDER BY date_count DESC"; |
@@ -8270,7 +8270,7 @@ discard block |
||
| 8270 | 8270 | $date_array = array(); |
| 8271 | 8271 | $temp_array = array(); |
| 8272 | 8272 | |
| 8273 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8273 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8274 | 8274 | { |
| 8275 | 8275 | $temp_array['month_name'] = $row['month_name']; |
| 8276 | 8276 | $temp_array['year_name'] = $row['year_name']; |
@@ -8297,15 +8297,15 @@ discard block |
||
| 8297 | 8297 | $datetime = new DateTime(); |
| 8298 | 8298 | $offset = $datetime->format('P'); |
| 8299 | 8299 | } else $offset = '+00:00'; |
| 8300 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8300 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8301 | 8301 | |
| 8302 | 8302 | if ($globalDBdriver == 'mysql') { |
| 8303 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8303 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8304 | 8304 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8305 | 8305 | GROUP BY year_name, month_name |
| 8306 | 8306 | ORDER BY date_count DESC"; |
| 8307 | 8307 | } else { |
| 8308 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8308 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8309 | 8309 | FROM spotter_output".$filter_query." pilot_id <> '' AND pilot_id IS NOT NULL |
| 8310 | 8310 | GROUP BY year_name, month_name |
| 8311 | 8311 | ORDER BY date_count DESC"; |
@@ -8317,7 +8317,7 @@ discard block |
||
| 8317 | 8317 | $date_array = array(); |
| 8318 | 8318 | $temp_array = array(); |
| 8319 | 8319 | |
| 8320 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8320 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8321 | 8321 | { |
| 8322 | 8322 | $temp_array['month_name'] = $row['month_name']; |
| 8323 | 8323 | $temp_array['year_name'] = $row['year_name']; |
@@ -8338,7 +8338,7 @@ discard block |
||
| 8338 | 8338 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 8339 | 8339 | { |
| 8340 | 8340 | global $globalTimezone, $globalDBdriver; |
| 8341 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8341 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8342 | 8342 | if ($globalTimezone != '') { |
| 8343 | 8343 | date_default_timezone_set($globalTimezone); |
| 8344 | 8344 | $datetime = new DateTime(); |
@@ -8346,12 +8346,12 @@ discard block |
||
| 8346 | 8346 | } else $offset = '+00:00'; |
| 8347 | 8347 | |
| 8348 | 8348 | if ($globalDBdriver == 'mysql') { |
| 8349 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8349 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct pilot_id) as date_count |
|
| 8350 | 8350 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8351 | 8351 | GROUP BY spotter_output.airline_icao,year_name, month_name |
| 8352 | 8352 | ORDER BY date_count DESC"; |
| 8353 | 8353 | } else { |
| 8354 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8354 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct pilot_id) as date_count |
|
| 8355 | 8355 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND pilot_id <> '' AND pilot_id IS NOT NULL |
| 8356 | 8356 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8357 | 8357 | ORDER BY date_count DESC"; |
@@ -8363,7 +8363,7 @@ discard block |
||
| 8363 | 8363 | $date_array = array(); |
| 8364 | 8364 | $temp_array = array(); |
| 8365 | 8365 | |
| 8366 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8366 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8367 | 8367 | { |
| 8368 | 8368 | $temp_array['month_name'] = $row['month_name']; |
| 8369 | 8369 | $temp_array['year_name'] = $row['year_name']; |
@@ -8385,7 +8385,7 @@ discard block |
||
| 8385 | 8385 | public function countAllMonthsAirlines($filters = array()) |
| 8386 | 8386 | { |
| 8387 | 8387 | global $globalTimezone, $globalDBdriver; |
| 8388 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8388 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8389 | 8389 | if ($globalTimezone != '') { |
| 8390 | 8390 | date_default_timezone_set($globalTimezone); |
| 8391 | 8391 | $datetime = new DateTime(); |
@@ -8393,12 +8393,12 @@ discard block |
||
| 8393 | 8393 | } else $offset = '+00:00'; |
| 8394 | 8394 | |
| 8395 | 8395 | if ($globalDBdriver == 'mysql') { |
| 8396 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8396 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct airline_icao) as date_count |
|
| 8397 | 8397 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8398 | 8398 | GROUP BY year_name, month_name |
| 8399 | 8399 | ORDER BY date_count DESC"; |
| 8400 | 8400 | } else { |
| 8401 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8401 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct airline_icao) as date_count |
|
| 8402 | 8402 | FROM spotter_output".$filter_query." airline_icao <> '' |
| 8403 | 8403 | GROUP BY year_name, month_name |
| 8404 | 8404 | ORDER BY date_count DESC"; |
@@ -8410,7 +8410,7 @@ discard block |
||
| 8410 | 8410 | $date_array = array(); |
| 8411 | 8411 | $temp_array = array(); |
| 8412 | 8412 | |
| 8413 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8413 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8414 | 8414 | { |
| 8415 | 8415 | $temp_array['month_name'] = $row['month_name']; |
| 8416 | 8416 | $temp_array['year_name'] = $row['year_name']; |
@@ -8436,15 +8436,15 @@ discard block |
||
| 8436 | 8436 | $datetime = new DateTime(); |
| 8437 | 8437 | $offset = $datetime->format('P'); |
| 8438 | 8438 | } else $offset = '+00:00'; |
| 8439 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8439 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8440 | 8440 | |
| 8441 | 8441 | if ($globalDBdriver == 'mysql') { |
| 8442 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8442 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8443 | 8443 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8444 | 8444 | GROUP BY year_name, month_name |
| 8445 | 8445 | ORDER BY date_count DESC"; |
| 8446 | 8446 | } else { |
| 8447 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8447 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8448 | 8448 | FROM spotter_output".$filter_query." aircraft_icao <> '' |
| 8449 | 8449 | GROUP BY year_name, month_name |
| 8450 | 8450 | ORDER BY date_count DESC"; |
@@ -8456,7 +8456,7 @@ discard block |
||
| 8456 | 8456 | $date_array = array(); |
| 8457 | 8457 | $temp_array = array(); |
| 8458 | 8458 | |
| 8459 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8459 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8460 | 8460 | { |
| 8461 | 8461 | $temp_array['month_name'] = $row['month_name']; |
| 8462 | 8462 | $temp_array['year_name'] = $row['year_name']; |
@@ -8478,7 +8478,7 @@ discard block |
||
| 8478 | 8478 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 8479 | 8479 | { |
| 8480 | 8480 | global $globalTimezone, $globalDBdriver; |
| 8481 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8481 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8482 | 8482 | if ($globalTimezone != '') { |
| 8483 | 8483 | date_default_timezone_set($globalTimezone); |
| 8484 | 8484 | $datetime = new DateTime(); |
@@ -8486,12 +8486,12 @@ discard block |
||
| 8486 | 8486 | } else $offset = '+00:00'; |
| 8487 | 8487 | |
| 8488 | 8488 | if ($globalDBdriver == 'mysql') { |
| 8489 | - $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8489 | + $query = "SELECT spotter_output.airline_icao,YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8490 | 8490 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8491 | 8491 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8492 | 8492 | ORDER BY date_count DESC"; |
| 8493 | 8493 | } else { |
| 8494 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8494 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(distinct aircraft_icao) as date_count |
|
| 8495 | 8495 | FROM spotter_output".$filter_query." aircraft_icao <> '' AND spotter_output.airline_icao <> '' |
| 8496 | 8496 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8497 | 8497 | ORDER BY date_count DESC"; |
@@ -8503,7 +8503,7 @@ discard block |
||
| 8503 | 8503 | $date_array = array(); |
| 8504 | 8504 | $temp_array = array(); |
| 8505 | 8505 | |
| 8506 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8506 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8507 | 8507 | { |
| 8508 | 8508 | $temp_array['month_name'] = $row['month_name']; |
| 8509 | 8509 | $temp_array['year_name'] = $row['year_name']; |
@@ -8530,15 +8530,15 @@ discard block |
||
| 8530 | 8530 | $datetime = new DateTime(); |
| 8531 | 8531 | $offset = $datetime->format('P'); |
| 8532 | 8532 | } else $offset = '+00:00'; |
| 8533 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8533 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8534 | 8534 | |
| 8535 | 8535 | if ($globalDBdriver == 'mysql') { |
| 8536 | - $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8536 | + $query = "SELECT YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8537 | 8537 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8538 | 8538 | GROUP BY year_name, month_name |
| 8539 | 8539 | ORDER BY date_count DESC"; |
| 8540 | 8540 | } else { |
| 8541 | - $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8541 | + $query = "SELECT EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8542 | 8542 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' |
| 8543 | 8543 | GROUP BY year_name, month_name |
| 8544 | 8544 | ORDER BY date_count DESC"; |
@@ -8550,7 +8550,7 @@ discard block |
||
| 8550 | 8550 | $date_array = array(); |
| 8551 | 8551 | $temp_array = array(); |
| 8552 | 8552 | |
| 8553 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8553 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8554 | 8554 | { |
| 8555 | 8555 | $temp_array['month_name'] = $row['month_name']; |
| 8556 | 8556 | $temp_array['year_name'] = $row['year_name']; |
@@ -8572,7 +8572,7 @@ discard block |
||
| 8572 | 8572 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 8573 | 8573 | { |
| 8574 | 8574 | global $globalTimezone, $globalDBdriver; |
| 8575 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8575 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8576 | 8576 | if ($globalTimezone != '') { |
| 8577 | 8577 | date_default_timezone_set($globalTimezone); |
| 8578 | 8578 | $datetime = new DateTime(); |
@@ -8580,12 +8580,12 @@ discard block |
||
| 8580 | 8580 | } else $offset = '+00:00'; |
| 8581 | 8581 | |
| 8582 | 8582 | if ($globalDBdriver == 'mysql') { |
| 8583 | - $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8583 | + $query = "SELECT spotter_output.airline_icao, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name,MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8584 | 8584 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8585 | 8585 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8586 | 8586 | ORDER BY date_count DESC"; |
| 8587 | 8587 | } else { |
| 8588 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8588 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(YEAR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS year_name,EXTRACT(MONTH FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS month_name, count(real_arrival_airport_icao) as date_count |
|
| 8589 | 8589 | FROM spotter_output".$filter_query." real_arrival_airport_icao <> '' AND spotter_output.airline_icao <> '' |
| 8590 | 8590 | GROUP BY spotter_output.airline_icao, year_name, month_name |
| 8591 | 8591 | ORDER BY date_count DESC"; |
@@ -8597,7 +8597,7 @@ discard block |
||
| 8597 | 8597 | $date_array = array(); |
| 8598 | 8598 | $temp_array = array(); |
| 8599 | 8599 | |
| 8600 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8600 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8601 | 8601 | { |
| 8602 | 8602 | $temp_array['month_name'] = $row['month_name']; |
| 8603 | 8603 | $temp_array['year_name'] = $row['year_name']; |
@@ -8625,7 +8625,7 @@ discard block |
||
| 8625 | 8625 | $datetime = new DateTime(); |
| 8626 | 8626 | $offset = $datetime->format('P'); |
| 8627 | 8627 | } else $offset = '+00:00'; |
| 8628 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8628 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8629 | 8629 | if ($globalDBdriver == 'mysql') { |
| 8630 | 8630 | $query = "SELECT MONTH(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS month_name, YEAR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS year_name, count(*) as date_count |
| 8631 | 8631 | FROM spotter_output".$filter_query." spotter_output.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 YEAR)"; |
@@ -8646,7 +8646,7 @@ discard block |
||
| 8646 | 8646 | $date_array = array(); |
| 8647 | 8647 | $temp_array = array(); |
| 8648 | 8648 | |
| 8649 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8649 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8650 | 8650 | { |
| 8651 | 8651 | $temp_array['year_name'] = $row['year_name']; |
| 8652 | 8652 | $temp_array['month_name'] = $row['month_name']; |
@@ -8666,7 +8666,7 @@ discard block |
||
| 8666 | 8666 | * @return Array the hour list |
| 8667 | 8667 | * |
| 8668 | 8668 | */ |
| 8669 | - public function countAllHours($orderby,$filters = array()) |
|
| 8669 | + public function countAllHours($orderby, $filters = array()) |
|
| 8670 | 8670 | { |
| 8671 | 8671 | global $globalTimezone, $globalDBdriver; |
| 8672 | 8672 | if ($globalTimezone != '') { |
@@ -8714,7 +8714,7 @@ discard block |
||
| 8714 | 8714 | $hour_array = array(); |
| 8715 | 8715 | $temp_array = array(); |
| 8716 | 8716 | |
| 8717 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8717 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8718 | 8718 | { |
| 8719 | 8719 | $temp_array['hour_name'] = $row['hour_name']; |
| 8720 | 8720 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8734,7 +8734,7 @@ discard block |
||
| 8734 | 8734 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 8735 | 8735 | { |
| 8736 | 8736 | global $globalTimezone, $globalDBdriver; |
| 8737 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8737 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8738 | 8738 | if ($globalTimezone != '') { |
| 8739 | 8739 | date_default_timezone_set($globalTimezone); |
| 8740 | 8740 | $datetime = new DateTime(); |
@@ -8752,7 +8752,7 @@ discard block |
||
| 8752 | 8752 | } |
| 8753 | 8753 | |
| 8754 | 8754 | if ($globalDBdriver == 'mysql') { |
| 8755 | - $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8755 | + $query = "SELECT spotter_output.airline_icao, HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8756 | 8756 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8757 | 8757 | GROUP BY spotter_output.airline_icao, hour_name |
| 8758 | 8758 | ".$orderby_sql; |
@@ -8765,7 +8765,7 @@ discard block |
||
| 8765 | 8765 | */ |
| 8766 | 8766 | $query_data = array(':offset' => $offset); |
| 8767 | 8767 | } else { |
| 8768 | - $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8768 | + $query = "SELECT spotter_output.airline_icao, EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8769 | 8769 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' |
| 8770 | 8770 | GROUP BY spotter_output.airline_icao, hour_name |
| 8771 | 8771 | ".$orderby_sql; |
@@ -8778,7 +8778,7 @@ discard block |
||
| 8778 | 8778 | $hour_array = array(); |
| 8779 | 8779 | $temp_array = array(); |
| 8780 | 8780 | |
| 8781 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8781 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8782 | 8782 | { |
| 8783 | 8783 | $temp_array['hour_name'] = $row['hour_name']; |
| 8784 | 8784 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8801,34 +8801,34 @@ discard block |
||
| 8801 | 8801 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 8802 | 8802 | { |
| 8803 | 8803 | global $globalTimezone, $globalDBdriver; |
| 8804 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8804 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8805 | 8805 | if ($globalTimezone != '') { |
| 8806 | 8806 | date_default_timezone_set($globalTimezone); |
| 8807 | 8807 | $datetime = new DateTime(); |
| 8808 | 8808 | $offset = $datetime->format('P'); |
| 8809 | 8809 | } else $offset = '+00:00'; |
| 8810 | 8810 | |
| 8811 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
| 8811 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
| 8812 | 8812 | |
| 8813 | 8813 | if ($globalDBdriver == 'mysql') { |
| 8814 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8814 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8815 | 8815 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8816 | 8816 | GROUP BY hour_name |
| 8817 | 8817 | ORDER BY hour_name ASC"; |
| 8818 | 8818 | } else { |
| 8819 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8819 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8820 | 8820 | FROM spotter_output".$filter_query." spotter_output.airline_icao = :airline_icao |
| 8821 | 8821 | GROUP BY hour_name |
| 8822 | 8822 | ORDER BY hour_name ASC"; |
| 8823 | 8823 | } |
| 8824 | 8824 | |
| 8825 | 8825 | $sth = $this->db->prepare($query); |
| 8826 | - $sth->execute(array(':airline_icao' => $airline_icao,':offset' => $offset)); |
|
| 8826 | + $sth->execute(array(':airline_icao' => $airline_icao, ':offset' => $offset)); |
|
| 8827 | 8827 | |
| 8828 | 8828 | $hour_array = array(); |
| 8829 | 8829 | $temp_array = array(); |
| 8830 | 8830 | |
| 8831 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8831 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8832 | 8832 | { |
| 8833 | 8833 | $temp_array['hour_name'] = $row['hour_name']; |
| 8834 | 8834 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8851,8 +8851,8 @@ discard block |
||
| 8851 | 8851 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 8852 | 8852 | { |
| 8853 | 8853 | global $globalTimezone, $globalDBdriver; |
| 8854 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8855 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
| 8854 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8855 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
| 8856 | 8856 | if ($globalTimezone != '') { |
| 8857 | 8857 | date_default_timezone_set($globalTimezone); |
| 8858 | 8858 | $datetime = new DateTime(); |
@@ -8860,24 +8860,24 @@ discard block |
||
| 8860 | 8860 | } else $offset = '+00:00'; |
| 8861 | 8861 | |
| 8862 | 8862 | if ($globalDBdriver == 'mysql') { |
| 8863 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8863 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8864 | 8864 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8865 | 8865 | GROUP BY hour_name |
| 8866 | 8866 | ORDER BY hour_name ASC"; |
| 8867 | 8867 | } else { |
| 8868 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8868 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8869 | 8869 | FROM spotter_output".$filter_query." spotter_output.aircraft_icao = :aircraft_icao |
| 8870 | 8870 | GROUP BY hour_name |
| 8871 | 8871 | ORDER BY hour_name ASC"; |
| 8872 | 8872 | } |
| 8873 | 8873 | |
| 8874 | 8874 | $sth = $this->db->prepare($query); |
| 8875 | - $sth->execute(array(':aircraft_icao' => $aircraft_icao,':offset' => $offset)); |
|
| 8875 | + $sth->execute(array(':aircraft_icao' => $aircraft_icao, ':offset' => $offset)); |
|
| 8876 | 8876 | |
| 8877 | 8877 | $hour_array = array(); |
| 8878 | 8878 | $temp_array = array(); |
| 8879 | 8879 | |
| 8880 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8880 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8881 | 8881 | { |
| 8882 | 8882 | $temp_array['hour_name'] = $row['hour_name']; |
| 8883 | 8883 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8898,8 +8898,8 @@ discard block |
||
| 8898 | 8898 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 8899 | 8899 | { |
| 8900 | 8900 | global $globalTimezone, $globalDBdriver; |
| 8901 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8902 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 8901 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8902 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 8903 | 8903 | if ($globalTimezone != '') { |
| 8904 | 8904 | date_default_timezone_set($globalTimezone); |
| 8905 | 8905 | $datetime = new DateTime(); |
@@ -8907,24 +8907,24 @@ discard block |
||
| 8907 | 8907 | } else $offset = '+00:00'; |
| 8908 | 8908 | |
| 8909 | 8909 | if ($globalDBdriver == 'mysql') { |
| 8910 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8910 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8911 | 8911 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8912 | 8912 | GROUP BY hour_name |
| 8913 | 8913 | ORDER BY hour_name ASC"; |
| 8914 | 8914 | } else { |
| 8915 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8915 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8916 | 8916 | FROM spotter_output".$filter_query." spotter_output.registration = :registration |
| 8917 | 8917 | GROUP BY hour_name |
| 8918 | 8918 | ORDER BY hour_name ASC"; |
| 8919 | 8919 | } |
| 8920 | 8920 | |
| 8921 | 8921 | $sth = $this->db->prepare($query); |
| 8922 | - $sth->execute(array(':registration' => $registration,':offset' => $offset)); |
|
| 8922 | + $sth->execute(array(':registration' => $registration, ':offset' => $offset)); |
|
| 8923 | 8923 | |
| 8924 | 8924 | $hour_array = array(); |
| 8925 | 8925 | $temp_array = array(); |
| 8926 | 8926 | |
| 8927 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8927 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8928 | 8928 | { |
| 8929 | 8929 | $temp_array['hour_name'] = $row['hour_name']; |
| 8930 | 8930 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8945,8 +8945,8 @@ discard block |
||
| 8945 | 8945 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 8946 | 8946 | { |
| 8947 | 8947 | global $globalTimezone, $globalDBdriver; |
| 8948 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8949 | - $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
|
| 8948 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8949 | + $airport_icao = filter_var($airport_icao, FILTER_SANITIZE_STRING); |
|
| 8950 | 8950 | if ($globalTimezone != '') { |
| 8951 | 8951 | date_default_timezone_set($globalTimezone); |
| 8952 | 8952 | $datetime = new DateTime(); |
@@ -8954,24 +8954,24 @@ discard block |
||
| 8954 | 8954 | } else $offset = '+00:00'; |
| 8955 | 8955 | |
| 8956 | 8956 | if ($globalDBdriver == 'mysql') { |
| 8957 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8957 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 8958 | 8958 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8959 | 8959 | GROUP BY hour_name |
| 8960 | 8960 | ORDER BY hour_name ASC"; |
| 8961 | 8961 | } else { |
| 8962 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8962 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 8963 | 8963 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :airport_icao OR spotter_output.arrival_airport_icao = :airport_icao) |
| 8964 | 8964 | GROUP BY hour_name |
| 8965 | 8965 | ORDER BY hour_name ASC"; |
| 8966 | 8966 | } |
| 8967 | 8967 | |
| 8968 | 8968 | $sth = $this->db->prepare($query); |
| 8969 | - $sth->execute(array(':airport_icao' => $airport_icao,':offset' => $offset)); |
|
| 8969 | + $sth->execute(array(':airport_icao' => $airport_icao, ':offset' => $offset)); |
|
| 8970 | 8970 | |
| 8971 | 8971 | $hour_array = array(); |
| 8972 | 8972 | $temp_array = array(); |
| 8973 | 8973 | |
| 8974 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8974 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 8975 | 8975 | { |
| 8976 | 8976 | $temp_array['hour_name'] = $row['hour_name']; |
| 8977 | 8977 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -8990,11 +8990,11 @@ discard block |
||
| 8990 | 8990 | * @return Array the hour list |
| 8991 | 8991 | * |
| 8992 | 8992 | */ |
| 8993 | - public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
|
| 8993 | + public function countAllHoursByManufacturer($aircraft_manufacturer, $filters = array()) |
|
| 8994 | 8994 | { |
| 8995 | 8995 | global $globalTimezone, $globalDBdriver; |
| 8996 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 8997 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
| 8996 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 8997 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
| 8998 | 8998 | if ($globalTimezone != '') { |
| 8999 | 8999 | date_default_timezone_set($globalTimezone); |
| 9000 | 9000 | $datetime = new DateTime(); |
@@ -9002,24 +9002,24 @@ discard block |
||
| 9002 | 9002 | } else $offset = '+00:00'; |
| 9003 | 9003 | |
| 9004 | 9004 | if ($globalDBdriver == 'mysql') { |
| 9005 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9005 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9006 | 9006 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9007 | 9007 | GROUP BY hour_name |
| 9008 | 9008 | ORDER BY hour_name ASC"; |
| 9009 | 9009 | } else { |
| 9010 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9010 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9011 | 9011 | FROM spotter_output".$filter_query." spotter_output.aircraft_manufacturer = :aircraft_manufacturer |
| 9012 | 9012 | GROUP BY hour_name |
| 9013 | 9013 | ORDER BY hour_name ASC"; |
| 9014 | 9014 | } |
| 9015 | 9015 | |
| 9016 | 9016 | $sth = $this->db->prepare($query); |
| 9017 | - $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer,':offset' => $offset)); |
|
| 9017 | + $sth->execute(array(':aircraft_manufacturer' => $aircraft_manufacturer, ':offset' => $offset)); |
|
| 9018 | 9018 | |
| 9019 | 9019 | $hour_array = array(); |
| 9020 | 9020 | $temp_array = array(); |
| 9021 | 9021 | |
| 9022 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9022 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9023 | 9023 | { |
| 9024 | 9024 | $temp_array['hour_name'] = $row['hour_name']; |
| 9025 | 9025 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9041,8 +9041,8 @@ discard block |
||
| 9041 | 9041 | public function countAllHoursByDate($date, $filters = array()) |
| 9042 | 9042 | { |
| 9043 | 9043 | global $globalTimezone, $globalDBdriver; |
| 9044 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9045 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
| 9044 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9045 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
| 9046 | 9046 | if ($globalTimezone != '') { |
| 9047 | 9047 | date_default_timezone_set($globalTimezone); |
| 9048 | 9048 | $datetime = new DateTime($date); |
@@ -9050,12 +9050,12 @@ discard block |
||
| 9050 | 9050 | } else $offset = '+00:00'; |
| 9051 | 9051 | |
| 9052 | 9052 | if ($globalDBdriver == 'mysql') { |
| 9053 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9053 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9054 | 9054 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = :date |
| 9055 | 9055 | GROUP BY hour_name |
| 9056 | 9056 | ORDER BY hour_name ASC"; |
| 9057 | 9057 | } else { |
| 9058 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9058 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9059 | 9059 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset, 'YYYY-mm-dd') = :date |
| 9060 | 9060 | GROUP BY hour_name |
| 9061 | 9061 | ORDER BY hour_name ASC"; |
@@ -9067,7 +9067,7 @@ discard block |
||
| 9067 | 9067 | $hour_array = array(); |
| 9068 | 9068 | $temp_array = array(); |
| 9069 | 9069 | |
| 9070 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9070 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9071 | 9071 | { |
| 9072 | 9072 | $temp_array['hour_name'] = $row['hour_name']; |
| 9073 | 9073 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9089,8 +9089,8 @@ discard block |
||
| 9089 | 9089 | public function countAllHoursByIdent($ident, $filters = array()) |
| 9090 | 9090 | { |
| 9091 | 9091 | global $globalTimezone, $globalDBdriver; |
| 9092 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9093 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 9092 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9093 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 9094 | 9094 | if ($globalTimezone != '') { |
| 9095 | 9095 | date_default_timezone_set($globalTimezone); |
| 9096 | 9096 | $datetime = new DateTime(); |
@@ -9098,12 +9098,12 @@ discard block |
||
| 9098 | 9098 | } else $offset = '+00:00'; |
| 9099 | 9099 | |
| 9100 | 9100 | if ($globalDBdriver == 'mysql') { |
| 9101 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9101 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9102 | 9102 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9103 | 9103 | GROUP BY hour_name |
| 9104 | 9104 | ORDER BY hour_name ASC"; |
| 9105 | 9105 | } else { |
| 9106 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9106 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9107 | 9107 | FROM spotter_output".$filter_query." spotter_output.ident = :ident |
| 9108 | 9108 | GROUP BY hour_name |
| 9109 | 9109 | ORDER BY hour_name ASC"; |
@@ -9111,12 +9111,12 @@ discard block |
||
| 9111 | 9111 | |
| 9112 | 9112 | |
| 9113 | 9113 | $sth = $this->db->prepare($query); |
| 9114 | - $sth->execute(array(':ident' => $ident,':offset' => $offset)); |
|
| 9114 | + $sth->execute(array(':ident' => $ident, ':offset' => $offset)); |
|
| 9115 | 9115 | |
| 9116 | 9116 | $hour_array = array(); |
| 9117 | 9117 | $temp_array = array(); |
| 9118 | 9118 | |
| 9119 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9119 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9120 | 9120 | { |
| 9121 | 9121 | $temp_array['hour_name'] = $row['hour_name']; |
| 9122 | 9122 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9135,12 +9135,12 @@ discard block |
||
| 9135 | 9135 | * @return Array the hour list |
| 9136 | 9136 | * |
| 9137 | 9137 | */ |
| 9138 | - public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
|
| 9138 | + public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters = array()) |
|
| 9139 | 9139 | { |
| 9140 | 9140 | global $globalTimezone, $globalDBdriver; |
| 9141 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9142 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9143 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
| 9141 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9142 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9143 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
| 9144 | 9144 | if ($globalTimezone != '') { |
| 9145 | 9145 | date_default_timezone_set($globalTimezone); |
| 9146 | 9146 | $datetime = new DateTime(); |
@@ -9148,24 +9148,24 @@ discard block |
||
| 9148 | 9148 | } else $offset = '+00:00'; |
| 9149 | 9149 | |
| 9150 | 9150 | if ($globalDBdriver == 'mysql') { |
| 9151 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9151 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9152 | 9152 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9153 | 9153 | GROUP BY hour_name |
| 9154 | 9154 | ORDER BY hour_name ASC"; |
| 9155 | 9155 | } else { |
| 9156 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9156 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9157 | 9157 | FROM spotter_output".$filter_query." (spotter_output.departure_airport_icao = :departure_airport_icao) AND (spotter_output.arrival_airport_icao = :arrival_airport_icao) |
| 9158 | 9158 | GROUP BY hour_name |
| 9159 | 9159 | ORDER BY hour_name ASC"; |
| 9160 | 9160 | } |
| 9161 | 9161 | |
| 9162 | 9162 | $sth = $this->db->prepare($query); |
| 9163 | - $sth->execute(array(':departure_airport_icao' => $departure_airport_icao,':arrival_airport_icao' => $arrival_airport_icao,':offset' => $offset)); |
|
| 9163 | + $sth->execute(array(':departure_airport_icao' => $departure_airport_icao, ':arrival_airport_icao' => $arrival_airport_icao, ':offset' => $offset)); |
|
| 9164 | 9164 | |
| 9165 | 9165 | $hour_array = array(); |
| 9166 | 9166 | $temp_array = array(); |
| 9167 | 9167 | |
| 9168 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9168 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9169 | 9169 | { |
| 9170 | 9170 | $temp_array['hour_name'] = $row['hour_name']; |
| 9171 | 9171 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9186,8 +9186,8 @@ discard block |
||
| 9186 | 9186 | public function countAllHoursByCountry($country, $filters = array()) |
| 9187 | 9187 | { |
| 9188 | 9188 | global $globalTimezone, $globalDBdriver; |
| 9189 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9190 | - $country = filter_var($country,FILTER_SANITIZE_STRING); |
|
| 9189 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9190 | + $country = filter_var($country, FILTER_SANITIZE_STRING); |
|
| 9191 | 9191 | if ($globalTimezone != '') { |
| 9192 | 9192 | date_default_timezone_set($globalTimezone); |
| 9193 | 9193 | $datetime = new DateTime(); |
@@ -9195,24 +9195,24 @@ discard block |
||
| 9195 | 9195 | } else $offset = '+00:00'; |
| 9196 | 9196 | |
| 9197 | 9197 | if ($globalDBdriver == 'mysql') { |
| 9198 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9198 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9199 | 9199 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9200 | 9200 | GROUP BY hour_name |
| 9201 | 9201 | ORDER BY hour_name ASC"; |
| 9202 | 9202 | } else { |
| 9203 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9203 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9204 | 9204 | FROM spotter_output".$filter_query." ((spotter_output.departure_airport_country = :country) OR (spotter_output.arrival_airport_country = :country)) OR spotter_output.airline_country = :country |
| 9205 | 9205 | GROUP BY hour_name |
| 9206 | 9206 | ORDER BY hour_name ASC"; |
| 9207 | 9207 | } |
| 9208 | 9208 | |
| 9209 | 9209 | $sth = $this->db->prepare($query); |
| 9210 | - $sth->execute(array(':country' => $country,':offset' => $offset)); |
|
| 9210 | + $sth->execute(array(':country' => $country, ':offset' => $offset)); |
|
| 9211 | 9211 | |
| 9212 | 9212 | $hour_array = array(); |
| 9213 | 9213 | $temp_array = array(); |
| 9214 | 9214 | |
| 9215 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9215 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9216 | 9216 | { |
| 9217 | 9217 | $temp_array['hour_name'] = $row['hour_name']; |
| 9218 | 9218 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9234,8 +9234,8 @@ discard block |
||
| 9234 | 9234 | */ |
| 9235 | 9235 | public function countOverallAircrafts($filters = array()) |
| 9236 | 9236 | { |
| 9237 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9238 | - $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9237 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9238 | + $query = "SELECT COUNT(DISTINCT spotter_output.aircraft_icao) AS aircraft_count |
|
| 9239 | 9239 | FROM spotter_output".$filter_query." spotter_output.ident <> ''"; |
| 9240 | 9240 | $sth = $this->db->prepare($query); |
| 9241 | 9241 | $sth->execute(); |
@@ -9250,8 +9250,8 @@ discard block |
||
| 9250 | 9250 | */ |
| 9251 | 9251 | public function countOverallArrival($filters = array()) |
| 9252 | 9252 | { |
| 9253 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9254 | - $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9253 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9254 | + $query = "SELECT COUNT(spotter_output.real_arrival_airport_icao) AS arrival_count |
|
| 9255 | 9255 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_icao <> ''"; |
| 9256 | 9256 | |
| 9257 | 9257 | $sth = $this->db->prepare($query); |
@@ -9267,8 +9267,8 @@ discard block |
||
| 9267 | 9267 | */ |
| 9268 | 9268 | public function countOverallPilots($filters = array()) |
| 9269 | 9269 | { |
| 9270 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9271 | - $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9270 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9271 | + $query = "SELECT COUNT(DISTINCT spotter_output.pilot_id) AS pilot_count |
|
| 9272 | 9272 | FROM spotter_output".$filter_query." spotter_output.pilot_id <> ''"; |
| 9273 | 9273 | $sth = $this->db->prepare($query); |
| 9274 | 9274 | $sth->execute(); |
@@ -9283,8 +9283,8 @@ discard block |
||
| 9283 | 9283 | */ |
| 9284 | 9284 | public function countOverallOwners($filters = array()) |
| 9285 | 9285 | { |
| 9286 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9287 | - $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9286 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9287 | + $query = "SELECT COUNT(DISTINCT spotter_output.owner_name) AS owner_count |
|
| 9288 | 9288 | FROM spotter_output".$filter_query." spotter_output.owner_name <> ''"; |
| 9289 | 9289 | $sth = $this->db->prepare($query); |
| 9290 | 9290 | $sth->execute(); |
@@ -9317,8 +9317,8 @@ discard block |
||
| 9317 | 9317 | */ |
| 9318 | 9318 | public function countOverallMilitaryFlights($filters = array()) |
| 9319 | 9319 | { |
| 9320 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9321 | - $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9320 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9321 | + $query = "SELECT COUNT(spotter_output.spotter_id) AS flight_count |
|
| 9322 | 9322 | FROM airlines,spotter_output".$filter_query." spotter_output.airline_icao = airlines.icao AND airlines.type = 'military'"; |
| 9323 | 9323 | |
| 9324 | 9324 | $sth = $this->db->prepare($query); |
@@ -9355,7 +9355,7 @@ discard block |
||
| 9355 | 9355 | public function countAllHoursFromToday($filters = array()) |
| 9356 | 9356 | { |
| 9357 | 9357 | global $globalTimezone, $globalDBdriver; |
| 9358 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9358 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9359 | 9359 | if ($globalTimezone != '') { |
| 9360 | 9360 | date_default_timezone_set($globalTimezone); |
| 9361 | 9361 | $datetime = new DateTime(); |
@@ -9363,12 +9363,12 @@ discard block |
||
| 9363 | 9363 | } else $offset = '+00:00'; |
| 9364 | 9364 | |
| 9365 | 9365 | if ($globalDBdriver == 'mysql') { |
| 9366 | - $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9366 | + $query = "SELECT HOUR(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) AS hour_name, count(*) as hour_count |
|
| 9367 | 9367 | FROM spotter_output".$filter_query." DATE(CONVERT_TZ(spotter_output.date,'+00:00', :offset)) = CURDATE() |
| 9368 | 9368 | GROUP BY hour_name |
| 9369 | 9369 | ORDER BY hour_name ASC"; |
| 9370 | 9370 | } else { |
| 9371 | - $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9371 | + $query = "SELECT EXTRACT(HOUR FROM spotter_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
| 9372 | 9372 | FROM spotter_output".$filter_query." to_char(spotter_output.date AT TIME ZONE INTERVAL :offset,'YYYY-mm-dd') = CAST(NOW() AS date) |
| 9373 | 9373 | GROUP BY hour_name |
| 9374 | 9374 | ORDER BY hour_name ASC"; |
@@ -9380,7 +9380,7 @@ discard block |
||
| 9380 | 9380 | $hour_array = array(); |
| 9381 | 9381 | $temp_array = array(); |
| 9382 | 9382 | |
| 9383 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9383 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9384 | 9384 | { |
| 9385 | 9385 | $temp_array['hour_name'] = $row['hour_name']; |
| 9386 | 9386 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -9399,14 +9399,14 @@ discard block |
||
| 9399 | 9399 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 9400 | 9400 | { |
| 9401 | 9401 | global $global_query, $globalDBdriver, $globalTimezone; |
| 9402 | - $filter_query = $this->getFilter($filters,true,true); |
|
| 9402 | + $filter_query = $this->getFilter($filters, true, true); |
|
| 9403 | 9403 | date_default_timezone_set('UTC'); |
| 9404 | 9404 | $limit_query = ''; |
| 9405 | 9405 | if ($limit != "") |
| 9406 | 9406 | { |
| 9407 | 9407 | $limit_array = explode(",", $limit); |
| 9408 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 9409 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 9408 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 9409 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 9410 | 9410 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 9411 | 9411 | { |
| 9412 | 9412 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9459,7 +9459,7 @@ discard block |
||
| 9459 | 9459 | GROUP BY spotter_output.ident,spotter_output.airline_name,spotter_output.airline_icao,spotter_output.airline_country,spotter_output.airline_type,spotter_output.departure_airport_icao,spotter_output.departure_airport_name,spotter_output.departure_airport_city,spotter_output.departure_airport_country,spotter_output.departure_airport_time,spotter_output.arrival_airport_icao,spotter_output.arrival_airport_name,spotter_output.arrival_airport_city,spotter_output.arrival_airport_country,spotter_output.arrival_airport_time, to_char(spotter_output.date,'HH') |
| 9460 | 9460 | HAVING count(spotter_output.ident) > 5$orderby_query"; |
| 9461 | 9461 | //echo $query; |
| 9462 | - $spotter_array = $this->getDataFromDB($query.$limit_query,array(':timezone' => $globalTimezone)); |
|
| 9462 | + $spotter_array = $this->getDataFromDB($query.$limit_query, array(':timezone' => $globalTimezone)); |
|
| 9463 | 9463 | /* |
| 9464 | 9464 | $sth = $this->db->prepare($query); |
| 9465 | 9465 | $sth->execute(array(':timezone' => $globalTimezone)); |
@@ -9478,9 +9478,9 @@ discard block |
||
| 9478 | 9478 | */ |
| 9479 | 9479 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 9480 | 9480 | { |
| 9481 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
| 9481 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
| 9482 | 9482 | |
| 9483 | - $query = "SELECT spotter_output.spotter_id |
|
| 9483 | + $query = "SELECT spotter_output.spotter_id |
|
| 9484 | 9484 | FROM spotter_output |
| 9485 | 9485 | WHERE spotter_output.flightaware_id = '".$flightaware_id."'"; |
| 9486 | 9486 | |
@@ -9488,7 +9488,7 @@ discard block |
||
| 9488 | 9488 | $sth = $this->db->prepare($query); |
| 9489 | 9489 | $sth->execute(); |
| 9490 | 9490 | |
| 9491 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9491 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9492 | 9492 | { |
| 9493 | 9493 | return $row['spotter_id']; |
| 9494 | 9494 | } |
@@ -9513,23 +9513,23 @@ discard block |
||
| 9513 | 9513 | } |
| 9514 | 9514 | |
| 9515 | 9515 | $current_date = date("Y-m-d H:i:s"); |
| 9516 | - $date = date("Y-m-d H:i:s",strtotime($dateString." UTC")); |
|
| 9516 | + $date = date("Y-m-d H:i:s", strtotime($dateString." UTC")); |
|
| 9517 | 9517 | |
| 9518 | 9518 | $diff = abs(strtotime($current_date) - strtotime($date)); |
| 9519 | 9519 | |
| 9520 | - $time_array['years'] = floor($diff / (365*60*60*24)); |
|
| 9520 | + $time_array['years'] = floor($diff/(365*60*60*24)); |
|
| 9521 | 9521 | $years = $time_array['years']; |
| 9522 | 9522 | |
| 9523 | - $time_array['months'] = floor(($diff - $years * 365*60*60*24) / (30*60*60*24)); |
|
| 9523 | + $time_array['months'] = floor(($diff - $years*365*60*60*24)/(30*60*60*24)); |
|
| 9524 | 9524 | $months = $time_array['months']; |
| 9525 | 9525 | |
| 9526 | - $time_array['days'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24)/ (60*60*24)); |
|
| 9526 | + $time_array['days'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24)/(60*60*24)); |
|
| 9527 | 9527 | $days = $time_array['days']; |
| 9528 | - $time_array['hours'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/ (60*60)); |
|
| 9528 | + $time_array['hours'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24)/(60*60)); |
|
| 9529 | 9529 | $hours = $time_array['hours']; |
| 9530 | - $time_array['minutes'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/ 60); |
|
| 9530 | + $time_array['minutes'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60)/60); |
|
| 9531 | 9531 | $minutes = $time_array['minutes']; |
| 9532 | - $time_array['seconds'] = floor(($diff - $years * 365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9532 | + $time_array['seconds'] = floor(($diff - $years*365*60*60*24 - $months*30*60*60*24 - $days*60*60*24 - $hours*60*60 - $minutes*60)); |
|
| 9533 | 9533 | |
| 9534 | 9534 | return $time_array; |
| 9535 | 9535 | } |
@@ -9555,63 +9555,63 @@ discard block |
||
| 9555 | 9555 | $temp_array['direction_degree'] = $direction; |
| 9556 | 9556 | $temp_array['direction_shortname'] = "N"; |
| 9557 | 9557 | $temp_array['direction_fullname'] = "North"; |
| 9558 | - } elseif ($direction >= 22.5 && $direction < 45){ |
|
| 9558 | + } elseif ($direction >= 22.5 && $direction < 45) { |
|
| 9559 | 9559 | $temp_array['direction_degree'] = $direction; |
| 9560 | 9560 | $temp_array['direction_shortname'] = "NNE"; |
| 9561 | 9561 | $temp_array['direction_fullname'] = "North-Northeast"; |
| 9562 | - } elseif ($direction >= 45 && $direction < 67.5){ |
|
| 9562 | + } elseif ($direction >= 45 && $direction < 67.5) { |
|
| 9563 | 9563 | $temp_array['direction_degree'] = $direction; |
| 9564 | 9564 | $temp_array['direction_shortname'] = "NE"; |
| 9565 | 9565 | $temp_array['direction_fullname'] = "Northeast"; |
| 9566 | - } elseif ($direction >= 67.5 && $direction < 90){ |
|
| 9566 | + } elseif ($direction >= 67.5 && $direction < 90) { |
|
| 9567 | 9567 | $temp_array['direction_degree'] = $direction; |
| 9568 | 9568 | $temp_array['direction_shortname'] = "ENE"; |
| 9569 | 9569 | $temp_array['direction_fullname'] = "East-Northeast"; |
| 9570 | - } elseif ($direction >= 90 && $direction < 112.5){ |
|
| 9570 | + } elseif ($direction >= 90 && $direction < 112.5) { |
|
| 9571 | 9571 | $temp_array['direction_degree'] = $direction; |
| 9572 | 9572 | $temp_array['direction_shortname'] = "E"; |
| 9573 | 9573 | $temp_array['direction_fullname'] = "East"; |
| 9574 | - } elseif ($direction >= 112.5 && $direction < 135){ |
|
| 9574 | + } elseif ($direction >= 112.5 && $direction < 135) { |
|
| 9575 | 9575 | $temp_array['direction_degree'] = $direction; |
| 9576 | 9576 | $temp_array['direction_shortname'] = "ESE"; |
| 9577 | 9577 | $temp_array['direction_fullname'] = "East-Southeast"; |
| 9578 | - } elseif ($direction >= 135 && $direction < 157.5){ |
|
| 9578 | + } elseif ($direction >= 135 && $direction < 157.5) { |
|
| 9579 | 9579 | $temp_array['direction_degree'] = $direction; |
| 9580 | 9580 | $temp_array['direction_shortname'] = "SE"; |
| 9581 | 9581 | $temp_array['direction_fullname'] = "Southeast"; |
| 9582 | - } elseif ($direction >= 157.5 && $direction < 180){ |
|
| 9582 | + } elseif ($direction >= 157.5 && $direction < 180) { |
|
| 9583 | 9583 | $temp_array['direction_degree'] = $direction; |
| 9584 | 9584 | $temp_array['direction_shortname'] = "SSE"; |
| 9585 | 9585 | $temp_array['direction_fullname'] = "South-Southeast"; |
| 9586 | - } elseif ($direction >= 180 && $direction < 202.5){ |
|
| 9586 | + } elseif ($direction >= 180 && $direction < 202.5) { |
|
| 9587 | 9587 | $temp_array['direction_degree'] = $direction; |
| 9588 | 9588 | $temp_array['direction_shortname'] = "S"; |
| 9589 | 9589 | $temp_array['direction_fullname'] = "South"; |
| 9590 | - } elseif ($direction >= 202.5 && $direction < 225){ |
|
| 9590 | + } elseif ($direction >= 202.5 && $direction < 225) { |
|
| 9591 | 9591 | $temp_array['direction_degree'] = $direction; |
| 9592 | 9592 | $temp_array['direction_shortname'] = "SSW"; |
| 9593 | 9593 | $temp_array['direction_fullname'] = "South-Southwest"; |
| 9594 | - } elseif ($direction >= 225 && $direction < 247.5){ |
|
| 9594 | + } elseif ($direction >= 225 && $direction < 247.5) { |
|
| 9595 | 9595 | $temp_array['direction_degree'] = $direction; |
| 9596 | 9596 | $temp_array['direction_shortname'] = "SW"; |
| 9597 | 9597 | $temp_array['direction_fullname'] = "Southwest"; |
| 9598 | - } elseif ($direction >= 247.5 && $direction < 270){ |
|
| 9598 | + } elseif ($direction >= 247.5 && $direction < 270) { |
|
| 9599 | 9599 | $temp_array['direction_degree'] = $direction; |
| 9600 | 9600 | $temp_array['direction_shortname'] = "WSW"; |
| 9601 | 9601 | $temp_array['direction_fullname'] = "West-Southwest"; |
| 9602 | - } elseif ($direction >= 270 && $direction < 292.5){ |
|
| 9602 | + } elseif ($direction >= 270 && $direction < 292.5) { |
|
| 9603 | 9603 | $temp_array['direction_degree'] = $direction; |
| 9604 | 9604 | $temp_array['direction_shortname'] = "W"; |
| 9605 | 9605 | $temp_array['direction_fullname'] = "West"; |
| 9606 | - } elseif ($direction >= 292.5 && $direction < 315){ |
|
| 9606 | + } elseif ($direction >= 292.5 && $direction < 315) { |
|
| 9607 | 9607 | $temp_array['direction_degree'] = $direction; |
| 9608 | 9608 | $temp_array['direction_shortname'] = "WNW"; |
| 9609 | 9609 | $temp_array['direction_fullname'] = "West-Northwest"; |
| 9610 | - } elseif ($direction >= 315 && $direction < 337.5){ |
|
| 9610 | + } elseif ($direction >= 315 && $direction < 337.5) { |
|
| 9611 | 9611 | $temp_array['direction_degree'] = $direction; |
| 9612 | 9612 | $temp_array['direction_shortname'] = "NW"; |
| 9613 | 9613 | $temp_array['direction_fullname'] = "Northwest"; |
| 9614 | - } elseif ($direction >= 337.5 && $direction < 360){ |
|
| 9614 | + } elseif ($direction >= 337.5 && $direction < 360) { |
|
| 9615 | 9615 | $temp_array['direction_degree'] = $direction; |
| 9616 | 9616 | $temp_array['direction_shortname'] = "NNW"; |
| 9617 | 9617 | $temp_array['direction_fullname'] = "North-Northwest"; |
@@ -9664,9 +9664,9 @@ discard block |
||
| 9664 | 9664 | */ |
| 9665 | 9665 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 9666 | 9666 | { |
| 9667 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9667 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9668 | 9668 | |
| 9669 | - $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9669 | + $query = "SELECT aircraft_modes.Registration FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9670 | 9670 | |
| 9671 | 9671 | $sth = $this->db->prepare($query); |
| 9672 | 9672 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9689,9 +9689,9 @@ discard block |
||
| 9689 | 9689 | */ |
| 9690 | 9690 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 9691 | 9691 | { |
| 9692 | - $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
|
| 9692 | + $aircraft_modes = filter_var($aircraft_modes, FILTER_SANITIZE_STRING); |
|
| 9693 | 9693 | |
| 9694 | - $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9694 | + $query = "SELECT aircraft_modes.type_flight FROM aircraft_modes WHERE aircraft_modes.ModeS = :aircraft_modes ORDER BY FirstCreated DESC LIMIT 1"; |
|
| 9695 | 9695 | |
| 9696 | 9696 | $sth = $this->db->prepare($query); |
| 9697 | 9697 | $sth->execute(array(':aircraft_modes' => $aircraft_modes)); |
@@ -9712,11 +9712,11 @@ discard block |
||
| 9712 | 9712 | * @param Float $longitude longitute of the flight |
| 9713 | 9713 | * @return String the countrie |
| 9714 | 9714 | */ |
| 9715 | - public function getCountryFromLatitudeLongitude($latitude,$longitude) |
|
| 9715 | + public function getCountryFromLatitudeLongitude($latitude, $longitude) |
|
| 9716 | 9716 | { |
| 9717 | 9717 | global $globalDBdriver, $globalDebug; |
| 9718 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9719 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 9718 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9719 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 9720 | 9720 | |
| 9721 | 9721 | $Connection = new Connection($this->db); |
| 9722 | 9722 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9756,7 +9756,7 @@ discard block |
||
| 9756 | 9756 | public function getCountryFromISO2($iso2) |
| 9757 | 9757 | { |
| 9758 | 9758 | global $globalDBdriver, $globalDebug; |
| 9759 | - $iso2 = filter_var($iso2,FILTER_SANITIZE_STRING); |
|
| 9759 | + $iso2 = filter_var($iso2, FILTER_SANITIZE_STRING); |
|
| 9760 | 9760 | |
| 9761 | 9761 | $Connection = new Connection($this->db); |
| 9762 | 9762 | if (!$Connection->tableExists('countries')) return ''; |
@@ -9788,19 +9788,19 @@ discard block |
||
| 9788 | 9788 | */ |
| 9789 | 9789 | public function convertAircraftRegistration($registration) |
| 9790 | 9790 | { |
| 9791 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9791 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9792 | 9792 | $registration_prefix = ''; |
| 9793 | 9793 | $registration_1 = substr($registration, 0, 1); |
| 9794 | 9794 | $registration_2 = substr($registration, 0, 2); |
| 9795 | 9795 | |
| 9796 | 9796 | //first get the prefix based on two characters |
| 9797 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9797 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_2"; |
|
| 9798 | 9798 | |
| 9799 | 9799 | |
| 9800 | 9800 | $sth = $this->db->prepare($query); |
| 9801 | 9801 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9802 | 9802 | |
| 9803 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9803 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9804 | 9804 | { |
| 9805 | 9805 | $registration_prefix = $row['registration_prefix']; |
| 9806 | 9806 | } |
@@ -9808,11 +9808,11 @@ discard block |
||
| 9808 | 9808 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9809 | 9809 | if ($registration_prefix == '') |
| 9810 | 9810 | { |
| 9811 | - $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9811 | + $query = "SELECT aircraft_registration.registration_prefix FROM aircraft_registration WHERE registration_prefix = :registration_1"; |
|
| 9812 | 9812 | $sth = $this->db->prepare($query); |
| 9813 | 9813 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9814 | 9814 | |
| 9815 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9815 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9816 | 9816 | { |
| 9817 | 9817 | $registration_prefix = $row['registration_prefix']; |
| 9818 | 9818 | } |
@@ -9826,7 +9826,7 @@ discard block |
||
| 9826 | 9826 | } else { |
| 9827 | 9827 | $registration = preg_replace("/^(.{1})/", "$1-", $registration); |
| 9828 | 9828 | } |
| 9829 | - } else if(strlen($registration_prefix) == 2){ |
|
| 9829 | + } else if (strlen($registration_prefix) == 2) { |
|
| 9830 | 9830 | if (0 === strpos($registration, 'N')) { |
| 9831 | 9831 | $registration = preg_replace("/^(.{2})/", "$1", $registration); |
| 9832 | 9832 | } else { |
@@ -9845,17 +9845,17 @@ discard block |
||
| 9845 | 9845 | */ |
| 9846 | 9846 | public function countryFromAircraftRegistration($registration) |
| 9847 | 9847 | { |
| 9848 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9848 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9849 | 9849 | |
| 9850 | 9850 | $registration_prefix = ''; |
| 9851 | - $registration_test = explode('-',$registration); |
|
| 9851 | + $registration_test = explode('-', $registration); |
|
| 9852 | 9852 | $country = ''; |
| 9853 | 9853 | if ($registration_test[0] != $registration) { |
| 9854 | 9854 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
| 9855 | 9855 | |
| 9856 | 9856 | $sth = $this->db->prepare($query); |
| 9857 | 9857 | $sth->execute(array(':registration_1' => $registration_test[0])); |
| 9858 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9858 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9859 | 9859 | { |
| 9860 | 9860 | //$registration_prefix = $row['registration_prefix']; |
| 9861 | 9861 | $country = $row['country']; |
@@ -9866,13 +9866,13 @@ discard block |
||
| 9866 | 9866 | |
| 9867 | 9867 | $country = ''; |
| 9868 | 9868 | //first get the prefix based on two characters |
| 9869 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9869 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
|
| 9870 | 9870 | |
| 9871 | 9871 | |
| 9872 | 9872 | $sth = $this->db->prepare($query); |
| 9873 | 9873 | $sth->execute(array(':registration_2' => $registration_2)); |
| 9874 | 9874 | |
| 9875 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9875 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9876 | 9876 | { |
| 9877 | 9877 | $registration_prefix = $row['registration_prefix']; |
| 9878 | 9878 | $country = $row['country']; |
@@ -9881,12 +9881,12 @@ discard block |
||
| 9881 | 9881 | //if we didn't find a two chracter prefix lets just search the one with one character |
| 9882 | 9882 | if ($registration_prefix == "") |
| 9883 | 9883 | { |
| 9884 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9884 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_1 LIMIT 1"; |
|
| 9885 | 9885 | |
| 9886 | 9886 | $sth = $this->db->prepare($query); |
| 9887 | 9887 | $sth->execute(array(':registration_1' => $registration_1)); |
| 9888 | 9888 | |
| 9889 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9889 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9890 | 9890 | { |
| 9891 | 9891 | //$registration_prefix = $row['registration_prefix']; |
| 9892 | 9892 | $country = $row['country']; |
@@ -9906,13 +9906,13 @@ discard block |
||
| 9906 | 9906 | */ |
| 9907 | 9907 | public function countryFromAircraftRegistrationCode($registration) |
| 9908 | 9908 | { |
| 9909 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
| 9909 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
| 9910 | 9910 | |
| 9911 | 9911 | $country = ''; |
| 9912 | - $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 9912 | + $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration LIMIT 1"; |
|
| 9913 | 9913 | $sth = $this->db->prepare($query); |
| 9914 | 9914 | $sth->execute(array(':registration' => $registration)); |
| 9915 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9915 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 9916 | 9916 | { |
| 9917 | 9917 | $country = $row['country']; |
| 9918 | 9918 | } |
@@ -9925,9 +9925,9 @@ discard block |
||
| 9925 | 9925 | * @param String $flightaware_id flightaware_id from spotter_output table |
| 9926 | 9926 | * @param String $highlight New highlight value |
| 9927 | 9927 | */ |
| 9928 | - public function setHighlightFlight($flightaware_id,$highlight) { |
|
| 9928 | + public function setHighlightFlight($flightaware_id, $highlight) { |
|
| 9929 | 9929 | |
| 9930 | - $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9930 | + $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
|
| 9931 | 9931 | $sth = $this->db->prepare($query); |
| 9932 | 9932 | $sth->execute(array(':flightaware_id' => $flightaware_id, ':highlight' => $highlight)); |
| 9933 | 9933 | } |
@@ -9956,7 +9956,7 @@ discard block |
||
| 9956 | 9956 | |
| 9957 | 9957 | $bitly_data = json_decode($bitly_data); |
| 9958 | 9958 | $bitly_url = ''; |
| 9959 | - if ($bitly_data->status_txt = "OK"){ |
|
| 9959 | + if ($bitly_data->status_txt = "OK") { |
|
| 9960 | 9960 | $bitly_url = $bitly_data->data->url; |
| 9961 | 9961 | } |
| 9962 | 9962 | |
@@ -9966,7 +9966,7 @@ discard block |
||
| 9966 | 9966 | |
| 9967 | 9967 | public function getOrderBy() |
| 9968 | 9968 | { |
| 9969 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"),"distance_asc" => array("key" => "distance_asc","value" => "Distance - ASC","sql" => "ORDER BY distance ASC"),"distance_desc" => array("key" => "distance_desc","value" => "Distance - DESC","sql" => "ORDER BY distance DESC")); |
|
| 9969 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_output.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_output.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_output.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_output.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_output.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_output.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_output.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_output.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_output.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_output.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_output.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_output.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_output.date DESC"), "distance_asc" => array("key" => "distance_asc", "value" => "Distance - ASC", "sql" => "ORDER BY distance ASC"), "distance_desc" => array("key" => "distance_desc", "value" => "Distance - DESC", "sql" => "ORDER BY distance DESC")); |
|
| 9970 | 9970 | |
| 9971 | 9971 | return $orderby; |
| 9972 | 9972 | |
@@ -10100,14 +10100,14 @@ discard block |
||
| 10100 | 10100 | } |
| 10101 | 10101 | $sth = $this->db->prepare($query); |
| 10102 | 10102 | $sth->execute(); |
| 10103 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10103 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10104 | 10104 | { |
| 10105 | 10105 | $departure_airport_array = $this->getAllAirportInfo($row['fromairport_icao']); |
| 10106 | 10106 | $arrival_airport_array = $this->getAllAirportInfo($row['toairport_icao']); |
| 10107 | 10107 | if (count($departure_airport_array) > 0 && count($arrival_airport_array) > 0) { |
| 10108 | - $update_query="UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10108 | + $update_query = "UPDATE spotter_output SET departure_airport_icao = :fromicao, arrival_airport_icao = :toicao, departure_airport_name = :departure_airport_name, departure_airport_city = :departure_airport_city, departure_airport_country = :departure_airport_country, arrival_airport_name = :arrival_airport_name, arrival_airport_city = :arrival_airport_city, arrival_airport_country = :arrival_airport_country WHERE spotter_id = :spotter_id"; |
|
| 10109 | 10109 | $sthu = $this->db->prepare($update_query); |
| 10110 | - $sthu->execute(array(':fromicao' => $row['fromairport_icao'],':toicao' => $row['toairport_icao'],':spotter_id' => $row['spotter_id'],':departure_airport_name' => $departure_airport_array[0]['name'],':departure_airport_city' => $departure_airport_array[0]['city'],':departure_airport_country' => $departure_airport_array[0]['country'],':arrival_airport_name' => $arrival_airport_array[0]['name'],':arrival_airport_city' => $arrival_airport_array[0]['city'],':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10110 | + $sthu->execute(array(':fromicao' => $row['fromairport_icao'], ':toicao' => $row['toairport_icao'], ':spotter_id' => $row['spotter_id'], ':departure_airport_name' => $departure_airport_array[0]['name'], ':departure_airport_city' => $departure_airport_array[0]['city'], ':departure_airport_country' => $departure_airport_array[0]['country'], ':arrival_airport_name' => $arrival_airport_array[0]['name'], ':arrival_airport_city' => $arrival_airport_array[0]['city'], ':arrival_airport_country' => $arrival_airport_array[0]['country'])); |
|
| 10111 | 10111 | } |
| 10112 | 10112 | } |
| 10113 | 10113 | |
@@ -10120,7 +10120,7 @@ discard block |
||
| 10120 | 10120 | } |
| 10121 | 10121 | $sth = $this->db->prepare($query); |
| 10122 | 10122 | $sth->execute(); |
| 10123 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10123 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10124 | 10124 | { |
| 10125 | 10125 | if (is_numeric(substr($row['ident'], -1, 1))) |
| 10126 | 10126 | { |
@@ -10129,11 +10129,11 @@ discard block |
||
| 10129 | 10129 | elseif (isset($row['format_source']) && $row['format_source'] == 'whazzup') $fromsource = 'ivao'; |
| 10130 | 10130 | elseif (isset($globalVATSIM) && $globalVATSIM) $fromsource = 'vatsim'; |
| 10131 | 10131 | elseif (isset($globalIVAO) && $globalIVAO) $fromsource = 'ivao'; |
| 10132 | - $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3),$fromsource); |
|
| 10132 | + $airline_array = $this->getAllAirlineInfo(substr($row['ident'], 0, 3), $fromsource); |
|
| 10133 | 10133 | if (isset($airline_array[0]['name'])) { |
| 10134 | - $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10134 | + $update_query = "UPDATE spotter_output SET spotter_output.airline_name = :airline_name, spotter_output.airline_icao = :airline_icao, spotter_output.airline_country = :airline_country, spotter_output.airline_type = :airline_type WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10135 | 10135 | $sthu = $this->db->prepare($update_query); |
| 10136 | - $sthu->execute(array(':airline_name' => $airline_array[0]['name'],':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10136 | + $sthu->execute(array(':airline_name' => $airline_array[0]['name'], ':airline_icao' => $airline_array[0]['icao'], ':airline_country' => $airline_array[0]['country'], ':airline_type' => $airline_array[0]['type'], ':spotter_id' => $row['spotter_id'])); |
|
| 10137 | 10137 | } |
| 10138 | 10138 | } |
| 10139 | 10139 | } |
@@ -10153,18 +10153,18 @@ discard block |
||
| 10153 | 10153 | } |
| 10154 | 10154 | $sth = $this->db->prepare($query); |
| 10155 | 10155 | $sth->execute(); |
| 10156 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10156 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10157 | 10157 | { |
| 10158 | 10158 | if ($row['aircraft_icao'] != '') { |
| 10159 | 10159 | $aircraft_name = $this->getAllAircraftInfo($row['aircraft_icao']); |
| 10160 | - if ($row['registration'] != ""){ |
|
| 10160 | + if ($row['registration'] != "") { |
|
| 10161 | 10161 | $image_array = $Image->getSpotterImage($row['registration']); |
| 10162 | 10162 | if (!isset($image_array[0]['registration'])) { |
| 10163 | 10163 | $Image->addSpotterImage($row['registration']); |
| 10164 | 10164 | } |
| 10165 | 10165 | } |
| 10166 | 10166 | if (count($aircraft_name) > 0) { |
| 10167 | - $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10167 | + $update_query = "UPDATE spotter_output SET spotter_output.aircraft_name = :aircraft_name, spotter_output.aircraft_manufacturer = :aircraft_manufacturer WHERE spotter_output.spotter_id = :spotter_id"; |
|
| 10168 | 10168 | $sthu = $this->db->prepare($update_query); |
| 10169 | 10169 | $sthu->execute(array(':aircraft_name' => $aircraft_name[0]['type'], ':aircraft_manufacturer' => $aircraft_name[0]['manufacturer'], ':spotter_id' => $row['spotter_id'])); |
| 10170 | 10170 | } |
@@ -10179,10 +10179,10 @@ discard block |
||
| 10179 | 10179 | $query = "SELECT spotter_output.spotter_id, spotter_output.last_latitude, spotter_output.last_longitude, spotter_output.last_altitude, spotter_output.arrival_airport_icao, spotter_output.real_arrival_airport_icao FROM spotter_output"; |
| 10180 | 10180 | $sth = $this->db->prepare($query); |
| 10181 | 10181 | $sth->execute(); |
| 10182 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10182 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 10183 | 10183 | { |
| 10184 | 10184 | if ($row['last_latitude'] != '' && $row['last_longitude'] != '') { |
| 10185 | - $closestAirports = $this->closestAirports($row['last_latitude'],$row['last_longitude'],$globalClosestMinDist); |
|
| 10185 | + $closestAirports = $this->closestAirports($row['last_latitude'], $row['last_longitude'], $globalClosestMinDist); |
|
| 10186 | 10186 | $airport_icao = ''; |
| 10187 | 10187 | if (isset($closestAirports[0])) { |
| 10188 | 10188 | if ($row['arrival_airport_icao'] == $closestAirports[0]['icao']) { |
@@ -10196,7 +10196,7 @@ discard block |
||
| 10196 | 10196 | break; |
| 10197 | 10197 | } |
| 10198 | 10198 | } |
| 10199 | - } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100+1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude']+5000))) { |
|
| 10199 | + } elseif ($row['last_altitude'] == 0 || ($row['last_altitude'] != '' && ($closestAirports[0]['altitude'] <= $row['last_altitude']*100 + 1000 && $row['last_altitude']*100 < $closestAirports[0]['altitude'] + 5000))) { |
|
| 10200 | 10200 | $airport_icao = $closestAirports[0]['icao']; |
| 10201 | 10201 | if ($globalDebug) echo "\o/ NP --++ Find arrival airport. Airport ICAO : ".$airport_icao." ! Latitude : ".$row['last_latitude'].' - Longitude : '.$row['last_longitude'].' - MinDist : '.$globalClosestMinDist." - Airport altitude : ".$closestAirports[0]['altitude'].' - flight altitude : '.($row['last_altitude']*100)."\n"; |
| 10202 | 10202 | } else { |
@@ -10207,28 +10207,28 @@ discard block |
||
| 10207 | 10207 | } |
| 10208 | 10208 | if ($row['real_arrival_airport_icao'] != $airport_icao) { |
| 10209 | 10209 | if ($globalDebug) echo "Updating airport to ".$airport_icao."...\n"; |
| 10210 | - $update_query="UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10210 | + $update_query = "UPDATE spotter_output SET real_arrival_airport_icao = :airport_icao WHERE spotter_id = :spotter_id"; |
|
| 10211 | 10211 | $sthu = $this->db->prepare($update_query); |
| 10212 | - $sthu->execute(array(':airport_icao' => $airport_icao,':spotter_id' => $row['spotter_id'])); |
|
| 10212 | + $sthu->execute(array(':airport_icao' => $airport_icao, ':spotter_id' => $row['spotter_id'])); |
|
| 10213 | 10213 | } |
| 10214 | 10214 | } |
| 10215 | 10215 | } |
| 10216 | 10216 | } |
| 10217 | 10217 | |
| 10218 | - public function closestAirports($origLat,$origLon,$dist = 10) { |
|
| 10218 | + public function closestAirports($origLat, $origLon, $dist = 10) { |
|
| 10219 | 10219 | global $globalDBdriver; |
| 10220 | - $dist = number_format($dist*0.621371,2,'.',''); // convert km to mile |
|
| 10220 | + $dist = number_format($dist*0.621371, 2, '.', ''); // convert km to mile |
|
| 10221 | 10221 | /* |
| 10222 | 10222 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - abs(latitude))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(abs(latitude)*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 10223 | 10223 | FROM airport WHERE longitude between ($origLon-$dist/abs(cos(radians($origLat))*69)) and ($origLon+$dist/abs(cos(radians($origLat))*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10224 | 10224 | having distance < $dist ORDER BY distance limit 100;"; |
| 10225 | 10225 | */ |
| 10226 | 10226 | if ($globalDBdriver == 'mysql') { |
| 10227 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10227 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
|
| 10228 | 10228 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10229 | 10229 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10230 | 10230 | } else { |
| 10231 | - $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10231 | + $query = "SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
|
| 10232 | 10232 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 10233 | 10233 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 10234 | 10234 | } |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | * |
| 28 | 28 | * @return Array Return ACARS data in array |
| 29 | 29 | */ |
| 30 | - public function getLatestAccidentData($limit = '',$type = '') { |
|
| 30 | + public function getLatestAccidentData($limit = '', $type = '') { |
|
| 31 | 31 | global $globalURL, $globalDBdriver; |
| 32 | 32 | $Image = new Image($this->db); |
| 33 | 33 | $Spotter = new Spotter($this->db); |
@@ -39,8 +39,8 @@ discard block |
||
| 39 | 39 | { |
| 40 | 40 | $limit_array = explode(",", $limit); |
| 41 | 41 | |
| 42 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 43 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 42 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 43 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 44 | 44 | |
| 45 | 45 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 46 | 46 | { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | |
| 61 | 61 | $sth = $this->db->prepare($query); |
| 62 | 62 | $sth->execute($query_values); |
| 63 | - } catch(PDOException $e) { |
|
| 63 | + } catch (PDOException $e) { |
|
| 64 | 64 | return "error : ".$e->getMessage(); |
| 65 | 65 | } |
| 66 | 66 | $i = 0; |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | if ($row['registration'] != '') { |
| 70 | 70 | // $row['registration'] = str_replace('.','',$row['registration']); |
| 71 | 71 | $image_array = $Image->getSpotterImage($row['registration']); |
| 72 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
| 73 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 72 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
| 73 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
| 74 | 74 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
| 75 | 75 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
| 76 | 76 | //echo $row['registration']; |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | $data['aircraft_name'] = $aircraft_info[0]['type']; |
| 82 | 82 | $data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer']; |
| 83 | 83 | } else { |
| 84 | - $data = array_merge($data,array('aircraft_type' => 'NA')); |
|
| 84 | + $data = array_merge($data, array('aircraft_type' => 'NA')); |
|
| 85 | 85 | } |
| 86 | 86 | $owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']); |
| 87 | 87 | if (!empty($owner_data)) { |
@@ -89,21 +89,21 @@ discard block |
||
| 89 | 89 | $data['aircraft_base'] = $owner_data['base']; |
| 90 | 90 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
| 91 | 91 | } |
| 92 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
| 92 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
| 93 | 93 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
| 94 | 94 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
| 95 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,2)); |
|
| 95 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 2)); |
|
| 96 | 96 | if (isset($identicao[0])) { |
| 97 | - if (substr($row['ident'],0,2) == 'AF') { |
|
| 98 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 99 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
| 100 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
| 97 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
| 98 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
| 99 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
| 100 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
| 101 | 101 | |
| 102 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
| 102 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
| 103 | 103 | } else $icao = $row['ident']; |
| 104 | - $icao = $Translation->checkTranslation($icao,false); |
|
| 104 | + $icao = $Translation->checkTranslation($icao, false); |
|
| 105 | 105 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
| 106 | - $data = array_merge($row,$data); |
|
| 106 | + $data = array_merge($row, $data); |
|
| 107 | 107 | if ($data['ident'] == null) $data['ident'] = $icao; |
| 108 | 108 | if ($data['title'] == null) { |
| 109 | 109 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | $page_url = $globalURL.'/accident-latest'; |
| 10 | 10 | |
| 11 | -if(!isset($_GET['limit'])) |
|
| 11 | +if (!isset($_GET['limit'])) |
|
| 12 | 12 | { |
| 13 | 13 | $limit_start = 0; |
| 14 | 14 | $limit_end = 25; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | print '<div class="table column">'; |
| 36 | 36 | print '<p>'._("The table below shows the latest Accidents.").'</p>'; |
| 37 | -$spotter_array = $Accident->getLatestAccidentData($limit_start.",".$absolute_difference,'accident'); |
|
| 37 | +$spotter_array = $Accident->getLatestAccidentData($limit_start.",".$absolute_difference, 'accident'); |
|
| 38 | 38 | //print_r($spotter_array); |
| 39 | 39 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
| 40 | 40 | include('table-output.php'); |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | print '<th class="more"></th>'; |
| 94 | 94 | print '</thead>'; |
| 95 | -} else if (strtolower($current_page) == "upcoming"){ |
|
| 95 | +} else if (strtolower($current_page) == "upcoming") { |
|
| 96 | 96 | print '<thead>'; |
| 97 | 97 | if ($_GET['sort'] == "airline_name_asc") |
| 98 | 98 | { |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | } |
| 143 | 143 | */ |
| 144 | 144 | print '</thead>'; |
| 145 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
| 145 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
| 146 | 146 | print '<thead>'; |
| 147 | 147 | print '<th class="aircraft_thumbnail"></th>'; |
| 148 | 148 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | print '</thead>'; |
| 180 | 180 | } else { |
| 181 | 181 | |
| 182 | - if ($hide_th_links === true){ |
|
| 182 | + if ($hide_th_links === true) { |
|
| 183 | 183 | print '<thead>'; |
| 184 | 184 | print '<th class="aircraft_thumbnail"></th>'; |
| 185 | 185 | if ($_GET['sort'] == "airline_name_asc") |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | print '<tbody>'."\n"; |
| 363 | -foreach($spotter_array as $spotter_item) |
|
| 363 | +foreach ($spotter_array as $spotter_item) |
|
| 364 | 364 | { |
| 365 | 365 | if (isset($globalTimezone)) |
| 366 | 366 | { |
@@ -391,13 +391,13 @@ discard block |
||
| 391 | 391 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 392 | 392 | } |
| 393 | 393 | if (isset($spotter_item['airline_name'])) { |
| 394 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 394 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 395 | 395 | } else { |
| 396 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 396 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 397 | 397 | } |
| 398 | 398 | } else { |
| 399 | 399 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 400 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 400 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 401 | 401 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 402 | 402 | if (isset($spotter_item['airline_name'])) { |
| 403 | 403 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n"; |
| 412 | 412 | print '</td>'."\n"; |
| 413 | 413 | } |
| 414 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest"){ |
|
| 414 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest") { |
|
| 415 | 415 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 416 | 416 | $spotter_item['squawk'] = '-'; |
| 417 | 417 | } |
@@ -427,17 +427,17 @@ discard block |
||
| 427 | 427 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 428 | 428 | } |
| 429 | 429 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 430 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 430 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 431 | 431 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
| 432 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 432 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 433 | 433 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
| 434 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 434 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 435 | 435 | } else { |
| 436 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 436 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 437 | 437 | } |
| 438 | 438 | } else { |
| 439 | 439 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 440 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 440 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 441 | 441 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 442 | 442 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 443 | 443 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -500,7 +500,7 @@ discard block |
||
| 500 | 500 | } |
| 501 | 501 | print '</td>'."\n"; |
| 502 | 502 | // Aircraft type |
| 503 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
| 503 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
| 504 | 504 | print '<td class="type">'."\n"; |
| 505 | 505 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
| 506 | 506 | print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n"; |
@@ -524,22 +524,22 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 526 | 526 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 527 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 528 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 527 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 528 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 529 | 529 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 530 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 530 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 531 | 531 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 532 | 532 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 533 | 533 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 534 | 534 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 535 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 535 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 536 | 536 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 537 | 537 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 538 | 538 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 539 | 539 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 540 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 540 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 541 | 541 | } else { |
| 542 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 542 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 543 | 543 | } |
| 544 | 544 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
| 545 | 545 | } |
@@ -554,7 +554,7 @@ discard block |
||
| 554 | 554 | $latitude = $spotter_item['latitude']; |
| 555 | 555 | $longitude = $spotter_item['longitude']; |
| 556 | 556 | } |
| 557 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
| 557 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
| 558 | 558 | } else $distance = ''; |
| 559 | 559 | if ($distance != '') { |
| 560 | 560 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -595,20 +595,20 @@ discard block |
||
| 595 | 595 | } |
| 596 | 596 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 597 | 597 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 598 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 598 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 599 | 599 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 600 | 600 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 601 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 601 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 602 | 602 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 603 | 603 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 604 | 604 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 605 | 605 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 606 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 606 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 607 | 607 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 608 | 608 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 609 | 609 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 610 | 610 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 611 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 611 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 612 | 612 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 613 | 613 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 614 | 614 | } |
@@ -621,7 +621,7 @@ discard block |
||
| 621 | 621 | $latitude = $spotter_item['latitude']; |
| 622 | 622 | $longitude = $spotter_item['longitude']; |
| 623 | 623 | } |
| 624 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
| 624 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
| 625 | 625 | } else $distance = ''; |
| 626 | 626 | if ($distance != '') { |
| 627 | 627 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -635,7 +635,7 @@ discard block |
||
| 635 | 635 | } |
| 636 | 636 | print '</td>'."\n"; |
| 637 | 637 | // Route stop |
| 638 | - if(strtolower($current_page) != "upcoming"){ |
|
| 638 | + if (strtolower($current_page) != "upcoming") { |
|
| 639 | 639 | print '<td class="route_stop">'."\n"; |
| 640 | 640 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
| 641 | 641 | print '<span class="nomobile">-</span>'."\n"; |
@@ -659,21 +659,21 @@ discard block |
||
| 659 | 659 | } else { |
| 660 | 660 | //if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') { |
| 661 | 661 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 662 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 663 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 662 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 663 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 664 | 664 | //} elseif ($globalUnitDistance == 'mi') { |
| 665 | 665 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 666 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 667 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 666 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 667 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 668 | 668 | //} elseif ($globalUnitDistance == 'nm') { |
| 669 | 669 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 670 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 671 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 670 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 671 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | print '</td>'."\n"; |
| 675 | 675 | } |
| 676 | - if(strtolower($current_page) != "upcoming"){ |
|
| 676 | + if (strtolower($current_page) != "upcoming") { |
|
| 677 | 677 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 678 | 678 | print '<td class="pilot">'."\n"; |
| 679 | 679 | if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) { |
@@ -708,7 +708,7 @@ discard block |
||
| 708 | 708 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
| 709 | 709 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
| 710 | 710 | print '<td class="message"><p>'."\n"; |
| 711 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 711 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 712 | 712 | print '</p><p class="decode">'; |
| 713 | 713 | $decode_array = json_decode($spotter_item['decode']); |
| 714 | 714 | foreach ($decode_array as $key => $value) { |
@@ -718,7 +718,7 @@ discard block |
||
| 718 | 718 | print '</td>'."\n"; |
| 719 | 719 | } else { |
| 720 | 720 | print '<td class="message">'."\n"; |
| 721 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 721 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 722 | 722 | print '</td>'."\n"; |
| 723 | 723 | } |
| 724 | 724 | } |
@@ -743,7 +743,7 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | print '</td>'."\n"; |
| 745 | 745 | print '<td class="message">'."\n"; |
| 746 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 746 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 747 | 747 | print '</td>'."\n"; |
| 748 | 748 | } |
| 749 | 749 | if (strtolower($current_page) == "incident-latest") { |
@@ -769,7 +769,7 @@ discard block |
||
| 769 | 769 | print '</td>'."\n"; |
| 770 | 770 | */ |
| 771 | 771 | print '<td class="message">'."\n"; |
| 772 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 772 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 773 | 773 | print '</td>'."\n"; |
| 774 | 774 | } |
| 775 | 775 | // Date |
@@ -24,20 +24,20 @@ discard block |
||
| 24 | 24 | fclose($fp); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 27 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 28 | 28 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 29 | 29 | $buffer_size = 4096; // read 4kb at a time |
| 30 | 30 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 31 | 31 | if ($in_file != '' && file_exists($in_file)) { |
| 32 | 32 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 33 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 34 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 35 | 35 | else { |
| 36 | 36 | echo 'gzopen not available'; |
| 37 | 37 | die; |
| 38 | 38 | } |
| 39 | 39 | $out_file = fopen($out_file_name, 'wb'); |
| 40 | - while(!gzeof($file)) { |
|
| 40 | + while (!gzeof($file)) { |
|
| 41 | 41 | fwrite($out_file, gzread($file, $buffer_size)); |
| 42 | 42 | } |
| 43 | 43 | fclose($out_file); |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | try { |
| 62 | 62 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 63 | 63 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 64 | - } catch(PDOException $e) { |
|
| 64 | + } catch (PDOException $e) { |
|
| 65 | 65 | return "error : ".$e->getMessage(); |
| 66 | 66 | } |
| 67 | 67 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | //$Connection = new Connection(); |
| 77 | 77 | $sth = $Connection->db->prepare($query); |
| 78 | 78 | $sth->execute(array(':source' => $database_file)); |
| 79 | - } catch(PDOException $e) { |
|
| 79 | + } catch (PDOException $e) { |
|
| 80 | 80 | return "error : ".$e->getMessage(); |
| 81 | 81 | } |
| 82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | try { |
| 88 | 88 | $sth = update_db::$db_sqlite->prepare($query); |
| 89 | 89 | $sth->execute(); |
| 90 | - } catch(PDOException $e) { |
|
| 90 | + } catch (PDOException $e) { |
|
| 91 | 91 | return "error : ".$e->getMessage(); |
| 92 | 92 | } |
| 93 | 93 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -98,11 +98,11 @@ discard block |
||
| 98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 99 | 99 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 100 | 100 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 101 | - $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
|
| 101 | + $query_dest_values = array(':CallSign' => $values['Callsign'], ':Operator_ICAO' => $values['operator_icao'], ':FromAirport_ICAO' => $values['FromAirportIcao'], ':ToAirport_ICAO' => $values['ToAirportIcao'], ':routestop' => $values['AllStop'], ':source' => $database_file); |
|
| 102 | 102 | $sth_dest->execute($query_dest_values); |
| 103 | 103 | } |
| 104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
| 105 | - } catch(PDOException $e) { |
|
| 105 | + } catch (PDOException $e) { |
|
| 106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
| 107 | 107 | return "error : ".$e->getMessage(); |
| 108 | 108 | } |
@@ -118,26 +118,26 @@ discard block |
||
| 118 | 118 | //$Connection = new Connection(); |
| 119 | 119 | $sth = $Connection->db->prepare($query); |
| 120 | 120 | $sth->execute(array(':source' => 'oneworld')); |
| 121 | - } catch(PDOException $e) { |
|
| 121 | + } catch (PDOException $e) { |
|
| 122 | 122 | return "error : ".$e->getMessage(); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | if ($globalDebug) echo " - Add routes to DB -"; |
| 126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 127 | 127 | $Spotter = new Spotter(); |
| 128 | - if ($fh = fopen($database_file,"r")) { |
|
| 128 | + if ($fh = fopen($database_file, "r")) { |
|
| 129 | 129 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 130 | 130 | $Connection = new Connection(); |
| 131 | 131 | $sth_dest = $Connection->db->prepare($query_dest); |
| 132 | 132 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 133 | 133 | while (!feof($fh)) { |
| 134 | - $line = fgetcsv($fh,9999,','); |
|
| 134 | + $line = fgetcsv($fh, 9999, ','); |
|
| 135 | 135 | if ($line[0] != '') { |
| 136 | 136 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
| 137 | 137 | try { |
| 138 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
|
| 138 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[7]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[5], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[6], ':routestop' => '', ':source' => 'oneworld'); |
|
| 139 | 139 | $sth_dest->execute($query_dest_values); |
| 140 | - } catch(PDOException $e) { |
|
| 140 | + } catch (PDOException $e) { |
|
| 141 | 141 | if ($globalTransaction) $Connection->db->rollBack(); |
| 142 | 142 | return "error : ".$e->getMessage(); |
| 143 | 143 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | //$Connection = new Connection(); |
| 160 | 160 | $sth = $Connection->db->prepare($query); |
| 161 | 161 | $sth->execute(array(':source' => 'skyteam')); |
| 162 | - } catch(PDOException $e) { |
|
| 162 | + } catch (PDOException $e) { |
|
| 163 | 163 | return "error : ".$e->getMessage(); |
| 164 | 164 | } |
| 165 | 165 | |
@@ -167,24 +167,24 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 169 | 169 | $Spotter = new Spotter(); |
| 170 | - if ($fh = fopen($database_file,"r")) { |
|
| 170 | + if ($fh = fopen($database_file, "r")) { |
|
| 171 | 171 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 172 | 172 | $Connection = new Connection(); |
| 173 | 173 | $sth_dest = $Connection->db->prepare($query_dest); |
| 174 | 174 | try { |
| 175 | 175 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 176 | 176 | while (!feof($fh)) { |
| 177 | - $line = fgetcsv($fh,9999,','); |
|
| 177 | + $line = fgetcsv($fh, 9999, ','); |
|
| 178 | 178 | if ($line[0] != '') { |
| 179 | - $datebe = explode(' - ',$line[2]); |
|
| 179 | + $datebe = explode(' - ', $line[2]); |
|
| 180 | 180 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
| 181 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
| 181 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
| 182 | 182 | $sth_dest->execute($query_dest_values); |
| 183 | 183 | } |
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | if ($globalTransaction) $Connection->db->commit(); |
| 187 | - } catch(PDOException $e) { |
|
| 187 | + } catch (PDOException $e) { |
|
| 188 | 188 | if ($globalTransaction) $Connection->db->rollBack(); |
| 189 | 189 | return "error : ".$e->getMessage(); |
| 190 | 190 | } |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | $Connection = new Connection(); |
| 200 | 200 | $sth = $Connection->db->prepare($query); |
| 201 | 201 | $sth->execute(array(':source' => $database_file)); |
| 202 | - } catch(PDOException $e) { |
|
| 202 | + } catch (PDOException $e) { |
|
| 203 | 203 | return "error : ".$e->getMessage(); |
| 204 | 204 | } |
| 205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | $Connection = new Connection(); |
| 208 | 208 | $sth = $Connection->db->prepare($query); |
| 209 | 209 | $sth->execute(array(':source' => $database_file)); |
| 210 | - } catch(PDOException $e) { |
|
| 210 | + } catch (PDOException $e) { |
|
| 211 | 211 | return "error : ".$e->getMessage(); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | try { |
| 217 | 217 | $sth = update_db::$db_sqlite->prepare($query); |
| 218 | 218 | $sth->execute(); |
| 219 | - } catch(PDOException $e) { |
|
| 219 | + } catch (PDOException $e) { |
|
| 220 | 220 | return "error : ".$e->getMessage(); |
| 221 | 221 | } |
| 222 | 222 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -233,15 +233,15 @@ discard block |
||
| 233 | 233 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 235 | 235 | else $type = null; |
| 236 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 236 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
| 237 | 237 | $sth_dest->execute($query_dest_values); |
| 238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 239 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 240 | 240 | $sth_dest_owner->execute($query_dest_owner_values); |
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
| 244 | - } catch(PDOException $e) { |
|
| 244 | + } catch (PDOException $e) { |
|
| 245 | 245 | return "error : ".$e->getMessage(); |
| 246 | 246 | } |
| 247 | 247 | |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | $Connection = new Connection(); |
| 252 | 252 | $sth = $Connection->db->prepare($query); |
| 253 | 253 | $sth->execute(array(':source' => $database_file)); |
| 254 | - } catch(PDOException $e) { |
|
| 254 | + } catch (PDOException $e) { |
|
| 255 | 255 | return "error : ".$e->getMessage(); |
| 256 | 256 | } |
| 257 | 257 | return ''; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | $Connection = new Connection(); |
| 267 | 267 | $sth = $Connection->db->prepare($query); |
| 268 | 268 | $sth->execute(array(':source' => $database_file)); |
| 269 | - } catch(PDOException $e) { |
|
| 269 | + } catch (PDOException $e) { |
|
| 270 | 270 | return "error : ".$e->getMessage(); |
| 271 | 271 | } |
| 272 | 272 | |
| 273 | - if ($fh = fopen($database_file,"r")) { |
|
| 273 | + if ($fh = fopen($database_file, "r")) { |
|
| 274 | 274 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 275 | 275 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
| 276 | 276 | |
@@ -280,13 +280,13 @@ discard block |
||
| 280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 281 | 281 | while (!feof($fh)) { |
| 282 | 282 | $values = array(); |
| 283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 283 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 285 | - $values['ModeS'] = substr($line,0,6); |
|
| 286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 287 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 285 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 286 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 287 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 288 | 288 | // Check if we can find ICAO, else set it to GLID |
| 289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 289 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 290 | 290 | $search_more = ''; |
| 291 | 291 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 292 | 292 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -298,20 +298,20 @@ discard block |
||
| 298 | 298 | if (isset($result['icao']) && $result['icao'] != '') { |
| 299 | 299 | $values['ICAOTypeCode'] = $result['icao']; |
| 300 | 300 | } |
| 301 | - } catch(PDOException $e) { |
|
| 301 | + } catch (PDOException $e) { |
|
| 302 | 302 | return "error : ".$e->getMessage(); |
| 303 | 303 | } |
| 304 | 304 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 305 | 305 | // Add data to db |
| 306 | 306 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 307 | 307 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 308 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
| 308 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
| 309 | 309 | //print_r($query_dest_values); |
| 310 | 310 | $sth_dest->execute($query_dest_values); |
| 311 | 311 | } |
| 312 | 312 | } |
| 313 | 313 | if ($globalTransaction) $Connection->db->commit(); |
| 314 | - } catch(PDOException $e) { |
|
| 314 | + } catch (PDOException $e) { |
|
| 315 | 315 | return "error : ".$e->getMessage(); |
| 316 | 316 | } |
| 317 | 317 | } |
@@ -321,7 +321,7 @@ discard block |
||
| 321 | 321 | $Connection = new Connection(); |
| 322 | 322 | $sth = $Connection->db->prepare($query); |
| 323 | 323 | $sth->execute(array(':source' => $database_file)); |
| 324 | - } catch(PDOException $e) { |
|
| 324 | + } catch (PDOException $e) { |
|
| 325 | 325 | return "error : ".$e->getMessage(); |
| 326 | 326 | } |
| 327 | 327 | return ''; |
@@ -335,11 +335,11 @@ discard block |
||
| 335 | 335 | $Connection = new Connection(); |
| 336 | 336 | $sth = $Connection->db->prepare($query); |
| 337 | 337 | $sth->execute(array(':source' => $database_file)); |
| 338 | - } catch(PDOException $e) { |
|
| 338 | + } catch (PDOException $e) { |
|
| 339 | 339 | return "error : ".$e->getMessage(); |
| 340 | 340 | } |
| 341 | 341 | |
| 342 | - if ($fh = fopen($database_file,"r")) { |
|
| 342 | + if ($fh = fopen($database_file, "r")) { |
|
| 343 | 343 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 344 | 344 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source)'; |
| 345 | 345 | |
@@ -347,9 +347,9 @@ discard block |
||
| 347 | 347 | $sth_dest = $Connection->db->prepare($query_dest); |
| 348 | 348 | try { |
| 349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 350 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 350 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 351 | 351 | while (!feof($fh)) { |
| 352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 352 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 353 | 353 | |
| 354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 355 | 355 | //print_r($line); |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | $values['Registration'] = $line[3]; |
| 358 | 358 | $aircraft_name = $line[2]; |
| 359 | 359 | // Check if we can find ICAO, else set it to GLID |
| 360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 360 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 361 | 361 | $search_more = ''; |
| 362 | 362 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 363 | 363 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -366,20 +366,20 @@ discard block |
||
| 366 | 366 | $sth_search->execute(); |
| 367 | 367 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 368 | 368 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 369 | - } catch(PDOException $e) { |
|
| 369 | + } catch (PDOException $e) { |
|
| 370 | 370 | return "error : ".$e->getMessage(); |
| 371 | 371 | } |
| 372 | 372 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 373 | 373 | // Add data to db |
| 374 | 374 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 375 | 375 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 376 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file); |
|
| 376 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file); |
|
| 377 | 377 | //print_r($query_dest_values); |
| 378 | 378 | $sth_dest->execute($query_dest_values); |
| 379 | 379 | } |
| 380 | 380 | } |
| 381 | 381 | if ($globalTransaction) $Connection->db->commit(); |
| 382 | - } catch(PDOException $e) { |
|
| 382 | + } catch (PDOException $e) { |
|
| 383 | 383 | return "error : ".$e->getMessage(); |
| 384 | 384 | } |
| 385 | 385 | } |
@@ -389,13 +389,13 @@ discard block |
||
| 389 | 389 | $Connection = new Connection(); |
| 390 | 390 | $sth = $Connection->db->prepare($query); |
| 391 | 391 | $sth->execute(array(':source' => $database_file)); |
| 392 | - } catch(PDOException $e) { |
|
| 392 | + } catch (PDOException $e) { |
|
| 393 | 393 | return "error : ".$e->getMessage(); |
| 394 | 394 | } |
| 395 | 395 | return ''; |
| 396 | 396 | } |
| 397 | 397 | |
| 398 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 398 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 399 | 399 | global $globalTransaction; |
| 400 | 400 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 401 | 401 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -403,11 +403,11 @@ discard block |
||
| 403 | 403 | $Connection = new Connection(); |
| 404 | 404 | $sth = $Connection->db->prepare($query); |
| 405 | 405 | $sth->execute(array(':source' => $database_file)); |
| 406 | - } catch(PDOException $e) { |
|
| 406 | + } catch (PDOException $e) { |
|
| 407 | 407 | return "error : ".$e->getMessage(); |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - if ($fh = fopen($database_file,"r")) { |
|
| 410 | + if ($fh = fopen($database_file, "r")) { |
|
| 411 | 411 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 412 | 412 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 413 | 413 | |
@@ -415,9 +415,9 @@ discard block |
||
| 415 | 415 | $sth_dest = $Connection->db->prepare($query_dest); |
| 416 | 416 | try { |
| 417 | 417 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 418 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 418 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 419 | 419 | while (!feof($fh)) { |
| 420 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 420 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 421 | 421 | $values = array(); |
| 422 | 422 | //print_r($line); |
| 423 | 423 | if ($country == 'F') { |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | $values['base'] = $line[4]; |
| 426 | 426 | $values['owner'] = $line[5]; |
| 427 | 427 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 428 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 428 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 429 | 429 | $values['cancel'] = $line[7]; |
| 430 | 430 | } elseif ($country == 'EI') { |
| 431 | 431 | // TODO : add modeS & reg to aircraft_modes |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $values['base'] = $line[3]; |
| 434 | 434 | $values['owner'] = $line[2]; |
| 435 | 435 | if ($line[1] == '') $values['date_first_reg'] = null; |
| 436 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 436 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 437 | 437 | $values['cancel'] = ''; |
| 438 | 438 | } elseif ($country == 'HB') { |
| 439 | 439 | // TODO : add modeS & reg to aircraft_modes |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | $values['base'] = null; |
| 449 | 449 | $values['owner'] = $line[5]; |
| 450 | 450 | if ($line[18] == '') $values['date_first_reg'] = null; |
| 451 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 451 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 452 | 452 | $values['cancel'] = ''; |
| 453 | 453 | } elseif ($country == 'VH') { |
| 454 | 454 | // TODO : add modeS & reg to aircraft_modes |
@@ -456,7 +456,7 @@ discard block |
||
| 456 | 456 | $values['base'] = null; |
| 457 | 457 | $values['owner'] = $line[12]; |
| 458 | 458 | if ($line[28] == '') $values['date_first_reg'] = null; |
| 459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 459 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 460 | 460 | |
| 461 | 461 | $values['cancel'] = $line[39]; |
| 462 | 462 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -476,28 +476,28 @@ discard block |
||
| 476 | 476 | $values['base'] = null; |
| 477 | 477 | $values['owner'] = $line[8]; |
| 478 | 478 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 479 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 479 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 480 | 480 | $values['cancel'] = ''; |
| 481 | 481 | } elseif ($country == 'PP') { |
| 482 | 482 | $values['registration'] = $line[0]; |
| 483 | 483 | $values['base'] = null; |
| 484 | 484 | $values['owner'] = $line[4]; |
| 485 | 485 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 486 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 486 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 487 | 487 | $values['cancel'] = $line[7]; |
| 488 | 488 | } elseif ($country == 'E7') { |
| 489 | 489 | $values['registration'] = $line[0]; |
| 490 | 490 | $values['base'] = null; |
| 491 | 491 | $values['owner'] = $line[4]; |
| 492 | 492 | if ($line[5] == '') $values['date_first_reg'] = null; |
| 493 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 493 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 494 | 494 | $values['cancel'] = ''; |
| 495 | 495 | } elseif ($country == '8Q') { |
| 496 | 496 | $values['registration'] = $line[0]; |
| 497 | 497 | $values['base'] = null; |
| 498 | 498 | $values['owner'] = $line[3]; |
| 499 | 499 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 500 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 500 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 501 | 501 | $values['cancel'] = ''; |
| 502 | 502 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 503 | 503 | $values['registration'] = $line[0]; |
@@ -507,12 +507,12 @@ discard block |
||
| 507 | 507 | $values['cancel'] = ''; |
| 508 | 508 | } |
| 509 | 509 | if ($values['cancel'] == '' && $values['registration'] != null) { |
| 510 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 510 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 511 | 511 | $sth_dest->execute($query_dest_values); |
| 512 | 512 | } |
| 513 | 513 | } |
| 514 | 514 | if ($globalTransaction) $Connection->db->commit(); |
| 515 | - } catch(PDOException $e) { |
|
| 515 | + } catch (PDOException $e) { |
|
| 516 | 516 | return "error : ".$e->getMessage(); |
| 517 | 517 | } |
| 518 | 518 | } |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | $Connection = new Connection(); |
| 628 | 628 | $sth = $Connection->db->prepare($query); |
| 629 | 629 | $sth->execute(); |
| 630 | - } catch(PDOException $e) { |
|
| 630 | + } catch (PDOException $e) { |
|
| 631 | 631 | return "error : ".$e->getMessage(); |
| 632 | 632 | } |
| 633 | 633 | |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $Connection = new Connection(); |
| 638 | 638 | $sth = $Connection->db->prepare($query); |
| 639 | 639 | $sth->execute(); |
| 640 | - } catch(PDOException $e) { |
|
| 640 | + } catch (PDOException $e) { |
|
| 641 | 641 | return "error : ".$e->getMessage(); |
| 642 | 642 | } |
| 643 | 643 | |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 649 | 649 | |
| 650 | 650 | $i = 0; |
| 651 | - while($row = sparql_fetch_array($result)) |
|
| 651 | + while ($row = sparql_fetch_array($result)) |
|
| 652 | 652 | { |
| 653 | 653 | if ($i >= 1) { |
| 654 | 654 | //print_r($row); |
@@ -668,31 +668,31 @@ discard block |
||
| 668 | 668 | $row['image'] = ''; |
| 669 | 669 | $row['image_thumb'] = ''; |
| 670 | 670 | } else { |
| 671 | - $image = str_replace(' ','_',$row['image']); |
|
| 671 | + $image = str_replace(' ', '_', $row['image']); |
|
| 672 | 672 | $digest = md5($image); |
| 673 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 674 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 675 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 676 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 673 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 674 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 675 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 676 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | - $country = explode('-',$row['country']); |
|
| 679 | + $country = explode('-', $row['country']); |
|
| 680 | 680 | $row['country'] = $country[0]; |
| 681 | 681 | |
| 682 | 682 | $row['type'] = trim($row['type']); |
| 683 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
| 683 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
| 684 | 684 | $row['type'] = 'Military'; |
| 685 | 685 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
| 686 | 686 | $row['type'] = 'small_airport'; |
| 687 | 687 | } |
| 688 | 688 | |
| 689 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 690 | - $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => $row['altitude'],':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 689 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 690 | + $query_dest_values = array(':airport_id' => $i, ':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => $row['altitude'], ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
| 691 | 691 | //print_r($query_dest_values); |
| 692 | 692 | |
| 693 | 693 | try { |
| 694 | 694 | $sth_dest->execute($query_dest_values); |
| 695 | - } catch(PDOException $e) { |
|
| 695 | + } catch (PDOException $e) { |
|
| 696 | 696 | return "error : ".$e->getMessage(); |
| 697 | 697 | } |
| 698 | 698 | } |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | $Connection = new Connection(); |
| 707 | 707 | $sth = $Connection->db->prepare($query); |
| 708 | 708 | $sth->execute(); |
| 709 | - } catch(PDOException $e) { |
|
| 709 | + } catch (PDOException $e) { |
|
| 710 | 710 | return "error : ".$e->getMessage(); |
| 711 | 711 | } |
| 712 | 712 | |
@@ -714,12 +714,12 @@ discard block |
||
| 714 | 714 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
| 715 | 715 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
| 716 | 716 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
| 717 | - $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
|
| 717 | + $query_values = array(':airport_id' => $i, ':name' => 'Not available', ':iata' => 'NA', ':icao' => 'NA', ':latitude' => '0', ':longitude' => '0', ':altitude' => '0', ':type' => 'NA', ':city' => 'N/A', ':country' => 'N/A', ':home_link' => '', ':wikipedia_link' => '', ':image' => '', ':image_thumb' => ''); |
|
| 718 | 718 | try { |
| 719 | 719 | $Connection = new Connection(); |
| 720 | 720 | $sth = $Connection->db->prepare($query); |
| 721 | 721 | $sth->execute($query_values); |
| 722 | - } catch(PDOException $e) { |
|
| 722 | + } catch (PDOException $e) { |
|
| 723 | 723 | return "error : ".$e->getMessage(); |
| 724 | 724 | } |
| 725 | 725 | $i++; |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | echo "Download data from ourairports.com...\n"; |
| 738 | 738 | $delimiter = ','; |
| 739 | 739 | $out_file = $tmp_dir.'airports.csv'; |
| 740 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 740 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 741 | 741 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 742 | 742 | echo "Add data from ourairports.com...\n"; |
| 743 | 743 | |
@@ -748,32 +748,32 @@ discard block |
||
| 748 | 748 | //$Connection->db->beginTransaction(); |
| 749 | 749 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 750 | 750 | { |
| 751 | - if(!$header) $header = $row; |
|
| 751 | + if (!$header) $header = $row; |
|
| 752 | 752 | else { |
| 753 | 753 | $data = array(); |
| 754 | 754 | $data = array_combine($header, $row); |
| 755 | 755 | try { |
| 756 | 756 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE `icao` = :icao'); |
| 757 | 757 | $sth->execute(array(':icao' => $data['gps_code'])); |
| 758 | - } catch(PDOException $e) { |
|
| 758 | + } catch (PDOException $e) { |
|
| 759 | 759 | return "error : ".$e->getMessage(); |
| 760 | 760 | } |
| 761 | 761 | if ($sth->fetchColumn() > 0) { |
| 762 | 762 | $query = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 763 | 763 | try { |
| 764 | 764 | $sth = $Connection->db->prepare($query); |
| 765 | - $sth->execute(array(':icao' => $data['gps_code'],':type' => $data['type'])); |
|
| 766 | - } catch(PDOException $e) { |
|
| 765 | + $sth->execute(array(':icao' => $data['gps_code'], ':type' => $data['type'])); |
|
| 766 | + } catch (PDOException $e) { |
|
| 767 | 767 | return "error : ".$e->getMessage(); |
| 768 | 768 | } |
| 769 | 769 | } else { |
| 770 | 770 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`) |
| 771 | 771 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 772 | - $query_values = array(':airport_id' => $i, ':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => $data['elevation_ft'],':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
| 772 | + $query_values = array(':airport_id' => $i, ':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => $data['elevation_ft'], ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
| 773 | 773 | try { |
| 774 | 774 | $sth = $Connection->db->prepare($query); |
| 775 | 775 | $sth->execute($query_values); |
| 776 | - } catch(PDOException $e) { |
|
| 776 | + } catch (PDOException $e) { |
|
| 777 | 777 | return "error : ".$e->getMessage(); |
| 778 | 778 | } |
| 779 | 779 | $i++; |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | |
| 787 | 787 | echo "Download data from another free database...\n"; |
| 788 | 788 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 789 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 789 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 790 | 790 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 791 | 791 | update_db::unzip($out_file); |
| 792 | 792 | $header = NULL; |
@@ -798,15 +798,15 @@ discard block |
||
| 798 | 798 | //$Connection->db->beginTransaction(); |
| 799 | 799 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 800 | 800 | { |
| 801 | - if(!$header) $header = $row; |
|
| 801 | + if (!$header) $header = $row; |
|
| 802 | 802 | else { |
| 803 | 803 | $data = $row; |
| 804 | 804 | |
| 805 | 805 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
| 806 | 806 | try { |
| 807 | 807 | $sth = $Connection->db->prepare($query); |
| 808 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 809 | - } catch(PDOException $e) { |
|
| 808 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 809 | + } catch (PDOException $e) { |
|
| 810 | 810 | return "error : ".$e->getMessage(); |
| 811 | 811 | } |
| 812 | 812 | } |
@@ -820,15 +820,15 @@ discard block |
||
| 820 | 820 | try { |
| 821 | 821 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE `name` LIKE '%Air Base%'"); |
| 822 | 822 | $sth->execute(); |
| 823 | - } catch(PDOException $e) { |
|
| 823 | + } catch (PDOException $e) { |
|
| 824 | 824 | return "error : ".$e->getMessage(); |
| 825 | 825 | } |
| 826 | 826 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 827 | 827 | $query2 = 'UPDATE airport SET `type` = :type WHERE icao = :icao'; |
| 828 | 828 | try { |
| 829 | 829 | $sth2 = $Connection->db->prepare($query2); |
| 830 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 831 | - } catch(PDOException $e) { |
|
| 830 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 831 | + } catch (PDOException $e) { |
|
| 832 | 832 | return "error : ".$e->getMessage(); |
| 833 | 833 | } |
| 834 | 834 | } |
@@ -852,7 +852,7 @@ discard block |
||
| 852 | 852 | $Connection = new Connection(); |
| 853 | 853 | $sth = $Connection->db->prepare($query); |
| 854 | 854 | $sth->execute(array(':source' => 'translation.csv')); |
| 855 | - } catch(PDOException $e) { |
|
| 855 | + } catch (PDOException $e) { |
|
| 856 | 856 | return "error : ".$e->getMessage(); |
| 857 | 857 | } |
| 858 | 858 | |
@@ -869,7 +869,7 @@ discard block |
||
| 869 | 869 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 870 | 870 | { |
| 871 | 871 | $i++; |
| 872 | - if($i > 12) { |
|
| 872 | + if ($i > 12) { |
|
| 873 | 873 | $data = $row; |
| 874 | 874 | $operator = $data[2]; |
| 875 | 875 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -877,7 +877,7 @@ discard block |
||
| 877 | 877 | //echo substr($operator, 0, 2)."\n";; |
| 878 | 878 | if (count($airline_array) > 0) { |
| 879 | 879 | //print_r($airline_array); |
| 880 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 880 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 881 | 881 | } |
| 882 | 882 | } |
| 883 | 883 | |
@@ -885,14 +885,14 @@ discard block |
||
| 885 | 885 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 886 | 886 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 887 | 887 | if (count($airline_array) > 0) { |
| 888 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 888 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 892 | 892 | try { |
| 893 | 893 | $sth = $Connection->db->prepare($query); |
| 894 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 895 | - } catch(PDOException $e) { |
|
| 894 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 895 | + } catch (PDOException $e) { |
|
| 896 | 896 | return "error : ".$e->getMessage(); |
| 897 | 897 | } |
| 898 | 898 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | $Connection = new Connection(); |
| 913 | 913 | $sth = $Connection->db->prepare($query); |
| 914 | 914 | $sth->execute(array(':source' => 'website_fam')); |
| 915 | - } catch(PDOException $e) { |
|
| 915 | + } catch (PDOException $e) { |
|
| 916 | 916 | return "error : ".$e->getMessage(); |
| 917 | 917 | } |
| 918 | 918 | |
@@ -932,8 +932,8 @@ discard block |
||
| 932 | 932 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 933 | 933 | try { |
| 934 | 934 | $sth = $Connection->db->prepare($query); |
| 935 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 936 | - } catch(PDOException $e) { |
|
| 935 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 936 | + } catch (PDOException $e) { |
|
| 937 | 937 | return "error : ".$e->getMessage(); |
| 938 | 938 | } |
| 939 | 939 | } |
@@ -956,7 +956,7 @@ discard block |
||
| 956 | 956 | $Connection = new Connection(); |
| 957 | 957 | $sth = $Connection->db->prepare($query); |
| 958 | 958 | $sth->execute(array(':source' => 'website_faa')); |
| 959 | - } catch(PDOException $e) { |
|
| 959 | + } catch (PDOException $e) { |
|
| 960 | 960 | return "error : ".$e->getMessage(); |
| 961 | 961 | } |
| 962 | 962 | |
@@ -965,7 +965,7 @@ discard block |
||
| 965 | 965 | $Connection = new Connection(); |
| 966 | 966 | $sth = $Connection->db->prepare($query); |
| 967 | 967 | $sth->execute(array(':source' => 'website_faa')); |
| 968 | - } catch(PDOException $e) { |
|
| 968 | + } catch (PDOException $e) { |
|
| 969 | 969 | return "error : ".$e->getMessage(); |
| 970 | 970 | } |
| 971 | 971 | |
@@ -981,8 +981,8 @@ discard block |
||
| 981 | 981 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
| 982 | 982 | try { |
| 983 | 983 | $sths = $Connection->db->prepare($query_search); |
| 984 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
| 985 | - } catch(PDOException $e) { |
|
| 984 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
| 985 | + } catch (PDOException $e) { |
|
| 986 | 986 | return "error s : ".$e->getMessage(); |
| 987 | 987 | } |
| 988 | 988 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -991,8 +991,8 @@ discard block |
||
| 991 | 991 | $queryi = 'UPDATE aircraft SET mfr = :mfr WHERE icao = :icao'; |
| 992 | 992 | try { |
| 993 | 993 | $sthi = $Connection->db->prepare($queryi); |
| 994 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
| 995 | - } catch(PDOException $e) { |
|
| 994 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
| 995 | + } catch (PDOException $e) { |
|
| 996 | 996 | return "error u : ".$e->getMessage(); |
| 997 | 997 | } |
| 998 | 998 | } else { |
@@ -1000,7 +1000,7 @@ discard block |
||
| 1000 | 1000 | try { |
| 1001 | 1001 | $sthsm = $Connection->db->prepare($query_search_mfr); |
| 1002 | 1002 | $sthsm->execute(array(':mfr' => $data[2])); |
| 1003 | - } catch(PDOException $e) { |
|
| 1003 | + } catch (PDOException $e) { |
|
| 1004 | 1004 | return "error mfr : ".$e->getMessage(); |
| 1005 | 1005 | } |
| 1006 | 1006 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1010,8 +1010,8 @@ discard block |
||
| 1010 | 1010 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1011 | 1011 | try { |
| 1012 | 1012 | $sthf = $Connection->db->prepare($queryf); |
| 1013 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
| 1014 | - } catch(PDOException $e) { |
|
| 1013 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
| 1014 | + } catch (PDOException $e) { |
|
| 1015 | 1015 | return "error f : ".$e->getMessage(); |
| 1016 | 1016 | } |
| 1017 | 1017 | } |
@@ -1021,13 +1021,13 @@ discard block |
||
| 1021 | 1021 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1022 | 1022 | try { |
| 1023 | 1023 | $sth = $Connection->db->prepare($query); |
| 1024 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1025 | - } catch(PDOException $e) { |
|
| 1024 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1025 | + } catch (PDOException $e) { |
|
| 1026 | 1026 | return "error i : ".$e->getMessage(); |
| 1027 | 1027 | } |
| 1028 | 1028 | } |
| 1029 | 1029 | } |
| 1030 | - if ($i % 90 == 0) { |
|
| 1030 | + if ($i%90 == 0) { |
|
| 1031 | 1031 | if ($globalTransaction) $Connection->db->commit(); |
| 1032 | 1032 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1033 | 1033 | } |
@@ -1045,7 +1045,7 @@ discard block |
||
| 1045 | 1045 | $Connection = new Connection(); |
| 1046 | 1046 | $sth = $Connection->db->prepare($query); |
| 1047 | 1047 | $sth->execute(array(':source' => 'website_fam')); |
| 1048 | - } catch(PDOException $e) { |
|
| 1048 | + } catch (PDOException $e) { |
|
| 1049 | 1049 | return "error : ".$e->getMessage(); |
| 1050 | 1050 | } |
| 1051 | 1051 | |
@@ -1065,8 +1065,8 @@ discard block |
||
| 1065 | 1065 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1066 | 1066 | try { |
| 1067 | 1067 | $sth = $Connection->db->prepare($query); |
| 1068 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
| 1069 | - } catch(PDOException $e) { |
|
| 1068 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
| 1069 | + } catch (PDOException $e) { |
|
| 1070 | 1070 | return "error : ".$e->getMessage(); |
| 1071 | 1071 | } |
| 1072 | 1072 | } |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | $Connection = new Connection(); |
| 1086 | 1086 | $sth = $Connection->db->prepare($query); |
| 1087 | 1087 | $sth->execute(array(':source' => 'website_fam')); |
| 1088 | - } catch(PDOException $e) { |
|
| 1088 | + } catch (PDOException $e) { |
|
| 1089 | 1089 | return "error : ".$e->getMessage(); |
| 1090 | 1090 | } |
| 1091 | 1091 | |
@@ -1101,8 +1101,8 @@ discard block |
||
| 1101 | 1101 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
| 1102 | 1102 | try { |
| 1103 | 1103 | $sth = $Connection->db->prepare($query); |
| 1104 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1105 | - } catch(PDOException $e) { |
|
| 1104 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1105 | + } catch (PDOException $e) { |
|
| 1106 | 1106 | print_r($data); |
| 1107 | 1107 | return "error : ".$e->getMessage(); |
| 1108 | 1108 | } |
@@ -1122,7 +1122,7 @@ discard block |
||
| 1122 | 1122 | $Connection = new Connection(); |
| 1123 | 1123 | $sth = $Connection->db->prepare($query); |
| 1124 | 1124 | $sth->execute(array(':source' => 'website_fam')); |
| 1125 | - } catch(PDOException $e) { |
|
| 1125 | + } catch (PDOException $e) { |
|
| 1126 | 1126 | return "error : ".$e->getMessage(); |
| 1127 | 1127 | } |
| 1128 | 1128 | |
@@ -1142,8 +1142,8 @@ discard block |
||
| 1142 | 1142 | $query = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign,:Operator_ICAO,:FromAirport_ICAO,:FromAirport_Time,:ToAirport_ICAO,:ToAirport_Time,:RouteStop,:source)'; |
| 1143 | 1143 | try { |
| 1144 | 1144 | $sth = $Connection->db->prepare($query); |
| 1145 | - $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
|
| 1146 | - } catch(PDOException $e) { |
|
| 1145 | + $sth->execute(array(':CallSign' => $data[0], ':Operator_ICAO' => $data[1], ':FromAirport_ICAO' => $data[2], ':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4], ':ToAirport_Time' => $data[5], ':RouteStop' => $data[6], ':source' => 'website_fam')); |
|
| 1146 | + } catch (PDOException $e) { |
|
| 1147 | 1147 | return "error : ".$e->getMessage(); |
| 1148 | 1148 | } |
| 1149 | 1149 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | return ''; |
| 1156 | 1156 | } |
| 1157 | 1157 | |
| 1158 | - public static function tle($filename,$tletype) { |
|
| 1158 | + public static function tle($filename, $tletype) { |
|
| 1159 | 1159 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1160 | 1160 | global $tmp_dir, $globalTransaction; |
| 1161 | 1161 | //$Spotter = new Spotter(); |
@@ -1165,7 +1165,7 @@ discard block |
||
| 1165 | 1165 | $Connection = new Connection(); |
| 1166 | 1166 | $sth = $Connection->db->prepare($query); |
| 1167 | 1167 | $sth->execute(array(':source' => $filename)); |
| 1168 | - } catch(PDOException $e) { |
|
| 1168 | + } catch (PDOException $e) { |
|
| 1169 | 1169 | return "error : ".$e->getMessage(); |
| 1170 | 1170 | } |
| 1171 | 1171 | |
@@ -1190,8 +1190,8 @@ discard block |
||
| 1190 | 1190 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
| 1191 | 1191 | try { |
| 1192 | 1192 | $sth = $Connection->db->prepare($query); |
| 1193 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
| 1194 | - } catch(PDOException $e) { |
|
| 1193 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
| 1194 | + } catch (PDOException $e) { |
|
| 1195 | 1195 | return "error : ".$e->getMessage(); |
| 1196 | 1196 | } |
| 1197 | 1197 | |
@@ -1211,28 +1211,28 @@ discard block |
||
| 1211 | 1211 | */ |
| 1212 | 1212 | private static function table2array($data) { |
| 1213 | 1213 | $html = str_get_html($data); |
| 1214 | - $tabledata=array(); |
|
| 1215 | - foreach($html->find('tr') as $element) |
|
| 1214 | + $tabledata = array(); |
|
| 1215 | + foreach ($html->find('tr') as $element) |
|
| 1216 | 1216 | { |
| 1217 | 1217 | $td = array(); |
| 1218 | - foreach( $element->find('th') as $row) |
|
| 1218 | + foreach ($element->find('th') as $row) |
|
| 1219 | 1219 | { |
| 1220 | 1220 | $td [] = trim($row->plaintext); |
| 1221 | 1221 | } |
| 1222 | - $td=array_filter($td); |
|
| 1222 | + $td = array_filter($td); |
|
| 1223 | 1223 | $tabledata[] = $td; |
| 1224 | 1224 | |
| 1225 | 1225 | $td = array(); |
| 1226 | 1226 | $tdi = array(); |
| 1227 | - foreach( $element->find('td') as $row) |
|
| 1227 | + foreach ($element->find('td') as $row) |
|
| 1228 | 1228 | { |
| 1229 | 1229 | $td [] = trim($row->plaintext); |
| 1230 | 1230 | $tdi [] = trim($row->innertext); |
| 1231 | 1231 | } |
| 1232 | - $td=array_filter($td); |
|
| 1233 | - $tdi=array_filter($tdi); |
|
| 1232 | + $td = array_filter($td); |
|
| 1233 | + $tdi = array_filter($tdi); |
|
| 1234 | 1234 | // $tabledata[]=array_merge($td,$tdi); |
| 1235 | - $tabledata[]=$td; |
|
| 1235 | + $tabledata[] = $td; |
|
| 1236 | 1236 | } |
| 1237 | 1237 | return(array_filter($tabledata)); |
| 1238 | 1238 | } |
@@ -1305,13 +1305,13 @@ discard block |
||
| 1305 | 1305 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1306 | 1306 | { |
| 1307 | 1307 | $i++; |
| 1308 | - if($i > 3 && count($row) > 2) { |
|
| 1308 | + if ($i > 3 && count($row) > 2) { |
|
| 1309 | 1309 | $data = array_values(array_filter($row)); |
| 1310 | 1310 | $cntdata = count($data); |
| 1311 | 1311 | if ($cntdata > 10) { |
| 1312 | 1312 | $value = $data[9]; |
| 1313 | 1313 | |
| 1314 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 1314 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 1315 | 1315 | $value .= ' '.$data[$i]; |
| 1316 | 1316 | } |
| 1317 | 1317 | $data[9] = $value; |
@@ -1321,8 +1321,8 @@ discard block |
||
| 1321 | 1321 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
| 1322 | 1322 | try { |
| 1323 | 1323 | $sth = $Connection->db->prepare($query); |
| 1324 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1325 | - } catch(PDOException $e) { |
|
| 1324 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1325 | + } catch (PDOException $e) { |
|
| 1326 | 1326 | return "error : ".$e->getMessage(); |
| 1327 | 1327 | } |
| 1328 | 1328 | } |
@@ -1343,7 +1343,7 @@ discard block |
||
| 1343 | 1343 | $Connection = new Connection(); |
| 1344 | 1344 | $sth = $Connection->db->prepare($query); |
| 1345 | 1345 | $sth->execute(); |
| 1346 | - } catch(PDOException $e) { |
|
| 1346 | + } catch (PDOException $e) { |
|
| 1347 | 1347 | return "error : ".$e->getMessage(); |
| 1348 | 1348 | } |
| 1349 | 1349 | |
@@ -1355,12 +1355,12 @@ discard block |
||
| 1355 | 1355 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1356 | 1356 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1357 | 1357 | { |
| 1358 | - if(count($row) > 1) { |
|
| 1358 | + if (count($row) > 1) { |
|
| 1359 | 1359 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
| 1360 | 1360 | try { |
| 1361 | 1361 | $sth = $Connection->db->prepare($query); |
| 1362 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 1363 | - } catch(PDOException $e) { |
|
| 1362 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 1363 | + } catch (PDOException $e) { |
|
| 1364 | 1364 | return "error : ".$e->getMessage(); |
| 1365 | 1365 | } |
| 1366 | 1366 | } |
@@ -1380,21 +1380,21 @@ discard block |
||
| 1380 | 1380 | try { |
| 1381 | 1381 | $sth = $Connection->db->prepare($query); |
| 1382 | 1382 | $sth->execute(); |
| 1383 | - } catch(PDOException $e) { |
|
| 1383 | + } catch (PDOException $e) { |
|
| 1384 | 1384 | return "error : ".$e->getMessage(); |
| 1385 | 1385 | } |
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | |
| 1389 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1389 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1390 | 1390 | else { |
| 1391 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1391 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1392 | 1392 | $query = "CREATE EXTENSION postgis"; |
| 1393 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 1393 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 1394 | 1394 | try { |
| 1395 | 1395 | $sth = $Connection->db->prepare($query); |
| 1396 | 1396 | $sth->execute(); |
| 1397 | - } catch(PDOException $e) { |
|
| 1397 | + } catch (PDOException $e) { |
|
| 1398 | 1398 | return "error : ".$e->getMessage(); |
| 1399 | 1399 | } |
| 1400 | 1400 | } |
@@ -1407,7 +1407,7 @@ discard block |
||
| 1407 | 1407 | include_once('class.create_db.php'); |
| 1408 | 1408 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 1409 | 1409 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
| 1410 | - update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
| 1410 | + update_db::download('http://data.flightairmap.fr/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
| 1411 | 1411 | $error = ''; |
| 1412 | 1412 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 1413 | 1413 | if ($globalDebug) echo "Gunzip..."; |
@@ -1439,14 +1439,14 @@ discard block |
||
| 1439 | 1439 | try { |
| 1440 | 1440 | $sth = $Connection->db->prepare($query); |
| 1441 | 1441 | $sth->execute(); |
| 1442 | - } catch(PDOException $e) { |
|
| 1442 | + } catch (PDOException $e) { |
|
| 1443 | 1443 | echo "error : ".$e->getMessage(); |
| 1444 | 1444 | } |
| 1445 | 1445 | } |
| 1446 | 1446 | if ($globalDBdriver == 'mysql') { |
| 1447 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1447 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1448 | 1448 | } else { |
| 1449 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 1449 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 1450 | 1450 | } |
| 1451 | 1451 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 1452 | 1452 | return $error; |
@@ -1459,7 +1459,7 @@ discard block |
||
| 1459 | 1459 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 1460 | 1460 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 1461 | 1461 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
| 1462 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
| 1462 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
| 1463 | 1463 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 1464 | 1464 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 1465 | 1465 | return $error; |
@@ -1479,7 +1479,7 @@ discard block |
||
| 1479 | 1479 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1480 | 1480 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 1481 | 1481 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1482 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1482 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1483 | 1483 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 1484 | 1484 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 1485 | 1485 | if ($error != '') { |
@@ -1492,7 +1492,7 @@ discard block |
||
| 1492 | 1492 | global $tmp_dir, $globalDebug; |
| 1493 | 1493 | $error = ''; |
| 1494 | 1494 | if ($globalDebug) echo "Routes : Download..."; |
| 1495 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 1495 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 1496 | 1496 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1497 | 1497 | if ($globalDebug) echo "Gunzip..."; |
| 1498 | 1498 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -1508,7 +1508,7 @@ discard block |
||
| 1508 | 1508 | global $tmp_dir, $globalDebug; |
| 1509 | 1509 | $error = ''; |
| 1510 | 1510 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
| 1511 | - update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
| 1511 | + update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
| 1512 | 1512 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 1513 | 1513 | if ($globalDebug) echo "Gunzip..."; |
| 1514 | 1514 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -1524,7 +1524,7 @@ discard block |
||
| 1524 | 1524 | global $tmp_dir, $globalDebug; |
| 1525 | 1525 | $error = ''; |
| 1526 | 1526 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
| 1527 | - update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
| 1527 | + update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
| 1528 | 1528 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 1529 | 1529 | if ($globalDebug) echo "Gunzip..."; |
| 1530 | 1530 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -1552,7 +1552,7 @@ discard block |
||
| 1552 | 1552 | */ |
| 1553 | 1553 | if ($globalDebug) echo "Modes : Download..."; |
| 1554 | 1554 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 1555 | - update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
| 1555 | + update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
| 1556 | 1556 | |
| 1557 | 1557 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 1558 | 1558 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -1572,7 +1572,7 @@ discard block |
||
| 1572 | 1572 | public static function update_ModeS_faa() { |
| 1573 | 1573 | global $tmp_dir, $globalDebug; |
| 1574 | 1574 | if ($globalDebug) echo "Modes FAA: Download..."; |
| 1575 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
| 1575 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
| 1576 | 1576 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 1577 | 1577 | if ($globalDebug) echo "Unzip..."; |
| 1578 | 1578 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -1588,7 +1588,7 @@ discard block |
||
| 1588 | 1588 | public static function update_ModeS_flarm() { |
| 1589 | 1589 | global $tmp_dir, $globalDebug; |
| 1590 | 1590 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 1591 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 1591 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 1592 | 1592 | if (file_exists($tmp_dir.'data.fln')) { |
| 1593 | 1593 | if ($globalDebug) echo "Add to DB..."; |
| 1594 | 1594 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -1602,7 +1602,7 @@ discard block |
||
| 1602 | 1602 | public static function update_ModeS_ogn() { |
| 1603 | 1603 | global $tmp_dir, $globalDebug; |
| 1604 | 1604 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 1605 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 1605 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 1606 | 1606 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 1607 | 1607 | if ($globalDebug) echo "Add to DB..."; |
| 1608 | 1608 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -1617,173 +1617,173 @@ discard block |
||
| 1617 | 1617 | global $tmp_dir, $globalDebug; |
| 1618 | 1618 | |
| 1619 | 1619 | if ($globalDebug) echo "Owner France: Download..."; |
| 1620 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 1620 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 1621 | 1621 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 1622 | 1622 | if ($globalDebug) echo "Add to DB..."; |
| 1623 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 1623 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 1624 | 1624 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 1625 | 1625 | if ($error != '') { |
| 1626 | 1626 | return $error; |
| 1627 | 1627 | } elseif ($globalDebug) echo "Done\n"; |
| 1628 | 1628 | |
| 1629 | 1629 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 1630 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 1630 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 1631 | 1631 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 1632 | 1632 | if ($globalDebug) echo "Add to DB..."; |
| 1633 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 1633 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 1634 | 1634 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 1635 | 1635 | if ($error != '') { |
| 1636 | 1636 | return $error; |
| 1637 | 1637 | } elseif ($globalDebug) echo "Done\n"; |
| 1638 | 1638 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 1639 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 1639 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 1640 | 1640 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 1641 | 1641 | if ($globalDebug) echo "Add to DB..."; |
| 1642 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 1642 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 1643 | 1643 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 1644 | 1644 | if ($error != '') { |
| 1645 | 1645 | return $error; |
| 1646 | 1646 | } elseif ($globalDebug) echo "Done\n"; |
| 1647 | 1647 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 1648 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 1648 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 1649 | 1649 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 1650 | 1650 | if ($globalDebug) echo "Add to DB..."; |
| 1651 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 1651 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 1652 | 1652 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 1653 | 1653 | if ($error != '') { |
| 1654 | 1654 | return $error; |
| 1655 | 1655 | } elseif ($globalDebug) echo "Done\n"; |
| 1656 | 1656 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 1657 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 1657 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 1658 | 1658 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 1659 | 1659 | if ($globalDebug) echo "Add to DB..."; |
| 1660 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 1660 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 1661 | 1661 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 1662 | 1662 | if ($error != '') { |
| 1663 | 1663 | return $error; |
| 1664 | 1664 | } elseif ($globalDebug) echo "Done\n"; |
| 1665 | 1665 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 1666 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 1666 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 1667 | 1667 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 1668 | 1668 | if ($globalDebug) echo "Add to DB..."; |
| 1669 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 1669 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 1670 | 1670 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 1671 | 1671 | if ($error != '') { |
| 1672 | 1672 | return $error; |
| 1673 | 1673 | } elseif ($globalDebug) echo "Done\n"; |
| 1674 | 1674 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 1675 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 1675 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 1676 | 1676 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 1677 | 1677 | if ($globalDebug) echo "Add to DB..."; |
| 1678 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 1678 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 1679 | 1679 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 1680 | 1680 | if ($error != '') { |
| 1681 | 1681 | return $error; |
| 1682 | 1682 | } elseif ($globalDebug) echo "Done\n"; |
| 1683 | 1683 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 1684 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 1684 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 1685 | 1685 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 1686 | 1686 | if ($globalDebug) echo "Add to DB..."; |
| 1687 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 1687 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 1688 | 1688 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 1689 | 1689 | if ($error != '') { |
| 1690 | 1690 | return $error; |
| 1691 | 1691 | } elseif ($globalDebug) echo "Done\n"; |
| 1692 | 1692 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 1693 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 1693 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 1694 | 1694 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 1695 | 1695 | if ($globalDebug) echo "Add to DB..."; |
| 1696 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 1696 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 1697 | 1697 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 1698 | 1698 | if ($error != '') { |
| 1699 | 1699 | return $error; |
| 1700 | 1700 | } elseif ($globalDebug) echo "Done\n"; |
| 1701 | 1701 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 1702 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 1702 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 1703 | 1703 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 1704 | 1704 | if ($globalDebug) echo "Add to DB..."; |
| 1705 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 1705 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 1706 | 1706 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 1707 | 1707 | if ($error != '') { |
| 1708 | 1708 | return $error; |
| 1709 | 1709 | } elseif ($globalDebug) echo "Done\n"; |
| 1710 | 1710 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 1711 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 1711 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 1712 | 1712 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 1713 | 1713 | if ($globalDebug) echo "Add to DB..."; |
| 1714 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 1714 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 1715 | 1715 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 1716 | 1716 | if ($error != '') { |
| 1717 | 1717 | return $error; |
| 1718 | 1718 | } elseif ($globalDebug) echo "Done\n"; |
| 1719 | 1719 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 1720 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 1720 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 1721 | 1721 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 1722 | 1722 | if ($globalDebug) echo "Add to DB..."; |
| 1723 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 1723 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 1724 | 1724 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 1725 | 1725 | if ($error != '') { |
| 1726 | 1726 | return $error; |
| 1727 | 1727 | } elseif ($globalDebug) echo "Done\n"; |
| 1728 | 1728 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 1729 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 1729 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 1730 | 1730 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 1731 | 1731 | if ($globalDebug) echo "Add to DB..."; |
| 1732 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 1732 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 1733 | 1733 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 1734 | 1734 | if ($error != '') { |
| 1735 | 1735 | return $error; |
| 1736 | 1736 | } elseif ($globalDebug) echo "Done\n"; |
| 1737 | 1737 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 1738 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 1738 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 1739 | 1739 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 1740 | 1740 | if ($globalDebug) echo "Add to DB..."; |
| 1741 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 1741 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 1742 | 1742 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 1743 | 1743 | if ($error != '') { |
| 1744 | 1744 | return $error; |
| 1745 | 1745 | } elseif ($globalDebug) echo "Done\n"; |
| 1746 | 1746 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 1747 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 1747 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 1748 | 1748 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 1749 | 1749 | if ($globalDebug) echo "Add to DB..."; |
| 1750 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 1750 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 1751 | 1751 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 1752 | 1752 | if ($error != '') { |
| 1753 | 1753 | return $error; |
| 1754 | 1754 | } elseif ($globalDebug) echo "Done\n"; |
| 1755 | 1755 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 1756 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 1756 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 1757 | 1757 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 1758 | 1758 | if ($globalDebug) echo "Add to DB..."; |
| 1759 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 1759 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 1760 | 1760 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 1761 | 1761 | if ($error != '') { |
| 1762 | 1762 | return $error; |
| 1763 | 1763 | } elseif ($globalDebug) echo "Done\n"; |
| 1764 | 1764 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 1765 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 1765 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 1766 | 1766 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 1767 | 1767 | if ($globalDebug) echo "Add to DB..."; |
| 1768 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 1768 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 1769 | 1769 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 1770 | 1770 | if ($error != '') { |
| 1771 | 1771 | return $error; |
| 1772 | 1772 | } elseif ($globalDebug) echo "Done\n"; |
| 1773 | 1773 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 1774 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 1774 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 1775 | 1775 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 1776 | 1776 | if ($globalDebug) echo "Add to DB..."; |
| 1777 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 1777 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 1778 | 1778 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 1779 | 1779 | if ($error != '') { |
| 1780 | 1780 | return $error; |
| 1781 | 1781 | } elseif ($globalDebug) echo "Done\n"; |
| 1782 | 1782 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 1783 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 1783 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 1784 | 1784 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 1785 | 1785 | if ($globalDebug) echo "Add to DB..."; |
| 1786 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 1786 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 1787 | 1787 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 1788 | 1788 | if ($error != '') { |
| 1789 | 1789 | return $error; |
@@ -1795,7 +1795,7 @@ discard block |
||
| 1795 | 1795 | global $tmp_dir, $globalDebug; |
| 1796 | 1796 | $error = ''; |
| 1797 | 1797 | if ($globalDebug) echo "Translation : Download..."; |
| 1798 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 1798 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 1799 | 1799 | if (file_exists($tmp_dir.'translation.zip')) { |
| 1800 | 1800 | if ($globalDebug) echo "Unzip..."; |
| 1801 | 1801 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -1811,7 +1811,7 @@ discard block |
||
| 1811 | 1811 | public static function update_translation_fam() { |
| 1812 | 1812 | global $tmp_dir, $globalDebug; |
| 1813 | 1813 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 1814 | - update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 1814 | + update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 1815 | 1815 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
| 1816 | 1816 | if ($globalDebug) echo "Gunzip..."; |
| 1817 | 1817 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
@@ -1826,7 +1826,7 @@ discard block |
||
| 1826 | 1826 | public static function update_ModeS_fam() { |
| 1827 | 1827 | global $tmp_dir, $globalDebug; |
| 1828 | 1828 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
| 1829 | - update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
| 1829 | + update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
| 1830 | 1830 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
| 1831 | 1831 | if ($globalDebug) echo "Gunzip..."; |
| 1832 | 1832 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
@@ -1842,9 +1842,9 @@ discard block |
||
| 1842 | 1842 | global $tmp_dir, $globalDebug, $globalOwner; |
| 1843 | 1843 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
| 1844 | 1844 | if ($globalOwner === TRUE) { |
| 1845 | - update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 1845 | + update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 1846 | 1846 | } else { |
| 1847 | - update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 1847 | + update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 1848 | 1848 | } |
| 1849 | 1849 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
| 1850 | 1850 | if ($globalDebug) echo "Gunzip..."; |
@@ -1860,7 +1860,7 @@ discard block |
||
| 1860 | 1860 | public static function update_routes_fam() { |
| 1861 | 1861 | global $tmp_dir, $globalDebug; |
| 1862 | 1862 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
| 1863 | - update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
| 1863 | + update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
| 1864 | 1864 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
| 1865 | 1865 | if ($globalDebug) echo "Gunzip..."; |
| 1866 | 1866 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
@@ -1879,18 +1879,18 @@ discard block |
||
| 1879 | 1879 | $error = ''; |
| 1880 | 1880 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
| 1881 | 1881 | if ($globalDBdriver == 'mysql') { |
| 1882 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 1882 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 1883 | 1883 | } else { |
| 1884 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 1884 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 1885 | 1885 | } |
| 1886 | 1886 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
| 1887 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 1887 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 1888 | 1888 | $airspace_md5 = $airspace_md5_file[0]; |
| 1889 | 1889 | if (!update_db::check_airspace_version($airspace_md5)) { |
| 1890 | 1890 | if ($globalDBdriver == 'mysql') { |
| 1891 | - update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 1891 | + update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 1892 | 1892 | } else { |
| 1893 | - update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 1893 | + update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 1894 | 1894 | } |
| 1895 | 1895 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 1896 | 1896 | if ($globalDebug) echo "Gunzip..."; |
@@ -1902,7 +1902,7 @@ discard block |
||
| 1902 | 1902 | try { |
| 1903 | 1903 | $sth = $Connection->db->prepare($query); |
| 1904 | 1904 | $sth->execute(); |
| 1905 | - } catch(PDOException $e) { |
|
| 1905 | + } catch (PDOException $e) { |
|
| 1906 | 1906 | return "error : ".$e->getMessage(); |
| 1907 | 1907 | } |
| 1908 | 1908 | } |
@@ -1920,15 +1920,15 @@ discard block |
||
| 1920 | 1920 | public static function update_tle() { |
| 1921 | 1921 | global $tmp_dir, $globalDebug; |
| 1922 | 1922 | if ($globalDebug) echo "Download TLE : Download..."; |
| 1923 | - $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
|
| 1924 | - 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
|
| 1925 | - 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
|
| 1923 | + $alltle = array('stations.txt', 'gps-ops.txt', 'glo-ops.txt', 'galileo.txt', 'weather.txt', 'noaa.txt', 'goes.txt', 'resource.txt', 'dmc.txt', 'tdrss.txt', 'geo.txt', 'intelsat.txt', 'gorizont.txt', |
|
| 1924 | + 'raduga.txt', 'molniya.txt', 'iridium.txt', 'orbcomm.txt', 'globalstar.txt', 'amateur.txt', 'x-comm.txt', 'other-comm.txt', 'sbas.txt', 'nnss.txt', 'musson.txt', 'science.txt', 'geodetic.txt', |
|
| 1925 | + 'engineering.txt', 'education.txt', 'military.txt', 'radar.txt', 'cubesat.txt', 'other.txt', 'tle-new.txt'); |
|
| 1926 | 1926 | foreach ($alltle as $filename) { |
| 1927 | 1927 | if ($globalDebug) echo "downloading ".$filename.'...'; |
| 1928 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
| 1928 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
| 1929 | 1929 | if (file_exists($tmp_dir.$filename)) { |
| 1930 | 1930 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
| 1931 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
| 1931 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
| 1932 | 1932 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
| 1933 | 1933 | if ($error != '') { |
| 1934 | 1934 | echo $error."\n"; |
@@ -1941,32 +1941,32 @@ discard block |
||
| 1941 | 1941 | global $tmp_dir, $globalDebug; |
| 1942 | 1942 | $error = ''; |
| 1943 | 1943 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
| 1944 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
| 1944 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
| 1945 | 1945 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 1946 | 1946 | if ($globalDebug) echo "Check files...\n"; |
| 1947 | 1947 | $newmodelsdb = array(); |
| 1948 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
| 1949 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 1948 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
| 1949 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 1950 | 1950 | $model = trim($row[2]); |
| 1951 | 1951 | $newmodelsdb[$model] = trim($row[0]); |
| 1952 | 1952 | } |
| 1953 | 1953 | } |
| 1954 | 1954 | $modelsdb = array(); |
| 1955 | 1955 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
| 1956 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
| 1957 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 1956 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
| 1957 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 1958 | 1958 | $model = trim($row[2]); |
| 1959 | 1959 | $modelsdb[$model] = trim($row[0]); |
| 1960 | 1960 | } |
| 1961 | 1961 | } |
| 1962 | 1962 | } |
| 1963 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 1963 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 1964 | 1964 | foreach ($diff as $key => $value) { |
| 1965 | 1965 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 1966 | - update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
| 1966 | + update_db::download('http://data.flightairmap.fr/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
| 1967 | 1967 | |
| 1968 | 1968 | } |
| 1969 | - update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
| 1969 | + update_db::download('http://data.flightairmap.fr/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
| 1970 | 1970 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 1971 | 1971 | if ($error != '') { |
| 1972 | 1972 | return $error; |
@@ -1978,32 +1978,32 @@ discard block |
||
| 1978 | 1978 | global $tmp_dir, $globalDebug; |
| 1979 | 1979 | $error = ''; |
| 1980 | 1980 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
| 1981 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
| 1981 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
| 1982 | 1982 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 1983 | 1983 | if ($globalDebug) echo "Check files...\n"; |
| 1984 | 1984 | $newmodelsdb = array(); |
| 1985 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
| 1986 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 1985 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
| 1986 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 1987 | 1987 | $model = trim($row[2]); |
| 1988 | 1988 | $newmodelsdb[$model] = trim($row[0]); |
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | $modelsdb = array(); |
| 1992 | 1992 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
| 1993 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
| 1994 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 1993 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
| 1994 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 1995 | 1995 | $model = trim($row[2]); |
| 1996 | 1996 | $modelsdb[$model] = trim($row[0]); |
| 1997 | 1997 | } |
| 1998 | 1998 | } |
| 1999 | 1999 | } |
| 2000 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2000 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2001 | 2001 | foreach ($diff as $key => $value) { |
| 2002 | 2002 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
| 2003 | - update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
| 2003 | + update_db::download('http://data.flightairmap.fr/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
| 2004 | 2004 | |
| 2005 | 2005 | } |
| 2006 | - update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2006 | + update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2007 | 2007 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2008 | 2008 | if ($error != '') { |
| 2009 | 2009 | return $error; |
@@ -2026,8 +2026,8 @@ discard block |
||
| 2026 | 2026 | */ |
| 2027 | 2027 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 2028 | 2028 | //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
| 2029 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 2030 | - $result = fread($fh,100000000); |
|
| 2029 | + $fh = fopen($tmp_dir.'aircrafts.html', "r"); |
|
| 2030 | + $result = fread($fh, 100000000); |
|
| 2031 | 2031 | //echo $result; |
| 2032 | 2032 | //var_dump(str_get_html($result)); |
| 2033 | 2033 | //print_r(self::table2array($result)); |
@@ -2045,23 +2045,23 @@ discard block |
||
| 2045 | 2045 | $Connection = new Connection(); |
| 2046 | 2046 | $sth = $Connection->db->prepare($query); |
| 2047 | 2047 | $sth->execute(); |
| 2048 | - } catch(PDOException $e) { |
|
| 2048 | + } catch (PDOException $e) { |
|
| 2049 | 2049 | return "error : ".$e->getMessage(); |
| 2050 | 2050 | } |
| 2051 | 2051 | |
| 2052 | 2052 | $error = ''; |
| 2053 | 2053 | if ($globalDebug) echo "Notam : Download..."; |
| 2054 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 2054 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 2055 | 2055 | if (file_exists($tmp_dir.'notam.rss')) { |
| 2056 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 2056 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 2057 | 2057 | foreach ($notams['channel']['item'] as $notam) { |
| 2058 | - $title = explode(':',$notam['title']); |
|
| 2058 | + $title = explode(':', $notam['title']); |
|
| 2059 | 2059 | $data['ref'] = trim($title[0]); |
| 2060 | 2060 | unset($title[0]); |
| 2061 | - $data['title'] = trim(implode(':',$title)); |
|
| 2062 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 2063 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 2064 | - $q = explode('/',$match[1]); |
|
| 2061 | + $data['title'] = trim(implode(':', $title)); |
|
| 2062 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 2063 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 2064 | + $q = explode('/', $match[1]); |
|
| 2065 | 2065 | $data['fir'] = $q[0]; |
| 2066 | 2066 | $data['code'] = $q[1]; |
| 2067 | 2067 | $ifrvfr = $q[2]; |
@@ -2077,30 +2077,30 @@ discard block |
||
| 2077 | 2077 | $data['lower_limit'] = $q[5]; |
| 2078 | 2078 | $data['upper_limit'] = $q[6]; |
| 2079 | 2079 | $latlonrad = $q[7]; |
| 2080 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 2081 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 2082 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 2080 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 2081 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 2082 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 2083 | 2083 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 2084 | 2084 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 2085 | 2085 | $data['center_latitude'] = $latitude; |
| 2086 | 2086 | $data['center_longitude'] = $longitude; |
| 2087 | 2087 | $data['radius'] = intval($radius); |
| 2088 | 2088 | |
| 2089 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 2089 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 2090 | 2090 | $data['text'] = $match[1]; |
| 2091 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 2091 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 2092 | 2092 | $fromto = $match[1]; |
| 2093 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 2093 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 2094 | 2094 | $fromall = trim($match[1]); |
| 2095 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 2095 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 2096 | 2096 | $from = trim($match[1]); |
| 2097 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 2098 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 2097 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 2098 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 2099 | 2099 | $toall = trim($match[1]); |
| 2100 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 2101 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 2100 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 2101 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 2102 | 2102 | $to = trim($match[1]); |
| 2103 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 2103 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 2104 | 2104 | $data['permanent'] = 0; |
| 2105 | 2105 | } else { |
| 2106 | 2106 | $data['date_end'] = NULL; |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | } |
| 2109 | 2109 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 2110 | 2110 | $NOTAM = new NOTAM(); |
| 2111 | - $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
|
| 2111 | + $NOTAM->addNOTAM($data['ref'], $data['title'], '', $data['fir'], $data['code'], '', $data['scope'], $data['lower_limit'], $data['upper_limit'], $data['center_latitude'], $data['center_longitude'], $data['radius'], $data['date_begin'], $data['date_end'], $data['permanent'], $data['text'], $data['full_notam']); |
|
| 2112 | 2112 | unset($data); |
| 2113 | 2113 | } |
| 2114 | 2114 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -2131,16 +2131,16 @@ discard block |
||
| 2131 | 2131 | $Connection = new Connection(); |
| 2132 | 2132 | $sth = $Connection->db->prepare($query); |
| 2133 | 2133 | $sth->execute(); |
| 2134 | - } catch(PDOException $e) { |
|
| 2134 | + } catch (PDOException $e) { |
|
| 2135 | 2135 | return "error : ".$e->getMessage(); |
| 2136 | 2136 | } |
| 2137 | 2137 | } |
| 2138 | 2138 | $Common = new Common(); |
| 2139 | 2139 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 2140 | - $airspace_json = json_decode($airspace_lst,true); |
|
| 2140 | + $airspace_json = json_decode($airspace_lst, true); |
|
| 2141 | 2141 | foreach ($airspace_json['records'] as $airspace) { |
| 2142 | 2142 | if ($globalDebug) echo $airspace['name']."...\n"; |
| 2143 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
| 2143 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
| 2144 | 2144 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 2145 | 2145 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
| 2146 | 2146 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -2164,7 +2164,7 @@ discard block |
||
| 2164 | 2164 | $Connection = new Connection(); |
| 2165 | 2165 | $sth = $Connection->db->prepare($query); |
| 2166 | 2166 | $sth->execute(); |
| 2167 | - } catch(PDOException $e) { |
|
| 2167 | + } catch (PDOException $e) { |
|
| 2168 | 2168 | return "error : ".$e->getMessage(); |
| 2169 | 2169 | } |
| 2170 | 2170 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2179,7 +2179,7 @@ discard block |
||
| 2179 | 2179 | $Connection = new Connection(); |
| 2180 | 2180 | $sth = $Connection->db->prepare($query); |
| 2181 | 2181 | $sth->execute(); |
| 2182 | - } catch(PDOException $e) { |
|
| 2182 | + } catch (PDOException $e) { |
|
| 2183 | 2183 | return "error : ".$e->getMessage(); |
| 2184 | 2184 | } |
| 2185 | 2185 | } |
@@ -2190,7 +2190,7 @@ discard block |
||
| 2190 | 2190 | $Connection = new Connection(); |
| 2191 | 2191 | $sth = $Connection->db->prepare($query); |
| 2192 | 2192 | $sth->execute(array(':version' => $version)); |
| 2193 | - } catch(PDOException $e) { |
|
| 2193 | + } catch (PDOException $e) { |
|
| 2194 | 2194 | return "error : ".$e->getMessage(); |
| 2195 | 2195 | } |
| 2196 | 2196 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2206,7 +2206,7 @@ discard block |
||
| 2206 | 2206 | $Connection = new Connection(); |
| 2207 | 2207 | $sth = $Connection->db->prepare($query); |
| 2208 | 2208 | $sth->execute(array(':version' => $version)); |
| 2209 | - } catch(PDOException $e) { |
|
| 2209 | + } catch (PDOException $e) { |
|
| 2210 | 2210 | return "error : ".$e->getMessage(); |
| 2211 | 2211 | } |
| 2212 | 2212 | } |
@@ -2222,7 +2222,7 @@ discard block |
||
| 2222 | 2222 | $Connection = new Connection(); |
| 2223 | 2223 | $sth = $Connection->db->prepare($query); |
| 2224 | 2224 | $sth->execute(); |
| 2225 | - } catch(PDOException $e) { |
|
| 2225 | + } catch (PDOException $e) { |
|
| 2226 | 2226 | return "error : ".$e->getMessage(); |
| 2227 | 2227 | } |
| 2228 | 2228 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2237,7 +2237,7 @@ discard block |
||
| 2237 | 2237 | $Connection = new Connection(); |
| 2238 | 2238 | $sth = $Connection->db->prepare($query); |
| 2239 | 2239 | $sth->execute(); |
| 2240 | - } catch(PDOException $e) { |
|
| 2240 | + } catch (PDOException $e) { |
|
| 2241 | 2241 | return "error : ".$e->getMessage(); |
| 2242 | 2242 | } |
| 2243 | 2243 | } |
@@ -2252,7 +2252,7 @@ discard block |
||
| 2252 | 2252 | $Connection = new Connection(); |
| 2253 | 2253 | $sth = $Connection->db->prepare($query); |
| 2254 | 2254 | $sth->execute(); |
| 2255 | - } catch(PDOException $e) { |
|
| 2255 | + } catch (PDOException $e) { |
|
| 2256 | 2256 | return "error : ".$e->getMessage(); |
| 2257 | 2257 | } |
| 2258 | 2258 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2267,7 +2267,7 @@ discard block |
||
| 2267 | 2267 | $Connection = new Connection(); |
| 2268 | 2268 | $sth = $Connection->db->prepare($query); |
| 2269 | 2269 | $sth->execute(); |
| 2270 | - } catch(PDOException $e) { |
|
| 2270 | + } catch (PDOException $e) { |
|
| 2271 | 2271 | return "error : ".$e->getMessage(); |
| 2272 | 2272 | } |
| 2273 | 2273 | } |
@@ -2283,7 +2283,7 @@ discard block |
||
| 2283 | 2283 | $Connection = new Connection(); |
| 2284 | 2284 | $sth = $Connection->db->prepare($query); |
| 2285 | 2285 | $sth->execute(); |
| 2286 | - } catch(PDOException $e) { |
|
| 2286 | + } catch (PDOException $e) { |
|
| 2287 | 2287 | return "error : ".$e->getMessage(); |
| 2288 | 2288 | } |
| 2289 | 2289 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2298,7 +2298,7 @@ discard block |
||
| 2298 | 2298 | $Connection = new Connection(); |
| 2299 | 2299 | $sth = $Connection->db->prepare($query); |
| 2300 | 2300 | $sth->execute(); |
| 2301 | - } catch(PDOException $e) { |
|
| 2301 | + } catch (PDOException $e) { |
|
| 2302 | 2302 | return "error : ".$e->getMessage(); |
| 2303 | 2303 | } |
| 2304 | 2304 | } |
@@ -2313,7 +2313,7 @@ discard block |
||
| 2313 | 2313 | $Connection = new Connection(); |
| 2314 | 2314 | $sth = $Connection->db->prepare($query); |
| 2315 | 2315 | $sth->execute(); |
| 2316 | - } catch(PDOException $e) { |
|
| 2316 | + } catch (PDOException $e) { |
|
| 2317 | 2317 | return "error : ".$e->getMessage(); |
| 2318 | 2318 | } |
| 2319 | 2319 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2328,7 +2328,7 @@ discard block |
||
| 2328 | 2328 | $Connection = new Connection(); |
| 2329 | 2329 | $sth = $Connection->db->prepare($query); |
| 2330 | 2330 | $sth->execute(); |
| 2331 | - } catch(PDOException $e) { |
|
| 2331 | + } catch (PDOException $e) { |
|
| 2332 | 2332 | return "error : ".$e->getMessage(); |
| 2333 | 2333 | } |
| 2334 | 2334 | } |
@@ -2343,7 +2343,7 @@ discard block |
||
| 2343 | 2343 | $Connection = new Connection(); |
| 2344 | 2344 | $sth = $Connection->db->prepare($query); |
| 2345 | 2345 | $sth->execute(); |
| 2346 | - } catch(PDOException $e) { |
|
| 2346 | + } catch (PDOException $e) { |
|
| 2347 | 2347 | return "error : ".$e->getMessage(); |
| 2348 | 2348 | } |
| 2349 | 2349 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | $Connection = new Connection(); |
| 2359 | 2359 | $sth = $Connection->db->prepare($query); |
| 2360 | 2360 | $sth->execute(); |
| 2361 | - } catch(PDOException $e) { |
|
| 2361 | + } catch (PDOException $e) { |
|
| 2362 | 2362 | return "error : ".$e->getMessage(); |
| 2363 | 2363 | } |
| 2364 | 2364 | } |
@@ -2373,7 +2373,7 @@ discard block |
||
| 2373 | 2373 | $Connection = new Connection(); |
| 2374 | 2374 | $sth = $Connection->db->prepare($query); |
| 2375 | 2375 | $sth->execute(); |
| 2376 | - } catch(PDOException $e) { |
|
| 2376 | + } catch (PDOException $e) { |
|
| 2377 | 2377 | return "error : ".$e->getMessage(); |
| 2378 | 2378 | } |
| 2379 | 2379 | } |
@@ -2388,7 +2388,7 @@ discard block |
||
| 2388 | 2388 | $Connection = new Connection(); |
| 2389 | 2389 | $sth = $Connection->db->prepare($query); |
| 2390 | 2390 | $sth->execute(); |
| 2391 | - } catch(PDOException $e) { |
|
| 2391 | + } catch (PDOException $e) { |
|
| 2392 | 2392 | return "error : ".$e->getMessage(); |
| 2393 | 2393 | } |
| 2394 | 2394 | } |
@@ -14,11 +14,11 @@ discard block |
||
| 14 | 14 | try { |
| 15 | 15 | $sth = $Connection->db->prepare($query); |
| 16 | 16 | $sth->execute(); |
| 17 | - } catch(PDOException $e) { |
|
| 17 | + } catch (PDOException $e) { |
|
| 18 | 18 | return "error : ".$e->getMessage()."\n"; |
| 19 | 19 | } |
| 20 | 20 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 21 | + $Schedule->addSchedule($row['ident'], $row['departure_airport_icao'], $row['departure_airport_time'], $row['arrival_airport_icao'], $row['arrival_airport_time']); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | } |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | try { |
| 51 | 51 | $sth = $Connection->db->prepare($query); |
| 52 | 52 | $sth->execute(); |
| 53 | - } catch(PDOException $e) { |
|
| 53 | + } catch (PDOException $e) { |
|
| 54 | 54 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
| 55 | 55 | } |
| 56 | 56 | // Copy schedules data to routes table |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | try { |
| 61 | 61 | $sth = $Connection->db->prepare($query); |
| 62 | 62 | $sth->execute(); |
| 63 | - } catch(PDOException $e) { |
|
| 63 | + } catch (PDOException $e) { |
|
| 64 | 64 | return "error (delete schedule table) : ".$e->getMessage()."\n"; |
| 65 | 65 | } |
| 66 | 66 | // Add source column |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | try { |
| 69 | 69 | $sth = $Connection->db->prepare($query); |
| 70 | 70 | $sth->execute(); |
| 71 | - } catch(PDOException $e) { |
|
| 71 | + } catch (PDOException $e) { |
|
| 72 | 72 | return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
| 73 | 73 | } |
| 74 | 74 | // Delete unused column |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | try { |
| 77 | 77 | $sth = $Connection->db->prepare($query); |
| 78 | 78 | $sth->execute(); |
| 79 | - } catch(PDOException $e) { |
|
| 79 | + } catch (PDOException $e) { |
|
| 80 | 80 | return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
| 81 | 81 | } |
| 82 | 82 | // Add ModeS column |
@@ -84,14 +84,14 @@ discard block |
||
| 84 | 84 | try { |
| 85 | 85 | $sth = $Connection->db->prepare($query); |
| 86 | 86 | $sth->execute(); |
| 87 | - } catch(PDOException $e) { |
|
| 87 | + } catch (PDOException $e) { |
|
| 88 | 88 | return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
| 89 | 89 | } |
| 90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
| 91 | 91 | try { |
| 92 | 92 | $sth = $Connection->db->prepare($query); |
| 93 | 93 | $sth->execute(); |
| 94 | - } catch(PDOException $e) { |
|
| 94 | + } catch (PDOException $e) { |
|
| 95 | 95 | return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
| 96 | 96 | } |
| 97 | 97 | // Add auto_increment for aircraft_modes |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | try { |
| 100 | 100 | $sth = $Connection->db->prepare($query); |
| 101 | 101 | $sth->execute(); |
| 102 | - } catch(PDOException $e) { |
|
| 102 | + } catch (PDOException $e) { |
|
| 103 | 103 | return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
| 104 | 104 | } |
| 105 | 105 | $error = ''; |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | try { |
| 111 | 111 | $sth = $Connection->db->prepare($query); |
| 112 | 112 | $sth->execute(); |
| 113 | - } catch(PDOException $e) { |
|
| 113 | + } catch (PDOException $e) { |
|
| 114 | 114 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 115 | 115 | } |
| 116 | 116 | return $error; |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | try { |
| 124 | 124 | $sth = $Connection->db->prepare($query); |
| 125 | 125 | $sth->execute(); |
| 126 | - } catch(PDOException $e) { |
|
| 126 | + } catch (PDOException $e) { |
|
| 127 | 127 | return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
| 128 | 128 | } |
| 129 | 129 | $error = ''; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | try { |
| 135 | 135 | $sth = $Connection->db->prepare($query); |
| 136 | 136 | $sth->execute(); |
| 137 | - } catch(PDOException $e) { |
|
| 137 | + } catch (PDOException $e) { |
|
| 138 | 138 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 139 | 139 | } |
| 140 | 140 | return $error; |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | try { |
| 148 | 148 | $sth = $Connection->db->prepare($query); |
| 149 | 149 | $sth->execute(); |
| 150 | - } catch(PDOException $e) { |
|
| 150 | + } catch (PDOException $e) { |
|
| 151 | 151 | return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
| 152 | 152 | } |
| 153 | 153 | // Add image_source_website column to spotter_image |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | try { |
| 156 | 156 | $sth = $Connection->db->prepare($query); |
| 157 | 157 | $sth->execute(); |
| 158 | - } catch(PDOException $e) { |
|
| 158 | + } catch (PDOException $e) { |
|
| 159 | 159 | return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
| 160 | 160 | } |
| 161 | 161 | $error = ''; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | try { |
| 165 | 165 | $sth = $Connection->db->prepare($query); |
| 166 | 166 | $sth->execute(); |
| 167 | - } catch(PDOException $e) { |
|
| 167 | + } catch (PDOException $e) { |
|
| 168 | 168 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 169 | 169 | } |
| 170 | 170 | return $error; |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | try { |
| 183 | 183 | $sth = $Connection->db->prepare($query); |
| 184 | 184 | $sth->execute(); |
| 185 | - } catch(PDOException $e) { |
|
| 185 | + } catch (PDOException $e) { |
|
| 186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 187 | 187 | } |
| 188 | 188 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | try { |
| 197 | 197 | $sth = $Connection->db->prepare($query); |
| 198 | 198 | $sth->execute(); |
| 199 | - } catch(PDOException $e) { |
|
| 199 | + } catch (PDOException $e) { |
|
| 200 | 200 | return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
| 201 | 201 | } |
| 202 | 202 | // Add aircraft_shadow column to aircraft |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | try { |
| 205 | 205 | $sth = $Connection->db->prepare($query); |
| 206 | 206 | $sth->execute(); |
| 207 | - } catch(PDOException $e) { |
|
| 207 | + } catch (PDOException $e) { |
|
| 208 | 208 | return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
| 209 | 209 | } |
| 210 | 210 | // Add aircraft_shadow column to spotter_live |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | try { |
| 213 | 213 | $sth = $Connection->db->prepare($query); |
| 214 | 214 | $sth->execute(); |
| 215 | - } catch(PDOException $e) { |
|
| 215 | + } catch (PDOException $e) { |
|
| 216 | 216 | return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
| 217 | 217 | } |
| 218 | 218 | $error = ''; |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | try { |
| 226 | 226 | $sth = $Connection->db->prepare($query); |
| 227 | 227 | $sth->execute(); |
| 228 | - } catch(PDOException $e) { |
|
| 228 | + } catch (PDOException $e) { |
|
| 229 | 229 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 230 | 230 | } |
| 231 | 231 | return $error; |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | |
| 234 | 234 | private static function update_from_6() { |
| 235 | 235 | $Connection = new Connection(); |
| 236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 236 | + if (!$Connection->indexExists('spotter_output', 'flightaware_id')) { |
|
| 237 | 237 | $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
| 238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
| 239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
@@ -250,7 +250,7 @@ discard block |
||
| 250 | 250 | try { |
| 251 | 251 | $sth = $Connection->db->prepare($query); |
| 252 | 252 | $sth->execute(); |
| 253 | - } catch(PDOException $e) { |
|
| 253 | + } catch (PDOException $e) { |
|
| 254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | try { |
| 266 | 266 | $sth = $Connection->db->prepare($query); |
| 267 | 267 | $sth->execute(); |
| 268 | - } catch(PDOException $e) { |
|
| 268 | + } catch (PDOException $e) { |
|
| 269 | 269 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 270 | 270 | } |
| 271 | 271 | return $error; |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | private static function update_from_7() { |
| 275 | 275 | global $globalDBname, $globalDBdriver; |
| 276 | 276 | $Connection = new Connection(); |
| 277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 277 | + $query = "ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
| 279 | 279 | try { |
| 280 | 280 | $sth = $Connection->db->prepare($query); |
| 281 | 281 | $sth->execute(); |
| 282 | - } catch(PDOException $e) { |
|
| 282 | + } catch (PDOException $e) { |
|
| 283 | 283 | return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
| 284 | 284 | } |
| 285 | 285 | if ($globalDBdriver == 'mysql') { |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | try { |
| 288 | 288 | $sth = $Connection->db->prepare($query); |
| 289 | 289 | $sth->execute(); |
| 290 | - } catch(PDOException $e) { |
|
| 290 | + } catch (PDOException $e) { |
|
| 291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 292 | 292 | } |
| 293 | 293 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -299,15 +299,15 @@ discard block |
||
| 299 | 299 | DROP TABLE spotter_archive; |
| 300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
| 301 | 301 | } else { |
| 302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 302 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | 303 | } |
| 304 | 304 | } else { |
| 305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 305 | + $query = "ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | 306 | } |
| 307 | 307 | try { |
| 308 | 308 | $sth = $Connection->db->prepare($query); |
| 309 | 309 | $sth->execute(); |
| 310 | - } catch(PDOException $e) { |
|
| 310 | + } catch (PDOException $e) { |
|
| 311 | 311 | return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
| 312 | 312 | } |
| 313 | 313 | |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | try { |
| 321 | 321 | $sth = $Connection->db->prepare($query); |
| 322 | 322 | $sth->execute(); |
| 323 | - } catch(PDOException $e) { |
|
| 323 | + } catch (PDOException $e) { |
|
| 324 | 324 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 325 | 325 | } |
| 326 | 326 | return $error; |
@@ -339,14 +339,14 @@ discard block |
||
| 339 | 339 | try { |
| 340 | 340 | $sth = $Connection->db->prepare($query); |
| 341 | 341 | $sth->execute(); |
| 342 | - } catch(PDOException $e) { |
|
| 342 | + } catch (PDOException $e) { |
|
| 343 | 343 | return "error (insert last_update values) : ".$e->getMessage()."\n"; |
| 344 | 344 | } |
| 345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
| 346 | 346 | try { |
| 347 | 347 | $sth = $Connection->db->prepare($query); |
| 348 | 348 | $sth->execute(); |
| 349 | - } catch(PDOException $e) { |
|
| 349 | + } catch (PDOException $e) { |
|
| 350 | 350 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 351 | 351 | } |
| 352 | 352 | return $error; |
@@ -354,12 +354,12 @@ discard block |
||
| 354 | 354 | |
| 355 | 355 | private static function update_from_9() { |
| 356 | 356 | $Connection = new Connection(); |
| 357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 357 | + $query = "ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
| 359 | 359 | try { |
| 360 | 360 | $sth = $Connection->db->prepare($query); |
| 361 | 361 | $sth->execute(); |
| 362 | - } catch(PDOException $e) { |
|
| 362 | + } catch (PDOException $e) { |
|
| 363 | 363 | return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
| 364 | 364 | } |
| 365 | 365 | $error = ''; |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | try { |
| 372 | 372 | $sth = $Connection->db->prepare($query); |
| 373 | 373 | $sth->execute(); |
| 374 | - } catch(PDOException $e) { |
|
| 374 | + } catch (PDOException $e) { |
|
| 375 | 375 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 376 | 376 | } |
| 377 | 377 | return $error; |
@@ -379,11 +379,11 @@ discard block |
||
| 379 | 379 | |
| 380 | 380 | private static function update_from_10() { |
| 381 | 381 | $Connection = new Connection(); |
| 382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 382 | + $query = "ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | 383 | try { |
| 384 | 384 | $sth = $Connection->db->prepare($query); |
| 385 | 385 | $sth->execute(); |
| 386 | - } catch(PDOException $e) { |
|
| 386 | + } catch (PDOException $e) { |
|
| 387 | 387 | return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
| 388 | 388 | } |
| 389 | 389 | $error = ''; |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | try { |
| 402 | 402 | $sth = $Connection->db->prepare($query); |
| 403 | 403 | $sth->execute(); |
| 404 | - } catch(PDOException $e) { |
|
| 404 | + } catch (PDOException $e) { |
|
| 405 | 405 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 406 | 406 | } |
| 407 | 407 | return $error; |
@@ -410,18 +410,18 @@ discard block |
||
| 410 | 410 | private static function update_from_11() { |
| 411 | 411 | global $globalDBdriver, $globalDBname; |
| 412 | 412 | $Connection = new Connection(); |
| 413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 413 | + $query = "ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | 414 | try { |
| 415 | 415 | $sth = $Connection->db->prepare($query); |
| 416 | 416 | $sth->execute(); |
| 417 | - } catch(PDOException $e) { |
|
| 417 | + } catch (PDOException $e) { |
|
| 418 | 418 | return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
| 419 | 419 | } |
| 420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 420 | + $query = "ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | 421 | try { |
| 422 | 422 | $sth = $Connection->db->prepare($query); |
| 423 | 423 | $sth->execute(); |
| 424 | - } catch(PDOException $e) { |
|
| 424 | + } catch (PDOException $e) { |
|
| 425 | 425 | return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
| 426 | 426 | } |
| 427 | 427 | if ($globalDBdriver == 'mysql') { |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | try { |
| 430 | 430 | $sth = $Connection->db->prepare($query); |
| 431 | 431 | $sth->execute(); |
| 432 | - } catch(PDOException $e) { |
|
| 432 | + } catch (PDOException $e) { |
|
| 433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 434 | 434 | } |
| 435 | 435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -441,15 +441,15 @@ discard block |
||
| 441 | 441 | DROP TABLE spotter_archive; |
| 442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
| 443 | 443 | } else { |
| 444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 444 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | 445 | } |
| 446 | 446 | } else { |
| 447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 447 | + $query = "ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | 448 | } |
| 449 | 449 | try { |
| 450 | 450 | $sth = $Connection->db->prepare($query); |
| 451 | 451 | $sth->execute(); |
| 452 | - } catch(PDOException $e) { |
|
| 452 | + } catch (PDOException $e) { |
|
| 453 | 453 | return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
| 454 | 454 | } |
| 455 | 455 | |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | try { |
| 460 | 460 | $sth = $Connection->db->prepare($query); |
| 461 | 461 | $sth->execute(); |
| 462 | - } catch(PDOException $e) { |
|
| 462 | + } catch (PDOException $e) { |
|
| 463 | 463 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 464 | 464 | } |
| 465 | 465 | return $error; |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | try { |
| 488 | 488 | $sth = $Connection->db->prepare($query); |
| 489 | 489 | $sth->execute(); |
| 490 | - } catch(PDOException $e) { |
|
| 490 | + } catch (PDOException $e) { |
|
| 491 | 491 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 492 | 492 | } |
| 493 | 493 | return $error; |
@@ -495,12 +495,12 @@ discard block |
||
| 495 | 495 | |
| 496 | 496 | private static function update_from_13() { |
| 497 | 497 | $Connection = new Connection(); |
| 498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 498 | + if (!$Connection->checkColumnName('spotter_archive_output', 'real_departure_airport_icao')) { |
|
| 499 | + $query = "ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 500 | 500 | try { |
| 501 | 501 | $sth = $Connection->db->prepare($query); |
| 502 | 502 | $sth->execute(); |
| 503 | - } catch(PDOException $e) { |
|
| 503 | + } catch (PDOException $e) { |
|
| 504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
| 505 | 505 | } |
| 506 | 506 | } |
@@ -509,7 +509,7 @@ discard block |
||
| 509 | 509 | try { |
| 510 | 510 | $sth = $Connection->db->prepare($query); |
| 511 | 511 | $sth->execute(); |
| 512 | - } catch(PDOException $e) { |
|
| 512 | + } catch (PDOException $e) { |
|
| 513 | 513 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 514 | 514 | } |
| 515 | 515 | return $error; |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | try { |
| 528 | 528 | $sth = $Connection->db->prepare($query); |
| 529 | 529 | $sth->execute(); |
| 530 | - } catch(PDOException $e) { |
|
| 530 | + } catch (PDOException $e) { |
|
| 531 | 531 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 532 | 532 | } |
| 533 | 533 | return $error; |
@@ -538,11 +538,11 @@ discard block |
||
| 538 | 538 | $Connection = new Connection(); |
| 539 | 539 | $error = ''; |
| 540 | 540 | // Add tables |
| 541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 541 | + $query = "ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | 542 | try { |
| 543 | 543 | $sth = $Connection->db->prepare($query); |
| 544 | 544 | $sth->execute(); |
| 545 | - } catch(PDOException $e) { |
|
| 545 | + } catch (PDOException $e) { |
|
| 546 | 546 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 547 | 547 | } |
| 548 | 548 | if ($error != '') return $error; |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | try { |
| 551 | 551 | $sth = $Connection->db->prepare($query); |
| 552 | 552 | $sth->execute(); |
| 553 | - } catch(PDOException $e) { |
|
| 553 | + } catch (PDOException $e) { |
|
| 554 | 554 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 555 | 555 | } |
| 556 | 556 | return $error; |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | try { |
| 572 | 572 | $sth = $Connection->db->prepare($query); |
| 573 | 573 | $sth->execute(); |
| 574 | - } catch(PDOException $e) { |
|
| 574 | + } catch (PDOException $e) { |
|
| 575 | 575 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 576 | 576 | } |
| 577 | 577 | return $error; |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | try { |
| 590 | 590 | $sth = $Connection->db->prepare($query); |
| 591 | 591 | $sth->execute(); |
| 592 | - } catch(PDOException $e) { |
|
| 592 | + } catch (PDOException $e) { |
|
| 593 | 593 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 594 | 594 | } |
| 595 | 595 | return $error; |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | $Connection = new Connection(); |
| 599 | 599 | $error = ''; |
| 600 | 600 | // Modify stats_airport table |
| 601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 601 | + if (!$Connection->checkColumnName('stats_airport', 'airport_name')) { |
|
| 602 | 602 | $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
| 603 | 603 | try { |
| 604 | 604 | $sth = $Connection->db->prepare($query); |
| 605 | 605 | $sth->execute(); |
| 606 | - } catch(PDOException $e) { |
|
| 606 | + } catch (PDOException $e) { |
|
| 607 | 607 | return "error (update stats) : ".$e->getMessage()."\n"; |
| 608 | 608 | } |
| 609 | 609 | } |
@@ -612,7 +612,7 @@ discard block |
||
| 612 | 612 | try { |
| 613 | 613 | $sth = $Connection->db->prepare($query); |
| 614 | 614 | $sth->execute(); |
| 615 | - } catch(PDOException $e) { |
|
| 615 | + } catch (PDOException $e) { |
|
| 616 | 616 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 617 | 617 | } |
| 618 | 618 | return $error; |
@@ -629,73 +629,73 @@ discard block |
||
| 629 | 629 | try { |
| 630 | 630 | $sth = $Connection->db->prepare($query); |
| 631 | 631 | $sth->execute(); |
| 632 | - } catch(PDOException $e) { |
|
| 632 | + } catch (PDOException $e) { |
|
| 633 | 633 | return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
| 634 | 634 | } |
| 635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
| 636 | 636 | try { |
| 637 | 637 | $sth = $Connection->db->prepare($query); |
| 638 | 638 | $sth->execute(); |
| 639 | - } catch(PDOException $e) { |
|
| 639 | + } catch (PDOException $e) { |
|
| 640 | 640 | return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
| 641 | 641 | } |
| 642 | - if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
|
| 642 | + if (!$Connection->checkColumnName('spotter_archive', 'over_country')) { |
|
| 643 | 643 | // Add column over_country |
| 644 | 644 | $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
| 645 | 645 | try { |
| 646 | 646 | $sth = $Connection->db->prepare($query); |
| 647 | 647 | $sth->execute(); |
| 648 | - } catch(PDOException $e) { |
|
| 648 | + } catch (PDOException $e) { |
|
| 649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 650 | 650 | } |
| 651 | 651 | } |
| 652 | - if (!$Connection->checkColumnName('spotter_live','over_country')) { |
|
| 652 | + if (!$Connection->checkColumnName('spotter_live', 'over_country')) { |
|
| 653 | 653 | // Add column over_country |
| 654 | 654 | $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
| 655 | 655 | try { |
| 656 | 656 | $sth = $Connection->db->prepare($query); |
| 657 | 657 | $sth->execute(); |
| 658 | - } catch(PDOException $e) { |
|
| 658 | + } catch (PDOException $e) { |
|
| 659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 660 | 660 | } |
| 661 | 661 | } |
| 662 | - if (!$Connection->checkColumnName('spotter_output','source_name')) { |
|
| 662 | + if (!$Connection->checkColumnName('spotter_output', 'source_name')) { |
|
| 663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 664 | 664 | $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 665 | 665 | try { |
| 666 | 666 | $sth = $Connection->db->prepare($query); |
| 667 | 667 | $sth->execute(); |
| 668 | - } catch(PDOException $e) { |
|
| 668 | + } catch (PDOException $e) { |
|
| 669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 670 | 670 | } |
| 671 | 671 | } |
| 672 | - if (!$Connection->checkColumnName('spotter_live','source_name')) { |
|
| 672 | + if (!$Connection->checkColumnName('spotter_live', 'source_name')) { |
|
| 673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 674 | 674 | $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 675 | 675 | try { |
| 676 | 676 | $sth = $Connection->db->prepare($query); |
| 677 | 677 | $sth->execute(); |
| 678 | - } catch(PDOException $e) { |
|
| 678 | + } catch (PDOException $e) { |
|
| 679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 680 | 680 | } |
| 681 | 681 | } |
| 682 | - if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
|
| 682 | + if (!$Connection->checkColumnName('spotter_archive_output', 'source_name')) { |
|
| 683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 684 | 684 | $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
| 685 | 685 | try { |
| 686 | 686 | $sth = $Connection->db->prepare($query); |
| 687 | 687 | $sth->execute(); |
| 688 | - } catch(PDOException $e) { |
|
| 688 | + } catch (PDOException $e) { |
|
| 689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | - if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
|
| 692 | + if (!$Connection->checkColumnName('spotter_archive', 'source_name')) { |
|
| 693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 694 | 694 | $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
| 695 | 695 | try { |
| 696 | 696 | $sth = $Connection->db->prepare($query); |
| 697 | 697 | $sth->execute(); |
| 698 | - } catch(PDOException $e) { |
|
| 698 | + } catch (PDOException $e) { |
|
| 699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | 700 | } |
| 701 | 701 | } |
@@ -704,7 +704,7 @@ discard block |
||
| 704 | 704 | try { |
| 705 | 705 | $sth = $Connection->db->prepare($query); |
| 706 | 706 | $sth->execute(); |
| 707 | - } catch(PDOException $e) { |
|
| 707 | + } catch (PDOException $e) { |
|
| 708 | 708 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 709 | 709 | } |
| 710 | 710 | return $error; |
@@ -719,13 +719,13 @@ discard block |
||
| 719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 721 | 721 | } |
| 722 | - if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
|
| 722 | + if (!$Connection->checkColumnName('aircraft_modes', 'type_flight')) { |
|
| 723 | 723 | // Add column over_country |
| 724 | 724 | $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
| 725 | 725 | try { |
| 726 | 726 | $sth = $Connection->db->prepare($query); |
| 727 | 727 | $sth->execute(); |
| 728 | - } catch(PDOException $e) { |
|
| 728 | + } catch (PDOException $e) { |
|
| 729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | 730 | } |
| 731 | 731 | } |
@@ -741,7 +741,7 @@ discard block |
||
| 741 | 741 | try { |
| 742 | 742 | $sth = $Connection->db->prepare($query); |
| 743 | 743 | $sth->execute(); |
| 744 | - } catch(PDOException $e) { |
|
| 744 | + } catch (PDOException $e) { |
|
| 745 | 745 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 746 | 746 | } |
| 747 | 747 | return $error; |
@@ -750,13 +750,13 @@ discard block |
||
| 750 | 750 | private static function update_from_21() { |
| 751 | 751 | $Connection = new Connection(); |
| 752 | 752 | $error = ''; |
| 753 | - if (!$Connection->checkColumnName('stats_airport','stats_type')) { |
|
| 753 | + if (!$Connection->checkColumnName('stats_airport', 'stats_type')) { |
|
| 754 | 754 | // Rename type to stats_type |
| 755 | 755 | $query = "ALTER TABLE `stats_airport` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats` CHANGE `type` `stats_type` VARCHAR(50);ALTER TABLE `stats_flight` CHANGE `type` `stats_type` VARCHAR(50);"; |
| 756 | 756 | try { |
| 757 | 757 | $sth = $Connection->db->prepare($query); |
| 758 | 758 | $sth->execute(); |
| 759 | - } catch(PDOException $e) { |
|
| 759 | + } catch (PDOException $e) { |
|
| 760 | 760 | return "error (rename type to stats_type on stats*) : ".$e->getMessage()."\n"; |
| 761 | 761 | } |
| 762 | 762 | if ($error != '') return $error; |
@@ -765,7 +765,7 @@ discard block |
||
| 765 | 765 | try { |
| 766 | 766 | $sth = $Connection->db->prepare($query); |
| 767 | 767 | $sth->execute(); |
| 768 | - } catch(PDOException $e) { |
|
| 768 | + } catch (PDOException $e) { |
|
| 769 | 769 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 770 | 770 | } |
| 771 | 771 | return $error; |
@@ -788,7 +788,7 @@ discard block |
||
| 788 | 788 | try { |
| 789 | 789 | $sth = $Connection->db->prepare($query); |
| 790 | 790 | $sth->execute(); |
| 791 | - } catch(PDOException $e) { |
|
| 791 | + } catch (PDOException $e) { |
|
| 792 | 792 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 793 | 793 | } |
| 794 | 794 | return $error; |
@@ -815,17 +815,17 @@ discard block |
||
| 815 | 815 | try { |
| 816 | 816 | $sth = $Connection->db->prepare($query); |
| 817 | 817 | $sth->execute(); |
| 818 | - } catch(PDOException $e) { |
|
| 818 | + } catch (PDOException $e) { |
|
| 819 | 819 | return "error (create index on spotter_archive) : ".$e->getMessage()."\n"; |
| 820 | 820 | } |
| 821 | 821 | } |
| 822 | - if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
|
| 822 | + if (!$Connection->checkColumnName('stats_aircraft', 'aircraft_manufacturer')) { |
|
| 823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
| 824 | 824 | $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
| 825 | 825 | try { |
| 826 | 826 | $sth = $Connection->db->prepare($query); |
| 827 | 827 | $sth->execute(); |
| 828 | - } catch(PDOException $e) { |
|
| 828 | + } catch (PDOException $e) { |
|
| 829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
| 830 | 830 | } |
| 831 | 831 | } |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | try { |
| 835 | 835 | $sth = $Connection->db->prepare($query); |
| 836 | 836 | $sth->execute(); |
| 837 | - } catch(PDOException $e) { |
|
| 837 | + } catch (PDOException $e) { |
|
| 838 | 838 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 839 | 839 | } |
| 840 | 840 | return $error; |
@@ -850,23 +850,23 @@ discard block |
||
| 850 | 850 | $error .= create_db::import_file('../db/pgsql/airlines.sql'); |
| 851 | 851 | } |
| 852 | 852 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 853 | - if (!$Connection->checkColumnName('airlines','forsource')) { |
|
| 853 | + if (!$Connection->checkColumnName('airlines', 'forsource')) { |
|
| 854 | 854 | // Add forsource to airlines |
| 855 | 855 | $query = "ALTER TABLE airlines ADD forsource VARCHAR(255) NULL DEFAULT NULL"; |
| 856 | 856 | try { |
| 857 | 857 | $sth = $Connection->db->prepare($query); |
| 858 | 858 | $sth->execute(); |
| 859 | - } catch(PDOException $e) { |
|
| 859 | + } catch (PDOException $e) { |
|
| 860 | 860 | return "error (add forsource column) : ".$e->getMessage()."\n"; |
| 861 | 861 | } |
| 862 | 862 | } |
| 863 | - if (!$Connection->checkColumnName('stats_aircraft','stats_airline')) { |
|
| 863 | + if (!$Connection->checkColumnName('stats_aircraft', 'stats_airline')) { |
|
| 864 | 864 | // Add forsource to airlines |
| 865 | 865 | $query = "ALTER TABLE stats_aircraft ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 866 | 866 | try { |
| 867 | 867 | $sth = $Connection->db->prepare($query); |
| 868 | 868 | $sth->execute(); |
| 869 | - } catch(PDOException $e) { |
|
| 869 | + } catch (PDOException $e) { |
|
| 870 | 870 | return "error (add stats_airline & filter_name column in stats_aircraft) : ".$e->getMessage()."\n"; |
| 871 | 871 | } |
| 872 | 872 | // Add unique key |
@@ -878,17 +878,17 @@ discard block |
||
| 878 | 878 | try { |
| 879 | 879 | $sth = $Connection->db->prepare($query); |
| 880 | 880 | $sth->execute(); |
| 881 | - } catch(PDOException $e) { |
|
| 881 | + } catch (PDOException $e) { |
|
| 882 | 882 | return "error (add unique key in stats_aircraft) : ".$e->getMessage()."\n"; |
| 883 | 883 | } |
| 884 | 884 | } |
| 885 | - if (!$Connection->checkColumnName('stats_airport','stats_airline')) { |
|
| 885 | + if (!$Connection->checkColumnName('stats_airport', 'stats_airline')) { |
|
| 886 | 886 | // Add forsource to airlines |
| 887 | 887 | $query = "ALTER TABLE stats_airport ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 888 | 888 | try { |
| 889 | 889 | $sth = $Connection->db->prepare($query); |
| 890 | 890 | $sth->execute(); |
| 891 | - } catch(PDOException $e) { |
|
| 891 | + } catch (PDOException $e) { |
|
| 892 | 892 | return "error (add filter_name column in stats_airport) : ".$e->getMessage()."\n"; |
| 893 | 893 | } |
| 894 | 894 | // Add unique key |
@@ -900,17 +900,17 @@ discard block |
||
| 900 | 900 | try { |
| 901 | 901 | $sth = $Connection->db->prepare($query); |
| 902 | 902 | $sth->execute(); |
| 903 | - } catch(PDOException $e) { |
|
| 903 | + } catch (PDOException $e) { |
|
| 904 | 904 | return "error (add unique key in stats_airport) : ".$e->getMessage()."\n"; |
| 905 | 905 | } |
| 906 | 906 | } |
| 907 | - if (!$Connection->checkColumnName('stats_country','stats_airline')) { |
|
| 907 | + if (!$Connection->checkColumnName('stats_country', 'stats_airline')) { |
|
| 908 | 908 | // Add forsource to airlines |
| 909 | 909 | $query = "ALTER TABLE stats_country ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 910 | 910 | try { |
| 911 | 911 | $sth = $Connection->db->prepare($query); |
| 912 | 912 | $sth->execute(); |
| 913 | - } catch(PDOException $e) { |
|
| 913 | + } catch (PDOException $e) { |
|
| 914 | 914 | return "error (add stats_airline & filter_name column in stats_country) : ".$e->getMessage()."\n"; |
| 915 | 915 | } |
| 916 | 916 | // Add unique key |
@@ -922,36 +922,36 @@ discard block |
||
| 922 | 922 | try { |
| 923 | 923 | $sth = $Connection->db->prepare($query); |
| 924 | 924 | $sth->execute(); |
| 925 | - } catch(PDOException $e) { |
|
| 925 | + } catch (PDOException $e) { |
|
| 926 | 926 | return "error (add unique key in stats_airline) : ".$e->getMessage()."\n"; |
| 927 | 927 | } |
| 928 | 928 | } |
| 929 | - if (!$Connection->checkColumnName('stats_flight','stats_airline')) { |
|
| 929 | + if (!$Connection->checkColumnName('stats_flight', 'stats_airline')) { |
|
| 930 | 930 | // Add forsource to airlines |
| 931 | 931 | $query = "ALTER TABLE stats_flight ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 932 | 932 | try { |
| 933 | 933 | $sth = $Connection->db->prepare($query); |
| 934 | 934 | $sth->execute(); |
| 935 | - } catch(PDOException $e) { |
|
| 935 | + } catch (PDOException $e) { |
|
| 936 | 936 | return "error (add stats_airline & filter_name column in stats_flight) : ".$e->getMessage()."\n"; |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | - if (!$Connection->checkColumnName('stats','stats_airline')) { |
|
| 939 | + if (!$Connection->checkColumnName('stats', 'stats_airline')) { |
|
| 940 | 940 | // Add forsource to airlines |
| 941 | 941 | $query = "ALTER TABLE stats ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 942 | 942 | try { |
| 943 | 943 | $sth = $Connection->db->prepare($query); |
| 944 | 944 | $sth->execute(); |
| 945 | - } catch(PDOException $e) { |
|
| 945 | + } catch (PDOException $e) { |
|
| 946 | 946 | return "error (add stats_airline & filter_name column in stats) : ".$e->getMessage()."\n"; |
| 947 | 947 | } |
| 948 | - if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats','type')) { |
|
| 948 | + if ($globalDBdriver == 'mysql' && $Connection->indexExists('stats', 'type')) { |
|
| 949 | 949 | // Add unique key |
| 950 | 950 | $query = "drop index type on stats;ALTER TABLE stats ADD UNIQUE stats_type (stats_type,stats_date,stats_airline,filter_name);"; |
| 951 | 951 | try { |
| 952 | 952 | $sth = $Connection->db->prepare($query); |
| 953 | 953 | $sth->execute(); |
| 954 | - } catch(PDOException $e) { |
|
| 954 | + } catch (PDOException $e) { |
|
| 955 | 955 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
| 956 | 956 | } |
| 957 | 957 | } else { |
@@ -964,18 +964,18 @@ discard block |
||
| 964 | 964 | try { |
| 965 | 965 | $sth = $Connection->db->prepare($query); |
| 966 | 966 | $sth->execute(); |
| 967 | - } catch(PDOException $e) { |
|
| 967 | + } catch (PDOException $e) { |
|
| 968 | 968 | return "error (add unique key in stats) : ".$e->getMessage()."\n"; |
| 969 | 969 | } |
| 970 | 970 | } |
| 971 | 971 | } |
| 972 | - if (!$Connection->checkColumnName('stats_registration','stats_airline')) { |
|
| 972 | + if (!$Connection->checkColumnName('stats_registration', 'stats_airline')) { |
|
| 973 | 973 | // Add forsource to airlines |
| 974 | 974 | $query = "ALTER TABLE stats_registration ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 975 | 975 | try { |
| 976 | 976 | $sth = $Connection->db->prepare($query); |
| 977 | 977 | $sth->execute(); |
| 978 | - } catch(PDOException $e) { |
|
| 978 | + } catch (PDOException $e) { |
|
| 979 | 979 | return "error (add stats_airline & filter_name column in stats_registration) : ".$e->getMessage()."\n"; |
| 980 | 980 | } |
| 981 | 981 | // Add unique key |
@@ -987,17 +987,17 @@ discard block |
||
| 987 | 987 | try { |
| 988 | 988 | $sth = $Connection->db->prepare($query); |
| 989 | 989 | $sth->execute(); |
| 990 | - } catch(PDOException $e) { |
|
| 990 | + } catch (PDOException $e) { |
|
| 991 | 991 | return "error (add unique key in stats_registration) : ".$e->getMessage()."\n"; |
| 992 | 992 | } |
| 993 | 993 | } |
| 994 | - if (!$Connection->checkColumnName('stats_callsign','filter_name')) { |
|
| 994 | + if (!$Connection->checkColumnName('stats_callsign', 'filter_name')) { |
|
| 995 | 995 | // Add forsource to airlines |
| 996 | 996 | $query = "ALTER TABLE stats_callsign ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 997 | 997 | try { |
| 998 | 998 | $sth = $Connection->db->prepare($query); |
| 999 | 999 | $sth->execute(); |
| 1000 | - } catch(PDOException $e) { |
|
| 1000 | + } catch (PDOException $e) { |
|
| 1001 | 1001 | return "error (add filter_name column in stats_callsign) : ".$e->getMessage()."\n"; |
| 1002 | 1002 | } |
| 1003 | 1003 | // Add unique key |
@@ -1009,17 +1009,17 @@ discard block |
||
| 1009 | 1009 | try { |
| 1010 | 1010 | $sth = $Connection->db->prepare($query); |
| 1011 | 1011 | $sth->execute(); |
| 1012 | - } catch(PDOException $e) { |
|
| 1012 | + } catch (PDOException $e) { |
|
| 1013 | 1013 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
| 1014 | 1014 | } |
| 1015 | 1015 | } |
| 1016 | - if (!$Connection->checkColumnName('stats_airline','filter_name')) { |
|
| 1016 | + if (!$Connection->checkColumnName('stats_airline', 'filter_name')) { |
|
| 1017 | 1017 | // Add forsource to airlines |
| 1018 | 1018 | $query = "ALTER TABLE stats_airline ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1019 | 1019 | try { |
| 1020 | 1020 | $sth = $Connection->db->prepare($query); |
| 1021 | 1021 | $sth->execute(); |
| 1022 | - } catch(PDOException $e) { |
|
| 1022 | + } catch (PDOException $e) { |
|
| 1023 | 1023 | return "error (add filter_name column in stats_airline) : ".$e->getMessage()."\n"; |
| 1024 | 1024 | } |
| 1025 | 1025 | // Add unique key |
@@ -1031,7 +1031,7 @@ discard block |
||
| 1031 | 1031 | try { |
| 1032 | 1032 | $sth = $Connection->db->prepare($query); |
| 1033 | 1033 | $sth->execute(); |
| 1034 | - } catch(PDOException $e) { |
|
| 1034 | + } catch (PDOException $e) { |
|
| 1035 | 1035 | return "error (add unique key in stats_callsign) : ".$e->getMessage()."\n"; |
| 1036 | 1036 | } |
| 1037 | 1037 | } |
@@ -1040,7 +1040,7 @@ discard block |
||
| 1040 | 1040 | try { |
| 1041 | 1041 | $sth = $Connection->db->prepare($query); |
| 1042 | 1042 | $sth->execute(); |
| 1043 | - } catch(PDOException $e) { |
|
| 1043 | + } catch (PDOException $e) { |
|
| 1044 | 1044 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1045 | 1045 | } |
| 1046 | 1046 | return $error; |
@@ -1050,13 +1050,13 @@ discard block |
||
| 1050 | 1050 | global $globalDBdriver; |
| 1051 | 1051 | $Connection = new Connection(); |
| 1052 | 1052 | $error = ''; |
| 1053 | - if (!$Connection->checkColumnName('stats_owner','stats_airline')) { |
|
| 1053 | + if (!$Connection->checkColumnName('stats_owner', 'stats_airline')) { |
|
| 1054 | 1054 | // Add forsource to airlines |
| 1055 | 1055 | $query = "ALTER TABLE stats_owner ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1056 | 1056 | try { |
| 1057 | 1057 | $sth = $Connection->db->prepare($query); |
| 1058 | 1058 | $sth->execute(); |
| 1059 | - } catch(PDOException $e) { |
|
| 1059 | + } catch (PDOException $e) { |
|
| 1060 | 1060 | return "error (add stats_airline & filter_name column in stats_owner) : ".$e->getMessage()."\n"; |
| 1061 | 1061 | } |
| 1062 | 1062 | // Add unique key |
@@ -1068,17 +1068,17 @@ discard block |
||
| 1068 | 1068 | try { |
| 1069 | 1069 | $sth = $Connection->db->prepare($query); |
| 1070 | 1070 | $sth->execute(); |
| 1071 | - } catch(PDOException $e) { |
|
| 1071 | + } catch (PDOException $e) { |
|
| 1072 | 1072 | return "error (add unique key in stats_owner) : ".$e->getMessage()."\n"; |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | - if (!$Connection->checkColumnName('stats_pilot','stats_airline')) { |
|
| 1075 | + if (!$Connection->checkColumnName('stats_pilot', 'stats_airline')) { |
|
| 1076 | 1076 | // Add forsource to airlines |
| 1077 | 1077 | $query = "ALTER TABLE stats_pilot ADD stats_airline VARCHAR(255) NULL DEFAULT '', ADD filter_name VARCHAR(255) NULL DEFAULT ''"; |
| 1078 | 1078 | try { |
| 1079 | 1079 | $sth = $Connection->db->prepare($query); |
| 1080 | 1080 | $sth->execute(); |
| 1081 | - } catch(PDOException $e) { |
|
| 1081 | + } catch (PDOException $e) { |
|
| 1082 | 1082 | return "error (add stats_airline & filter_name column in stats_pilot) : ".$e->getMessage()."\n"; |
| 1083 | 1083 | } |
| 1084 | 1084 | // Add unique key |
@@ -1090,7 +1090,7 @@ discard block |
||
| 1090 | 1090 | try { |
| 1091 | 1091 | $sth = $Connection->db->prepare($query); |
| 1092 | 1092 | $sth->execute(); |
| 1093 | - } catch(PDOException $e) { |
|
| 1093 | + } catch (PDOException $e) { |
|
| 1094 | 1094 | return "error (add unique key in stats_pilot) : ".$e->getMessage()."\n"; |
| 1095 | 1095 | } |
| 1096 | 1096 | } |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | try { |
| 1099 | 1099 | $sth = $Connection->db->prepare($query); |
| 1100 | 1100 | $sth->execute(); |
| 1101 | - } catch(PDOException $e) { |
|
| 1101 | + } catch (PDOException $e) { |
|
| 1102 | 1102 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1103 | 1103 | } |
| 1104 | 1104 | return $error; |
@@ -1108,12 +1108,12 @@ discard block |
||
| 1108 | 1108 | global $globalDBdriver; |
| 1109 | 1109 | $Connection = new Connection(); |
| 1110 | 1110 | $error = ''; |
| 1111 | - if (!$Connection->checkColumnName('atc','format_source')) { |
|
| 1111 | + if (!$Connection->checkColumnName('atc', 'format_source')) { |
|
| 1112 | 1112 | $query = "ALTER TABLE atc ADD format_source VARCHAR(255) DEFAULT NULL, ADD source_name VARCHAR(255) DEFAULT NULL"; |
| 1113 | 1113 | try { |
| 1114 | 1114 | $sth = $Connection->db->prepare($query); |
| 1115 | 1115 | $sth->execute(); |
| 1116 | - } catch(PDOException $e) { |
|
| 1116 | + } catch (PDOException $e) { |
|
| 1117 | 1117 | return "error (add format_source & source_name column in atc) : ".$e->getMessage()."\n"; |
| 1118 | 1118 | } |
| 1119 | 1119 | } |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | try { |
| 1122 | 1122 | $sth = $Connection->db->prepare($query); |
| 1123 | 1123 | $sth->execute(); |
| 1124 | - } catch(PDOException $e) { |
|
| 1124 | + } catch (PDOException $e) { |
|
| 1125 | 1125 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1126 | 1126 | } |
| 1127 | 1127 | return $error; |
@@ -1131,13 +1131,13 @@ discard block |
||
| 1131 | 1131 | global $globalDBdriver; |
| 1132 | 1132 | $Connection = new Connection(); |
| 1133 | 1133 | $error = ''; |
| 1134 | - if (!$Connection->checkColumnName('stats_pilot','format_source')) { |
|
| 1134 | + if (!$Connection->checkColumnName('stats_pilot', 'format_source')) { |
|
| 1135 | 1135 | // Add forsource to airlines |
| 1136 | 1136 | $query = "ALTER TABLE stats_pilot ADD format_source VARCHAR(255) NULL DEFAULT ''"; |
| 1137 | 1137 | try { |
| 1138 | 1138 | $sth = $Connection->db->prepare($query); |
| 1139 | 1139 | $sth->execute(); |
| 1140 | - } catch(PDOException $e) { |
|
| 1140 | + } catch (PDOException $e) { |
|
| 1141 | 1141 | return "error (add format_source column in stats_pilot) : ".$e->getMessage()."\n"; |
| 1142 | 1142 | } |
| 1143 | 1143 | // Add unique key |
@@ -1149,7 +1149,7 @@ discard block |
||
| 1149 | 1149 | try { |
| 1150 | 1150 | $sth = $Connection->db->prepare($query); |
| 1151 | 1151 | $sth->execute(); |
| 1152 | - } catch(PDOException $e) { |
|
| 1152 | + } catch (PDOException $e) { |
|
| 1153 | 1153 | return "error (modify unique key in stats_pilot) : ".$e->getMessage()."\n"; |
| 1154 | 1154 | } |
| 1155 | 1155 | } |
@@ -1157,7 +1157,7 @@ discard block |
||
| 1157 | 1157 | try { |
| 1158 | 1158 | $sth = $Connection->db->prepare($query); |
| 1159 | 1159 | $sth->execute(); |
| 1160 | - } catch(PDOException $e) { |
|
| 1160 | + } catch (PDOException $e) { |
|
| 1161 | 1161 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1162 | 1162 | } |
| 1163 | 1163 | return $error; |
@@ -1167,23 +1167,23 @@ discard block |
||
| 1167 | 1167 | global $globalDBdriver; |
| 1168 | 1168 | $Connection = new Connection(); |
| 1169 | 1169 | $error = ''; |
| 1170 | - if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live','latitude')) { |
|
| 1170 | + if ($globalDBdriver == 'mysql' && !$Connection->indexExists('spotter_live', 'latitude')) { |
|
| 1171 | 1171 | // Add unique key |
| 1172 | 1172 | $query = "alter table spotter_live add index(latitude,longitude)"; |
| 1173 | 1173 | try { |
| 1174 | 1174 | $sth = $Connection->db->prepare($query); |
| 1175 | 1175 | $sth->execute(); |
| 1176 | - } catch(PDOException $e) { |
|
| 1176 | + } catch (PDOException $e) { |
|
| 1177 | 1177 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
| 1178 | 1178 | } |
| 1179 | 1179 | } |
| 1180 | - if (!$Connection->checkColumnName('aircraft','manufacturer')) { |
|
| 1180 | + if (!$Connection->checkColumnName('aircraft', 'manufacturer')) { |
|
| 1181 | 1181 | // Add mfr to aircraft |
| 1182 | 1182 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
| 1183 | 1183 | try { |
| 1184 | 1184 | $sth = $Connection->db->prepare($query); |
| 1185 | 1185 | $sth->execute(); |
| 1186 | - } catch(PDOException $e) { |
|
| 1186 | + } catch (PDOException $e) { |
|
| 1187 | 1187 | return "error (add mfr column in aircraft) : ".$e->getMessage()."\n"; |
| 1188 | 1188 | } |
| 1189 | 1189 | } |
@@ -1199,7 +1199,7 @@ discard block |
||
| 1199 | 1199 | try { |
| 1200 | 1200 | $sth = $Connection->db->prepare($query); |
| 1201 | 1201 | $sth->execute(); |
| 1202 | - } catch(PDOException $e) { |
|
| 1202 | + } catch (PDOException $e) { |
|
| 1203 | 1203 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 1204 | 1204 | } |
| 1205 | 1205 | return $error; |
@@ -1221,7 +1221,7 @@ discard block |
||
| 1221 | 1221 | try { |
| 1222 | 1222 | $sth = $Connection->db->prepare($query); |
| 1223 | 1223 | $sth->execute(); |
| 1224 | - } catch(PDOException $e) { |
|
| 1224 | + } catch (PDOException $e) { |
|
| 1225 | 1225 | return "error : ".$e->getMessage()."\n"; |
| 1226 | 1226 | } |
| 1227 | 1227 | $result = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | $page_url = $globalURL.'/accident-latest'; |
| 10 | 10 | |
| 11 | -if(!isset($_GET['limit'])) |
|
| 11 | +if (!isset($_GET['limit'])) |
|
| 12 | 12 | { |
| 13 | 13 | $limit_start = 0; |
| 14 | 14 | $limit_end = 25; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | |
| 35 | 35 | print '<div class="table column">'; |
| 36 | 36 | print '<p>'._("The table below shows the latest Incidents.").'</p>'; |
| 37 | -$spotter_array = $Accident->getLatestAccidentData($limit_start.",".$absolute_difference,'incident'); |
|
| 37 | +$spotter_array = $Accident->getLatestAccidentData($limit_start.",".$absolute_difference, 'incident'); |
|
| 38 | 38 | //print_r($spotter_array); |
| 39 | 39 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
| 40 | 40 | include('table-output.php'); |