@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | if (!empty($spotter_array)) |
26 | 26 | { |
27 | - $title = sprintf(_("Most Common Time of Day of %s"),$spotter_array[0]['aircraft_owner']); |
|
27 | + $title = sprintf(_("Most Common Time of Day of %s"), $spotter_array[0]['aircraft_owner']); |
|
28 | 28 | require_once('header.php'); |
29 | 29 | print '<div class="info column">'; |
30 | 30 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | include('owner-sub-menu.php'); |
36 | 36 | print '<div class="column">'; |
37 | 37 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
38 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | 39 | |
40 | 40 | if ($archive === false) { |
41 | - $hour_array = $Spotter->countAllHoursByOwner($owner,$filter); |
|
41 | + $hour_array = $Spotter->countAllHoursByOwner($owner, $filter); |
|
42 | 42 | } else { |
43 | - $hour_array = $SpotterArchive->countAllHoursByOwner($owner,$filter); |
|
43 | + $hour_array = $SpotterArchive->countAllHoursByOwner($owner, $filter); |
|
44 | 44 | } |
45 | 45 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
46 | 46 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | $hour_data = ''; |
50 | 50 | $hour_cnt = ''; |
51 | 51 | $last = 0; |
52 | - foreach($hour_array as $hour_item) |
|
52 | + foreach ($hour_array as $hour_item) |
|
53 | 53 | { |
54 | - while($last != $hour_item['hour_name']) { |
|
54 | + while ($last != $hour_item['hour_name']) { |
|
55 | 55 | $hour_data .= '"'.$last.':00",'; |
56 | 56 | $hour_cnt .= '0,'; |
57 | 57 | $last++; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $hour_cnt .= $hour_item['hour_count'].','; |
62 | 62 | } |
63 | 63 | $hour_data = "['x',".substr($hour_data, 0, -1)."]"; |
64 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
64 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
65 | 65 | print 'c3.generate({ |
66 | 66 | bindto: "#chartHour", |
67 | 67 | data: { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | print '</thead>'; |
87 | 87 | print '<tbody>'; |
88 | 88 | $i = 1; |
89 | - foreach($hour_array as $hour_item) |
|
89 | + foreach ($hour_array as $hour_item) |
|
90 | 90 | { |
91 | 91 | print '<tr>'; |
92 | 92 | print '<td>'.$hour_item['hour_name'].':00</td>'; |
@@ -9,21 +9,21 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
13 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
13 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
22 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
23 | 23 | } |
24 | 24 | if (!empty($spotter_array)) |
25 | 25 | { |
26 | - $title = sprintf(_("Most Common Aircraft by Registration of %s"),$spotter_array[0]['aircraft_owner']); |
|
26 | + $title = sprintf(_("Most Common Aircraft by Registration of %s"), $spotter_array[0]['aircraft_owner']); |
|
27 | 27 | require_once('header.php'); |
28 | 28 | print '<div class="info column">'; |
29 | 29 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | include('owner-sub-menu.php'); |
35 | 35 | print '<div class="column">'; |
36 | 36 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
37 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
37 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by Registration of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | 38 | if ($archive === false) { |
39 | - $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner,$filter); |
|
39 | + $aircraft_array = $Spotter->countAllAircraftRegistrationByOwner($owner, $filter); |
|
40 | 40 | } else { |
41 | - $aircraft_array = $SpotterArchive->countAllAircraftRegistrationByOwner($owner,$filter); |
|
41 | + $aircraft_array = $SpotterArchive->countAllAircraftRegistrationByOwner($owner, $filter); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | if (!empty($aircraft_array)) |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | print '</thead>'; |
56 | 56 | print '<tbody>'; |
57 | 57 | $i = 1; |
58 | - foreach($aircraft_array as $aircraft_item) |
|
58 | + foreach ($aircraft_array as $aircraft_item) |
|
59 | 59 | { |
60 | 60 | print '<tr>'; |
61 | 61 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | if (!empty($spotter_array)) |
26 | 26 | { |
27 | - $title = sprintf(_("Most Common Departure Airports of %s"),$spotter_array[0]['aircraft_owner']); |
|
27 | + $title = sprintf(_("Most Common Departure Airports of %s"), $spotter_array[0]['aircraft_owner']); |
|
28 | 28 | require_once('header.php'); |
29 | 29 | print '<div class="info column">'; |
30 | 30 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | include('owner-sub-menu.php'); |
36 | 36 | print '<div class="column">'; |
37 | 37 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
38 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | 39 | if ($archive === false) { |
40 | - $airport_airport_array = $Spotter->countAllDepartureAirportsByOwner($owner,$filter); |
|
40 | + $airport_airport_array = $Spotter->countAllDepartureAirportsByOwner($owner, $filter); |
|
41 | 41 | } else { |
42 | - $airport_airport_array = $SpotterArchive->countAllDepartureAirportsByOwner($owner,$filter); |
|
42 | + $airport_airport_array = $SpotterArchive->countAllDepartureAirportsByOwner($owner, $filter); |
|
43 | 43 | } |
44 | 44 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
45 | 45 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | print '<script>'; |
49 | 49 | print 'var series = ['; |
50 | 50 | $airport_data = ''; |
51 | - foreach($airport_airport_array as $airport_item) |
|
51 | + foreach ($airport_airport_array as $airport_item) |
|
52 | 52 | { |
53 | 53 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
54 | 54 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | print '</thead>'; |
104 | 104 | print '<tbody>'; |
105 | 105 | $i = 1; |
106 | - foreach($airport_airport_array as $airport_item) |
|
106 | + foreach ($airport_airport_array as $airport_item) |
|
107 | 107 | { |
108 | 108 | print '<tr>'; |
109 | 109 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -14,75 +14,75 @@ discard block |
||
14 | 14 | * @param Array $filter the filter |
15 | 15 | * @return Array the SQL part |
16 | 16 | */ |
17 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
17 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
18 | 18 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
19 | 19 | $filters = array(); |
20 | 20 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
21 | 21 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
22 | 22 | $filters = $globalStatsFilters[$globalFilterName]; |
23 | 23 | } else { |
24 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
24 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
25 | 25 | } |
26 | 26 | } |
27 | 27 | if (isset($filter[0]['source'])) { |
28 | - $filters = array_merge($filters,$filter); |
|
28 | + $filters = array_merge($filters, $filter); |
|
29 | 29 | } |
30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
30 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
31 | 31 | $filter_query_join = ''; |
32 | 32 | $filter_query_where = ''; |
33 | - foreach($filters as $flt) { |
|
33 | + foreach ($filters as $flt) { |
|
34 | 34 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
35 | 35 | if ($flt['airlines'][0] != '' && $flt['airlines'][0] != 'all') { |
36 | 36 | if (isset($flt['source'])) { |
37 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
37 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
38 | 38 | } else { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saff ON saff.flightaware_id = spotter_archive_output.flightaware_id"; |
|
40 | 40 | } |
41 | 41 | } |
42 | 42 | } |
43 | 43 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
44 | 44 | if (isset($flt['source'])) { |
45 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
45 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
46 | 46 | } else { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) sp ON sp.flightaware_id = spotter_archive_output.flightaware_id"; |
|
48 | 48 | } |
49 | 49 | } |
50 | 50 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
51 | 51 | if (isset($flt['source'])) { |
52 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
52 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
53 | 53 | } else { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','",$flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.ident IN ('".implode("','", $flt['idents'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
58 | 58 | if (isset($flt['source'])) { |
59 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
59 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_archive_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
60 | 60 | } else { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_archive_output.flightaware_id"; |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents']) && isset($flt['registrations']) && empty($flt['registrations'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
65 | 65 | if (isset($flt['source'])) { |
66 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
66 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saa ON saa.flightaware_id = spotter_archive_output.flightaware_id"; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
70 | 70 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
71 | 71 | if ($filter['airlines'][0] != '' && $filter['airlines'][0] != 'all') { |
72 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
72 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) saf ON saf.flightaware_id = spotter_archive_output.flightaware_id"; |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
76 | 76 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive_output.flightaware_id "; |
77 | 77 | } |
78 | 78 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
79 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
79 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) spi ON spi.flightaware_id = spotter_archive_output.flightaware_id"; |
|
80 | 80 | } |
81 | 81 | if (isset($filter['source']) && !empty($filter['source'])) { |
82 | 82 | if (count($filter['source']) == 1) { |
83 | 83 | $filter_query_where .= " AND format_source = '".$filter['source'][0]."'"; |
84 | 84 | } else { |
85 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
85 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
86 | 86 | } |
87 | 87 | } |
88 | 88 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | $filter_query_where .= " AND flightaware_id = '".$filter['id']."'"; |
93 | 93 | } |
94 | 94 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
95 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
95 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
96 | 96 | } |
97 | 97 | if ((isset($filter['year']) && $filter['year'] != '') || (isset($filter['month']) && $filter['month'] != '') || (isset($filter['day']) && $filter['day'] != '')) { |
98 | 98 | $filter_query_date = ''; |
@@ -117,41 +117,41 @@ discard block |
||
117 | 117 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_archive_output.date) = '".$filter['day']."'"; |
118 | 118 | } |
119 | 119 | } |
120 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
120 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
|
121 | 121 | } |
122 | 122 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
123 | 123 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
124 | 124 | if ($filter_query_where != '') { |
125 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
125 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
126 | 126 | } |
127 | 127 | $filter_query = $filter_query_join.$filter_query_where; |
128 | 128 | return $filter_query; |
129 | 129 | } |
130 | 130 | |
131 | 131 | // Spotter_archive |
132 | - public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '',$arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city ='', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '',$latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '',$heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '',$verticalrate = '',$format_source = '', $source_name = '', $over_country = '') { |
|
132 | + public function addSpotterArchiveData($flightaware_id = '', $ident = '', $registration = '', $airline_name = '', $airline_icao = '', $airline_country = '', $airline_type = '', $aircraft_icao = '', $aircraft_shadow = '', $aircraft_name = '', $aircraft_manufacturer = '', $departure_airport_icao = '', $departure_airport_name = '', $departure_airport_city = '', $departure_airport_country = '', $departure_airport_time = '', $arrival_airport_icao = '', $arrival_airport_name = '', $arrival_airport_city = '', $arrival_airport_country = '', $arrival_airport_time = '', $route_stop = '', $date = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $real_altitude = '', $heading = '', $ground_speed = '', $squawk = '', $ModeS = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $format_source = '', $source_name = '', $over_country = '') { |
|
133 | 133 | require_once(dirname(__FILE__).'/class.Spotter.php'); |
134 | 134 | if ($over_country == '') { |
135 | 135 | $Spotter = new Spotter($this->db); |
136 | - $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
|
136 | + $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude, $longitude); |
|
137 | 137 | if (!empty($data_country)) $country = $data_country['iso2']; |
138 | 138 | else $country = ''; |
139 | 139 | } else $country = $over_country; |
140 | - if ($airline_type === NULL) $airline_type =''; |
|
140 | + if ($airline_type === NULL) $airline_type = ''; |
|
141 | 141 | |
142 | 142 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
143 | 143 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
144 | 144 | |
145 | 145 | // Route is not added in spotter_archive |
146 | - $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
146 | + $query = "INSERT INTO spotter_archive (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, departure_airport_time,arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, arrival_airport_time, route_stop, date,latitude, longitude, waypoints, altitude, heading, ground_speed, squawk, ModeS, pilot_id, pilot_name, verticalrate,format_source,over_country,source_name,real_altitude) |
|
147 | 147 | VALUES (:flightaware_id, :ident, :registration, :airline_name, :airline_icao, :airline_country, :airline_type, :aircraft_icao, :aircraft_shadow, :aircraft_name, :aircraft_manufacturer, :departure_airport_icao, :departure_airport_name, :departure_airport_city, :departure_airport_country, :departure_airport_time,:arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :arrival_airport_time, :route_stop, :date,:latitude, :longitude, :waypoints, :altitude, :heading, :ground_speed, :squawk, :ModeS, :pilot_id, :pilot_name, :verticalrate, :format_source, :over_country, :source_name,:real_altitude)"; |
148 | 148 | |
149 | - $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time,':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date,':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name,':real_altitude' => $real_altitude); |
|
149 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_name' => $aircraft_name, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':arrival_airport_time' => $arrival_airport_time, ':route_stop' => $route_stop, ':date' => $date, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':ground_speed' => $ground_speed, ':squawk' => $squawk, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':over_country' => $country, ':source_name' => $source_name, ':real_altitude' => $real_altitude); |
|
150 | 150 | try { |
151 | 151 | $sth = $this->db->prepare($query); |
152 | 152 | $sth->execute($query_values); |
153 | 153 | $sth->closeCursor(); |
154 | - } catch(PDOException $e) { |
|
154 | + } catch (PDOException $e) { |
|
155 | 155 | return "error : ".$e->getMessage(); |
156 | 156 | } |
157 | 157 | return "success"; |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | |
171 | 171 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
172 | 172 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
173 | - $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
173 | + $query = "SELECT spotter_archive.* FROM spotter_archive WHERE ident = :ident ORDER BY date DESC LIMIT 1"; |
|
174 | 174 | |
175 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident)); |
|
175 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident)); |
|
176 | 176 | |
177 | 177 | return $spotter_array; |
178 | 178 | } |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
191 | 191 | //$query = SpotterArchive->$global_query." WHERE spotter_archive.flightaware_id = :id"; |
192 | 192 | //$query = "SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
193 | - $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
193 | + $query = "SELECT * FROM spotter_archive WHERE flightaware_id = :id ORDER BY date DESC LIMIT 1"; |
|
194 | 194 | |
195 | 195 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
196 | 196 | /* |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | } |
204 | 204 | $spotter_array = $sth->fetchAll(PDO->FETCH_ASSOC); |
205 | 205 | */ |
206 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id)); |
|
206 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id)); |
|
207 | 207 | |
208 | 208 | return $spotter_array; |
209 | 209 | } |
@@ -217,14 +217,14 @@ discard block |
||
217 | 217 | public function getAllArchiveSpotterDataById($id) { |
218 | 218 | date_default_timezone_set('UTC'); |
219 | 219 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
220 | - $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
220 | + $query = $this->global_query." WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
221 | 221 | |
222 | 222 | // $spotter_array = Spotter->getDataFromDB($query,array(':id' => $id)); |
223 | 223 | |
224 | 224 | try { |
225 | 225 | $sth = $this->db->prepare($query); |
226 | 226 | $sth->execute(array(':id' => $id)); |
227 | - } catch(PDOException $e) { |
|
227 | + } catch (PDOException $e) { |
|
228 | 228 | echo $e->getMessage(); |
229 | 229 | die; |
230 | 230 | } |
@@ -242,11 +242,11 @@ discard block |
||
242 | 242 | public function getCoordArchiveSpotterDataById($id) { |
243 | 243 | date_default_timezone_set('UTC'); |
244 | 244 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
245 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
245 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER by spotter_archive.date ASC"; |
|
246 | 246 | try { |
247 | 247 | $sth = $this->db->prepare($query); |
248 | 248 | $sth->execute(array(':id' => $id)); |
249 | - } catch(PDOException $e) { |
|
249 | + } catch (PDOException $e) { |
|
250 | 250 | echo $e->getMessage(); |
251 | 251 | die; |
252 | 252 | } |
@@ -260,14 +260,14 @@ discard block |
||
260 | 260 | * @return Array the spotter information |
261 | 261 | * |
262 | 262 | */ |
263 | - public function getCoordArchiveSpotterDataByIdDate($id,$begindate,$enddate) { |
|
263 | + public function getCoordArchiveSpotterDataByIdDate($id, $begindate, $enddate) { |
|
264 | 264 | date_default_timezone_set('UTC'); |
265 | 265 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
266 | - $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
266 | + $query = "SELECT spotter_archive.latitude, spotter_archive.longitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.date BETWEEN :begindate AND :enddate ORDER by spotter_archive.date ASC"; |
|
267 | 267 | try { |
268 | 268 | $sth = $this->db->prepare($query); |
269 | - $sth->execute(array(':id' => $id,':begindate' => $begindate,':enddate' => $enddate)); |
|
270 | - } catch(PDOException $e) { |
|
269 | + $sth->execute(array(':id' => $id, ':begindate' => $begindate, ':enddate' => $enddate)); |
|
270 | + } catch (PDOException $e) { |
|
271 | 271 | echo $e->getMessage(); |
272 | 272 | die; |
273 | 273 | } |
@@ -287,12 +287,12 @@ discard block |
||
287 | 287 | date_default_timezone_set('UTC'); |
288 | 288 | |
289 | 289 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
290 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
290 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
291 | 291 | |
292 | 292 | try { |
293 | 293 | $sth = $this->db->prepare($query); |
294 | 294 | $sth->execute(array(':ident' => $ident)); |
295 | - } catch(PDOException $e) { |
|
295 | + } catch (PDOException $e) { |
|
296 | 296 | echo $e->getMessage(); |
297 | 297 | die; |
298 | 298 | } |
@@ -312,12 +312,12 @@ discard block |
||
312 | 312 | date_default_timezone_set('UTC'); |
313 | 313 | |
314 | 314 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
315 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
315 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id AND spotter_archive.latitude <> 0 AND spotter_archive.longitude <> 0 ORDER BY date"; |
|
316 | 316 | |
317 | 317 | try { |
318 | 318 | $sth = $this->db->prepare($query); |
319 | 319 | $sth->execute(array(':id' => $id)); |
320 | - } catch(PDOException $e) { |
|
320 | + } catch (PDOException $e) { |
|
321 | 321 | echo $e->getMessage(); |
322 | 322 | die; |
323 | 323 | } |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | public function getAltitudeSpeedArchiveSpotterDataById($id) { |
336 | 336 | date_default_timezone_set('UTC'); |
337 | 337 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
338 | - $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
338 | + $query = "SELECT spotter_archive.altitude, spotter_archive.real_altitude,spotter_archive.ground_speed, spotter_archive.date FROM spotter_archive WHERE spotter_archive.flightaware_id = :id ORDER BY date"; |
|
339 | 339 | try { |
340 | 340 | $sth = $this->db->prepare($query); |
341 | 341 | $sth->execute(array(':id' => $id)); |
342 | - } catch(PDOException $e) { |
|
342 | + } catch (PDOException $e) { |
|
343 | 343 | echo $e->getMessage(); |
344 | 344 | die; |
345 | 345 | } |
@@ -356,12 +356,12 @@ discard block |
||
356 | 356 | public function getLastAltitudeArchiveSpotterDataByIdent($ident) { |
357 | 357 | date_default_timezone_set('UTC'); |
358 | 358 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
359 | - $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
359 | + $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate LIMIT 1"; |
|
360 | 360 | // $query = "SELECT spotter_archive.altitude, spotter_archive.date FROM spotter_archive WHERE spotter_archive.ident = :ident"; |
361 | 361 | try { |
362 | 362 | $sth = $this->db->prepare($query); |
363 | 363 | $sth->execute(array(':ident' => $ident)); |
364 | - } catch(PDOException $e) { |
|
364 | + } catch (PDOException $e) { |
|
365 | 365 | echo $e->getMessage(); |
366 | 366 | die; |
367 | 367 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | * @return Array the spotter information |
378 | 378 | * |
379 | 379 | */ |
380 | - public function getSpotterArchiveData($ident,$flightaware_id,$date) { |
|
380 | + public function getSpotterArchiveData($ident, $flightaware_id, $date) { |
|
381 | 381 | $Spotter = new Spotter($this->db); |
382 | 382 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
383 | - $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
384 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':flightaware_id' => $flightaware_id,':date' => $date.'%')); |
|
383 | + $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.flightaware_id = :flightaware_id AND l.date LIKE :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
|
384 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':flightaware_id' => $flightaware_id, ':date' => $date.'%')); |
|
385 | 385 | return $spotter_array; |
386 | 386 | } |
387 | 387 | |
@@ -395,7 +395,7 @@ discard block |
||
395 | 395 | try { |
396 | 396 | $sth = $this->db->prepare($query); |
397 | 397 | $sth->execute(); |
398 | - } catch(PDOException $e) { |
|
398 | + } catch (PDOException $e) { |
|
399 | 399 | echo $e->getMessage(); |
400 | 400 | die; |
401 | 401 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | try { |
407 | 407 | $sth = $this->db->prepare($query); |
408 | 408 | $sth->execute(array(':id' => $id)); |
409 | - } catch(PDOException $e) { |
|
409 | + } catch (PDOException $e) { |
|
410 | 410 | echo $e->getMessage(); |
411 | 411 | die; |
412 | 412 | } |
@@ -418,39 +418,39 @@ discard block |
||
418 | 418 | * @return Array the spotter information |
419 | 419 | * |
420 | 420 | */ |
421 | - public function getMinLiveSpotterData($begindate,$enddate,$filter = array(),$part = 0) { |
|
421 | + public function getMinLiveSpotterData($begindate, $enddate, $filter = array(), $part = 0) { |
|
422 | 422 | global $globalDBdriver, $globalLiveInterval; |
423 | 423 | date_default_timezone_set('UTC'); |
424 | 424 | //$filter_query = $this->getFilter($filter,true,true); |
425 | 425 | |
426 | 426 | $filter_query = ''; |
427 | 427 | if (isset($filter['source']) && !empty($filter['source'])) { |
428 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
428 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
429 | 429 | } |
430 | 430 | // Use spotter_output also ? |
431 | 431 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
432 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
432 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
433 | 433 | } |
434 | 434 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
435 | 435 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
436 | 436 | } |
437 | 437 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
438 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
438 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
439 | 439 | } |
440 | 440 | |
441 | 441 | $limit = ''; |
442 | 442 | if ($part != 0) { |
443 | - $limit = ' LIMIT 100 OFFSET '.($part-1)*100; |
|
443 | + $limit = ' LIMIT 100 OFFSET '.($part - 1)*100; |
|
444 | 444 | } |
445 | 445 | if ($globalDBdriver == 'mysql') { |
446 | - $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
446 | + $query = 'SELECT spotter_archive.date,spotter_archive.flightaware_id, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
447 | 447 | FROM spotter_archive |
448 | 448 | INNER JOIN aircraft a on spotter_archive.aircraft_icao = a.icao |
449 | 449 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
450 | 450 | '.$filter_query.' ORDER BY flightaware_id'.$limit; |
451 | 451 | } else { |
452 | 452 | |
453 | - $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
453 | + $query = 'SELECT spotter_archive.flightaware_id, spotter_archive.date, spotter_archive.ident, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, a.aircraft_shadow,a.engine_type, a.engine_count, a.wake_category |
|
454 | 454 | FROM spotter_archive |
455 | 455 | INNER JOIN aircraft a on spotter_archive.aircraft_icao = a.icao |
456 | 456 | WHERE spotter_archive.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".' |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | try { |
469 | 469 | $sth = $this->db->prepare($query); |
470 | 470 | $sth->execute(); |
471 | - } catch(PDOException $e) { |
|
471 | + } catch (PDOException $e) { |
|
472 | 472 | echo $e->getMessage(); |
473 | 473 | die; |
474 | 474 | } |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * @return Array the spotter information |
483 | 483 | * |
484 | 484 | */ |
485 | - public function getMinLiveSpotterDataPlayback($begindate,$enddate,$filter = array()) { |
|
485 | + public function getMinLiveSpotterDataPlayback($begindate, $enddate, $filter = array()) { |
|
486 | 486 | global $globalDBdriver, $globalLiveInterval; |
487 | 487 | date_default_timezone_set('UTC'); |
488 | 488 | |
@@ -490,17 +490,17 @@ discard block |
||
490 | 490 | |
491 | 491 | $filter_query = ''; |
492 | 492 | if (isset($filter['source']) && !empty($filter['source'])) { |
493 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
493 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
494 | 494 | } |
495 | 495 | // Use spotter_output also ? |
496 | 496 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
497 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
497 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
498 | 498 | } |
499 | 499 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
500 | 500 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output WHERE spotter_archive_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
501 | 501 | } |
502 | 502 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
503 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
503 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | FROM spotter_archive |
512 | 512 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE (l.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate '.$filter_query.'LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive.aircraft_icao = a.icao'; |
513 | 513 | */ |
514 | - $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
514 | + $query = 'SELECT a.aircraft_shadow, spotter_archive_output.ident, spotter_archive_output.flightaware_id, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk |
|
515 | 515 | FROM spotter_archive_output |
516 | 516 | LEFT JOIN (SELECT aircraft_shadow,icao FROM aircraft) a ON spotter_archive_output.aircraft_icao = a.icao |
517 | 517 | WHERE (spotter_archive_output.date BETWEEN '."'".$begindate."'".' AND '."'".$enddate."'".') |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
527 | 527 | '.$filter_query.' GROUP BY spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao, spotter_archive_output.arrival_airport_icao, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow'; |
528 | 528 | */ |
529 | - $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
529 | + $query = 'SELECT DISTINCT spotter_archive_output.flightaware_id, spotter_archive_output.ident, spotter_archive_output.aircraft_icao, spotter_archive_output.departure_airport_icao as departure_airport, spotter_archive_output.arrival_airport_icao as arrival_airport, spotter_archive_output.latitude, spotter_archive_output.longitude, spotter_archive_output.altitude, spotter_archive_output.heading, spotter_archive_output.ground_speed, spotter_archive_output.squawk, a.aircraft_shadow |
|
530 | 530 | FROM spotter_archive_output |
531 | 531 | INNER JOIN (SELECT * FROM aircraft) a on spotter_archive_output.aircraft_icao = a.icao |
532 | 532 | WHERE spotter_archive_output.date >= '."'".$begindate."'".' AND spotter_archive_output.date <= '."'".$enddate."'".' |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | try { |
539 | 539 | $sth = $this->db->prepare($query); |
540 | 540 | $sth->execute(); |
541 | - } catch(PDOException $e) { |
|
541 | + } catch (PDOException $e) { |
|
542 | 542 | echo $e->getMessage(); |
543 | 543 | die; |
544 | 544 | } |
@@ -553,22 +553,22 @@ discard block |
||
553 | 553 | * @return Array the spotter information |
554 | 554 | * |
555 | 555 | */ |
556 | - public function getLiveSpotterCount($begindate,$enddate,$filter = array()) { |
|
556 | + public function getLiveSpotterCount($begindate, $enddate, $filter = array()) { |
|
557 | 557 | global $globalDBdriver, $globalLiveInterval; |
558 | 558 | date_default_timezone_set('UTC'); |
559 | 559 | |
560 | 560 | $filter_query = ''; |
561 | 561 | if (isset($filter['source']) && !empty($filter['source'])) { |
562 | - $filter_query .= " AND format_source IN ('".implode("','",$filter['source'])."') "; |
|
562 | + $filter_query .= " AND format_source IN ('".implode("','", $filter['source'])."') "; |
|
563 | 563 | } |
564 | 564 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
565 | - $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
565 | + $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) so ON so.flightaware_id = spotter_archive.flightaware_id "; |
|
566 | 566 | } |
567 | 567 | if (isset($filter['airlinestype']) && !empty($filter['airlinestype'])) { |
568 | 568 | $filter_query .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_archive.flightaware_id "; |
569 | 569 | } |
570 | 570 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
571 | - $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
571 | + $filter_query = " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
572 | 572 | } |
573 | 573 | |
574 | 574 | //if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | try { |
584 | 584 | $sth = $this->db->prepare($query); |
585 | 585 | $sth->execute(); |
586 | - } catch(PDOException $e) { |
|
586 | + } catch (PDOException $e) { |
|
587 | 587 | echo $e->getMessage(); |
588 | 588 | die; |
589 | 589 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | * @return Array the spotter information |
604 | 604 | * |
605 | 605 | */ |
606 | - 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()) { |
|
606 | + 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()) { |
|
607 | 607 | global $globalTimezone, $globalDBdriver; |
608 | 608 | require_once(dirname(__FILE__).'/class.Translation.php'); |
609 | 609 | $Translation = new Translation($this->db); |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | } |
654 | 654 | |
655 | 655 | if ($registration != "") { |
656 | - $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
|
656 | + $registration = filter_var($registration, FILTER_SANITIZE_STRING); |
|
657 | 657 | if (!is_string($registration)) { |
658 | 658 | return array(); |
659 | 659 | } else { |
@@ -662,7 +662,7 @@ discard block |
||
662 | 662 | } |
663 | 663 | |
664 | 664 | if ($aircraft_icao != "") { |
665 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
665 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
666 | 666 | if (!is_string($aircraft_icao)) { |
667 | 667 | return array(); |
668 | 668 | } else { |
@@ -671,7 +671,7 @@ discard block |
||
671 | 671 | } |
672 | 672 | |
673 | 673 | if ($aircraft_manufacturer != "") { |
674 | - $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
|
674 | + $aircraft_manufacturer = filter_var($aircraft_manufacturer, FILTER_SANITIZE_STRING); |
|
675 | 675 | if (!is_string($aircraft_manufacturer)) { |
676 | 676 | return array(); |
677 | 677 | } else { |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | |
690 | 690 | if ($airline_icao != "") { |
691 | - $airline_icao = filter_var($airline_icao,FILTER_SANITIZE_STRING); |
|
691 | + $airline_icao = filter_var($airline_icao, FILTER_SANITIZE_STRING); |
|
692 | 692 | if (!is_string($airline_icao)) { |
693 | 693 | return array(); |
694 | 694 | } else { |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | } |
698 | 698 | |
699 | 699 | if ($airline_country != "") { |
700 | - $airline_country = filter_var($airline_country,FILTER_SANITIZE_STRING); |
|
700 | + $airline_country = filter_var($airline_country, FILTER_SANITIZE_STRING); |
|
701 | 701 | if (!is_string($airline_country)) { |
702 | 702 | return array(); |
703 | 703 | } else { |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | } |
707 | 707 | |
708 | 708 | if ($airline_type != "") { |
709 | - $airline_type = filter_var($airline_type,FILTER_SANITIZE_STRING); |
|
709 | + $airline_type = filter_var($airline_type, FILTER_SANITIZE_STRING); |
|
710 | 710 | if (!is_string($airline_type)) { |
711 | 711 | return array(); |
712 | 712 | } else { |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | } |
724 | 724 | |
725 | 725 | if ($airport != "") { |
726 | - $airport = filter_var($airport,FILTER_SANITIZE_STRING); |
|
726 | + $airport = filter_var($airport, FILTER_SANITIZE_STRING); |
|
727 | 727 | if (!is_string($airport)) { |
728 | 728 | return array(); |
729 | 729 | } else { |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | } |
733 | 733 | |
734 | 734 | if ($airport_country != "") { |
735 | - $airport_country = filter_var($airport_country,FILTER_SANITIZE_STRING); |
|
735 | + $airport_country = filter_var($airport_country, FILTER_SANITIZE_STRING); |
|
736 | 736 | if (!is_string($airport_country)) { |
737 | 737 | return array(); |
738 | 738 | } else { |
@@ -741,14 +741,14 @@ discard block |
||
741 | 741 | } |
742 | 742 | |
743 | 743 | if ($callsign != "") { |
744 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
744 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
745 | 745 | if (!is_string($callsign)) { |
746 | 746 | return array(); |
747 | 747 | } else { |
748 | 748 | $translate = $Translation->ident2icao($callsign); |
749 | 749 | if ($translate != $callsign) { |
750 | 750 | $additional_query .= " AND (spotter_archive_output.ident = :callsign OR spotter_archive_output.ident = :translate)"; |
751 | - $query_values = array_merge($query_values,array(':callsign' => $callsign,':translate' => $translate)); |
|
751 | + $query_values = array_merge($query_values, array(':callsign' => $callsign, ':translate' => $translate)); |
|
752 | 752 | } else { |
753 | 753 | $additional_query .= " AND (spotter_archive_output.ident = '".$callsign."')"; |
754 | 754 | } |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | } |
757 | 757 | |
758 | 758 | if ($owner != "") { |
759 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
759 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
760 | 760 | if (!is_string($owner)) { |
761 | 761 | return array(); |
762 | 762 | } else { |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | } |
766 | 766 | |
767 | 767 | if ($pilot_name != "") { |
768 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
768 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
769 | 769 | if (!is_string($pilot_name)) { |
770 | 770 | return array(); |
771 | 771 | } else { |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | } |
775 | 775 | |
776 | 776 | if ($pilot_id != "") { |
777 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_NUMBER_INT); |
|
777 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_NUMBER_INT); |
|
778 | 778 | if (!is_string($pilot_id)) { |
779 | 779 | return array(); |
780 | 780 | } else { |
@@ -783,7 +783,7 @@ discard block |
||
783 | 783 | } |
784 | 784 | |
785 | 785 | if ($departure_airport_route != "") { |
786 | - $departure_airport_route = filter_var($departure_airport_route,FILTER_SANITIZE_STRING); |
|
786 | + $departure_airport_route = filter_var($departure_airport_route, FILTER_SANITIZE_STRING); |
|
787 | 787 | if (!is_string($departure_airport_route)) { |
788 | 788 | return array(); |
789 | 789 | } else { |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | } |
793 | 793 | |
794 | 794 | if ($arrival_airport_route != "") { |
795 | - $arrival_airport_route = filter_var($arrival_airport_route,FILTER_SANITIZE_STRING); |
|
795 | + $arrival_airport_route = filter_var($arrival_airport_route, FILTER_SANITIZE_STRING); |
|
796 | 796 | if (!is_string($arrival_airport_route)) { |
797 | 797 | return array(); |
798 | 798 | } else { |
@@ -803,8 +803,8 @@ discard block |
||
803 | 803 | if ($altitude != "") { |
804 | 804 | $altitude_array = explode(",", $altitude); |
805 | 805 | |
806 | - $altitude_array[0] = filter_var($altitude_array[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
807 | - $altitude_array[1] = filter_var($altitude_array[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
806 | + $altitude_array[0] = filter_var($altitude_array[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
807 | + $altitude_array[1] = filter_var($altitude_array[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
808 | 808 | |
809 | 809 | |
810 | 810 | if ($altitude_array[1] != "") { |
@@ -819,8 +819,8 @@ discard block |
||
819 | 819 | |
820 | 820 | if ($date_posted != "") { |
821 | 821 | $date_array = explode(",", $date_posted); |
822 | - $date_array[0] = filter_var($date_array[0],FILTER_SANITIZE_STRING); |
|
823 | - $date_array[1] = filter_var($date_array[1],FILTER_SANITIZE_STRING); |
|
822 | + $date_array[0] = filter_var($date_array[0], FILTER_SANITIZE_STRING); |
|
823 | + $date_array[1] = filter_var($date_array[1], FILTER_SANITIZE_STRING); |
|
824 | 824 | if ($globalTimezone != '') { |
825 | 825 | date_default_timezone_set($globalTimezone); |
826 | 826 | $datetime = new DateTime(); |
@@ -845,16 +845,16 @@ discard block |
||
845 | 845 | } |
846 | 846 | if ($limit != "") { |
847 | 847 | $limit_array = explode(",", $limit); |
848 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
849 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
848 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
849 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
850 | 850 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
851 | 851 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
852 | 852 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
853 | 853 | } |
854 | 854 | } |
855 | 855 | if ($origLat != "" && $origLon != "" && $dist != "") { |
856 | - $dist = number_format($dist*0.621371,2,'.',''); |
|
857 | - $query="SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
856 | + $dist = number_format($dist*0.621371, 2, '.', ''); |
|
857 | + $query = "SELECT spotter_archive_output.*, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2))) as distance |
|
858 | 858 | FROM spotter_archive_output, spotter_archive WHERE spotter_output_archive.flightaware_id = spotter_archive.flightaware_id AND spotter_output.ident <> '' ".$additional_query."AND CAST(spotter_archive.longitude as double precision) between ($origLon-$dist/ABS(cos(radians($origLat))*69)) and ($origLon+$dist/ABS(cos(radians($origLat))*69)) and CAST(spotter_archive.latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
859 | 859 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - ABS(CAST(spotter_archive.latitude as double precision)))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(ABS(CAST(spotter_archive.latitude as double precision))*pi()/180)*POWER(SIN(($origLon-CAST(spotter_archive.longitude as double precision))*pi()/180/2),2)))) < $dist".$filter_query." ORDER BY distance"; |
860 | 860 | } else { |
@@ -868,12 +868,12 @@ discard block |
||
868 | 868 | $additional_query .= " AND (spotter_archive_output.waypoints <> '')"; |
869 | 869 | } |
870 | 870 | |
871 | - $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
871 | + $query = "SELECT spotter_archive_output.* FROM spotter_archive_output |
|
872 | 872 | WHERE spotter_archive_output.ident <> '' |
873 | 873 | ".$additional_query." |
874 | 874 | ".$filter_query.$orderby_query; |
875 | 875 | } |
876 | - $spotter_array = $Spotter->getDataFromDB($query, $query_values,$limit_query); |
|
876 | + $spotter_array = $Spotter->getDataFromDB($query, $query_values, $limit_query); |
|
877 | 877 | return $spotter_array; |
878 | 878 | } |
879 | 879 | |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | try { |
889 | 889 | $sth = $this->db->prepare($query); |
890 | 890 | $sth->execute(); |
891 | - } catch(PDOException $e) { |
|
891 | + } catch (PDOException $e) { |
|
892 | 892 | return "error"; |
893 | 893 | } |
894 | 894 | } |
@@ -921,8 +921,8 @@ discard block |
||
921 | 921 | if ($limit != "") { |
922 | 922 | $limit_array = explode(",", $limit); |
923 | 923 | |
924 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
925 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
924 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
925 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
926 | 926 | |
927 | 927 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
928 | 928 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | $query_values = array(); |
961 | 961 | $limit_query = ''; |
962 | 962 | $additional_query = ''; |
963 | - $filter_query = $this->getFilter($filter,true,true); |
|
963 | + $filter_query = $this->getFilter($filter, true, true); |
|
964 | 964 | |
965 | 965 | if ($owner != "") { |
966 | 966 | if (!is_string($owner)) { |
@@ -974,8 +974,8 @@ discard block |
||
974 | 974 | if ($limit != "") { |
975 | 975 | $limit_array = explode(",", $limit); |
976 | 976 | |
977 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
978 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
977 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
978 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
979 | 979 | |
980 | 980 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0 && $limit_array[0] != '' && $limit_array[1] != '') { |
981 | 981 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | $query_values = array(); |
1013 | 1013 | $limit_query = ''; |
1014 | 1014 | $additional_query = ''; |
1015 | - $filter_query = $this->getFilter($filter,true,true); |
|
1015 | + $filter_query = $this->getFilter($filter, true, true); |
|
1016 | 1016 | |
1017 | 1017 | if ($pilot != "") { |
1018 | 1018 | $additional_query = " AND (spotter_archive_output.pilot_id = :pilot OR spotter_archive_output.pilot_name = :pilot)"; |
@@ -1022,8 +1022,8 @@ discard block |
||
1022 | 1022 | if ($limit != "") { |
1023 | 1023 | $limit_array = explode(",", $limit); |
1024 | 1024 | |
1025 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1026 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1025 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1026 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1027 | 1027 | |
1028 | 1028 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1029 | 1029 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | * @return Array the airline country list |
1052 | 1052 | * |
1053 | 1053 | */ |
1054 | - public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1054 | + public function countAllFlightOverCountries($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1055 | 1055 | global $globalDBdriver; |
1056 | 1056 | /* |
1057 | 1057 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | $flight_array = array(); |
1080 | 1080 | $temp_array = array(); |
1081 | 1081 | |
1082 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1082 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1083 | 1083 | $temp_array['flight_count'] = $row['nb']; |
1084 | 1084 | $temp_array['flight_country'] = $row['name']; |
1085 | 1085 | $temp_array['flight_country_iso3'] = $row['iso3']; |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | * @return Array the airline country list |
1096 | 1096 | * |
1097 | 1097 | */ |
1098 | - public function countAllFlightOverCountriesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '') { |
|
1098 | + public function countAllFlightOverCountriesByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') { |
|
1099 | 1099 | global $globalDBdriver; |
1100 | 1100 | /* |
1101 | 1101 | $query = "SELECT c.name, c.iso3, c.iso2, count(c.name) as nb |
@@ -1123,7 +1123,7 @@ discard block |
||
1123 | 1123 | $flight_array = array(); |
1124 | 1124 | $temp_array = array(); |
1125 | 1125 | |
1126 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1126 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
1127 | 1127 | $temp_array['airline_icao'] = $row['airline_icao']; |
1128 | 1128 | $temp_array['flight_count'] = $row['nb']; |
1129 | 1129 | $temp_array['flight_country'] = $row['name']; |
@@ -1140,17 +1140,17 @@ discard block |
||
1140 | 1140 | * @return Array the aircraft list |
1141 | 1141 | * |
1142 | 1142 | */ |
1143 | - public function countAllAircraftTypesByOwner($owner,$filters = array()) |
|
1143 | + public function countAllAircraftTypesByOwner($owner, $filters = array()) |
|
1144 | 1144 | { |
1145 | 1145 | global $globalDBdriver; |
1146 | - $filter_query = $this->getFilter($filters,true,true); |
|
1147 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1146 | + $filter_query = $this->getFilter($filters, true, true); |
|
1147 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1148 | 1148 | $query = "SELECT DISTINCT spotter_archive_output.aircraft_icao, COUNT(spotter_archive_output.aircraft_icao) AS aircraft_icao_count, spotter_archive_output.aircraft_name, spotter_archive_output.aircraft_manufacturer |
1149 | 1149 | FROM spotter_archive_output".$filter_query." spotter_archive_output.owner_name = :owner"; |
1150 | 1150 | $query_values = array(); |
1151 | 1151 | $query .= " GROUP BY spotter_archive_output.aircraft_name, spotter_archive_output.aircraft_manufacturer, spotter_archive_output.aircraft_icao |
1152 | 1152 | ORDER BY aircraft_icao_count DESC"; |
1153 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
1153 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
1154 | 1154 | $sth = $this->db->prepare($query); |
1155 | 1155 | $sth->execute($query_values); |
1156 | 1156 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -1162,11 +1162,11 @@ discard block |
||
1162 | 1162 | * @return Array the airline list |
1163 | 1163 | * |
1164 | 1164 | */ |
1165 | - public function countAllAirlinesByOwner($owner,$filters = array()) |
|
1165 | + public function countAllAirlinesByOwner($owner, $filters = array()) |
|
1166 | 1166 | { |
1167 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1168 | - $filter_query = $this->getFilter($filters,true,true); |
|
1169 | - $query = "SELECT DISTINCT spotter_archive_output.airline_name, spotter_archive_output.airline_icao, spotter_archive_output.airline_country, COUNT(spotter_archive_output.airline_name) AS airline_count |
|
1167 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1168 | + $filter_query = $this->getFilter($filters, true, true); |
|
1169 | + $query = "SELECT DISTINCT spotter_archive_output.airline_name, spotter_archive_output.airline_icao, spotter_archive_output.airline_country, COUNT(spotter_archive_output.airline_name) AS airline_count |
|
1170 | 1170 | FROM spotter_archive_output".$filter_query." spotter_archive_output.owner_name = :owner |
1171 | 1171 | GROUP BY spotter_archive_output.airline_icao, spotter_archive_output.airline_name, spotter_archive_output.airline_country |
1172 | 1172 | ORDER BY airline_count DESC"; |
@@ -1184,9 +1184,9 @@ discard block |
||
1184 | 1184 | */ |
1185 | 1185 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
1186 | 1186 | { |
1187 | - $filter_query = $this->getFilter($filters,true,true); |
|
1188 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1189 | - $query = "SELECT DISTINCT spotter_archive_output.arrival_airport_country, COUNT(spotter_archive_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 |
|
1187 | + $filter_query = $this->getFilter($filters, true, true); |
|
1188 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1189 | + $query = "SELECT DISTINCT spotter_archive_output.arrival_airport_country, COUNT(spotter_archive_output.arrival_airport_country) AS airport_arrival_country_count, countries.iso3 AS airport_arrival_country_iso3 |
|
1190 | 1190 | FROM countries, spotter_archive_output".$filter_query." spotter_archive_output.arrival_airport_country <> '' AND spotter_archive_output.owner_name = :owner AND countries.name = spotter_archive_output.arrival_airport_country |
1191 | 1191 | GROUP BY spotter_archive_output.arrival_airport_country, countries.iso3 |
1192 | 1192 | ORDER BY airport_arrival_country_count DESC"; |
@@ -1201,11 +1201,11 @@ discard block |
||
1201 | 1201 | * @return Array the airport list |
1202 | 1202 | * |
1203 | 1203 | */ |
1204 | - public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
|
1204 | + public function countAllArrivalAirportsByOwner($owner, $filters = array()) |
|
1205 | 1205 | { |
1206 | - $filter_query = $this->getFilter($filters,true,true); |
|
1207 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1208 | - $query = "SELECT DISTINCT spotter_archive_output.arrival_airport_icao, COUNT(spotter_archive_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_archive_output.arrival_airport_name, spotter_archive_output.arrival_airport_city, spotter_archive_output.arrival_airport_country |
|
1206 | + $filter_query = $this->getFilter($filters, true, true); |
|
1207 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1208 | + $query = "SELECT DISTINCT spotter_archive_output.arrival_airport_icao, COUNT(spotter_archive_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_archive_output.arrival_airport_name, spotter_archive_output.arrival_airport_city, spotter_archive_output.arrival_airport_country |
|
1209 | 1209 | FROM spotter_archive_output".$filter_query." spotter_archive_output.arrival_airport_name <> '' AND spotter_archive_output.arrival_airport_icao <> 'NA' AND spotter_archive_output.arrival_airport_icao <> '' AND spotter_archive_output.owner_name = :owner |
1210 | 1210 | GROUP BY spotter_archive_output.arrival_airport_icao, spotter_archive_output.arrival_airport_name, spotter_archive_output.arrival_airport_city, spotter_archive_output.arrival_airport_country |
1211 | 1211 | ORDER BY airport_arrival_icao_count DESC"; |
@@ -1213,7 +1213,7 @@ discard block |
||
1213 | 1213 | $sth->execute(array(':owner' => $owner)); |
1214 | 1214 | $airport_array = array(); |
1215 | 1215 | $temp_array = array(); |
1216 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1216 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1217 | 1217 | { |
1218 | 1218 | $temp_array['airport_arrival_icao'] = $row['arrival_airport_icao']; |
1219 | 1219 | $temp_array['airport_arrival_icao_count'] = $row['airport_arrival_icao_count']; |
@@ -1231,11 +1231,11 @@ discard block |
||
1231 | 1231 | * @return Array the airport list |
1232 | 1232 | * |
1233 | 1233 | */ |
1234 | - public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
|
1234 | + public function countAllDepartureAirportCountriesByOwner($owner, $filters = array()) |
|
1235 | 1235 | { |
1236 | - $filter_query = $this->getFilter($filters,true,true); |
|
1237 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1238 | - $query = "SELECT DISTINCT spotter_archive_output.departure_airport_country, COUNT(spotter_archive_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 |
|
1236 | + $filter_query = $this->getFilter($filters, true, true); |
|
1237 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1238 | + $query = "SELECT DISTINCT spotter_archive_output.departure_airport_country, COUNT(spotter_archive_output.departure_airport_country) AS airport_departure_country_count, countries.iso3 AS airport_departure_country_iso3 |
|
1239 | 1239 | FROM spotter_archive_output,countries".$filter_query." spotter_archive_output.departure_airport_country <> '' AND spotter_archive_output.owner_name = :owner AND countries.name = spotter_archive_output.departure_airport_country |
1240 | 1240 | GROUP BY spotter_archive_output.departure_airport_country, countries.iso3 |
1241 | 1241 | ORDER BY airport_departure_country_count DESC"; |
@@ -1250,11 +1250,11 @@ discard block |
||
1250 | 1250 | * @return Array the airport list |
1251 | 1251 | * |
1252 | 1252 | */ |
1253 | - public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
|
1253 | + public function countAllDepartureAirportsByOwner($owner, $filters = array()) |
|
1254 | 1254 | { |
1255 | - $filter_query = $this->getFilter($filters,true,true); |
|
1256 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1257 | - $query = "SELECT DISTINCT spotter_archive_output.departure_airport_icao, COUNT(spotter_archive_output.departure_airport_icao) AS airport_departure_icao_count, spotter_archive_output.departure_airport_name, spotter_archive_output.departure_airport_city, spotter_archive_output.departure_airport_country, airport.latitude, airport.longitude |
|
1255 | + $filter_query = $this->getFilter($filters, true, true); |
|
1256 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1257 | + $query = "SELECT DISTINCT spotter_archive_output.departure_airport_icao, COUNT(spotter_archive_output.departure_airport_icao) AS airport_departure_icao_count, spotter_archive_output.departure_airport_name, spotter_archive_output.departure_airport_city, spotter_archive_output.departure_airport_country, airport.latitude, airport.longitude |
|
1258 | 1258 | FROM spotter_archive_output,airport".$filter_query." spotter_archive_output.departure_airport_name <> '' AND spotter_archive_output.departure_airport_icao <> 'NA' AND spotter_archive_output.departure_airport_icao <> '' AND spotter_archive_output.owner_name = :owner AND airport.icao = spotter_archive_output.departure_airport_icao |
1259 | 1259 | GROUP BY spotter_archive_output.departure_airport_icao, spotter_archive_output.departure_airport_name, spotter_archive_output.departure_airport_city, spotter_archive_output.departure_airport_country, airport.latitude, airport.longitude |
1260 | 1260 | ORDER BY airport_departure_icao_count DESC"; |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | $sth->execute(array(':owner' => $owner)); |
1263 | 1263 | $airport_array = array(); |
1264 | 1264 | $temp_array = array(); |
1265 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1265 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1266 | 1266 | { |
1267 | 1267 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
1268 | 1268 | $temp_array['airport_departure_icao_count'] = $row['airport_departure_icao_count']; |
@@ -1282,15 +1282,15 @@ discard block |
||
1282 | 1282 | * @return Array the aircraft manufacturer list |
1283 | 1283 | * |
1284 | 1284 | */ |
1285 | - public function countAllAircraftManufacturerByOwner($owner,$filters = array()) |
|
1285 | + public function countAllAircraftManufacturerByOwner($owner, $filters = array()) |
|
1286 | 1286 | { |
1287 | 1287 | global $globalDBdriver; |
1288 | - $filter_query = $this->getFilter($filters,true,true); |
|
1289 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1290 | - $query = "SELECT DISTINCT spotter_archive_output.aircraft_manufacturer, COUNT(spotter_archive_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
1288 | + $filter_query = $this->getFilter($filters, true, true); |
|
1289 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1290 | + $query = "SELECT DISTINCT spotter_archive_output.aircraft_manufacturer, COUNT(spotter_archive_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
|
1291 | 1291 | FROM spotter_archive_output".$filter_query." spotter_archive_output.aircraft_manufacturer <> '' AND spotter_archive_output.owner_name = :owner"; |
1292 | 1292 | $query_values = array(); |
1293 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
1293 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
1294 | 1294 | $query .= " GROUP BY spotter_archive_output.aircraft_manufacturer |
1295 | 1295 | ORDER BY aircraft_manufacturer_count DESC"; |
1296 | 1296 | $sth = $this->db->prepare($query); |
@@ -1304,23 +1304,23 @@ discard block |
||
1304 | 1304 | * @return Array the aircraft list |
1305 | 1305 | * |
1306 | 1306 | */ |
1307 | - public function countAllAircraftRegistrationByOwner($owner,$filters = array()) |
|
1307 | + public function countAllAircraftRegistrationByOwner($owner, $filters = array()) |
|
1308 | 1308 | { |
1309 | 1309 | global $globalDBdriver; |
1310 | - $filter_query = $this->getFilter($filters,true,true); |
|
1310 | + $filter_query = $this->getFilter($filters, true, true); |
|
1311 | 1311 | $Image = new Image($this->db); |
1312 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1313 | - $query = "SELECT DISTINCT spotter_archive_output.aircraft_icao, COUNT(spotter_archive_output.registration) AS registration_count, spotter_archive_output.aircraft_name, spotter_archive_output.aircraft_manufacturer, spotter_archive_output.registration, spotter_archive_output.airline_name |
|
1312 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1313 | + $query = "SELECT DISTINCT spotter_archive_output.aircraft_icao, COUNT(spotter_archive_output.registration) AS registration_count, spotter_archive_output.aircraft_name, spotter_archive_output.aircraft_manufacturer, spotter_archive_output.registration, spotter_archive_output.airline_name |
|
1314 | 1314 | FROM spotter_archive_output".$filter_query." spotter_archive_output.registration <> '' AND spotter_archive_output.owner_name = :owner"; |
1315 | 1315 | $query_values = array(); |
1316 | - $query_values = array_merge($query_values,array(':owner' => $owner)); |
|
1316 | + $query_values = array_merge($query_values, array(':owner' => $owner)); |
|
1317 | 1317 | $query .= " GROUP BY spotter_archive_output.registration,spotter_archive_output.aircraft_icao, spotter_archive_output.aircraft_name, spotter_archive_output.aircraft_manufacturer, spotter_archive_output.airline_name |
1318 | 1318 | ORDER BY registration_count DESC"; |
1319 | 1319 | $sth = $this->db->prepare($query); |
1320 | 1320 | $sth->execute($query_values); |
1321 | 1321 | $aircraft_array = array(); |
1322 | 1322 | $temp_array = array(); |
1323 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1323 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1324 | 1324 | { |
1325 | 1325 | $temp_array['aircraft_icao'] = $row['aircraft_icao']; |
1326 | 1326 | $temp_array['aircraft_name'] = $row['aircraft_name']; |
@@ -1328,7 +1328,7 @@ discard block |
||
1328 | 1328 | $temp_array['registration'] = $row['registration']; |
1329 | 1329 | $temp_array['airline_name'] = $row['airline_name']; |
1330 | 1330 | $temp_array['image_thumbnail'] = ""; |
1331 | - if($row['registration'] != "") |
|
1331 | + if ($row['registration'] != "") |
|
1332 | 1332 | { |
1333 | 1333 | $image_array = $Image->getSpotterImage($row['registration']); |
1334 | 1334 | if (isset($image_array[0]['image_thumbnail'])) $temp_array['image_thumbnail'] = $image_array[0]['image_thumbnail']; |
@@ -1346,11 +1346,11 @@ discard block |
||
1346 | 1346 | * @return Array the route list |
1347 | 1347 | * |
1348 | 1348 | */ |
1349 | - public function countAllRoutesByOwner($owner,$filters = array()) |
|
1349 | + public function countAllRoutesByOwner($owner, $filters = array()) |
|
1350 | 1350 | { |
1351 | - $filter_query = $this->getFilter($filters,true,true); |
|
1352 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1353 | - $query = "SELECT DISTINCT concat(spotter_archive_output.departure_airport_icao, ' - ', spotter_archive_output.arrival_airport_icao) AS route, count(concat(spotter_archive_output.departure_airport_icao, ' - ', spotter_archive_output.arrival_airport_icao)) AS route_count, spotter_archive_output.departure_airport_icao, spotter_archive_output.departure_airport_name AS airport_departure_name, spotter_archive_output.departure_airport_city AS airport_departure_city, spotter_archive_output.departure_airport_country AS airport_departure_country, spotter_archive_output.arrival_airport_icao, spotter_archive_output.arrival_airport_name AS airport_arrival_name, spotter_archive_output.arrival_airport_city AS airport_arrival_city, spotter_archive_output.arrival_airport_country AS airport_arrival_country |
|
1351 | + $filter_query = $this->getFilter($filters, true, true); |
|
1352 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1353 | + $query = "SELECT DISTINCT concat(spotter_archive_output.departure_airport_icao, ' - ', spotter_archive_output.arrival_airport_icao) AS route, count(concat(spotter_archive_output.departure_airport_icao, ' - ', spotter_archive_output.arrival_airport_icao)) AS route_count, spotter_archive_output.departure_airport_icao, spotter_archive_output.departure_airport_name AS airport_departure_name, spotter_archive_output.departure_airport_city AS airport_departure_city, spotter_archive_output.departure_airport_country AS airport_departure_country, spotter_archive_output.arrival_airport_icao, spotter_archive_output.arrival_airport_name AS airport_arrival_name, spotter_archive_output.arrival_airport_city AS airport_arrival_city, spotter_archive_output.arrival_airport_country AS airport_arrival_country |
|
1354 | 1354 | FROM spotter_archive_output".$filter_query." spotter_archive_output.ident <> '' AND spotter_archive_output.owner_name = :owner |
1355 | 1355 | GROUP BY route, spotter_archive_output.departure_airport_icao, spotter_archive_output.departure_airport_name, spotter_archive_output.departure_airport_city, spotter_archive_output.departure_airport_country, spotter_archive_output.arrival_airport_icao, spotter_archive_output.arrival_airport_name, spotter_archive_output.arrival_airport_city, spotter_archive_output.arrival_airport_country |
1356 | 1356 | ORDER BY route_count DESC"; |
@@ -1358,7 +1358,7 @@ discard block |
||
1358 | 1358 | $sth->execute(array(':owner' => $owner)); |
1359 | 1359 | $routes_array = array(); |
1360 | 1360 | $temp_array = array(); |
1361 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1361 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1362 | 1362 | { |
1363 | 1363 | $temp_array['route_count'] = $row['route_count']; |
1364 | 1364 | $temp_array['airport_departure_icao'] = $row['departure_airport_icao']; |
@@ -1383,8 +1383,8 @@ discard block |
||
1383 | 1383 | public function countAllHoursByOwner($owner, $filters = array()) |
1384 | 1384 | { |
1385 | 1385 | global $globalTimezone, $globalDBdriver; |
1386 | - $filter_query = $this->getFilter($filters,true,true); |
|
1387 | - $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
|
1386 | + $filter_query = $this->getFilter($filters, true, true); |
|
1387 | + $owner = filter_var($owner, FILTER_SANITIZE_STRING); |
|
1388 | 1388 | if ($globalTimezone != '') { |
1389 | 1389 | date_default_timezone_set($globalTimezone); |
1390 | 1390 | $datetime = new DateTime(); |
@@ -1396,16 +1396,16 @@ discard block |
||
1396 | 1396 | GROUP BY hour_name |
1397 | 1397 | ORDER BY hour_name ASC"; |
1398 | 1398 | } else { |
1399 | - $query = "SELECT EXTRACT(HOUR FROM spotter_archive_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1399 | + $query = "SELECT EXTRACT(HOUR FROM spotter_archive_output.date AT TIME ZONE INTERVAL :offset) AS hour_name, count(*) as hour_count |
|
1400 | 1400 | FROM spotter_archive_output".$filter_query." spotter_archive_output.owner_name = :owner |
1401 | 1401 | GROUP BY hour_name |
1402 | 1402 | ORDER BY hour_name ASC"; |
1403 | 1403 | } |
1404 | 1404 | $sth = $this->db->prepare($query); |
1405 | - $sth->execute(array(':owner' => $owner,':offset' => $offset)); |
|
1405 | + $sth->execute(array(':owner' => $owner, ':offset' => $offset)); |
|
1406 | 1406 | $hour_array = array(); |
1407 | 1407 | $temp_array = array(); |
1408 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1408 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
1409 | 1409 | { |
1410 | 1410 | $temp_array['hour_name'] = $row['hour_name']; |
1411 | 1411 | $temp_array['hour_count'] = $row['hour_count']; |
@@ -1420,13 +1420,13 @@ discard block |
||
1420 | 1420 | * @return Array the spotter information |
1421 | 1421 | * |
1422 | 1422 | */ |
1423 | - public function getDateArchiveSpotterDataById($id,$date) { |
|
1423 | + public function getDateArchiveSpotterDataById($id, $date) { |
|
1424 | 1424 | $Spotter = new Spotter($this->db); |
1425 | 1425 | date_default_timezone_set('UTC'); |
1426 | 1426 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
1427 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1428 | - $date = date('c',$date); |
|
1429 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date)); |
|
1427 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1428 | + $date = date('c', $date); |
|
1429 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date)); |
|
1430 | 1430 | return $spotter_array; |
1431 | 1431 | } |
1432 | 1432 | |
@@ -1436,13 +1436,13 @@ discard block |
||
1436 | 1436 | * @return Array the spotter information |
1437 | 1437 | * |
1438 | 1438 | */ |
1439 | - public function getDateArchiveSpotterDataByIdent($ident,$date) { |
|
1439 | + public function getDateArchiveSpotterDataByIdent($ident, $date) { |
|
1440 | 1440 | $Spotter = new Spotter($this->db); |
1441 | 1441 | date_default_timezone_set('UTC'); |
1442 | 1442 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
1443 | - $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1444 | - $date = date('c',$date); |
|
1445 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
1443 | + $query = 'SELECT spotter_archive.* FROM spotter_archive INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_archive l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_archive.flightaware_id = s.flightaware_id AND spotter_archive.date = s.maxdate ORDER BY spotter_archive.date DESC'; |
|
1444 | + $date = date('c', $date); |
|
1445 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
1446 | 1446 | return $spotter_array; |
1447 | 1447 | } |
1448 | 1448 | |
@@ -1452,14 +1452,14 @@ discard block |
||
1452 | 1452 | * @return Array the spotter information |
1453 | 1453 | * |
1454 | 1454 | */ |
1455 | - public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) { |
|
1455 | + public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '', $filters = array()) { |
|
1456 | 1456 | global $global_query; |
1457 | 1457 | $Spotter = new Spotter($this->db); |
1458 | 1458 | date_default_timezone_set('UTC'); |
1459 | 1459 | $query_values = array(); |
1460 | 1460 | $limit_query = ''; |
1461 | 1461 | $additional_query = ''; |
1462 | - $filter_query = $this->getFilter($filters,true,true); |
|
1462 | + $filter_query = $this->getFilter($filters, true, true); |
|
1463 | 1463 | |
1464 | 1464 | if ($airport != "") { |
1465 | 1465 | if (!is_string($airport)) { |
@@ -1473,8 +1473,8 @@ discard block |
||
1473 | 1473 | if ($limit != "") { |
1474 | 1474 | $limit_array = explode(",", $limit); |
1475 | 1475 | |
1476 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
1477 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
1476 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
1477 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
1478 | 1478 | |
1479 | 1479 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) { |
1480 | 1480 | //$limit_query = " LIMIT ".$limit_array[0].",".$limit_array[1]; |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort, $filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort, $filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | if (!empty($spotter_array)) |
26 | 26 | { |
27 | - $title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['aircraft_owner']); |
|
27 | + $title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['aircraft_owner']); |
|
28 | 28 | require_once('header.php'); |
29 | 29 | print '<div class="info column">'; |
30 | 30 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | include('owner-sub-menu.php'); |
36 | 36 | print '<div class="column">'; |
37 | 37 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
38 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | 39 | if ($archive === false) { |
40 | - $airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner,$filter); |
|
40 | + $airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner, $filter); |
|
41 | 41 | } else { |
42 | - $airport_country_array = $SpotterArchive->countAllArrivalAirportCountriesByOwner($owner,$filter); |
|
42 | + $airport_country_array = $SpotterArchive->countAllArrivalAirportCountriesByOwner($owner, $filter); |
|
43 | 43 | } |
44 | 44 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
45 | 45 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
48 | 48 | print 'var series = ['; |
49 | 49 | $country_data = ''; |
50 | - foreach($airport_country_array as $airport_item) |
|
50 | + foreach ($airport_country_array as $airport_item) |
|
51 | 51 | { |
52 | 52 | $country_data .= '[ "'.$airport_item['airport_arrival_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
53 | 53 | } |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | print '</thead>'; |
95 | 95 | print '<tbody>'; |
96 | 96 | $i = 1; |
97 | - foreach($airport_country_array as $airport_item) |
|
97 | + foreach ($airport_country_array as $airport_item) |
|
98 | 98 | { |
99 | 99 | print '<tr>'; |
100 | 100 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,23 +9,23 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | if (!empty($spotter_array)) |
27 | 27 | { |
28 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['aircraft_owner']); |
|
28 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['aircraft_owner']); |
|
29 | 29 | require_once('header.php'); |
30 | 30 | print '<div class="info column">'; |
31 | 31 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -36,12 +36,12 @@ discard block |
||
36 | 36 | include('owner-sub-menu.php'); |
37 | 37 | print '<div class="column">'; |
38 | 38 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
39 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
40 | 40 | |
41 | 41 | if ($archive === false) { |
42 | - $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner,$filter); |
|
42 | + $aircraft_array = $Spotter->countAllAircraftTypesByOwner($owner, $filter); |
|
43 | 43 | } else { |
44 | - $aircraft_array = $SpotterArchive->countAllAircraftTypesByOwner($owner,$filter); |
|
44 | + $aircraft_array = $SpotterArchive->countAllAircraftTypesByOwner($owner, $filter); |
|
45 | 45 | } |
46 | 46 | if (!empty($aircraft_array)) |
47 | 47 | { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | print '</thead>'; |
55 | 55 | print '<tbody>'; |
56 | 56 | $i = 1; |
57 | - foreach($aircraft_array as $aircraft_item) |
|
57 | + foreach ($aircraft_array as $aircraft_item) |
|
58 | 58 | { |
59 | 59 | print '<tr>'; |
60 | 60 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | //require_once('require/class.SpotterLive.php'); |
8 | 8 | require_once('require/class.SpotterArchive.php'); |
9 | 9 | |
10 | -if (!isset($_GET['owner'])){ |
|
10 | +if (!isset($_GET['owner'])) { |
|
11 | 11 | header('Location: '.$globalURL.''); |
12 | 12 | } else { |
13 | 13 | $Spotter = new Spotter(); |
14 | 14 | $SpotterArchive = new SpotterArchive(); |
15 | 15 | //$Translation = new Translation(); |
16 | 16 | //calculuation for the pagination |
17 | - if(!isset($_GET['limit'])) |
|
17 | + if (!isset($_GET['limit'])) |
|
18 | 18 | { |
19 | 19 | $limit_start = 0; |
20 | 20 | $limit_end = 25; |
@@ -22,8 +22,8 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | $limit_explode = explode(",", $_GET['limit']); |
24 | 24 | if (isset($limit_explode[1])) { |
25 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
26 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
25 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
26 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
27 | 27 | } else { |
28 | 28 | $limit_start = 0; |
29 | 29 | $limit_end = 25; |
@@ -40,21 +40,21 @@ discard block |
||
40 | 40 | |
41 | 41 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
42 | 42 | |
43 | - $owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
44 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
45 | - $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
46 | - $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
43 | + $owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
44 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
45 | + $year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
46 | + $month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
47 | 47 | $filter = array(); |
48 | - if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
49 | - if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
50 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
48 | + if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
49 | + if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
50 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
51 | 51 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
52 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort,$filter); |
|
52 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort, $filter); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | if (!empty($spotter_array)) |
56 | 56 | { |
57 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
57 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
58 | 58 | //$ident = $spotter_array[0]['ident']; |
59 | 59 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
60 | 60 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -65,23 +65,23 @@ discard block |
||
65 | 65 | $Stats = new Stats(); |
66 | 66 | if ($year == '' && $month == '') $flights = $Stats->getStatsOwner($owner); |
67 | 67 | else $flights = 0; |
68 | - if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner,$filter); |
|
68 | + if ($flights == 0) $flights = $Spotter->countFlightsByOwner($owner, $filter); |
|
69 | 69 | print '<div><span class="label">'._("Flights").'</span>'.$flights.'</div>'; |
70 | - $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner,$filter)); |
|
70 | + $aircraft_type = count($Spotter->countAllAircraftTypesByOwner($owner, $filter)); |
|
71 | 71 | print '<div><span class="label">'._("Aircraft type").'</span>'.$aircraft_type.'</div>'; |
72 | - $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner,$filter)); |
|
72 | + $aircraft_registration = count($Spotter->countAllAircraftRegistrationByOwner($owner, $filter)); |
|
73 | 73 | print '<div><span class="label">'._("Aircraft").'</span>'.$aircraft_registration.'</div>'; |
74 | - $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner,$filter)); |
|
74 | + $aircraft_manufacturer = count($Spotter->countAllAircraftManufacturerByOwner($owner, $filter)); |
|
75 | 75 | print '<div><span class="label">'._("Manufacturers").'</span>'.$aircraft_manufacturer.'</div>'; |
76 | - $airlines = count($Spotter->countAllAirlinesByOwner($owner,$filter)); |
|
76 | + $airlines = count($Spotter->countAllAirlinesByOwner($owner, $filter)); |
|
77 | 77 | print '<div><span class="label">'._("Airlines").'</span>'.$airlines.'</div>'; |
78 | - $duration = $Spotter->getFlightDurationByOwner($owner,$filter); |
|
78 | + $duration = $Spotter->getFlightDurationByOwner($owner, $filter); |
|
79 | 79 | if ($duration != '0') print '<div><span class="label">'._("Total flights spotted duration").'</span>'.$duration.'</div>'; |
80 | 80 | print '</div>'; |
81 | 81 | |
82 | 82 | include('owner-sub-menu.php'); |
83 | 83 | print '<div class="table column">'; |
84 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
84 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
85 | 85 | |
86 | 86 | include('table-output.php'); |
87 | 87 | print '<div class="pagination">'; |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | if (!empty($spotter_array)) |
26 | 26 | { |
27 | - $title = sprintf(_("Most Common Arrival Airports of %s"),$spotter_array[0]['aircraft_owner']); |
|
27 | + $title = sprintf(_("Most Common Arrival Airports of %s"), $spotter_array[0]['aircraft_owner']); |
|
28 | 28 | require_once('header.php'); |
29 | 29 | print '<div class="info column">'; |
30 | 30 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | include('owner-sub-menu.php'); |
36 | 36 | print '<div class="column">'; |
37 | 37 | print '<h2>'._("Most Common Arrival Airports").'</h2>'; |
38 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | 39 | if ($archive === false) { |
40 | - $airport_airport_array = $Spotter->countAllArrivalAirportsByOwner($owner,$filter); |
|
40 | + $airport_airport_array = $Spotter->countAllArrivalAirportsByOwner($owner, $filter); |
|
41 | 41 | } else { |
42 | - $airport_airport_array = $SpotterArchive->countAllArrivalAirportsByOwner($owner,$filter); |
|
42 | + $airport_airport_array = $SpotterArchive->countAllArrivalAirportsByOwner($owner, $filter); |
|
43 | 43 | } |
44 | 44 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
45 | 45 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | print '<script>'; |
49 | 49 | print 'var series = ['; |
50 | 50 | $airport_data = ''; |
51 | - foreach($airport_airport_array as $airport_item) |
|
51 | + foreach ($airport_airport_array as $airport_item) |
|
52 | 52 | { |
53 | 53 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_name'].' ('.$airport_item['airport_arrival_icao'].')",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
54 | 54 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | print '</thead>'; |
104 | 104 | print '<tbody>'; |
105 | 105 | $i = 1; |
106 | - foreach($airport_airport_array as $airport_item) |
|
106 | + foreach ($airport_airport_array as $airport_item) |
|
107 | 107 | { |
108 | 108 | print '<tr>'; |
109 | 109 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,22 +9,22 @@ discard block |
||
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | 11 | $SpotterArchive = new SpotterArchive(); |
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$owner = urldecode(filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING)); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$owner = urldecode(filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING)); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | $filter = array(); |
17 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
18 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
17 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
18 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
19 | 19 | $archive = false; |
20 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
20 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
21 | 21 | if (empty($spotter_array) && isset($globalArchiveResults) && $globalArchiveResults) { |
22 | 22 | $archive = true; |
23 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,"0,1", $sort,$filter); |
|
23 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, "0,1", $sort, $filter); |
|
24 | 24 | } |
25 | 25 | if (!empty($spotter_array)) |
26 | 26 | { |
27 | - $title = sprintf(_("Most Common Routes of %s"),$spotter_array[0]['aircraft_owner']); |
|
27 | + $title = sprintf(_("Most Common Routes of %s"), $spotter_array[0]['aircraft_owner']); |
|
28 | 28 | require_once('header.php'); |
29 | 29 | print '<div class="info column">'; |
30 | 30 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | include('owner-sub-menu.php'); |
36 | 36 | print '<div class="column">'; |
37 | 37 | print '<h2>'._("Most Common Routes").'</h2>'; |
38 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
38 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from flights owner by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
39 | 39 | if ($archive === false) { |
40 | - $route_array = $Spotter->countAllRoutesByOwner($owner,$filter); |
|
40 | + $route_array = $Spotter->countAllRoutesByOwner($owner, $filter); |
|
41 | 41 | } else { |
42 | - $route_array = $SpotterArchive->countAllRoutesByOwner($owner,$filter); |
|
42 | + $route_array = $SpotterArchive->countAllRoutesByOwner($owner, $filter); |
|
43 | 43 | } |
44 | 44 | if (!empty($route_array)) |
45 | 45 | { |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | print '</thead>'; |
56 | 56 | print '<tbody>'; |
57 | 57 | $i = 1; |
58 | - foreach($route_array as $route_item) |
|
58 | + foreach ($route_array as $route_item) |
|
59 | 59 | { |
60 | 60 | print '<tr>'; |
61 | 61 | print '<td><strong>'.$i.'</strong></td>'; |