@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport by Country"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | require_once('header.php'); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Arrival Airport by Country"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | require_once('header.php'); |
16 | 16 | include('statistics-sub-menu.php'); |
17 | 17 | |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | <p>'._("Below are the <strong>Top 10</strong> most common countries of all the arrival airports.").'</p>'; |
25 | 25 | print '<div id="chartCountry" class="chart" width="100%"></div>'; |
26 | 26 | |
27 | -$airport_country_array = $Stats->countAllArrivalCountries(true,$airline_icao,$filter_name,$year,$month); |
|
27 | +$airport_country_array = $Stats->countAllArrivalCountries(true, $airline_icao, $filter_name, $year, $month); |
|
28 | 28 | print '<script>'; |
29 | 29 | print 'var series = ['; |
30 | 30 | $country_data = ''; |
31 | -foreach($airport_country_array as $airport_item) |
|
31 | +foreach ($airport_country_array as $airport_item) |
|
32 | 32 | { |
33 | 33 | $country_data .= '[ "'.$airport_item['airport_arrival_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
34 | 34 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | -foreach($airport_country_array as $airport_item) |
|
77 | +foreach ($airport_country_array as $airport_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport by Country"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport by Country"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | |
16 | 16 | require_once('header.php'); |
17 | 17 | include('statistics-sub-menu.php'); |
@@ -25,11 +25,11 @@ discard block |
||
25 | 25 | <p>'._("Below are the <strong>Top 10</strong> most common countries of all the departure airports.").'</p>'; |
26 | 26 | print '<div id="chartCountry" class="chart" width="100%"></div>'; |
27 | 27 | |
28 | -$airport_country_array = $Stats->countAllDepartureCountries(true,$airline_icao,$filter_name,$year,$month); |
|
28 | +$airport_country_array = $Stats->countAllDepartureCountries(true, $airline_icao, $filter_name, $year, $month); |
|
29 | 29 | print '<script>'; |
30 | 30 | print 'var series = ['; |
31 | 31 | $country_data = ''; |
32 | -foreach($airport_country_array as $airport_item) |
|
32 | +foreach ($airport_country_array as $airport_item) |
|
33 | 33 | { |
34 | 34 | $country_data .= '[ "'.$airport_item['airport_departure_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
35 | 35 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | -foreach($airport_country_array as $airport_item) |
|
77 | +foreach ($airport_country_array as $airport_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 18 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | require_once('header.php'); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
14 | 14 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,12 +6,12 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Departure Airport"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
14 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
14 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
15 | 15 | require_once('header.php'); |
16 | 16 | |
17 | 17 | include('statistics-sub-menu.php'); |
@@ -23,12 +23,12 @@ discard block |
||
23 | 23 | </div> |
24 | 24 | <p>'._("Below are the <strong>Top 10</strong> most common departure airports.").'</p>'; |
25 | 25 | |
26 | -$airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
26 | +$airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
27 | 27 | print '<div id="chartAirport" class="chart" width="100%"></div>'; |
28 | 28 | print '<script>'; |
29 | 29 | print 'var series = ['; |
30 | 30 | $airport_data = ''; |
31 | -foreach($airport_airport_array as $airport_item) |
|
31 | +foreach ($airport_airport_array as $airport_item) |
|
32 | 32 | { |
33 | 33 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
34 | 34 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | print '</thead>'; |
83 | 83 | print '<tbody>'; |
84 | 84 | $i = 1; |
85 | -foreach($airport_airport_array as $airport_item) |
|
85 | +foreach ($airport_airport_array as $airport_item) |
|
86 | 86 | { |
87 | 87 | print '<tr>'; |
88 | 88 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft Manufacturer"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | |
14 | 18 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Aircraft Manufacturer"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | 13 | |
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | |
17 | 17 | require_once('header.php'); |
18 | 18 | include('statistics-sub-menu.php'); |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | </div> |
25 | 25 | <p>'._("Below are the <strong>Top 10</strong> most common aircraft manufacturers.").'</p>'; |
26 | 26 | |
27 | -$manufacturers_array = $Stats->countAllAircraftManufacturers(true,$airline_icao,$filter_name,$year,$month); |
|
27 | +$manufacturers_array = $Stats->countAllAircraftManufacturers(true, $airline_icao, $filter_name, $year, $month); |
|
28 | 28 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
29 | 29 | $manufacturer_data = ''; |
30 | -foreach($manufacturers_array as $manufacturer_item) |
|
30 | +foreach ($manufacturers_array as $manufacturer_item) |
|
31 | 31 | { |
32 | 32 | $manufacturer_data .= '[ "'.$manufacturer_item['aircraft_manufacturer'].'",'.$manufacturer_item['aircraft_manufacturer_count'].'],'; |
33 | 33 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | print '</thead>'; |
53 | 53 | print '<tbody>'; |
54 | 54 | $i = 1; |
55 | - foreach($manufacturers_array as $manufacturer_item) |
|
55 | + foreach ($manufacturers_array as $manufacturer_item) |
|
56 | 56 | { |
57 | 57 | print '<tr>'; |
58 | 58 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,11 +5,15 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
7 | 7 | |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 12 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | -} |
|
13 | + if (isset($globalFilter['airline'])) { |
|
14 | + $airline_icao = $globalFilter['airline'][0]; |
|
15 | + } |
|
16 | + } |
|
13 | 17 | setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
14 | 18 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
15 | 19 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
14 | 14 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Pilots"); |
7 | 7 | |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
9 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | 11 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
12 | 12 | } |
13 | -setcookie('stats_airline_icao',$airline_icao,time()+60*60*24,'/'); |
|
14 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
15 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
13 | +setcookie('stats_airline_icao', $airline_icao, time() + 60*60*24, '/'); |
|
14 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
15 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | include('statistics-sub-menu.php'); |
18 | 18 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | </div> |
23 | 23 | <p>'._("Below are the <strong>Top 10</strong> most common pilot.").'</p>'; |
24 | 24 | |
25 | -$pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
25 | +$pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
26 | 26 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
27 | 27 | $pilot_data = ''; |
28 | -foreach($pilot_array as $pilot_item) |
|
28 | +foreach ($pilot_array as $pilot_item) |
|
29 | 29 | { |
30 | 30 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
31 | 31 | } |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | print '</thead>'; |
51 | 51 | print '<tbody>'; |
52 | 52 | $i = 1; |
53 | - foreach($pilot_array as $pilot_item) |
|
53 | + foreach ($pilot_array as $pilot_item) |
|
54 | 54 | { |
55 | 55 | print '<tr>'; |
56 | 56 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | require_once('header.php'); |
@@ -16,11 +16,15 @@ discard block |
||
16 | 16 | $Tracker = new Tracker(); |
17 | 17 | } |
18 | 18 | |
19 | -if (!isset($filter_name)) $filter_name = ''; |
|
19 | +if (!isset($filter_name)) { |
|
20 | + $filter_name = ''; |
|
21 | +} |
|
20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
23 | -} |
|
24 | + if (isset($globalFilter['airline'])) { |
|
25 | + $airline_icao = $globalFilter['airline'][0]; |
|
26 | + } |
|
27 | + } |
|
24 | 28 | |
25 | 29 | require_once('header.php'); |
26 | 30 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true); |
|
38 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $hour_array = $Marine->countAllHours('hour',true); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $hour_array = $Tracker->countAllHours('hour',true); |
|
46 | +} |
|
39 | 47 | print '<div id="chartHour" class="chart" width="100%"></div><script>'; |
40 | 48 | $hour_data = ''; |
41 | 49 | $hour_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
53 | 61 | axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});'; |
54 | 62 | print '</script>'; |
55 | 63 | |
56 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
57 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true); |
|
58 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true); |
|
64 | +if ($type == 'aircraft') { |
|
65 | + $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
66 | +} elseif ($type == 'marine') { |
|
67 | + $hour_array = $Marine->countAllHours('count',true); |
|
68 | +} elseif ($type == 'tracker') { |
|
69 | + $hour_array = $Tracker->countAllHours('count',true); |
|
70 | +} |
|
59 | 71 | if (!empty($hour_array)) |
60 | 72 | { |
61 | 73 | print '<div class="table-responsive">'; |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!isset($filter_name)) $filter_name = ''; |
20 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
20 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
21 | 21 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | 22 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
23 | 23 | } |
@@ -33,16 +33,16 @@ discard block |
||
33 | 33 | </div> |
34 | 34 | <p>'._("Below is a list of the most common <strong>time of day</strong>.").'</p>'; |
35 | 35 | |
36 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour',true); |
|
38 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour',true); |
|
36 | +if ($type == 'aircraft') $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
37 | +elseif ($type == 'marine') $hour_array = $Marine->countAllHours('hour', true); |
|
38 | +elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('hour', true); |
|
39 | 39 | print '<div id="chartHour" class="chart" width="100%"></div><script>'; |
40 | 40 | $hour_data = ''; |
41 | 41 | $hour_cnt = ''; |
42 | 42 | $last = 0; |
43 | -foreach($hour_array as $hour_item) |
|
43 | +foreach ($hour_array as $hour_item) |
|
44 | 44 | { |
45 | - while($last != $hour_item['hour_name']) { |
|
45 | + while ($last != $hour_item['hour_name']) { |
|
46 | 46 | $hour_data .= '"'.$last.':00",'; |
47 | 47 | $hour_cnt .= '0,'; |
48 | 48 | $last++; |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | $hour_cnt .= $hour_item['hour_count'].','; |
53 | 53 | } |
54 | 54 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
55 | -$hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
55 | +$hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
56 | 56 | print 'c3.generate({ |
57 | 57 | bindto: "#chartHour", |
58 | 58 | data: { |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | axis: { x: { type: "category", categories: '.$hour_data.'},y: { label: "# of Flights"}},legend: { show: false }});'; |
61 | 61 | print '</script>'; |
62 | 62 | |
63 | -if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count',true,$airline_icao,$filter_name); |
|
64 | -elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count',true); |
|
65 | -elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count',true); |
|
63 | +if ($type == 'aircraft') $hour_array = $Stats->countAllHours('count', true, $airline_icao, $filter_name); |
|
64 | +elseif ($type == 'marine') $hour_array = $Marine->countAllHours('count', true); |
|
65 | +elseif ($type == 'tracker') $hour_array = $Tracker->countAllHours('count', true); |
|
66 | 66 | if (!empty($hour_array)) |
67 | 67 | { |
68 | 68 | print '<div class="table-responsive">'; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | - foreach($hour_array as $hour_item) |
|
77 | + foreach ($hour_array as $hour_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | require_once('header.php'); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | } |
18 | 18 | |
19 | 19 | if (!isset($filter_name)) $filter_name = ''; |
20 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
20 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
21 | 21 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | 22 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
23 | 23 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | </div> |
34 | 34 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
35 | 35 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
36 | +if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
37 | 37 | elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days(); |
38 | 38 | elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days(); |
39 | 39 | if (count($date_array) == 0) { |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
43 | 43 | $date_data = ''; |
44 | 44 | $date_cnt = ''; |
45 | -foreach($date_array as $date_item) |
|
45 | +foreach ($date_array as $date_item) |
|
46 | 46 | { |
47 | 47 | $date_data .= '"'.$date_item['date_name'].'",'; |
48 | 48 | $date_cnt .= $date_item['date_count'].','; |
49 | 49 | } |
50 | 50 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
51 | -$date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
51 | +$date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
52 | 52 | print 'c3.generate({ |
53 | 53 | bindto: "#chart", |
54 | 54 | data: { x: "x", |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | print '</script>'; |
58 | 58 | } |
59 | 59 | if (isset($globalDBArchiveMonths) && $globalDBArchiveMonths > 0) { |
60 | - print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."),$globalDBArchiveMonths).'</p>'; |
|
60 | + print '<p>'.sprintf(_("Below are the <strong>Top 10</strong> most busiest dates of last %d month(s)."), $globalDBArchiveMonths).'</p>'; |
|
61 | 61 | } else { |
62 | 62 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
63 | 63 | } |
64 | -if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
64 | +if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao, $filter_name); |
|
65 | 65 | elseif ($type == 'marine') $date_array = $Marine->countAllDates(); |
66 | 66 | elseif ($type == 'tracker') $date_array = $Tracker->countAllDates(); |
67 | 67 | if (!empty($date_array)) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | print '</thead>'; |
76 | 76 | print '<tbody>'; |
77 | 77 | $i = 1; |
78 | - foreach($date_array as $date_item) |
|
78 | + foreach ($date_array as $date_item) |
|
79 | 79 | { |
80 | 80 | print '<tr>'; |
81 | 81 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -16,11 +16,15 @@ discard block |
||
16 | 16 | $Tracker = new Tracker(); |
17 | 17 | } |
18 | 18 | |
19 | -if (!isset($filter_name)) $filter_name = ''; |
|
19 | +if (!isset($filter_name)) { |
|
20 | + $filter_name = ''; |
|
21 | +} |
|
20 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
21 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
22 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
23 | -} |
|
24 | + if (isset($globalFilter['airline'])) { |
|
25 | + $airline_icao = $globalFilter['airline'][0]; |
|
26 | + } |
|
27 | + } |
|
24 | 28 | |
25 | 29 | require_once('header.php'); |
26 | 30 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a chart that plots the busiest day during the <strong>last 7 days</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $date_array = $Marine->countAllDatesLast7Days(); |
|
38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDatesLast7Days(); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $date_array = $Marine->countAllDatesLast7Days(); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $date_array = $Tracker->countAllDatesLast7Days(); |
|
46 | +} |
|
39 | 47 | if (count($date_array) == 0) { |
40 | 48 | print _("No data available"); |
41 | 49 | } else { |
@@ -61,9 +69,13 @@ discard block |
||
61 | 69 | } else { |
62 | 70 | print '<p>'._("Below are the <strong>Top 10</strong> most busiest dates.").'</p>'; |
63 | 71 | } |
64 | -if ($type == 'aircraft') $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
65 | -elseif ($type == 'marine') $date_array = $Marine->countAllDates(); |
|
66 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllDates(); |
|
72 | +if ($type == 'aircraft') { |
|
73 | + $date_array = $Stats->countAllDates($airline_icao,$filter_name); |
|
74 | +} elseif ($type == 'marine') { |
|
75 | + $date_array = $Marine->countAllDates(); |
|
76 | +} elseif ($type == 'tracker') { |
|
77 | + $date_array = $Tracker->countAllDates(); |
|
78 | +} |
|
67 | 79 | if (!empty($date_array)) |
68 | 80 | { |
69 | 81 | print '<div class="table-responsive">'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | require_once('header.php'); |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | |
20 | 20 | if (!isset($filter_name)) $filter_name = ''; |
21 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
21 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
22 | 22 | if ($airline_icao == '' && isset($globalFilter)) { |
23 | 23 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
24 | 24 | } |
@@ -33,19 +33,19 @@ discard block |
||
33 | 33 | </div> |
34 | 34 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
35 | 35 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
36 | +if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
37 | 37 | elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true); |
38 | 38 | elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true); |
39 | 39 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
40 | 40 | $year_data = ''; |
41 | 41 | $year_cnt = ''; |
42 | -foreach($date_array as $year_item) |
|
42 | +foreach ($date_array as $year_item) |
|
43 | 43 | { |
44 | 44 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
45 | 45 | $year_cnt .= $year_item['date_count'].','; |
46 | 46 | } |
47 | 47 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
48 | -$year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
48 | +$year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
49 | 49 | print 'c3.generate({ |
50 | 50 | bindto: "#chart", |
51 | 51 | data: { x: "x", |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | print '</thead>'; |
69 | 69 | print '<tbody>'; |
70 | 70 | $i = 1; |
71 | - foreach($date_array as $date_item) |
|
71 | + foreach ($date_array as $date_item) |
|
72 | 72 | { |
73 | 73 | print '<tr>'; |
74 | 74 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -17,11 +17,15 @@ discard block |
||
17 | 17 | $title = _("Statistics").' - '._("Busiest Month of Last Year"); |
18 | 18 | |
19 | 19 | |
20 | -if (!isset($filter_name)) $filter_name = ''; |
|
20 | +if (!isset($filter_name)) { |
|
21 | + $filter_name = ''; |
|
22 | +} |
|
21 | 23 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
22 | 24 | if ($airline_icao == '' && isset($globalFilter)) { |
23 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
24 | -} |
|
25 | + if (isset($globalFilter['airline'])) { |
|
26 | + $airline_icao = $globalFilter['airline'][0]; |
|
27 | + } |
|
28 | + } |
|
25 | 29 | |
26 | 30 | require_once('header.php'); |
27 | 31 | include('statistics-sub-menu.php'); |
@@ -33,9 +37,13 @@ discard block |
||
33 | 37 | </div> |
34 | 38 | <p>'._("Below is a chart that plots the busiest month during the <strong>last year</strong>.").'</p>'; |
35 | 39 | |
36 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
37 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonthsLastYear(true); |
|
38 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonthsLastYear(true); |
|
40 | +if ($type == 'aircraft') { |
|
41 | + $date_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
42 | +} elseif ($type == 'marine') { |
|
43 | + $date_array = $Marine->countAllMonthsLastYear(true); |
|
44 | +} elseif ($type == 'tracker') { |
|
45 | + $date_array = $Tracker->countAllMonthsLastYear(true); |
|
46 | +} |
|
39 | 47 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
40 | 48 | $year_data = ''; |
41 | 49 | $year_cnt = ''; |
@@ -53,9 +61,13 @@ discard block |
||
53 | 61 | axis: { x: { type: "timeseries", localtime: false,tick: { format: "%Y-%m"}}, y: { label: "#"}},legend: { show: false }});'; |
54 | 62 | print '</script>'; |
55 | 63 | |
56 | -if ($type == 'aircraft') $date_array = $Stats->countAllMonths($airline_icao); |
|
57 | -elseif ($type == 'marine') $date_array = $Marine->countAllMonths(); |
|
58 | -elseif ($type == 'tracker') $date_array = $Tracker->countAllMonths(); |
|
64 | +if ($type == 'aircraft') { |
|
65 | + $date_array = $Stats->countAllMonths($airline_icao); |
|
66 | +} elseif ($type == 'marine') { |
|
67 | + $date_array = $Marine->countAllMonths(); |
|
68 | +} elseif ($type == 'tracker') { |
|
69 | + $date_array = $Tracker->countAllMonths(); |
|
70 | +} |
|
59 | 71 | |
60 | 72 | if (!empty($date_array)) |
61 | 73 | { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | /** |
15 | 15 | * Get SQL query part for filter used |
16 | 16 | * @param Array $filter the filter |
17 | - * @return Array the SQL part |
|
17 | + * @return string the SQL part |
|
18 | 18 | */ |
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -29,7 +29,9 @@ discard block |
||
29 | 29 | if (isset($filter[0]['source'])) { |
30 | 30 | $filters = array_merge($filters,$filter); |
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) { |
|
33 | + $filter = array_merge($filter,$globalFilter); |
|
34 | + } |
|
33 | 35 | $filter_query_join = ''; |
34 | 36 | $filter_query_where = ''; |
35 | 37 | foreach($filters as $flt) { |
@@ -118,8 +120,11 @@ discard block |
||
118 | 120 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | 121 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
120 | 122 | } |
121 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
122 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
123 | + if ($filter_query_where == '' && $where) { |
|
124 | + $filter_query_where = ' WHERE'; |
|
125 | + } elseif ($filter_query_where != '' && $and) { |
|
126 | + $filter_query_where .= ' AND'; |
|
127 | + } |
|
123 | 128 | if ($filter_query_where != '') { |
124 | 129 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
125 | 130 | } |
@@ -160,9 +165,13 @@ discard block |
||
160 | 165 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
161 | 166 | } |
162 | 167 | } |
163 | - if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
168 | + if ($orderby_query == '') { |
|
169 | + $orderby_query = ' ORDER BY date DESC'; |
|
170 | + } |
|
164 | 171 | |
165 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
172 | + if (!isset($globalLiveInterval)) { |
|
173 | + $globalLiveInterval = '200'; |
|
174 | + } |
|
166 | 175 | if ($globalDBdriver == 'mysql') { |
167 | 176 | //$query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate"; |
168 | 177 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -185,7 +194,9 @@ discard block |
||
185 | 194 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
186 | 195 | date_default_timezone_set('UTC'); |
187 | 196 | $filter_query = $this->getFilter($filter,true,true); |
188 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
197 | + if (!isset($globalLiveInterval)) { |
|
198 | + $globalLiveInterval = '200'; |
|
199 | + } |
|
189 | 200 | if ($globalDBdriver == 'mysql') { |
190 | 201 | if (isset($globalArchive) && $globalArchive === TRUE) { |
191 | 202 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -228,7 +239,9 @@ discard block |
||
228 | 239 | |
229 | 240 | $filter_query = $this->getFilter($filter,true,true); |
230 | 241 | |
231 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
242 | + if (!isset($globalLiveInterval)) { |
|
243 | + $globalLiveInterval = '200'; |
|
244 | + } |
|
232 | 245 | if ($globalDBdriver == 'mysql') { |
233 | 246 | if (isset($globalArchive) && $globalArchive === TRUE) { |
234 | 247 | /* |
@@ -296,7 +309,9 @@ discard block |
||
296 | 309 | global $globalDBdriver, $globalLiveInterval; |
297 | 310 | $filter_query = $this->getFilter($filter,true,true); |
298 | 311 | |
299 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
312 | + if (!isset($globalLiveInterval)) { |
|
313 | + $globalLiveInterval = '200'; |
|
314 | + } |
|
300 | 315 | if ($globalDBdriver == 'mysql') { |
301 | 316 | //$query = 'SELECT COUNT(*) as nb FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate'.$filter_query; |
302 | 317 | $query = 'SELECT COUNT(DISTINCT spotter_live.flightaware_id) as nb FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
@@ -326,7 +341,9 @@ discard block |
||
326 | 341 | { |
327 | 342 | global $globalDBdriver, $globalLiveInterval; |
328 | 343 | $Spotter = new Spotter($this->db); |
329 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
344 | + if (!isset($globalLiveInterval)) { |
|
345 | + $globalLiveInterval = '200'; |
|
346 | + } |
|
330 | 347 | $filter_query = $this->getFilter($filter); |
331 | 348 | |
332 | 349 | if (is_array($coord)) { |
@@ -334,7 +351,9 @@ discard block |
||
334 | 351 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
335 | 352 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
336 | 353 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
337 | - } else return array(); |
|
354 | + } else { |
|
355 | + return array(); |
|
356 | + } |
|
338 | 357 | if ($globalDBdriver == 'mysql') { |
339 | 358 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
340 | 359 | } else { |
@@ -355,7 +374,9 @@ discard block |
||
355 | 374 | { |
356 | 375 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
357 | 376 | $Spotter = new Spotter($this->db); |
358 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
377 | + if (!isset($globalLiveInterval)) { |
|
378 | + $globalLiveInterval = '200'; |
|
379 | + } |
|
359 | 380 | $filter_query = $this->getFilter($filter,true,true); |
360 | 381 | |
361 | 382 | if (is_array($coord)) { |
@@ -363,7 +384,9 @@ discard block |
||
363 | 384 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
364 | 385 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
365 | 386 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
366 | - } else return array(); |
|
387 | + } else { |
|
388 | + return array(); |
|
389 | + } |
|
367 | 390 | if ($globalDBdriver == 'mysql') { |
368 | 391 | if (isset($globalArchive) && $globalArchive === TRUE) { |
369 | 392 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -593,11 +616,15 @@ discard block |
||
593 | 616 | //$query = self::$global_query.' WHERE spotter_live.flightaware_id = :id ORDER BY date'; |
594 | 617 | if ($globalDBdriver == 'mysql') { |
595 | 618 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
596 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
619 | + if ($liveinterval) { |
|
620 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
621 | + } |
|
597 | 622 | $query .= ' ORDER BY date'; |
598 | 623 | } else { |
599 | 624 | $query = 'SELECT spotter_live.* FROM spotter_live WHERE spotter_live.flightaware_id = :id'; |
600 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
625 | + if ($liveinterval) { |
|
626 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
627 | + } |
|
601 | 628 | $query .= ' ORDER BY date'; |
602 | 629 | } |
603 | 630 | |
@@ -692,7 +719,9 @@ discard block |
||
692 | 719 | $i++; |
693 | 720 | $j++; |
694 | 721 | if ($j == 30) { |
695 | - if ($globalDebug) echo "."; |
|
722 | + if ($globalDebug) { |
|
723 | + echo "."; |
|
724 | + } |
|
696 | 725 | try { |
697 | 726 | |
698 | 727 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -999,7 +1028,9 @@ discard block |
||
999 | 1028 | { |
1000 | 1029 | return false; |
1001 | 1030 | } |
1002 | - } else return ''; |
|
1031 | + } else { |
|
1032 | + return ''; |
|
1033 | + } |
|
1003 | 1034 | |
1004 | 1035 | if ($longitude != '') |
1005 | 1036 | { |
@@ -1007,7 +1038,9 @@ discard block |
||
1007 | 1038 | { |
1008 | 1039 | return false; |
1009 | 1040 | } |
1010 | - } else return ''; |
|
1041 | + } else { |
|
1042 | + return ''; |
|
1043 | + } |
|
1011 | 1044 | |
1012 | 1045 | if ($waypoints != '') |
1013 | 1046 | { |
@@ -1023,14 +1056,18 @@ discard block |
||
1023 | 1056 | { |
1024 | 1057 | return false; |
1025 | 1058 | } |
1026 | - } else $altitude = 0; |
|
1059 | + } else { |
|
1060 | + $altitude = 0; |
|
1061 | + } |
|
1027 | 1062 | if ($altitude_real != '') |
1028 | 1063 | { |
1029 | 1064 | if (!is_numeric($altitude_real)) |
1030 | 1065 | { |
1031 | 1066 | return false; |
1032 | 1067 | } |
1033 | - } else $altitude_real = 0; |
|
1068 | + } else { |
|
1069 | + $altitude_real = 0; |
|
1070 | + } |
|
1034 | 1071 | |
1035 | 1072 | if ($heading != '') |
1036 | 1073 | { |
@@ -1038,7 +1075,9 @@ discard block |
||
1038 | 1075 | { |
1039 | 1076 | return false; |
1040 | 1077 | } |
1041 | - } else $heading = 0; |
|
1078 | + } else { |
|
1079 | + $heading = 0; |
|
1080 | + } |
|
1042 | 1081 | |
1043 | 1082 | if ($groundspeed != '') |
1044 | 1083 | { |
@@ -1046,9 +1085,13 @@ discard block |
||
1046 | 1085 | { |
1047 | 1086 | return false; |
1048 | 1087 | } |
1049 | - } else $groundspeed = 0; |
|
1088 | + } else { |
|
1089 | + $groundspeed = 0; |
|
1090 | + } |
|
1050 | 1091 | date_default_timezone_set('UTC'); |
1051 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
1092 | + if ($date == '') { |
|
1093 | + $date = date("Y-m-d H:i:s", time()); |
|
1094 | + } |
|
1052 | 1095 | |
1053 | 1096 | |
1054 | 1097 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -1093,14 +1136,24 @@ discard block |
||
1093 | 1136 | $arrival_airport_country = ''; |
1094 | 1137 | |
1095 | 1138 | |
1096 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1097 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1098 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1099 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1139 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) { |
|
1140 | + $squawk = NULL; |
|
1141 | + } |
|
1142 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) { |
|
1143 | + $verticalrate = NULL; |
|
1144 | + } |
|
1145 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) { |
|
1146 | + $groundspeed = 0; |
|
1147 | + } |
|
1148 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
1149 | + $heading = 0; |
|
1150 | + } |
|
1100 | 1151 | |
1101 | 1152 | $query = ''; |
1102 | 1153 | if ($globalArchive) { |
1103 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
1154 | + if ($globalDebug) { |
|
1155 | + echo '-- Delete previous data -- '; |
|
1156 | + } |
|
1104 | 1157 | $query .= 'DELETE FROM spotter_live WHERE flightaware_id = :flightaware_id;'; |
1105 | 1158 | } |
1106 | 1159 | |
@@ -1117,10 +1170,14 @@ discard block |
||
1117 | 1170 | return "error : ".$e->getMessage(); |
1118 | 1171 | } |
1119 | 1172 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1120 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1173 | + if ($globalDebug) { |
|
1174 | + echo '(Add to SBS archive : '; |
|
1175 | + } |
|
1121 | 1176 | $SpotterArchive = new SpotterArchive($this->db); |
1122 | 1177 | $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
1123 | - if ($globalDebug) echo $result.')'; |
|
1178 | + if ($globalDebug) { |
|
1179 | + echo $result.')'; |
|
1180 | + } |
|
1124 | 1181 | } elseif ($globalDebug && $putinarchive !== true) { |
1125 | 1182 | echo '(Not adding to archive)'; |
1126 | 1183 | } elseif ($globalDebug && $noarchive === true) { |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
@@ -128,11 +128,11 @@ discard block |
||
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
131 | - * Gets all the spotter information based on the latest data entry |
|
132 | - * |
|
133 | - * @return Array the spotter information |
|
134 | - * |
|
135 | - */ |
|
131 | + * Gets all the spotter information based on the latest data entry |
|
132 | + * |
|
133 | + * @return Array the spotter information |
|
134 | + * |
|
135 | + */ |
|
136 | 136 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
137 | 137 | { |
138 | 138 | global $globalDBdriver, $globalLiveInterval; |
@@ -175,11 +175,11 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Gets Minimal Live Spotter data |
|
179 | - * |
|
180 | - * @return Array the spotter information |
|
181 | - * |
|
182 | - */ |
|
178 | + * Gets Minimal Live Spotter data |
|
179 | + * |
|
180 | + * @return Array the spotter information |
|
181 | + * |
|
182 | + */ |
|
183 | 183 | public function getMinLiveSpotterData($filter = array()) |
184 | 184 | { |
185 | 185 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | } |
217 | 217 | |
218 | 218 | /** |
219 | - * Gets Minimal Live Spotter data since xx seconds |
|
220 | - * |
|
221 | - * @return Array the spotter information |
|
222 | - * |
|
223 | - */ |
|
219 | + * Gets Minimal Live Spotter data since xx seconds |
|
220 | + * |
|
221 | + * @return Array the spotter information |
|
222 | + * |
|
223 | + */ |
|
224 | 224 | public function getMinLastLiveSpotterData($filter = array()) |
225 | 225 | { |
226 | 226 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
251 | 251 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
252 | 252 | } |
253 | - } else { |
|
253 | + } else { |
|
254 | 254 | if (isset($globalArchive) && $globalArchive === TRUE) { |
255 | 255 | /* |
256 | 256 | $query = "SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
@@ -274,7 +274,7 @@ discard block |
||
274 | 274 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
275 | 275 | } |
276 | 276 | } |
277 | - try { |
|
277 | + try { |
|
278 | 278 | $sth = $this->db->prepare($query); |
279 | 279 | $sth->execute(); |
280 | 280 | } catch(PDOException $e) { |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
289 | - * Gets number of latest data entry |
|
290 | - * |
|
291 | - * @return String number of entry |
|
292 | - * |
|
293 | - */ |
|
289 | + * Gets number of latest data entry |
|
290 | + * |
|
291 | + * @return String number of entry |
|
292 | + * |
|
293 | + */ |
|
294 | 294 | public function getLiveSpotterCount($filter = array()) |
295 | 295 | { |
296 | 296 | global $globalDBdriver, $globalLiveInterval; |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | } |
318 | 318 | |
319 | 319 | /** |
320 | - * Gets all the spotter information based on the latest data entry and coord |
|
321 | - * |
|
322 | - * @return Array the spotter information |
|
323 | - * |
|
324 | - */ |
|
320 | + * Gets all the spotter information based on the latest data entry and coord |
|
321 | + * |
|
322 | + * @return Array the spotter information |
|
323 | + * |
|
324 | + */ |
|
325 | 325 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
326 | 326 | { |
327 | 327 | global $globalDBdriver, $globalLiveInterval; |
@@ -346,11 +346,11 @@ discard block |
||
346 | 346 | } |
347 | 347 | |
348 | 348 | /** |
349 | - * Gets all the spotter information based on the latest data entry and coord |
|
350 | - * |
|
351 | - * @return Array the spotter information |
|
352 | - * |
|
353 | - */ |
|
349 | + * Gets all the spotter information based on the latest data entry and coord |
|
350 | + * |
|
351 | + * @return Array the spotter information |
|
352 | + * |
|
353 | + */ |
|
354 | 354 | public function getMinLiveSpotterDatabyCoord($coord, $filter = array()) |
355 | 355 | { |
356 | 356 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | } |
416 | 416 | |
417 | 417 | /** |
418 | - * Gets all the spotter information based on a user's latitude and longitude |
|
419 | - * |
|
420 | - * @return Array the spotter information |
|
421 | - * |
|
422 | - */ |
|
418 | + * Gets all the spotter information based on a user's latitude and longitude |
|
419 | + * |
|
420 | + * @return Array the spotter information |
|
421 | + * |
|
422 | + */ |
|
423 | 423 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
424 | 424 | { |
425 | 425 | $Spotter = new Spotter($this->db); |
@@ -429,98 +429,98 @@ discard block |
||
429 | 429 | return false; |
430 | 430 | } |
431 | 431 | } |
432 | - if ($lng != '') |
|
433 | - { |
|
434 | - if (!is_numeric($lng)) |
|
435 | - { |
|
436 | - return false; |
|
437 | - } |
|
438 | - } |
|
439 | - |
|
440 | - if ($radius != '') |
|
441 | - { |
|
442 | - if (!is_numeric($radius)) |
|
443 | - { |
|
444 | - return false; |
|
445 | - } |
|
446 | - } |
|
432 | + if ($lng != '') |
|
433 | + { |
|
434 | + if (!is_numeric($lng)) |
|
435 | + { |
|
436 | + return false; |
|
437 | + } |
|
438 | + } |
|
439 | + |
|
440 | + if ($radius != '') |
|
441 | + { |
|
442 | + if (!is_numeric($radius)) |
|
443 | + { |
|
444 | + return false; |
|
445 | + } |
|
446 | + } |
|
447 | 447 | $additional_query = ''; |
448 | - if ($interval != '') |
|
449 | - { |
|
450 | - if (!is_string($interval)) |
|
451 | - { |
|
452 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
453 | - return false; |
|
454 | - } else { |
|
455 | - if ($interval == '1m') |
|
456 | - { |
|
457 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
458 | - } else if ($interval == '15m'){ |
|
459 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
460 | - } |
|
461 | - } |
|
462 | - } else { |
|
463 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
464 | - } |
|
465 | - |
|
466 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
448 | + if ($interval != '') |
|
449 | + { |
|
450 | + if (!is_string($interval)) |
|
451 | + { |
|
452 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
453 | + return false; |
|
454 | + } else { |
|
455 | + if ($interval == '1m') |
|
456 | + { |
|
457 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
458 | + } else if ($interval == '15m'){ |
|
459 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
460 | + } |
|
461 | + } |
|
462 | + } else { |
|
463 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
464 | + } |
|
465 | + |
|
466 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
467 | 467 | WHERE spotter_live.latitude <> '' |
468 | 468 | AND spotter_live.longitude <> '' |
469 | 469 | ".$additional_query." |
470 | 470 | HAVING distance < :radius |
471 | 471 | ORDER BY distance"; |
472 | 472 | |
473 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
473 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
474 | 474 | |
475 | - return $spotter_array; |
|
476 | - } |
|
475 | + return $spotter_array; |
|
476 | + } |
|
477 | 477 | |
478 | 478 | |
479 | - /** |
|
480 | - * Gets all the spotter information based on a particular callsign |
|
481 | - * |
|
482 | - * @return Array the spotter information |
|
483 | - * |
|
484 | - */ |
|
479 | + /** |
|
480 | + * Gets all the spotter information based on a particular callsign |
|
481 | + * |
|
482 | + * @return Array the spotter information |
|
483 | + * |
|
484 | + */ |
|
485 | 485 | public function getLastLiveSpotterDataByIdent($ident) |
486 | 486 | { |
487 | 487 | $Spotter = new Spotter($this->db); |
488 | 488 | date_default_timezone_set('UTC'); |
489 | 489 | |
490 | 490 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
491 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
491 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
492 | 492 | |
493 | 493 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
494 | 494 | |
495 | 495 | return $spotter_array; |
496 | 496 | } |
497 | 497 | |
498 | - /** |
|
499 | - * Gets all the spotter information based on a particular callsign |
|
500 | - * |
|
501 | - * @return Array the spotter information |
|
502 | - * |
|
503 | - */ |
|
498 | + /** |
|
499 | + * Gets all the spotter information based on a particular callsign |
|
500 | + * |
|
501 | + * @return Array the spotter information |
|
502 | + * |
|
503 | + */ |
|
504 | 504 | public function getDateLiveSpotterDataByIdent($ident,$date) |
505 | 505 | { |
506 | 506 | $Spotter = new Spotter($this->db); |
507 | 507 | date_default_timezone_set('UTC'); |
508 | 508 | |
509 | 509 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
510 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
510 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
511 | 511 | |
512 | - $date = date('c',$date); |
|
512 | + $date = date('c',$date); |
|
513 | 513 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
517 | 517 | |
518 | - /** |
|
519 | - * Gets last spotter information based on a particular callsign |
|
520 | - * |
|
521 | - * @return Array the spotter information |
|
522 | - * |
|
523 | - */ |
|
518 | + /** |
|
519 | + * Gets last spotter information based on a particular callsign |
|
520 | + * |
|
521 | + * @return Array the spotter information |
|
522 | + * |
|
523 | + */ |
|
524 | 524 | public function getLastLiveSpotterDataById($id) |
525 | 525 | { |
526 | 526 | $Spotter = new Spotter($this->db); |
@@ -531,12 +531,12 @@ discard block |
||
531 | 531 | return $spotter_array; |
532 | 532 | } |
533 | 533 | |
534 | - /** |
|
535 | - * Gets last spotter information based on a particular callsign |
|
536 | - * |
|
537 | - * @return Array the spotter information |
|
538 | - * |
|
539 | - */ |
|
534 | + /** |
|
535 | + * Gets last spotter information based on a particular callsign |
|
536 | + * |
|
537 | + * @return Array the spotter information |
|
538 | + * |
|
539 | + */ |
|
540 | 540 | public function getDateLiveSpotterDataById($id,$date) |
541 | 541 | { |
542 | 542 | $Spotter = new Spotter($this->db); |
@@ -549,21 +549,21 @@ discard block |
||
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
552 | - /** |
|
553 | - * Gets altitude information based on a particular callsign |
|
554 | - * |
|
555 | - * @return Array the spotter information |
|
556 | - * |
|
557 | - */ |
|
552 | + /** |
|
553 | + * Gets altitude information based on a particular callsign |
|
554 | + * |
|
555 | + * @return Array the spotter information |
|
556 | + * |
|
557 | + */ |
|
558 | 558 | public function getAltitudeLiveSpotterDataByIdent($ident) |
559 | 559 | { |
560 | 560 | |
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | |
563 | 563 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
564 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
564 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
565 | 565 | |
566 | - try { |
|
566 | + try { |
|
567 | 567 | |
568 | 568 | $sth = $this->db->prepare($query); |
569 | 569 | $sth->execute(array(':ident' => $ident)); |
@@ -576,12 +576,12 @@ discard block |
||
576 | 576 | return $spotter_array; |
577 | 577 | } |
578 | 578 | |
579 | - /** |
|
580 | - * Gets all the spotter information based on a particular id |
|
581 | - * |
|
582 | - * @return Array the spotter information |
|
583 | - * |
|
584 | - */ |
|
579 | + /** |
|
580 | + * Gets all the spotter information based on a particular id |
|
581 | + * |
|
582 | + * @return Array the spotter information |
|
583 | + * |
|
584 | + */ |
|
585 | 585 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
586 | 586 | { |
587 | 587 | global $globalDBdriver, $globalLiveInterval; |
@@ -609,18 +609,18 @@ discard block |
||
609 | 609 | return $spotter_array; |
610 | 610 | } |
611 | 611 | |
612 | - /** |
|
613 | - * Gets all the spotter information based on a particular ident |
|
614 | - * |
|
615 | - * @return Array the spotter information |
|
616 | - * |
|
617 | - */ |
|
612 | + /** |
|
613 | + * Gets all the spotter information based on a particular ident |
|
614 | + * |
|
615 | + * @return Array the spotter information |
|
616 | + * |
|
617 | + */ |
|
618 | 618 | public function getAllLiveSpotterDataByIdent($ident) |
619 | 619 | { |
620 | 620 | date_default_timezone_set('UTC'); |
621 | 621 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
622 | 622 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
623 | - try { |
|
623 | + try { |
|
624 | 624 | |
625 | 625 | $sth = $this->db->prepare($query); |
626 | 626 | $sth->execute(array(':ident' => $ident)); |
@@ -634,23 +634,23 @@ discard block |
||
634 | 634 | |
635 | 635 | |
636 | 636 | /** |
637 | - * Deletes all info in the table |
|
638 | - * |
|
639 | - * @return String success or false |
|
640 | - * |
|
641 | - */ |
|
637 | + * Deletes all info in the table |
|
638 | + * |
|
639 | + * @return String success or false |
|
640 | + * |
|
641 | + */ |
|
642 | 642 | public function deleteLiveSpotterData() |
643 | 643 | { |
644 | 644 | global $globalDBdriver; |
645 | 645 | if ($globalDBdriver == 'mysql') { |
646 | 646 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
647 | 647 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
648 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
648 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
649 | 649 | } else { |
650 | 650 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
651 | 651 | } |
652 | 652 | |
653 | - try { |
|
653 | + try { |
|
654 | 654 | |
655 | 655 | $sth = $this->db->prepare($query); |
656 | 656 | $sth->execute(); |
@@ -662,18 +662,18 @@ discard block |
||
662 | 662 | } |
663 | 663 | |
664 | 664 | /** |
665 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
666 | - * |
|
667 | - * @return String success or false |
|
668 | - * |
|
669 | - */ |
|
665 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
666 | + * |
|
667 | + * @return String success or false |
|
668 | + * |
|
669 | + */ |
|
670 | 670 | public function deleteLiveSpotterDataNotUpdated() |
671 | 671 | { |
672 | 672 | global $globalDBdriver, $globalDebug; |
673 | 673 | if ($globalDBdriver == 'mysql') { |
674 | 674 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
675 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
676 | - try { |
|
675 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 2000 OFFSET 0"; |
|
676 | + try { |
|
677 | 677 | |
678 | 678 | $sth = $this->db->prepare($query); |
679 | 679 | $sth->execute(); |
@@ -681,8 +681,8 @@ discard block |
||
681 | 681 | return "error"; |
682 | 682 | } |
683 | 683 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
684 | - $i = 0; |
|
685 | - $j =0; |
|
684 | + $i = 0; |
|
685 | + $j =0; |
|
686 | 686 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
687 | 687 | foreach($all as $row) |
688 | 688 | { |
@@ -690,20 +690,20 @@ discard block |
||
690 | 690 | $j++; |
691 | 691 | if ($j == 30) { |
692 | 692 | if ($globalDebug) echo "."; |
693 | - try { |
|
693 | + try { |
|
694 | 694 | |
695 | 695 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
696 | 696 | $sth->execute(); |
697 | 697 | } catch(PDOException $e) { |
698 | 698 | return "error"; |
699 | 699 | } |
700 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
701 | - $j = 0; |
|
700 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
701 | + $j = 0; |
|
702 | 702 | } |
703 | 703 | $query_delete .= "'".$row['flightaware_id']."',"; |
704 | 704 | } |
705 | 705 | if ($i > 0) { |
706 | - try { |
|
706 | + try { |
|
707 | 707 | |
708 | 708 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
709 | 709 | $sth->execute(); |
@@ -714,9 +714,9 @@ discard block |
||
714 | 714 | return "success"; |
715 | 715 | } elseif ($globalDBdriver == 'pgsql') { |
716 | 716 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
717 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
718 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
719 | - try { |
|
717 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
718 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 2000 OFFSET 0)"; |
|
719 | + try { |
|
720 | 720 | |
721 | 721 | $sth = $this->db->prepare($query); |
722 | 722 | $sth->execute(); |
@@ -760,17 +760,17 @@ discard block |
||
760 | 760 | } |
761 | 761 | |
762 | 762 | /** |
763 | - * Deletes all info in the table for an ident |
|
764 | - * |
|
765 | - * @return String success or false |
|
766 | - * |
|
767 | - */ |
|
763 | + * Deletes all info in the table for an ident |
|
764 | + * |
|
765 | + * @return String success or false |
|
766 | + * |
|
767 | + */ |
|
768 | 768 | public function deleteLiveSpotterDataByIdent($ident) |
769 | 769 | { |
770 | 770 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
771 | 771 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
772 | 772 | |
773 | - try { |
|
773 | + try { |
|
774 | 774 | |
775 | 775 | $sth = $this->db->prepare($query); |
776 | 776 | $sth->execute(array(':ident' => $ident)); |
@@ -782,17 +782,17 @@ discard block |
||
782 | 782 | } |
783 | 783 | |
784 | 784 | /** |
785 | - * Deletes all info in the table for an id |
|
786 | - * |
|
787 | - * @return String success or false |
|
788 | - * |
|
789 | - */ |
|
785 | + * Deletes all info in the table for an id |
|
786 | + * |
|
787 | + * @return String success or false |
|
788 | + * |
|
789 | + */ |
|
790 | 790 | public function deleteLiveSpotterDataById($id) |
791 | 791 | { |
792 | 792 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
793 | 793 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
794 | 794 | |
795 | - try { |
|
795 | + try { |
|
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':id' => $id)); |
@@ -805,11 +805,11 @@ discard block |
||
805 | 805 | |
806 | 806 | |
807 | 807 | /** |
808 | - * Gets the aircraft ident within the last hour |
|
809 | - * |
|
810 | - * @return String the ident |
|
811 | - * |
|
812 | - */ |
|
808 | + * Gets the aircraft ident within the last hour |
|
809 | + * |
|
810 | + * @return String the ident |
|
811 | + * |
|
812 | + */ |
|
813 | 813 | public function getIdentFromLastHour($ident) |
814 | 814 | { |
815 | 815 | global $globalDBdriver, $globalTimezone; |
@@ -835,14 +835,14 @@ discard block |
||
835 | 835 | $ident_result = $row['ident']; |
836 | 836 | } |
837 | 837 | return $ident_result; |
838 | - } |
|
838 | + } |
|
839 | 839 | |
840 | 840 | /** |
841 | - * Check recent aircraft |
|
842 | - * |
|
843 | - * @return String the ident |
|
844 | - * |
|
845 | - */ |
|
841 | + * Check recent aircraft |
|
842 | + * |
|
843 | + * @return String the ident |
|
844 | + * |
|
845 | + */ |
|
846 | 846 | public function checkIdentRecent($ident) |
847 | 847 | { |
848 | 848 | global $globalDBdriver, $globalTimezone; |
@@ -868,14 +868,14 @@ discard block |
||
868 | 868 | $ident_result = $row['flightaware_id']; |
869 | 869 | } |
870 | 870 | return $ident_result; |
871 | - } |
|
871 | + } |
|
872 | 872 | |
873 | 873 | /** |
874 | - * Check recent aircraft by id |
|
875 | - * |
|
876 | - * @return String the ident |
|
877 | - * |
|
878 | - */ |
|
874 | + * Check recent aircraft by id |
|
875 | + * |
|
876 | + * @return String the ident |
|
877 | + * |
|
878 | + */ |
|
879 | 879 | public function checkIdRecent($id) |
880 | 880 | { |
881 | 881 | global $globalDBdriver, $globalTimezone; |
@@ -901,14 +901,14 @@ discard block |
||
901 | 901 | $ident_result = $row['flightaware_id']; |
902 | 902 | } |
903 | 903 | return $ident_result; |
904 | - } |
|
904 | + } |
|
905 | 905 | |
906 | 906 | /** |
907 | - * Check recent aircraft by ModeS |
|
908 | - * |
|
909 | - * @return String the ModeS |
|
910 | - * |
|
911 | - */ |
|
907 | + * Check recent aircraft by ModeS |
|
908 | + * |
|
909 | + * @return String the ModeS |
|
910 | + * |
|
911 | + */ |
|
912 | 912 | public function checkModeSRecent($modes) |
913 | 913 | { |
914 | 914 | global $globalDBdriver, $globalTimezone; |
@@ -935,19 +935,19 @@ discard block |
||
935 | 935 | $ident_result = $row['flightaware_id']; |
936 | 936 | } |
937 | 937 | return $ident_result; |
938 | - } |
|
938 | + } |
|
939 | 939 | |
940 | 940 | /** |
941 | - * Adds a new spotter data |
|
942 | - * |
|
943 | - * @param String $flightaware_id the ID from flightaware |
|
944 | - * @param String $ident the flight ident |
|
945 | - * @param String $aircraft_icao the aircraft type |
|
946 | - * @param String $departure_airport_icao the departure airport |
|
947 | - * @param String $arrival_airport_icao the arrival airport |
|
948 | - * @return String success or false |
|
949 | - * |
|
950 | - */ |
|
941 | + * Adds a new spotter data |
|
942 | + * |
|
943 | + * @param String $flightaware_id the ID from flightaware |
|
944 | + * @param String $ident the flight ident |
|
945 | + * @param String $aircraft_icao the aircraft type |
|
946 | + * @param String $departure_airport_icao the departure airport |
|
947 | + * @param String $arrival_airport_icao the arrival airport |
|
948 | + * @return String success or false |
|
949 | + * |
|
950 | + */ |
|
951 | 951 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
952 | 952 | { |
953 | 953 | global $globalURL, $globalArchive, $globalDebug; |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | $arrival_airport_country = ''; |
1091 | 1091 | |
1092 | 1092 | |
1093 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1093 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1097 | 1097 | |
1098 | 1098 | $query = ''; |
1099 | 1099 | if ($globalArchive) { |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | return "error : ".$e->getMessage(); |
1115 | 1115 | } |
1116 | 1116 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1117 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
1118 | - $SpotterArchive = new SpotterArchive($this->db); |
|
1119 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1120 | - if ($globalDebug) echo $result.')'; |
|
1117 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
1118 | + $SpotterArchive = new SpotterArchive($this->db); |
|
1119 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1120 | + if ($globalDebug) echo $result.')'; |
|
1121 | 1121 | } elseif ($globalDebug && $putinarchive !== true) { |
1122 | 1122 | echo '(Not adding to archive)'; |
1123 | 1123 | } elseif ($globalDebug && $noarchive === true) { |
@@ -16,62 +16,62 @@ discard block |
||
16 | 16 | * @param Array $filter the filter |
17 | 17 | * @return Array the SQL part |
18 | 18 | */ |
19 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
19 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
22 | 22 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
23 | 23 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
24 | 24 | $filters = $globalStatsFilters[$globalFilterName]; |
25 | 25 | } else { |
26 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
26 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
27 | 27 | } |
28 | 28 | } |
29 | 29 | if (isset($filter[0]['source'])) { |
30 | - $filters = array_merge($filters,$filter); |
|
30 | + $filters = array_merge($filters, $filter); |
|
31 | 31 | } |
32 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
32 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
33 | 33 | $filter_query_join = ''; |
34 | 34 | $filter_query_where = ''; |
35 | - foreach($filters as $flt) { |
|
35 | + foreach ($filters as $flt) { |
|
36 | 36 | if (isset($flt['airlines']) && !empty($flt['airlines'])) { |
37 | 37 | if ($flt['airlines'][0] != '') { |
38 | 38 | if (isset($flt['source'])) { |
39 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
39 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
40 | 40 | } else { |
41 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
41 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $flt['airlines'])."')) saf ON saf.flightaware_id = spotter_live.flightaware_id"; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 | } |
45 | 45 | if (isset($flt['pilots_id']) && !empty($flt['pilots_id'])) { |
46 | 46 | if (isset($flt['source'])) { |
47 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
47 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
48 | 48 | } else { |
49 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
49 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $flt['pilots_id'])."')) spi ON spi.flightaware_id = spotter_live.flightaware_id"; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
53 | 53 | if (isset($flt['source'])) { |
54 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
54 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
55 | 55 | } else { |
56 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
56 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.flightaware_id = spotter_live.flightaware_id"; |
|
57 | 57 | } |
58 | 58 | } |
59 | 59 | if (isset($flt['registrations']) && !empty($flt['registrations'])) { |
60 | 60 | if (isset($flt['source'])) { |
61 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','",$flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
61 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."') AND spotter_output.format_source IN ('".implode("','", $flt['source'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
62 | 62 | } else { |
63 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','",$flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
63 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.registration IN ('".implode("','", $flt['registrations'])."')) sre ON sre.flightaware_id = spotter_live.flightaware_id"; |
|
64 | 64 | } |
65 | 65 | } |
66 | 66 | if ((isset($flt['airlines']) && empty($flt['airlines']) && isset($flt['pilots_id']) && empty($flt['pilots_id']) && isset($flt['idents']) && empty($flt['idents'])) || (!isset($flt['airlines']) && !isset($flt['pilots_id']) && !isset($flt['idents']) && !isset($flt['registrations']))) { |
67 | 67 | if (isset($flt['source'])) { |
68 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','",$flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
68 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.format_source IN ('".implode("','", $flt['source'])."')) ssf ON ssf.flightaware_id = spotter_live.flightaware_id"; |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | } |
72 | 72 | if (isset($filter['airlines']) && !empty($filter['airlines'])) { |
73 | 73 | if ($filter['airlines'][0] != '') { |
74 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','",$filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
74 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_icao IN ('".implode("','", $filter['airlines'])."')) sai ON sai.flightaware_id = spotter_live.flightaware_id"; |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | if (isset($filter['alliance']) && !empty($filter['alliance'])) { |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.airline_type = '".$filter['airlinestype']."') sa ON sa.flightaware_id = spotter_live.flightaware_id "; |
82 | 82 | } |
83 | 83 | if (isset($filter['pilots_id']) && !empty($filter['pilots_id'])) { |
84 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','",$filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
84 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output WHERE spotter_output.pilot_id IN ('".implode("','", $filter['pilots_id'])."')) sp ON sp.flightaware_id = spotter_live.flightaware_id"; |
|
85 | 85 | } |
86 | 86 | if (isset($filter['source']) && !empty($filter['source'])) { |
87 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
87 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
88 | 88 | } |
89 | 89 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
90 | 90 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -113,15 +113,15 @@ discard block |
||
113 | 113 | $filter_query_date .= " AND EXTRACT(DAY FROM spotter_output.date) = '".$filter['day']."'"; |
114 | 114 | } |
115 | 115 | } |
116 | - $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
116 | + $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.flightaware_id = spotter_live.flightaware_id"; |
|
117 | 117 | } |
118 | 118 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
119 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
119 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
120 | 120 | } |
121 | 121 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
122 | 122 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
123 | 123 | if ($filter_query_where != '') { |
124 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
124 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
125 | 125 | } |
126 | 126 | $filter_query = $filter_query_join.$filter_query_where; |
127 | 127 | return $filter_query; |
@@ -144,8 +144,8 @@ discard block |
||
144 | 144 | if ($limit != '') |
145 | 145 | { |
146 | 146 | $limit_array = explode(',', $limit); |
147 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
147 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
149 | 149 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
150 | 150 | { |
151 | 151 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | } else { |
170 | 170 | $query = "SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate".$filter_query.$orderby_query; |
171 | 171 | } |
172 | - $spotter_array = $Spotter->getDataFromDB($query.$limit_query,array(),'',true); |
|
172 | + $spotter_array = $Spotter->getDataFromDB($query.$limit_query, array(), '', true); |
|
173 | 173 | |
174 | 174 | return $spotter_array; |
175 | 175 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | { |
185 | 185 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
186 | 186 | date_default_timezone_set('UTC'); |
187 | - $filter_query = $this->getFilter($filter,true,true); |
|
187 | + $filter_query = $this->getFilter($filter, true, true); |
|
188 | 188 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
189 | 189 | if ($globalDBdriver == 'mysql') { |
190 | 190 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | try { |
208 | 208 | $sth = $this->db->prepare($query); |
209 | 209 | $sth->execute(); |
210 | - } catch(PDOException $e) { |
|
210 | + } catch (PDOException $e) { |
|
211 | 211 | echo $e->getMessage(); |
212 | 212 | die; |
213 | 213 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
227 | 227 | date_default_timezone_set('UTC'); |
228 | 228 | |
229 | - $filter_query = $this->getFilter($filter,true,true); |
|
229 | + $filter_query = $this->getFilter($filter, true, true); |
|
230 | 230 | |
231 | 231 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
232 | 232 | if ($globalDBdriver == 'mysql') { |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
238 | 238 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
239 | 239 | */ |
240 | - $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
240 | + $query = 'SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
241 | 241 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id |
242 | 242 | UNION |
243 | 243 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | WHERE latitude <> '0' AND longitude <> '0' |
246 | 246 | ORDER BY flightaware_id, date"; |
247 | 247 | } else { |
248 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
248 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
249 | 249 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date |
250 | 250 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
251 | 251 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | WHERE spotter_archive.latitude <> '0' AND spotter_archive.longitude <> '0' |
259 | 259 | ORDER BY spotter_archive.flightaware_id, spotter_archive.date"; |
260 | 260 | */ |
261 | - $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
261 | + $query = "SELECT * FROM (SELECT spotter_archive.ident, spotter_archive.flightaware_id, spotter_archive.aircraft_icao, spotter_archive.departure_airport_icao as departure_airport, spotter_archive.arrival_airport_icao as arrival_airport, spotter_archive.latitude, spotter_archive.longitude, spotter_archive.altitude, spotter_archive.heading, spotter_archive.ground_speed, spotter_archive.squawk, spotter_archive.date, spotter_archive.format_source |
|
262 | 262 | FROM spotter_archive INNER JOIN (SELECT flightaware_id FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date) l ON l.flightaware_id = spotter_archive.flightaware_id |
263 | 263 | UNION |
264 | 264 | SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | ORDER BY flightaware_id, date"; |
269 | 269 | //AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".round($globalLiveInterval*1000)." SECONDS' <= spotter_archive.date |
270 | 270 | } else { |
271 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
271 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
272 | 272 | FROM spotter_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
273 | 273 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
274 | 274 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | try { |
278 | 278 | $sth = $this->db->prepare($query); |
279 | 279 | $sth->execute(); |
280 | - } catch(PDOException $e) { |
|
280 | + } catch (PDOException $e) { |
|
281 | 281 | echo $e->getMessage(); |
282 | 282 | die; |
283 | 283 | } |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | public function getLiveSpotterCount($filter = array()) |
295 | 295 | { |
296 | 296 | global $globalDBdriver, $globalLiveInterval; |
297 | - $filter_query = $this->getFilter($filter,true,true); |
|
297 | + $filter_query = $this->getFilter($filter, true, true); |
|
298 | 298 | |
299 | 299 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
300 | 300 | if ($globalDBdriver == 'mysql') { |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | try { |
308 | 308 | $sth = $this->db->prepare($query); |
309 | 309 | $sth->execute(); |
310 | - } catch(PDOException $e) { |
|
310 | + } catch (PDOException $e) { |
|
311 | 311 | echo $e->getMessage(); |
312 | 312 | die; |
313 | 313 | } |
@@ -330,10 +330,10 @@ discard block |
||
330 | 330 | $filter_query = $this->getFilter($filter); |
331 | 331 | |
332 | 332 | if (is_array($coord)) { |
333 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
334 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
335 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
336 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
333 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
334 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
335 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
336 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
337 | 337 | } else return array(); |
338 | 338 | if ($globalDBdriver == 'mysql') { |
339 | 339 | $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY spotter_live.flightaware_id'.$filter_query; |
@@ -356,23 +356,23 @@ discard block |
||
356 | 356 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
357 | 357 | $Spotter = new Spotter($this->db); |
358 | 358 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
359 | - $filter_query = $this->getFilter($filter,true,true); |
|
359 | + $filter_query = $this->getFilter($filter, true, true); |
|
360 | 360 | |
361 | 361 | if (is_array($coord)) { |
362 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
363 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
364 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
365 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
362 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
363 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
364 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
365 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
366 | 366 | } else return array(); |
367 | 367 | if ($globalDBdriver == 'mysql') { |
368 | 368 | if (isset($globalArchive) && $globalArchive === TRUE) { |
369 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
369 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
370 | 370 | FROM spotter_live |
371 | 371 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= spotter_live.date |
372 | 372 | AND spotter_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND spotter_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
373 | 373 | AND spotter_live.latitude <> 0 AND spotter_live.longitude <> 0'; |
374 | 374 | } else { |
375 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
375 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
376 | 376 | FROM spotter_live |
377 | 377 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
378 | 378 | FROM spotter_live l |
@@ -384,14 +384,14 @@ discard block |
||
384 | 384 | } |
385 | 385 | } else { |
386 | 386 | if (isset($globalArchive) && $globalArchive === TRUE) { |
387 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
387 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
388 | 388 | FROM spotter_live |
389 | 389 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date |
390 | 390 | AND spotter_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
391 | 391 | AND spotter_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
392 | 392 | AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0'"; |
393 | 393 | } else { |
394 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
394 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
|
395 | 395 | FROM spotter_live |
396 | 396 | INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate |
397 | 397 | FROM spotter_live l |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | try { |
407 | 407 | $sth = $this->db->prepare($query); |
408 | 408 | $sth->execute(); |
409 | - } catch(PDOException $e) { |
|
409 | + } catch (PDOException $e) { |
|
410 | 410 | echo $e->getMessage(); |
411 | 411 | die; |
412 | 412 | } |
@@ -455,7 +455,7 @@ discard block |
||
455 | 455 | if ($interval == '1m') |
456 | 456 | { |
457 | 457 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
458 | - } else if ($interval == '15m'){ |
|
458 | + } else if ($interval == '15m') { |
|
459 | 459 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
460 | 460 | } |
461 | 461 | } |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
464 | 464 | } |
465 | 465 | |
466 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
466 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
467 | 467 | WHERE spotter_live.latitude <> '' |
468 | 468 | AND spotter_live.longitude <> '' |
469 | 469 | ".$additional_query." |
470 | 470 | HAVING distance < :radius |
471 | 471 | ORDER BY distance"; |
472 | 472 | |
473 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
473 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
474 | 474 | |
475 | 475 | return $spotter_array; |
476 | 476 | } |
@@ -488,9 +488,9 @@ discard block |
||
488 | 488 | date_default_timezone_set('UTC'); |
489 | 489 | |
490 | 490 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
491 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
491 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
492 | 492 | |
493 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
493 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
494 | 494 | |
495 | 495 | return $spotter_array; |
496 | 496 | } |
@@ -501,16 +501,16 @@ discard block |
||
501 | 501 | * @return Array the spotter information |
502 | 502 | * |
503 | 503 | */ |
504 | - public function getDateLiveSpotterDataByIdent($ident,$date) |
|
504 | + public function getDateLiveSpotterDataByIdent($ident, $date) |
|
505 | 505 | { |
506 | 506 | $Spotter = new Spotter($this->db); |
507 | 507 | date_default_timezone_set('UTC'); |
508 | 508 | |
509 | 509 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
510 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
510 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
511 | 511 | |
512 | - $date = date('c',$date); |
|
513 | - $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
512 | + $date = date('c', $date); |
|
513 | + $spotter_array = $Spotter->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
514 | 514 | |
515 | 515 | return $spotter_array; |
516 | 516 | } |
@@ -526,8 +526,8 @@ discard block |
||
526 | 526 | $Spotter = new Spotter($this->db); |
527 | 527 | date_default_timezone_set('UTC'); |
528 | 528 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
529 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
530 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
|
529 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
530 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id), '', true); |
|
531 | 531 | return $spotter_array; |
532 | 532 | } |
533 | 533 | |
@@ -537,15 +537,15 @@ discard block |
||
537 | 537 | * @return Array the spotter information |
538 | 538 | * |
539 | 539 | */ |
540 | - public function getDateLiveSpotterDataById($id,$date) |
|
540 | + public function getDateLiveSpotterDataById($id, $date) |
|
541 | 541 | { |
542 | 542 | $Spotter = new Spotter($this->db); |
543 | 543 | date_default_timezone_set('UTC'); |
544 | 544 | |
545 | 545 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
546 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
547 | - $date = date('c',$date); |
|
548 | - $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
546 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
547 | + $date = date('c', $date); |
|
548 | + $spotter_array = $Spotter->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
549 | 549 | return $spotter_array; |
550 | 550 | } |
551 | 551 | |
@@ -561,13 +561,13 @@ discard block |
||
561 | 561 | date_default_timezone_set('UTC'); |
562 | 562 | |
563 | 563 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
564 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
564 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
565 | 565 | |
566 | 566 | try { |
567 | 567 | |
568 | 568 | $sth = $this->db->prepare($query); |
569 | 569 | $sth->execute(array(':ident' => $ident)); |
570 | - } catch(PDOException $e) { |
|
570 | + } catch (PDOException $e) { |
|
571 | 571 | echo $e->getMessage(); |
572 | 572 | die; |
573 | 573 | } |
@@ -582,7 +582,7 @@ discard block |
||
582 | 582 | * @return Array the spotter information |
583 | 583 | * |
584 | 584 | */ |
585 | - public function getAllLiveSpotterDataById($id,$liveinterval = false) |
|
585 | + public function getAllLiveSpotterDataById($id, $liveinterval = false) |
|
586 | 586 | { |
587 | 587 | global $globalDBdriver, $globalLiveInterval; |
588 | 588 | date_default_timezone_set('UTC'); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | try { |
602 | 602 | $sth = $this->db->prepare($query); |
603 | 603 | $sth->execute(array(':id' => $id)); |
604 | - } catch(PDOException $e) { |
|
604 | + } catch (PDOException $e) { |
|
605 | 605 | echo $e->getMessage(); |
606 | 606 | die; |
607 | 607 | } |
@@ -619,12 +619,12 @@ discard block |
||
619 | 619 | { |
620 | 620 | date_default_timezone_set('UTC'); |
621 | 621 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
622 | - $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
622 | + $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
|
623 | 623 | try { |
624 | 624 | |
625 | 625 | $sth = $this->db->prepare($query); |
626 | 626 | $sth->execute(array(':ident' => $ident)); |
627 | - } catch(PDOException $e) { |
|
627 | + } catch (PDOException $e) { |
|
628 | 628 | echo $e->getMessage(); |
629 | 629 | die; |
630 | 630 | } |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | |
655 | 655 | $sth = $this->db->prepare($query); |
656 | 656 | $sth->execute(); |
657 | - } catch(PDOException $e) { |
|
657 | + } catch (PDOException $e) { |
|
658 | 658 | return "error"; |
659 | 659 | } |
660 | 660 | |
@@ -677,14 +677,14 @@ discard block |
||
677 | 677 | |
678 | 678 | $sth = $this->db->prepare($query); |
679 | 679 | $sth->execute(); |
680 | - } catch(PDOException $e) { |
|
680 | + } catch (PDOException $e) { |
|
681 | 681 | return "error"; |
682 | 682 | } |
683 | 683 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
684 | 684 | $i = 0; |
685 | - $j =0; |
|
685 | + $j = 0; |
|
686 | 686 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
687 | - foreach($all as $row) |
|
687 | + foreach ($all as $row) |
|
688 | 688 | { |
689 | 689 | $i++; |
690 | 690 | $j++; |
@@ -692,9 +692,9 @@ discard block |
||
692 | 692 | if ($globalDebug) echo "."; |
693 | 693 | try { |
694 | 694 | |
695 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
695 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
696 | 696 | $sth->execute(); |
697 | - } catch(PDOException $e) { |
|
697 | + } catch (PDOException $e) { |
|
698 | 698 | return "error"; |
699 | 699 | } |
700 | 700 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
@@ -705,9 +705,9 @@ discard block |
||
705 | 705 | if ($i > 0) { |
706 | 706 | try { |
707 | 707 | |
708 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
708 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
709 | 709 | $sth->execute(); |
710 | - } catch(PDOException $e) { |
|
710 | + } catch (PDOException $e) { |
|
711 | 711 | return "error"; |
712 | 712 | } |
713 | 713 | } |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | |
721 | 721 | $sth = $this->db->prepare($query); |
722 | 722 | $sth->execute(); |
723 | - } catch(PDOException $e) { |
|
723 | + } catch (PDOException $e) { |
|
724 | 724 | return "error"; |
725 | 725 | } |
726 | 726 | /* $query_delete = "DELETE FROM spotter_live WHERE flightaware_id IN ("; |
@@ -768,13 +768,13 @@ discard block |
||
768 | 768 | public function deleteLiveSpotterDataByIdent($ident) |
769 | 769 | { |
770 | 770 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
771 | - $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
771 | + $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
|
772 | 772 | |
773 | 773 | try { |
774 | 774 | |
775 | 775 | $sth = $this->db->prepare($query); |
776 | 776 | $sth->execute(array(':ident' => $ident)); |
777 | - } catch(PDOException $e) { |
|
777 | + } catch (PDOException $e) { |
|
778 | 778 | return "error"; |
779 | 779 | } |
780 | 780 | |
@@ -790,13 +790,13 @@ discard block |
||
790 | 790 | public function deleteLiveSpotterDataById($id) |
791 | 791 | { |
792 | 792 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
793 | - $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
793 | + $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
|
794 | 794 | |
795 | 795 | try { |
796 | 796 | |
797 | 797 | $sth = $this->db->prepare($query); |
798 | 798 | $sth->execute(array(':id' => $id)); |
799 | - } catch(PDOException $e) { |
|
799 | + } catch (PDOException $e) { |
|
800 | 800 | return "error"; |
801 | 801 | } |
802 | 802 | |
@@ -814,13 +814,13 @@ discard block |
||
814 | 814 | { |
815 | 815 | global $globalDBdriver, $globalTimezone; |
816 | 816 | if ($globalDBdriver == 'mysql') { |
817 | - $query = 'SELECT spotter_live.ident FROM spotter_live |
|
817 | + $query = 'SELECT spotter_live.ident FROM spotter_live |
|
818 | 818 | WHERE spotter_live.ident = :ident |
819 | 819 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
820 | 820 | AND spotter_live.date < UTC_TIMESTAMP()'; |
821 | 821 | $query_data = array(':ident' => $ident); |
822 | 822 | } else { |
823 | - $query = "SELECT spotter_live.ident FROM spotter_live |
|
823 | + $query = "SELECT spotter_live.ident FROM spotter_live |
|
824 | 824 | WHERE spotter_live.ident = :ident |
825 | 825 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
826 | 826 | AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -829,8 +829,8 @@ discard block |
||
829 | 829 | |
830 | 830 | $sth = $this->db->prepare($query); |
831 | 831 | $sth->execute($query_data); |
832 | - $ident_result=''; |
|
833 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
832 | + $ident_result = ''; |
|
833 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
834 | 834 | { |
835 | 835 | $ident_result = $row['ident']; |
836 | 836 | } |
@@ -847,13 +847,13 @@ discard block |
||
847 | 847 | { |
848 | 848 | global $globalDBdriver, $globalTimezone; |
849 | 849 | if ($globalDBdriver == 'mysql') { |
850 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
850 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
851 | 851 | WHERE spotter_live.ident = :ident |
852 | 852 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
853 | 853 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
854 | 854 | $query_data = array(':ident' => $ident); |
855 | 855 | } else { |
856 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
856 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
857 | 857 | WHERE spotter_live.ident = :ident |
858 | 858 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
859 | 859 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -862,8 +862,8 @@ discard block |
||
862 | 862 | |
863 | 863 | $sth = $this->db->prepare($query); |
864 | 864 | $sth->execute($query_data); |
865 | - $ident_result=''; |
|
866 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
865 | + $ident_result = ''; |
|
866 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
867 | 867 | { |
868 | 868 | $ident_result = $row['flightaware_id']; |
869 | 869 | } |
@@ -880,13 +880,13 @@ discard block |
||
880 | 880 | { |
881 | 881 | global $globalDBdriver, $globalTimezone; |
882 | 882 | if ($globalDBdriver == 'mysql') { |
883 | - $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
883 | + $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
884 | 884 | WHERE spotter_live.flightaware_id = :id |
885 | 885 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
886 | 886 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
887 | 887 | $query_data = array(':id' => $id); |
888 | 888 | } else { |
889 | - $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
889 | + $query = "SELECT spotter_live.ident, spotter_live.flightaware_id FROM spotter_live |
|
890 | 890 | WHERE spotter_live.flightaware_id = :id |
891 | 891 | AND spotter_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
892 | 892 | // AND spotter_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -895,8 +895,8 @@ discard block |
||
895 | 895 | |
896 | 896 | $sth = $this->db->prepare($query); |
897 | 897 | $sth->execute($query_data); |
898 | - $ident_result=''; |
|
899 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
898 | + $ident_result = ''; |
|
899 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
900 | 900 | { |
901 | 901 | $ident_result = $row['flightaware_id']; |
902 | 902 | } |
@@ -913,13 +913,13 @@ discard block |
||
913 | 913 | { |
914 | 914 | global $globalDBdriver, $globalTimezone; |
915 | 915 | if ($globalDBdriver == 'mysql') { |
916 | - $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
916 | + $query = 'SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
917 | 917 | WHERE spotter_live.ModeS = :modes |
918 | 918 | AND spotter_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
919 | 919 | // AND spotter_live.date < UTC_TIMESTAMP()"; |
920 | 920 | $query_data = array(':modes' => $modes); |
921 | 921 | } else { |
922 | - $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
922 | + $query = "SELECT spotter_live.ModeS, spotter_live.flightaware_id FROM spotter_live |
|
923 | 923 | WHERE spotter_live.ModeS = :modes |
924 | 924 | AND spotter_live.date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '30 MINUTE'"; |
925 | 925 | // // AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC'"; |
@@ -928,8 +928,8 @@ discard block |
||
928 | 928 | |
929 | 929 | $sth = $this->db->prepare($query); |
930 | 930 | $sth->execute($query_data); |
931 | - $ident_result=''; |
|
932 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
931 | + $ident_result = ''; |
|
932 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
933 | 933 | { |
934 | 934 | //$ident_result = $row['spotter_live_id']; |
935 | 935 | $ident_result = $row['flightaware_id']; |
@@ -948,7 +948,7 @@ discard block |
||
948 | 948 | * @return String success or false |
949 | 949 | * |
950 | 950 | */ |
951 | - public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '',$heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
|
951 | + public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $altitude_real = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false, $registration = '', $pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false, $format_source = '', $source_name = '', $over_country = '') |
|
952 | 952 | { |
953 | 953 | global $globalURL, $globalArchive, $globalDebug; |
954 | 954 | $Common = new Common(); |
@@ -1048,27 +1048,27 @@ discard block |
||
1048 | 1048 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
1049 | 1049 | |
1050 | 1050 | |
1051 | - $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
|
1052 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
1053 | - $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
|
1054 | - $departure_airport_icao = filter_var($departure_airport_icao,FILTER_SANITIZE_STRING); |
|
1055 | - $arrival_airport_icao = filter_var($arrival_airport_icao,FILTER_SANITIZE_STRING); |
|
1056 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1057 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1058 | - $waypoints = filter_var($waypoints,FILTER_SANITIZE_STRING); |
|
1059 | - $altitude = filter_var($altitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1060 | - $altitude_real = filter_var($altitude_real,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
1062 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | - $squawk = filter_var($squawk,FILTER_SANITIZE_NUMBER_INT); |
|
1064 | - $route_stop = filter_var($route_stop,FILTER_SANITIZE_STRING); |
|
1065 | - $ModeS = filter_var($ModeS,FILTER_SANITIZE_STRING); |
|
1066 | - $pilot_id = filter_var($pilot_id,FILTER_SANITIZE_STRING); |
|
1067 | - $pilot_name = filter_var($pilot_name,FILTER_SANITIZE_STRING); |
|
1068 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
1069 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
1070 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
1071 | - $verticalrate = filter_var($verticalrate,FILTER_SANITIZE_NUMBER_INT); |
|
1051 | + $flightaware_id = filter_var($flightaware_id, FILTER_SANITIZE_STRING); |
|
1052 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
1053 | + $aircraft_icao = filter_var($aircraft_icao, FILTER_SANITIZE_STRING); |
|
1054 | + $departure_airport_icao = filter_var($departure_airport_icao, FILTER_SANITIZE_STRING); |
|
1055 | + $arrival_airport_icao = filter_var($arrival_airport_icao, FILTER_SANITIZE_STRING); |
|
1056 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1057 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1058 | + $waypoints = filter_var($waypoints, FILTER_SANITIZE_STRING); |
|
1059 | + $altitude = filter_var($altitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1060 | + $altitude_real = filter_var($altitude_real, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1061 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
1062 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
1063 | + $squawk = filter_var($squawk, FILTER_SANITIZE_NUMBER_INT); |
|
1064 | + $route_stop = filter_var($route_stop, FILTER_SANITIZE_STRING); |
|
1065 | + $ModeS = filter_var($ModeS, FILTER_SANITIZE_STRING); |
|
1066 | + $pilot_id = filter_var($pilot_id, FILTER_SANITIZE_STRING); |
|
1067 | + $pilot_name = filter_var($pilot_name, FILTER_SANITIZE_STRING); |
|
1068 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
1069 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
1070 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
1071 | + $verticalrate = filter_var($verticalrate, FILTER_SANITIZE_NUMBER_INT); |
|
1072 | 1072 | |
1073 | 1073 | $airline_name = ''; |
1074 | 1074 | $airline_icao = ''; |
@@ -1090,10 +1090,10 @@ discard block |
||
1090 | 1090 | $arrival_airport_country = ''; |
1091 | 1091 | |
1092 | 1092 | |
1093 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
1094 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
1095 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
1096 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
1093 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
1094 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
1095 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
1096 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
1097 | 1097 | |
1098 | 1098 | $query = ''; |
1099 | 1099 | if ($globalArchive) { |
@@ -1104,19 +1104,19 @@ discard block |
||
1104 | 1104 | $query .= 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country, real_altitude) |
1105 | 1105 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country, :real_altitude)'; |
1106 | 1106 | |
1107 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_shadow' => $aircraft_shadow,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk,':route_stop' => $route_stop,':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source,':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country,':real_altitude' => $altitude_real); |
|
1107 | + $query_values = array(':flightaware_id' => $flightaware_id, ':ident' => $ident, ':registration' => $registration, ':airline_name' => $airline_name, ':airline_icao' => $airline_icao, ':airline_country' => $airline_country, ':airline_type' => $airline_type, ':aircraft_icao' => $aircraft_icao, ':aircraft_shadow' => $aircraft_shadow, ':aircraft_type' => $aircraft_type, ':aircraft_manufacturer' => $aircraft_manufacturer, ':departure_airport_icao' => $departure_airport_icao, ':departure_airport_name' => $departure_airport_name, ':departure_airport_city' => $departure_airport_city, ':departure_airport_country' => $departure_airport_country, ':arrival_airport_icao' => $arrival_airport_icao, ':arrival_airport_name' => $arrival_airport_name, ':arrival_airport_city' => $arrival_airport_city, ':arrival_airport_country' => $arrival_airport_country, ':latitude' => $latitude, ':longitude' => $longitude, ':waypoints' => $waypoints, ':altitude' => $altitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':departure_airport_time' => $departure_airport_time, ':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name, ':over_country' => $over_country, ':real_altitude' => $altitude_real); |
|
1108 | 1108 | try { |
1109 | 1109 | |
1110 | 1110 | $sth = $this->db->prepare($query); |
1111 | 1111 | $sth->execute($query_values); |
1112 | 1112 | $sth->closeCursor(); |
1113 | - } catch(PDOException $e) { |
|
1113 | + } catch (PDOException $e) { |
|
1114 | 1114 | return "error : ".$e->getMessage(); |
1115 | 1115 | } |
1116 | 1116 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
1117 | 1117 | if ($globalDebug) echo '(Add to SBS archive : '; |
1118 | 1118 | $SpotterArchive = new SpotterArchive($this->db); |
1119 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $altitude_real,$heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
1119 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time, $arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name, $verticalrate, $format_source, $source_name, $over_country); |
|
1120 | 1120 | if ($globalDebug) echo $result.')'; |
1121 | 1121 | } elseif ($globalDebug && $putinarchive !== true) { |
1122 | 1122 | echo '(Not adding to archive)'; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | |
1130 | 1130 | public function getOrderBy() |
1131 | 1131 | { |
1132 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1132 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY spotter_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY spotter_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY spotter_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY spotter_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY spotter_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY spotter_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY spotter_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY spotter_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY spotter_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY spotter_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY spotter_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY spotter_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY spotter_live.date DESC")); |
|
1133 | 1133 | return $orderby; |
1134 | 1134 | } |
1135 | 1135 |