@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Departure Airports of %s"),$spotter_array[0]['pilot_name']); |
|
16 | + $title = sprintf(_("Most Common Departure Airports of %s"), $spotter_array[0]['pilot_name']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('pilot-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
28 | 28 | $airport_airport_array = $Spotter->countAllDepartureAirportsByPilot($pilot); |
29 | 29 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script> |
30 | 30 | <script> |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | ["'._("Airport").'", "'._("# of times").'"],'; |
40 | 40 | |
41 | 41 | $airport_data = ''; |
42 | - foreach($airport_airport_array as $airport_item) |
|
42 | + foreach ($airport_airport_array as $airport_item) |
|
43 | 43 | { |
44 | 44 | $name = $airport_item['airport_departure_city'].', '.$airport_item['airport_departure_country'].' ('.$airport_item['airport_departure_icao'].')'; |
45 | 45 | $name = str_replace("'", "", $name); |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | print '</thead>'; |
79 | 79 | print '<tbody>'; |
80 | 80 | $i = 1; |
81 | - foreach($airport_airport_array as $airport_item) |
|
81 | + foreach ($airport_airport_array as $airport_item) |
|
82 | 82 | { |
83 | 83 | print '<tr>'; |
84 | 84 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Arrival Airports by Country of %s"),$spotter_array[0]['aircraft_owner']); |
|
16 | + $title = sprintf(_("Most Common Arrival Airports by Country of %s"), $spotter_array[0]['aircraft_owner']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('owner-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
28 | 28 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByOwner($owner); |
29 | 29 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
30 | 30 | print '<div id="chartCountry" class="chart" width="100%"></div> |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | var data = google.visualization.arrayToDataTable([ |
36 | 36 | ["'._("Country").'", "'._("# of times").'"], '; |
37 | 37 | $country_data = ''; |
38 | - foreach($airport_country_array as $airport_item) |
|
38 | + foreach ($airport_country_array as $airport_item) |
|
39 | 39 | { |
40 | 40 | $country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
41 | 41 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | print '</thead>'; |
70 | 70 | print '<tbody>'; |
71 | 71 | $i = 1; |
72 | - foreach($airport_country_array as $airport_item) |
|
72 | + foreach ($airport_country_array as $airport_item) |
|
73 | 73 | { |
74 | 74 | print '<tr>'; |
75 | 75 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
12 | 12 | if ($sort != '') { |
13 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort); |
|
13 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort); |
|
14 | 14 | } else { |
15 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", ''); |
|
15 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", ''); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | if (!empty($spotter_array)) |
19 | 19 | { |
20 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['pilot_name']); |
|
20 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['pilot_name']); |
|
21 | 21 | require_once('header.php'); |
22 | 22 | print '<div class="info column">'; |
23 | 23 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | include('pilot-sub-menu.php'); |
29 | 29 | print '<div class="column">'; |
30 | 30 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
31 | - print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
31 | + print '<p>'.sprintf(_("The statistic below shows the most common aircrafts of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
32 | 32 | |
33 | 33 | $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot); |
34 | 34 | if (!empty($aircraft_array)) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | print '</thead>'; |
43 | 43 | print '<tbody>'; |
44 | 44 | $i = 1; |
45 | - foreach($aircraft_array as $aircraft_item) |
|
45 | + foreach ($aircraft_array as $aircraft_item) |
|
46 | 46 | { |
47 | 47 | print '<tr>'; |
48 | 48 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByOwner($owner,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByOwner($owner, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Airlines of %s"),$spotter_array[0]['aircraft_owner']); |
|
16 | + $title = sprintf(_("Most Common Airlines of %s"), $spotter_array[0]['aircraft_owner']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['aircraft_owner'].'</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('owner-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Airlines").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights owned by <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
28 | 28 | |
29 | 29 | $airline_array = $Spotter->countAllAirlinesByOwner($owner); |
30 | 30 | if (!empty($airline_array)) |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | print '</thead>'; |
42 | 42 | print '<tbody>'; |
43 | 43 | $i = 1; |
44 | - foreach($airline_array as $airline_item) |
|
44 | + foreach ($airline_array as $airline_item) |
|
45 | 45 | { |
46 | 46 | print '<tr>'; |
47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | header('Location: '.$globalURL.'/pilot/'.$_POST['pilot']); |
10 | 10 | //} else if (isset($_GET['airport'])){ |
11 | 11 | } else { |
12 | - $Spotter= new Spotter(); |
|
12 | + $Spotter = new Spotter(); |
|
13 | 13 | $Stats = new Stats(); |
14 | 14 | $title = _("Pilots"); |
15 | 15 | require_once('header.php'); |
@@ -22,11 +22,11 @@ discard block |
||
22 | 22 | //ksort($pilot_names); |
23 | 23 | $previous = null; |
24 | 24 | print '<div class="alphabet-legend">'; |
25 | - foreach($pilot_names as $value) { |
|
25 | + foreach ($pilot_names as $value) { |
|
26 | 26 | $firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1)); |
27 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
27 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
28 | 28 | { |
29 | - if ($previous !== null){ |
|
29 | + if ($previous !== null) { |
|
30 | 30 | print ' | '; |
31 | 31 | } |
32 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -35,13 +35,13 @@ discard block |
||
35 | 35 | } |
36 | 36 | print '</div>'; |
37 | 37 | $previous = null; |
38 | - foreach($pilot_names as $value) { |
|
38 | + foreach ($pilot_names as $value) { |
|
39 | 39 | $firstLetter = mb_strtoupper(mb_substr($value['pilot_name'], 0, 1)); |
40 | 40 | if ($firstLetter != "") |
41 | 41 | { |
42 | - if($previous !== $firstLetter && $firstLetter != "'") |
|
42 | + if ($previous !== $firstLetter && $firstLetter != "'") |
|
43 | 43 | { |
44 | - if ($previous !== null){ |
|
44 | + if ($previous !== null) { |
|
45 | 45 | print '</div>'; |
46 | 46 | } |
47 | 47 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -6,14 +6,14 @@ discard block |
||
6 | 6 | //require_once('require/class.SpotterLive.php'); |
7 | 7 | require_once('require/class.SpotterArchive.php'); |
8 | 8 | |
9 | -if (!isset($_GET['owner'])){ |
|
9 | +if (!isset($_GET['owner'])) { |
|
10 | 10 | header('Location: '.$globalURL.''); |
11 | 11 | } else { |
12 | 12 | $Spotter = new Spotter(); |
13 | 13 | $SpotterArchive = new SpotterArchive(); |
14 | 14 | $Translation = new Translation(); |
15 | 15 | //calculuation for the pagination |
16 | - if(!isset($_GET['limit'])) |
|
16 | + if (!isset($_GET['limit'])) |
|
17 | 17 | { |
18 | 18 | $limit_start = 0; |
19 | 19 | $limit_end = 25; |
@@ -34,24 +34,24 @@ discard block |
||
34 | 34 | |
35 | 35 | $page_url = $globalURL.'/owner/'.$_GET['owner']; |
36 | 36 | |
37 | - $owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
38 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
37 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
38 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
39 | 39 | if ($sort != '') |
40 | 40 | { |
41 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort); |
|
41 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort); |
|
42 | 42 | if (empty($spotter_array)) { |
43 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference, $sort); |
|
43 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference, $sort); |
|
44 | 44 | } |
45 | 45 | } else { |
46 | - $spotter_array = $Spotter->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference); |
|
46 | + $spotter_array = $Spotter->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference); |
|
47 | 47 | if (empty($spotter_array)) { |
48 | - $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner,$limit_start.",".$absolute_difference); |
|
48 | + $spotter_array = $SpotterArchive->getSpotterDataByOwner($owner, $limit_start.",".$absolute_difference); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | 52 | if (!empty($spotter_array)) |
53 | 53 | { |
54 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['aircraft_owner']); |
|
54 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['aircraft_owner']); |
|
55 | 55 | //$ident = $spotter_array[0]['ident']; |
56 | 56 | if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
57 | 57 | if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | |
113 | 113 | include('owner-sub-menu.php'); |
114 | 114 | print '<div class="table column">'; |
115 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."),$spotter_array[0]['aircraft_owner']).'</p>'; |
|
115 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the owner <strong>%s</strong>."), $spotter_array[0]['aircraft_owner']).'</p>'; |
|
116 | 116 | |
117 | 117 | include('table-output.php'); |
118 | 118 | print '<div class="pagination">'; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | header('Location: '.$globalURL.'/owner/'.$_POST['owner']); |
11 | 11 | //} else if (isset($_GET['airport'])){ |
12 | 12 | } else { |
13 | - $Spotter= new Spotter(); |
|
13 | + $Spotter = new Spotter(); |
|
14 | 14 | $Stats = new Stats(); |
15 | 15 | $Common = new Common(); |
16 | 16 | $title = _("Owners"); |
@@ -24,11 +24,11 @@ discard block |
||
24 | 24 | ksort($owner_names); |
25 | 25 | $previous = null; |
26 | 26 | print '<div class="alphabet-legend">'; |
27 | - foreach($owner_names as $value) { |
|
27 | + foreach ($owner_names as $value) { |
|
28 | 28 | $firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1))); |
29 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
29 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
30 | 30 | { |
31 | - if ($previous !== null){ |
|
31 | + if ($previous !== null) { |
|
32 | 32 | print ' | '; |
33 | 33 | } |
34 | 34 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -37,13 +37,13 @@ discard block |
||
37 | 37 | } |
38 | 38 | print '</div>'; |
39 | 39 | $previous = null; |
40 | - foreach($owner_names as $value) { |
|
40 | + foreach ($owner_names as $value) { |
|
41 | 41 | $firstLetter = $Common->remove_accents(mb_strtoupper(mb_substr($value['owner_name'], 0, 1))); |
42 | 42 | if ($firstLetter != "") |
43 | 43 | { |
44 | - if($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
44 | + if ($previous !== $firstLetter && $firstLetter != "'" && $firstLetter != '"') |
|
45 | 45 | { |
46 | - if ($previous !== null){ |
|
46 | + if ($previous !== null) { |
|
47 | 47 | print '</div>'; |
48 | 48 | } |
49 | 49 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -17,14 +17,14 @@ discard block |
||
17 | 17 | $this->db = $Connection->db(); |
18 | 18 | } |
19 | 19 | |
20 | - public function addLastStatsUpdate($type,$stats_date) { |
|
20 | + public function addLastStatsUpdate($type, $stats_date) { |
|
21 | 21 | $query = "DELETE FROM config WHERE name = :type; |
22 | 22 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
23 | - $query_values = array('type' => $type,':stats_date' => $stats_date); |
|
23 | + $query_values = array('type' => $type, ':stats_date' => $stats_date); |
|
24 | 24 | try { |
25 | 25 | $sth = $this->db->prepare($query); |
26 | 26 | $sth->execute($query_values); |
27 | - } catch(PDOException $e) { |
|
27 | + } catch (PDOException $e) { |
|
28 | 28 | return "error : ".$e->getMessage(); |
29 | 29 | } |
30 | 30 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | try { |
35 | 35 | $sth = $this->db->prepare($query); |
36 | 36 | $sth->execute(array(':type' => $type)); |
37 | - } catch(PDOException $e) { |
|
37 | + } catch (PDOException $e) { |
|
38 | 38 | echo "error : ".$e->getMessage(); |
39 | 39 | } |
40 | 40 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | try { |
55 | 55 | $sth = $this->db->prepare($query); |
56 | 56 | $sth->execute(array(':filter_name' => $filter_name)); |
57 | - } catch(PDOException $e) { |
|
57 | + } catch (PDOException $e) { |
|
58 | 58 | return "error : ".$e->getMessage(); |
59 | 59 | } |
60 | 60 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | try { |
65 | 65 | $sth = $this->db->prepare($query); |
66 | 66 | $sth->execute(); |
67 | - } catch(PDOException $e) { |
|
67 | + } catch (PDOException $e) { |
|
68 | 68 | return "error : ".$e->getMessage(); |
69 | 69 | } |
70 | 70 | |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | try { |
73 | 73 | $sth = $this->db->prepare($query); |
74 | 74 | $sth->execute(array(':filter_name' => $filter_name)); |
75 | - } catch(PDOException $e) { |
|
75 | + } catch (PDOException $e) { |
|
76 | 76 | return "error : ".$e->getMessage(); |
77 | 77 | } |
78 | 78 | } |
@@ -82,69 +82,69 @@ discard block |
||
82 | 82 | try { |
83 | 83 | $sth = $this->db->prepare($query); |
84 | 84 | $sth->execute(array(':filter_name' => $filter_name)); |
85 | - } catch(PDOException $e) { |
|
85 | + } catch (PDOException $e) { |
|
86 | 86 | echo "error : ".$e->getMessage(); |
87 | 87 | } |
88 | 88 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
89 | 89 | return $all; |
90 | 90 | } |
91 | - public function getAllAircraftTypes($stats_airline = '',$filter_name = '') { |
|
91 | + public function getAllAircraftTypes($stats_airline = '', $filter_name = '') { |
|
92 | 92 | if ($filter_name == '') $filter_name = $this->filter_name; |
93 | 93 | $query = "SELECT * FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_manufacturer ASC"; |
94 | 94 | try { |
95 | 95 | $sth = $this->db->prepare($query); |
96 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
97 | - } catch(PDOException $e) { |
|
96 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
97 | + } catch (PDOException $e) { |
|
98 | 98 | echo "error : ".$e->getMessage(); |
99 | 99 | } |
100 | 100 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
101 | 101 | return $all; |
102 | 102 | } |
103 | - public function getAllManufacturers($stats_airline = '',$filter_name = '') { |
|
103 | + public function getAllManufacturers($stats_airline = '', $filter_name = '') { |
|
104 | 104 | if ($filter_name == '') $filter_name = $this->filter_name; |
105 | 105 | $query = "SELECT DISTINCT(aircraft_manufacturer) FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND aircraft_manufacturer <> '' ORDER BY aircraft_manufacturer ASC"; |
106 | 106 | try { |
107 | 107 | $sth = $this->db->prepare($query); |
108 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
109 | - } catch(PDOException $e) { |
|
108 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
109 | + } catch (PDOException $e) { |
|
110 | 110 | echo "error : ".$e->getMessage(); |
111 | 111 | } |
112 | 112 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
113 | 113 | return $all; |
114 | 114 | } |
115 | - public function getAllAirportNames($stats_airline = '',$filter_name = '') { |
|
115 | + public function getAllAirportNames($stats_airline = '', $filter_name = '') { |
|
116 | 116 | if ($filter_name == '') $filter_name = $this->filter_name; |
117 | 117 | $query = "SELECT airport_icao, airport_name,airport_city,airport_country FROM stats_airport WHERE stats_airline = :stats_airline AND filter_name = :filter_name AND stats_type = 'daily' GROUP BY airport_icao,airport_name,airport_city,airport_country ORDER BY airport_city ASC"; |
118 | 118 | try { |
119 | 119 | $sth = $this->db->prepare($query); |
120 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
121 | - } catch(PDOException $e) { |
|
120 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
121 | + } catch (PDOException $e) { |
|
122 | 122 | echo "error : ".$e->getMessage(); |
123 | 123 | } |
124 | 124 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
125 | 125 | return $all; |
126 | 126 | } |
127 | 127 | |
128 | - public function getAllOwnerNames($stats_airline = '',$filter_name = '') { |
|
128 | + public function getAllOwnerNames($stats_airline = '', $filter_name = '') { |
|
129 | 129 | if ($filter_name == '') $filter_name = $this->filter_name; |
130 | 130 | $query = "SELECT owner_name FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_name ASC"; |
131 | 131 | try { |
132 | 132 | $sth = $this->db->prepare($query); |
133 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
134 | - } catch(PDOException $e) { |
|
133 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
134 | + } catch (PDOException $e) { |
|
135 | 135 | echo "error : ".$e->getMessage(); |
136 | 136 | } |
137 | 137 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
138 | 138 | return $all; |
139 | 139 | } |
140 | 140 | |
141 | - public function getAllPilotNames($stats_airline = '',$filter_name = '') { |
|
141 | + public function getAllPilotNames($stats_airline = '', $filter_name = '') { |
|
142 | 142 | if ($filter_name == '') $filter_name = $this->filter_name; |
143 | 143 | $query = "SELECT pilot_id,pilot_name FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_name ASC"; |
144 | 144 | try { |
145 | 145 | $sth = $this->db->prepare($query); |
146 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
147 | - } catch(PDOException $e) { |
|
146 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
147 | + } catch (PDOException $e) { |
|
148 | 148 | echo "error : ".$e->getMessage(); |
149 | 149 | } |
150 | 150 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | } |
153 | 153 | |
154 | 154 | |
155 | - public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
155 | + public function countAllAircraftTypes($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
156 | 156 | global $globalStatsFilters; |
157 | 157 | if ($filter_name == '') $filter_name = $this->filter_name; |
158 | 158 | if ($year == '' && $month == '') { |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | else $query = "SELECT aircraft_icao, cnt AS aircraft_icao_count, aircraft_name, aircraft_manufacturer FROM stats_aircraft WHERE aircraft_name <> '' AND aircraft_icao <> '' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_icao_count DESC"; |
161 | 161 | try { |
162 | 162 | $sth = $this->db->prepare($query); |
163 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
164 | - } catch(PDOException $e) { |
|
163 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
164 | + } catch (PDOException $e) { |
|
165 | 165 | echo "error : ".$e->getMessage(); |
166 | 166 | } |
167 | 167 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -169,14 +169,14 @@ discard block |
||
169 | 169 | if (empty($all)) { |
170 | 170 | $filters = array('airlines' => array($stats_airline)); |
171 | 171 | if ($filter_name != '') { |
172 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
172 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
173 | 173 | } |
174 | 174 | $Spotter = new Spotter($this->db); |
175 | - $all = $Spotter->countAllAircraftTypes($limit,0,'',$filters,$year,$month); |
|
175 | + $all = $Spotter->countAllAircraftTypes($limit, 0, '', $filters, $year, $month); |
|
176 | 176 | } |
177 | 177 | return $all; |
178 | 178 | } |
179 | - public function countAllAirlineCountries($limit = true,$filter_name = '',$year = '',$month = '') { |
|
179 | + public function countAllAirlineCountries($limit = true, $filter_name = '', $year = '', $month = '') { |
|
180 | 180 | global $globalStatsFilters; |
181 | 181 | if ($filter_name == '') $filter_name = $this->filter_name; |
182 | 182 | if ($year == '' && $month == '') { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | try { |
186 | 186 | $sth = $this->db->prepare($query); |
187 | 187 | $sth->execute(array(':filter_name' => $filter_name)); |
188 | - } catch(PDOException $e) { |
|
188 | + } catch (PDOException $e) { |
|
189 | 189 | echo "error : ".$e->getMessage(); |
190 | 190 | } |
191 | 191 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -194,13 +194,13 @@ discard block |
||
194 | 194 | $Spotter = new Spotter($this->db); |
195 | 195 | $filters = array(); |
196 | 196 | if ($filter_name != '') { |
197 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
197 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
198 | 198 | } |
199 | - $all = $Spotter->countAllAirlineCountries($limit,$filters,$year,$month); |
|
199 | + $all = $Spotter->countAllAirlineCountries($limit, $filters, $year, $month); |
|
200 | 200 | } |
201 | 201 | return $all; |
202 | 202 | } |
203 | - public function countAllAircraftManufacturers($limit = true,$stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
203 | + public function countAllAircraftManufacturers($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
204 | 204 | global $globalStatsFilters; |
205 | 205 | if ($filter_name == '') $filter_name = $this->filter_name; |
206 | 206 | if ($year == '' && $month == '') { |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | else $query = "SELECT aircraft_manufacturer, SUM(stats_aircraft.cnt) as aircraft_manufacturer_count FROM stats_aircraft WHERE stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY aircraft_manufacturer ORDER BY aircraft_manufacturer_count DESC"; |
209 | 209 | try { |
210 | 210 | $sth = $this->db->prepare($query); |
211 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
212 | - } catch(PDOException $e) { |
|
211 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
212 | + } catch (PDOException $e) { |
|
213 | 213 | echo "error : ".$e->getMessage(); |
214 | 214 | } |
215 | 215 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -217,15 +217,15 @@ discard block |
||
217 | 217 | if (empty($all)) { |
218 | 218 | $filters = array('airlines' => array($stats_airline)); |
219 | 219 | if ($filter_name != '') { |
220 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
220 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
221 | 221 | } |
222 | 222 | $Spotter = new Spotter($this->db); |
223 | - $all = $Spotter->countAllAircraftManufacturers($filters,$year,$month); |
|
223 | + $all = $Spotter->countAllAircraftManufacturers($filters, $year, $month); |
|
224 | 224 | } |
225 | 225 | return $all; |
226 | 226 | } |
227 | 227 | |
228 | - public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '',$year = '', $month = '') { |
|
228 | + public function countAllArrivalCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
229 | 229 | global $globalStatsFilters; |
230 | 230 | if ($filter_name == '') $filter_name = $this->filter_name; |
231 | 231 | if ($year == '' && $month == '') { |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | else $query = "SELECT airport_country AS airport_arrival_country, SUM(arrival) as airport_arrival_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_arrival_country ORDER BY airport_arrival_country_count DESC"; |
234 | 234 | try { |
235 | 235 | $sth = $this->db->prepare($query); |
236 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
237 | - } catch(PDOException $e) { |
|
236 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
237 | + } catch (PDOException $e) { |
|
238 | 238 | echo "error : ".$e->getMessage(); |
239 | 239 | } |
240 | 240 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | if (empty($all)) { |
243 | 243 | $filters = array('airlines' => array($stats_airline)); |
244 | 244 | if ($filter_name != '') { |
245 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
245 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
246 | 246 | } |
247 | 247 | $Spotter = new Spotter($this->db); |
248 | - $all = $Spotter->countAllArrivalCountries($limit,$filters,$year,$month); |
|
248 | + $all = $Spotter->countAllArrivalCountries($limit, $filters, $year, $month); |
|
249 | 249 | } |
250 | 250 | return $all; |
251 | 251 | } |
@@ -256,23 +256,23 @@ discard block |
||
256 | 256 | else $query = "SELECT airport_country AS airport_departure_country, SUM(departure) as airport_departure_country_count FROM stats_airport WHERE stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name GROUP BY airport_departure_country ORDER BY airport_departure_country_count DESC"; |
257 | 257 | try { |
258 | 258 | $sth = $this->db->prepare($query); |
259 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
260 | - } catch(PDOException $e) { |
|
259 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
260 | + } catch (PDOException $e) { |
|
261 | 261 | echo "error : ".$e->getMessage(); |
262 | 262 | } |
263 | 263 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
264 | 264 | if (empty($all)) { |
265 | 265 | $filters = array('airlines' => array($stats_airline)); |
266 | 266 | if ($filter_name != '') { |
267 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
267 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
268 | 268 | } |
269 | 269 | $Spotter = new Spotter($this->db); |
270 | - $all = $Spotter->countAllDepartureCountries($filters,$year,$month); |
|
270 | + $all = $Spotter->countAllDepartureCountries($filters, $year, $month); |
|
271 | 271 | } |
272 | 272 | return $all; |
273 | 273 | } |
274 | 274 | |
275 | - public function countAllAirlines($limit = true,$filter_name = '',$year = '',$month = '') { |
|
275 | + public function countAllAirlines($limit = true, $filter_name = '', $year = '', $month = '') { |
|
276 | 276 | global $globalStatsFilters; |
277 | 277 | if ($filter_name == '') $filter_name = $this->filter_name; |
278 | 278 | if ($year == '' && $month == '') { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | try { |
282 | 282 | $sth = $this->db->prepare($query); |
283 | 283 | $sth->execute(array(':filter_name' => $filter_name)); |
284 | - } catch(PDOException $e) { |
|
284 | + } catch (PDOException $e) { |
|
285 | 285 | echo "error : ".$e->getMessage(); |
286 | 286 | } |
287 | 287 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -290,14 +290,14 @@ discard block |
||
290 | 290 | $Spotter = new Spotter($this->db); |
291 | 291 | $filters = array(); |
292 | 292 | if ($filter_name != '') { |
293 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
293 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
294 | 294 | } |
295 | 295 | |
296 | - $all = $Spotter->countAllAirlines($limit,0,'',$filters,$year,$month); |
|
296 | + $all = $Spotter->countAllAirlines($limit, 0, '', $filters, $year, $month); |
|
297 | 297 | } |
298 | 298 | return $all; |
299 | 299 | } |
300 | - public function countAllAircraftRegistrations($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
300 | + public function countAllAircraftRegistrations($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
301 | 301 | global $globalStatsFilters; |
302 | 302 | if ($filter_name == '') $filter_name = $this->filter_name; |
303 | 303 | if ($year == '' && $month == '') { |
@@ -305,8 +305,8 @@ discard block |
||
305 | 305 | else $query = "SELECT s.aircraft_icao, s.cnt AS aircraft_registration_count, a.type AS aircraft_name FROM stats_registration s, aircraft a WHERE s.registration <> '' AND a.icao = s.aircraft_icao AND s.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY aircraft_registration_count DESC"; |
306 | 306 | try { |
307 | 307 | $sth = $this->db->prepare($query); |
308 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
309 | - } catch(PDOException $e) { |
|
308 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
309 | + } catch (PDOException $e) { |
|
310 | 310 | echo "error : ".$e->getMessage(); |
311 | 311 | } |
312 | 312 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -314,14 +314,14 @@ discard block |
||
314 | 314 | if (empty($all)) { |
315 | 315 | $filters = array('airlines' => array($stats_airline)); |
316 | 316 | if ($filter_name != '') { |
317 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
317 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
318 | 318 | } |
319 | 319 | $Spotter = new Spotter($this->db); |
320 | - $all = $Spotter->countAllAircraftRegistrations($limit,0,'',$filters,$year,$month); |
|
320 | + $all = $Spotter->countAllAircraftRegistrations($limit, 0, '', $filters, $year, $month); |
|
321 | 321 | } |
322 | 322 | return $all; |
323 | 323 | } |
324 | - public function countAllCallsigns($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
324 | + public function countAllCallsigns($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
325 | 325 | global $globalStatsFilters; |
326 | 326 | if ($filter_name == '') $filter_name = $this->filter_name; |
327 | 327 | if ($year == '' && $month == '') { |
@@ -329,8 +329,8 @@ discard block |
||
329 | 329 | else $query = "SELECT s.callsign_icao, s.cnt AS callsign_icao_count, a.name AS airline_name, a.icao as airline_icao FROM stats_callsign s, airlines a WHERE s.callsign_icao <> '' AND a.icao = s.airline_icao AND s.airline_icao = :stats_airline AND filter_name = :filter_name ORDER BY callsign_icao_count DESC"; |
330 | 330 | try { |
331 | 331 | $sth = $this->db->prepare($query); |
332 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
333 | - } catch(PDOException $e) { |
|
332 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
333 | + } catch (PDOException $e) { |
|
334 | 334 | echo "error : ".$e->getMessage(); |
335 | 335 | } |
336 | 336 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -338,14 +338,14 @@ discard block |
||
338 | 338 | if (empty($all)) { |
339 | 339 | $filters = array('airlines' => array($stats_airline)); |
340 | 340 | if ($filter_name != '') { |
341 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
341 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
342 | 342 | } |
343 | 343 | $Spotter = new Spotter($this->db); |
344 | - $all = $Spotter->countAllCallsigns($limit,0,'',$filters,$year,$month); |
|
344 | + $all = $Spotter->countAllCallsigns($limit, 0, '', $filters, $year, $month); |
|
345 | 345 | } |
346 | 346 | return $all; |
347 | 347 | } |
348 | - public function countAllFlightOverCountries($limit = true, $stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
348 | + public function countAllFlightOverCountries($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
349 | 349 | $Connection = new Connection(); |
350 | 350 | if ($filter_name == '') $filter_name = $this->filter_name; |
351 | 351 | if ($Connection->tableExists('countries')) { |
@@ -354,8 +354,8 @@ discard block |
||
354 | 354 | else $query = "SELECT countries.iso3 as flight_country_iso3, countries.iso2 as flight_country_iso2, countries.name as flight_country, cnt as flight_count, lat as flight_country_latitude, lon as flight_country_longitude FROM stats_country, countries WHERE stats_country.iso2 = countries.iso2 AND stats_country.stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY flight_count DESC"; |
355 | 355 | try { |
356 | 356 | $sth = $this->db->prepare($query); |
357 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
358 | - } catch(PDOException $e) { |
|
357 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
358 | + } catch (PDOException $e) { |
|
359 | 359 | echo "error : ".$e->getMessage(); |
360 | 360 | } |
361 | 361 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -371,7 +371,7 @@ discard block |
||
371 | 371 | return array(); |
372 | 372 | } |
373 | 373 | } |
374 | - public function countAllPilots($limit = true,$stats_airline = '',$filter_name = '', $year = '',$month = '') { |
|
374 | + public function countAllPilots($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
375 | 375 | global $globalStatsFilters; |
376 | 376 | if ($filter_name == '') $filter_name = $this->filter_name; |
377 | 377 | if ($year == '' && $month == '') { |
@@ -379,8 +379,8 @@ discard block |
||
379 | 379 | else $query = "SELECT pilot_id, cnt AS pilot_count, pilot_name, format_source FROM stats_pilot WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY pilot_count DESC"; |
380 | 380 | try { |
381 | 381 | $sth = $this->db->prepare($query); |
382 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
383 | - } catch(PDOException $e) { |
|
382 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
383 | + } catch (PDOException $e) { |
|
384 | 384 | echo "error : ".$e->getMessage(); |
385 | 385 | } |
386 | 386 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -388,15 +388,15 @@ discard block |
||
388 | 388 | if (empty($all)) { |
389 | 389 | $filters = array('airlines' => array($stats_airline)); |
390 | 390 | if ($filter_name != '') { |
391 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
391 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
392 | 392 | } |
393 | 393 | $Spotter = new Spotter($this->db); |
394 | - $all = $Spotter->countAllPilots($limit,0,'',$filters,$year,$month); |
|
394 | + $all = $Spotter->countAllPilots($limit, 0, '', $filters, $year, $month); |
|
395 | 395 | } |
396 | 396 | return $all; |
397 | 397 | } |
398 | 398 | |
399 | - public function countAllOwners($limit = true,$stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
399 | + public function countAllOwners($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
400 | 400 | global $globalStatsFilters; |
401 | 401 | if ($filter_name == '') $filter_name = $this->filter_name; |
402 | 402 | if ($year == '' && $month == '') { |
@@ -404,8 +404,8 @@ discard block |
||
404 | 404 | else $query = "SELECT owner_name, cnt AS owner_count FROM stats_owner WHERE stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY owner_count DESC"; |
405 | 405 | try { |
406 | 406 | $sth = $this->db->prepare($query); |
407 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
408 | - } catch(PDOException $e) { |
|
407 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | echo "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -413,14 +413,14 @@ discard block |
||
413 | 413 | if (empty($all)) { |
414 | 414 | $filters = array('airlines' => array($stats_airline)); |
415 | 415 | if ($filter_name != '') { |
416 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
416 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
417 | 417 | } |
418 | 418 | $Spotter = new Spotter($this->db); |
419 | - $all = $Spotter->countAllOwners($limit,0,'',$filters,$year,$month); |
|
419 | + $all = $Spotter->countAllOwners($limit, 0, '', $filters, $year, $month); |
|
420 | 420 | } |
421 | 421 | return $all; |
422 | 422 | } |
423 | - public function countAllDepartureAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
423 | + public function countAllDepartureAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
424 | 424 | global $globalStatsFilters; |
425 | 425 | if ($filter_name == '') $filter_name = $this->filter_name; |
426 | 426 | if ($year == '' && $month == '') { |
@@ -428,8 +428,8 @@ discard block |
||
428 | 428 | else $query = "SELECT DISTINCT airport_icao AS airport_departure_icao,airport_city AS airport_departure_city,airport_country AS airport_departure_country,departure AS airport_departure_icao_count FROM stats_airport WHERE departure > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_departure_icao_count DESC"; |
429 | 429 | try { |
430 | 430 | $sth = $this->db->prepare($query); |
431 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
432 | - } catch(PDOException $e) { |
|
431 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
432 | + } catch (PDOException $e) { |
|
433 | 433 | echo "error : ".$e->getMessage(); |
434 | 434 | } |
435 | 435 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -437,11 +437,11 @@ discard block |
||
437 | 437 | if (empty($all)) { |
438 | 438 | $filters = array('airlines' => array($stats_airline)); |
439 | 439 | if ($filter_name != '') { |
440 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
440 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
441 | 441 | } |
442 | 442 | $Spotter = new Spotter($this->db); |
443 | - $pall = $Spotter->countAllDepartureAirports($limit,0,'',$filters,$year,$month); |
|
444 | - $dall = $Spotter->countAllDetectedDepartureAirports($limit,0,'',$filters,$year,$month); |
|
443 | + $pall = $Spotter->countAllDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
444 | + $dall = $Spotter->countAllDetectedDepartureAirports($limit, 0, '', $filters, $year, $month); |
|
445 | 445 | $all = array(); |
446 | 446 | foreach ($pall as $value) { |
447 | 447 | $icao = $value['airport_departure_icao']; |
@@ -458,11 +458,11 @@ discard block |
||
458 | 458 | foreach ($all as $key => $row) { |
459 | 459 | $count[$key] = $row['airport_departure_icao_count']; |
460 | 460 | } |
461 | - array_multisort($count,SORT_DESC,$all); |
|
461 | + array_multisort($count, SORT_DESC, $all); |
|
462 | 462 | } |
463 | 463 | return $all; |
464 | 464 | } |
465 | - public function countAllArrivalAirports($limit = true,$stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
465 | + public function countAllArrivalAirports($limit = true, $stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
466 | 466 | global $globalStatsFilters; |
467 | 467 | if ($filter_name == '') $filter_name = $this->filter_name; |
468 | 468 | if ($year == '' && $month == '') { |
@@ -470,8 +470,8 @@ discard block |
||
470 | 470 | else $query = "SELECT DISTINCT airport_icao AS airport_arrival_icao,airport_city AS airport_arrival_city,airport_country AS airport_arrival_country,arrival AS airport_arrival_icao_count FROM stats_airport WHERE arrival > 0 AND stats_type = 'yearly' AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY airport_arrival_icao_count DESC"; |
471 | 471 | try { |
472 | 472 | $sth = $this->db->prepare($query); |
473 | - $sth->execute(array(':stats_airline' => $stats_airline,':filter_name' => $filter_name)); |
|
474 | - } catch(PDOException $e) { |
|
473 | + $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
|
474 | + } catch (PDOException $e) { |
|
475 | 475 | echo "error : ".$e->getMessage(); |
476 | 476 | } |
477 | 477 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -479,11 +479,11 @@ discard block |
||
479 | 479 | if (empty($all)) { |
480 | 480 | $filters = array('airlines' => array($stats_airline)); |
481 | 481 | if ($filter_name != '') { |
482 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
482 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
483 | 483 | } |
484 | 484 | $Spotter = new Spotter($this->db); |
485 | - $pall = $Spotter->countAllArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
486 | - $dall = $Spotter->countAllDetectedArrivalAirports($limit,0,'',false,$filters,$year,$month); |
|
485 | + $pall = $Spotter->countAllArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
486 | + $dall = $Spotter->countAllDetectedArrivalAirports($limit, 0, '', false, $filters, $year, $month); |
|
487 | 487 | $all = array(); |
488 | 488 | foreach ($pall as $value) { |
489 | 489 | $icao = $value['airport_arrival_icao']; |
@@ -500,12 +500,12 @@ discard block |
||
500 | 500 | foreach ($all as $key => $row) { |
501 | 501 | $count[$key] = $row['airport_arrival_icao_count']; |
502 | 502 | } |
503 | - array_multisort($count,SORT_DESC,$all); |
|
503 | + array_multisort($count, SORT_DESC, $all); |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | return $all; |
507 | 507 | } |
508 | - public function countAllMonthsLastYear($limit = true,$stats_airline = '',$filter_name = '') { |
|
508 | + public function countAllMonthsLastYear($limit = true, $stats_airline = '', $filter_name = '') { |
|
509 | 509 | global $globalDBdriver, $globalStatsFilters; |
510 | 510 | if ($filter_name == '') $filter_name = $this->filter_name; |
511 | 511 | if ($globalDBdriver == 'mysql') { |
@@ -515,18 +515,18 @@ discard block |
||
515 | 515 | if ($limit) $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_date >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '12 MONTHS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
516 | 516 | else $query = "SELECT EXTRACT(MONTH FROM stats_date) as month_name, EXTRACT(YEAR FROM stats_date) as year_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
517 | 517 | } |
518 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
518 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
519 | 519 | try { |
520 | 520 | $sth = $this->db->prepare($query); |
521 | 521 | $sth->execute($query_data); |
522 | - } catch(PDOException $e) { |
|
522 | + } catch (PDOException $e) { |
|
523 | 523 | echo "error : ".$e->getMessage(); |
524 | 524 | } |
525 | 525 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
526 | 526 | if (empty($all)) { |
527 | 527 | $filters = array('airlines' => array($stats_airline)); |
528 | 528 | if ($filter_name != '') { |
529 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
529 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
530 | 530 | } |
531 | 531 | $Spotter = new Spotter($this->db); |
532 | 532 | $all = $Spotter->countAllMonthsLastYear($filters); |
@@ -535,29 +535,29 @@ discard block |
||
535 | 535 | return $all; |
536 | 536 | } |
537 | 537 | |
538 | - public function countAllDatesLastMonth($stats_airline = '',$filter_name = '') { |
|
538 | + public function countAllDatesLastMonth($stats_airline = '', $filter_name = '') { |
|
539 | 539 | global $globalStatsFilters; |
540 | 540 | if ($filter_name == '') $filter_name = $this->filter_name; |
541 | 541 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
542 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
542 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
543 | 543 | try { |
544 | 544 | $sth = $this->db->prepare($query); |
545 | 545 | $sth->execute($query_data); |
546 | - } catch(PDOException $e) { |
|
546 | + } catch (PDOException $e) { |
|
547 | 547 | echo "error : ".$e->getMessage(); |
548 | 548 | } |
549 | 549 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
550 | 550 | if (empty($all)) { |
551 | 551 | $filters = array('airlines' => array($stats_airline)); |
552 | 552 | if ($filter_name != '') { |
553 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
553 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
554 | 554 | } |
555 | 555 | $Spotter = new Spotter($this->db); |
556 | 556 | $all = $Spotter->countAllDatesLastMonth($filters); |
557 | 557 | } |
558 | 558 | return $all; |
559 | 559 | } |
560 | - public function countAllDatesLast7Days($stats_airline = '',$filter_name = '') { |
|
560 | + public function countAllDatesLast7Days($stats_airline = '', $filter_name = '') { |
|
561 | 561 | global $globalDBdriver, $globalStatsFilters; |
562 | 562 | if ($filter_name == '') $filter_name = $this->filter_name; |
563 | 563 | if ($globalDBdriver == 'mysql') { |
@@ -565,40 +565,40 @@ discard block |
||
565 | 565 | } else { |
566 | 566 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'month' AND flight_date::timestamp >= CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '7 DAYS' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
567 | 567 | } |
568 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
568 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
569 | 569 | try { |
570 | 570 | $sth = $this->db->prepare($query); |
571 | 571 | $sth->execute($query_data); |
572 | - } catch(PDOException $e) { |
|
572 | + } catch (PDOException $e) { |
|
573 | 573 | echo "error : ".$e->getMessage(); |
574 | 574 | } |
575 | 575 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
576 | 576 | if (empty($all)) { |
577 | 577 | $filters = array('airlines' => array($stats_airline)); |
578 | 578 | if ($filter_name != '') { |
579 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
579 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
580 | 580 | } |
581 | 581 | $Spotter = new Spotter($this->db); |
582 | 582 | $all = $Spotter->countAllDatesLast7Days($filters); |
583 | 583 | } |
584 | 584 | return $all; |
585 | 585 | } |
586 | - public function countAllDates($stats_airline = '',$filter_name = '') { |
|
586 | + public function countAllDates($stats_airline = '', $filter_name = '') { |
|
587 | 587 | global $globalStatsFilters; |
588 | 588 | if ($filter_name == '') $filter_name = $this->filter_name; |
589 | 589 | $query = "SELECT flight_date as date_name, cnt as date_count FROM stats_flight WHERE stats_type = 'date' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
590 | - $query_data = array(':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
590 | + $query_data = array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
591 | 591 | try { |
592 | 592 | $sth = $this->db->prepare($query); |
593 | 593 | $sth->execute($query_data); |
594 | - } catch(PDOException $e) { |
|
594 | + } catch (PDOException $e) { |
|
595 | 595 | echo "error : ".$e->getMessage(); |
596 | 596 | } |
597 | 597 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
598 | 598 | if (empty($all)) { |
599 | 599 | $filters = array('airlines' => array($stats_airline)); |
600 | 600 | if ($filter_name != '') { |
601 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
601 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
602 | 602 | } |
603 | 603 | $Spotter = new Spotter($this->db); |
604 | 604 | $all = $Spotter->countAllDates($filters); |
@@ -613,35 +613,35 @@ discard block |
||
613 | 613 | try { |
614 | 614 | $sth = $this->db->prepare($query); |
615 | 615 | $sth->execute($query_data); |
616 | - } catch(PDOException $e) { |
|
616 | + } catch (PDOException $e) { |
|
617 | 617 | echo "error : ".$e->getMessage(); |
618 | 618 | } |
619 | 619 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
620 | 620 | if (empty($all)) { |
621 | 621 | $filters = array(); |
622 | 622 | if ($filter_name != '') { |
623 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
623 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
624 | 624 | } |
625 | 625 | $Spotter = new Spotter($this->db); |
626 | 626 | $all = $Spotter->countAllDatesByAirlines($filters); |
627 | 627 | } |
628 | 628 | return $all; |
629 | 629 | } |
630 | - public function countAllMonths($stats_airline = '',$filter_name = '') { |
|
630 | + public function countAllMonths($stats_airline = '', $filter_name = '') { |
|
631 | 631 | global $globalStatsFilters; |
632 | 632 | if ($filter_name == '') $filter_name = $this->filter_name; |
633 | 633 | $query = "SELECT YEAR(stats_date) AS year_name,MONTH(stats_date) AS month_name, cnt as date_count FROM stats WHERE stats_type = 'flights_bymonth' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
634 | 634 | try { |
635 | 635 | $sth = $this->db->prepare($query); |
636 | 636 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
637 | - } catch(PDOException $e) { |
|
637 | + } catch (PDOException $e) { |
|
638 | 638 | echo "error : ".$e->getMessage(); |
639 | 639 | } |
640 | 640 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
641 | 641 | if (empty($all)) { |
642 | 642 | $filters = array('airlines' => array($stats_airline)); |
643 | 643 | if ($filter_name != '') { |
644 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
644 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
645 | 645 | } |
646 | 646 | $Spotter = new Spotter($this->db); |
647 | 647 | $all = $Spotter->countAllMonths($filters); |
@@ -655,21 +655,21 @@ discard block |
||
655 | 655 | try { |
656 | 656 | $sth = $this->db->prepare($query); |
657 | 657 | $sth->execute(array(':filter_name' => $filter_name)); |
658 | - } catch(PDOException $e) { |
|
658 | + } catch (PDOException $e) { |
|
659 | 659 | echo "error : ".$e->getMessage(); |
660 | 660 | } |
661 | 661 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
662 | 662 | if (empty($all)) { |
663 | 663 | $filters = array(); |
664 | 664 | if ($filter_name != '') { |
665 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
665 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
666 | 666 | } |
667 | 667 | $Spotter = new Spotter($this->db); |
668 | 668 | $all = $Spotter->countAllMilitaryMonths($filters); |
669 | 669 | } |
670 | 670 | return $all; |
671 | 671 | } |
672 | - public function countAllHours($orderby = 'hour',$limit = true,$stats_airline = '',$filter_name = '') { |
|
672 | + public function countAllHours($orderby = 'hour', $limit = true, $stats_airline = '', $filter_name = '') { |
|
673 | 673 | global $globalTimezone, $globalDBdriver, $globalStatsFilters; |
674 | 674 | if ($filter_name == '') $filter_name = $this->filter_name; |
675 | 675 | if ($limit) $query = "SELECT flight_date as hour_name, cnt as hour_count FROM stats_flight WHERE stats_type = 'hour' AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -686,82 +686,82 @@ discard block |
||
686 | 686 | try { |
687 | 687 | $sth = $this->db->prepare($query); |
688 | 688 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
689 | - } catch(PDOException $e) { |
|
689 | + } catch (PDOException $e) { |
|
690 | 690 | echo "error : ".$e->getMessage(); |
691 | 691 | } |
692 | 692 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
693 | 693 | if (empty($all)) { |
694 | 694 | $filters = array('airlines' => array($stats_airline)); |
695 | 695 | if ($filter_name != '') { |
696 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
696 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
697 | 697 | } |
698 | 698 | $Spotter = new Spotter($this->db); |
699 | - $all = $Spotter->countAllHours($orderby,$filters); |
|
699 | + $all = $Spotter->countAllHours($orderby, $filters); |
|
700 | 700 | } |
701 | 701 | return $all; |
702 | 702 | } |
703 | 703 | |
704 | - public function countOverallFlights($stats_airline = '', $filter_name = '',$year = '',$month = '') { |
|
704 | + public function countOverallFlights($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
705 | 705 | global $globalStatsFilters; |
706 | 706 | if ($filter_name == '') $filter_name = $this->filter_name; |
707 | 707 | if ($year == '') $year = date('Y'); |
708 | - $all = $this->getSumStats('flights_bymonth',$year,$stats_airline,$filter_name,$month); |
|
708 | + $all = $this->getSumStats('flights_bymonth', $year, $stats_airline, $filter_name, $month); |
|
709 | 709 | if (empty($all)) { |
710 | 710 | $filters = array('airlines' => array($stats_airline)); |
711 | 711 | if ($filter_name != '') { |
712 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
712 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
713 | 713 | } |
714 | 714 | $Spotter = new Spotter($this->db); |
715 | - $all = $Spotter->countOverallFlights($filters,$year,$month); |
|
715 | + $all = $Spotter->countOverallFlights($filters, $year, $month); |
|
716 | 716 | } |
717 | 717 | return $all; |
718 | 718 | } |
719 | - public function countOverallMilitaryFlights($filter_name = '',$year = '', $month = '') { |
|
719 | + public function countOverallMilitaryFlights($filter_name = '', $year = '', $month = '') { |
|
720 | 720 | global $globalStatsFilters; |
721 | 721 | if ($filter_name == '') $filter_name = $this->filter_name; |
722 | 722 | if ($year == '') $year = date('Y'); |
723 | - $all = $this->getSumStats('military_flights_bymonth',$year,'',$filter_name,$month); |
|
723 | + $all = $this->getSumStats('military_flights_bymonth', $year, '', $filter_name, $month); |
|
724 | 724 | if (empty($all)) { |
725 | 725 | $filters = array(); |
726 | 726 | if ($filter_name != '') { |
727 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
727 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
728 | 728 | } |
729 | 729 | $Spotter = new Spotter($this->db); |
730 | - $all = $Spotter->countOverallMilitaryFlights($filters,$year,$month); |
|
730 | + $all = $Spotter->countOverallMilitaryFlights($filters, $year, $month); |
|
731 | 731 | } |
732 | 732 | return $all; |
733 | 733 | } |
734 | - public function countOverallArrival($stats_airline = '',$filter_name = '', $year = '', $month = '') { |
|
734 | + public function countOverallArrival($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
735 | 735 | global $globalStatsFilters; |
736 | 736 | if ($filter_name == '') $filter_name = $this->filter_name; |
737 | 737 | if ($year == '') $year = date('Y'); |
738 | - $all = $this->getSumStats('realarrivals_bymonth',$year,$stats_airline,$filter_name,$month); |
|
738 | + $all = $this->getSumStats('realarrivals_bymonth', $year, $stats_airline, $filter_name, $month); |
|
739 | 739 | if (empty($all)) { |
740 | 740 | $filters = array('airlines' => array($stats_airline)); |
741 | 741 | if ($filter_name != '') { |
742 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
742 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
743 | 743 | } |
744 | 744 | $Spotter = new Spotter($this->db); |
745 | - $all = $Spotter->countOverallArrival($filters,$year,$month); |
|
745 | + $all = $Spotter->countOverallArrival($filters, $year, $month); |
|
746 | 746 | } |
747 | 747 | return $all; |
748 | 748 | } |
749 | - public function countOverallAircrafts($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
749 | + public function countOverallAircrafts($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
750 | 750 | global $globalStatsFilters; |
751 | 751 | if ($filter_name == '') $filter_name = $this->filter_name; |
752 | 752 | if ($year == '') $year = date('Y'); |
753 | - $all = $this->getSumStats('aircrafts_bymonth',$year,$stats_airline,$filter_name,$month); |
|
753 | + $all = $this->getSumStats('aircrafts_bymonth', $year, $stats_airline, $filter_name, $month); |
|
754 | 754 | if (empty($all)) { |
755 | 755 | $filters = array('airlines' => array($stats_airline)); |
756 | 756 | if ($filter_name != '') { |
757 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
757 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
758 | 758 | } |
759 | 759 | $Spotter = new Spotter($this->db); |
760 | - $all = $Spotter->countOverallAircrafts($filters,$year,$month); |
|
760 | + $all = $Spotter->countOverallAircrafts($filters, $year, $month); |
|
761 | 761 | } |
762 | 762 | return $all; |
763 | 763 | } |
764 | - public function countOverallAirlines($filter_name = '',$year = '',$month = '') { |
|
764 | + public function countOverallAirlines($filter_name = '', $year = '', $month = '') { |
|
765 | 765 | global $globalStatsFilters; |
766 | 766 | if ($filter_name == '') $filter_name = $this->filter_name; |
767 | 767 | if ($year == '' && $month == '') { |
@@ -769,23 +769,23 @@ discard block |
||
769 | 769 | try { |
770 | 770 | $sth = $this->db->prepare($query); |
771 | 771 | $sth->execute(array(':filter_name' => $filter_name)); |
772 | - } catch(PDOException $e) { |
|
772 | + } catch (PDOException $e) { |
|
773 | 773 | echo "error : ".$e->getMessage(); |
774 | 774 | } |
775 | 775 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
776 | 776 | $all = $result[0]['nb_airline']; |
777 | - } else $all = $this->getSumStats('airlines_bymonth',$year,'',$filter_name,$month); |
|
777 | + } else $all = $this->getSumStats('airlines_bymonth', $year, '', $filter_name, $month); |
|
778 | 778 | if (empty($all)) { |
779 | 779 | $filters = array(); |
780 | 780 | if ($filter_name != '') { |
781 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
781 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
782 | 782 | } |
783 | 783 | $Spotter = new Spotter($this->db); |
784 | - $all = $Spotter->countOverallAirlines($filters,$year,$month); |
|
784 | + $all = $Spotter->countOverallAirlines($filters, $year, $month); |
|
785 | 785 | } |
786 | 786 | return $all; |
787 | 787 | } |
788 | - public function countOverallOwners($stats_airline = '',$filter_name = '',$year = '', $month = '') { |
|
788 | + public function countOverallOwners($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
789 | 789 | global $globalStatsFilters; |
790 | 790 | if ($filter_name == '') $filter_name = $this->filter_name; |
791 | 791 | if ($year == '') $year = date('Y'); |
@@ -800,83 +800,83 @@ discard block |
||
800 | 800 | $result = $sth->fetchAll(PDO::FETCH_ASSOC); |
801 | 801 | $all = $result[0]['nb_owner']; |
802 | 802 | */ |
803 | - $all = $this->getSumStats('owners_bymonth',$year,$stats_airline,$filter_name,$month); |
|
803 | + $all = $this->getSumStats('owners_bymonth', $year, $stats_airline, $filter_name, $month); |
|
804 | 804 | if (empty($all)) { |
805 | 805 | $filters = array('airlines' => array($stats_airline)); |
806 | 806 | if ($filter_name != '') { |
807 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
807 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
808 | 808 | } |
809 | 809 | $Spotter = new Spotter($this->db); |
810 | - $all = $Spotter->countOverallOwners($filters,$year,$month); |
|
810 | + $all = $Spotter->countOverallOwners($filters, $year, $month); |
|
811 | 811 | } |
812 | 812 | return $all; |
813 | 813 | } |
814 | - public function countOverallPilots($stats_airline = '',$filter_name = '',$year = '',$month = '') { |
|
814 | + public function countOverallPilots($stats_airline = '', $filter_name = '', $year = '', $month = '') { |
|
815 | 815 | global $globalStatsFilters; |
816 | 816 | if ($filter_name == '') $filter_name = $this->filter_name; |
817 | 817 | if ($year == '') $year = date('Y'); |
818 | - $all = $this->getSumStats('pilots_bymonth',$year,$stats_airline,$filter_name,$month); |
|
818 | + $all = $this->getSumStats('pilots_bymonth', $year, $stats_airline, $filter_name, $month); |
|
819 | 819 | if (empty($all)) { |
820 | 820 | $filters = array('airlines' => array($stats_airline)); |
821 | 821 | if ($filter_name != '') { |
822 | - $filters = array_merge($filters,$globalStatsFilters[$filter_name]); |
|
822 | + $filters = array_merge($filters, $globalStatsFilters[$filter_name]); |
|
823 | 823 | } |
824 | 824 | $Spotter = new Spotter($this->db); |
825 | - $all = $Spotter->countOverallPilots($filters,$year,$month); |
|
825 | + $all = $Spotter->countOverallPilots($filters, $year, $month); |
|
826 | 826 | } |
827 | 827 | return $all; |
828 | 828 | } |
829 | 829 | |
830 | - public function getLast7DaysAirports($airport_icao = '', $stats_airline = '',$filter_name = '') { |
|
830 | + public function getLast7DaysAirports($airport_icao = '', $stats_airline = '', $filter_name = '') { |
|
831 | 831 | if ($filter_name == '') $filter_name = $this->filter_name; |
832 | 832 | $query = "SELECT * FROM stats_airport WHERE stats_type = 'daily' AND airport_icao = :airport_icao AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY date"; |
833 | - $query_values = array(':airport_icao' => $airport_icao,':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
833 | + $query_values = array(':airport_icao' => $airport_icao, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
834 | 834 | try { |
835 | 835 | $sth = $this->db->prepare($query); |
836 | 836 | $sth->execute($query_values); |
837 | - } catch(PDOException $e) { |
|
837 | + } catch (PDOException $e) { |
|
838 | 838 | echo "error : ".$e->getMessage(); |
839 | 839 | } |
840 | 840 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
841 | 841 | return $all; |
842 | 842 | } |
843 | - public function getStats($type,$stats_airline = '', $filter_name = '') { |
|
843 | + public function getStats($type, $stats_airline = '', $filter_name = '') { |
|
844 | 844 | if ($filter_name == '') $filter_name = $this->filter_name; |
845 | 845 | $query = "SELECT * FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name ORDER BY stats_date"; |
846 | - $query_values = array(':type' => $type,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
846 | + $query_values = array(':type' => $type, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
847 | 847 | try { |
848 | 848 | $sth = $this->db->prepare($query); |
849 | 849 | $sth->execute($query_values); |
850 | - } catch(PDOException $e) { |
|
850 | + } catch (PDOException $e) { |
|
851 | 851 | echo "error : ".$e->getMessage(); |
852 | 852 | } |
853 | 853 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
854 | 854 | return $all; |
855 | 855 | } |
856 | - public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
|
856 | + public function getSumStats($type, $year, $stats_airline = '', $filter_name = '', $month = '') { |
|
857 | 857 | if ($filter_name == '') $filter_name = $this->filter_name; |
858 | 858 | global $globalArchiveMonths, $globalDBdriver; |
859 | 859 | if ($globalDBdriver == 'mysql') { |
860 | 860 | if ($month == '') { |
861 | 861 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
862 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
862 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
863 | 863 | } else { |
864 | 864 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND YEAR(stats_date) = :year AND MONTH(stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
865 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
865 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
866 | 866 | } |
867 | 867 | } else { |
868 | 868 | if ($month == '') { |
869 | 869 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
870 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
870 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
871 | 871 | } else { |
872 | 872 | $query = "SELECT SUM(cnt) as total FROM stats WHERE stats_type = :type AND EXTRACT(YEAR FROM stats_date) = :year AND EXTRACT(MONTH FROM stats_date) = :month AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
873 | - $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline,':filter_name' => $filter_name,':month' => $month); |
|
873 | + $query_values = array(':type' => $type, ':year' => $year, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':month' => $month); |
|
874 | 874 | } |
875 | 875 | } |
876 | 876 | try { |
877 | 877 | $sth = $this->db->prepare($query); |
878 | 878 | $sth->execute($query_values); |
879 | - } catch(PDOException $e) { |
|
879 | + } catch (PDOException $e) { |
|
880 | 880 | echo "error : ".$e->getMessage(); |
881 | 881 | } |
882 | 882 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | try { |
895 | 895 | $sth = $this->db->prepare($query); |
896 | 896 | $sth->execute($query_values); |
897 | - } catch(PDOException $e) { |
|
897 | + } catch (PDOException $e) { |
|
898 | 898 | echo "error : ".$e->getMessage(); |
899 | 899 | } |
900 | 900 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | try { |
912 | 912 | $sth = $this->db->prepare($query); |
913 | 913 | $sth->execute(array(':stats_airline' => $stats_airline, ':filter_name' => $filter_name)); |
914 | - } catch(PDOException $e) { |
|
914 | + } catch (PDOException $e) { |
|
915 | 915 | echo "error : ".$e->getMessage(); |
916 | 916 | } |
917 | 917 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | try { |
929 | 929 | $sth = $this->db->prepare($query); |
930 | 930 | $sth->execute(array(':filter_name' => $filter_name)); |
931 | - } catch(PDOException $e) { |
|
931 | + } catch (PDOException $e) { |
|
932 | 932 | echo "error : ".$e->getMessage(); |
933 | 933 | } |
934 | 934 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | try { |
946 | 946 | $sth = $this->db->prepare($query); |
947 | 947 | $sth->execute(array(':filter_name' => $filter_name)); |
948 | - } catch(PDOException $e) { |
|
948 | + } catch (PDOException $e) { |
|
949 | 949 | echo "error : ".$e->getMessage(); |
950 | 950 | } |
951 | 951 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -962,14 +962,14 @@ discard block |
||
962 | 962 | try { |
963 | 963 | $sth = $this->db->prepare($query); |
964 | 964 | $sth->execute(array(':filter_name' => $filter_name)); |
965 | - } catch(PDOException $e) { |
|
965 | + } catch (PDOException $e) { |
|
966 | 966 | echo "error : ".$e->getMessage(); |
967 | 967 | } |
968 | 968 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
969 | 969 | return $all[0]['total']; |
970 | 970 | } |
971 | 971 | |
972 | - public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
972 | + public function addStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
973 | 973 | global $globalDBdriver; |
974 | 974 | if ($filter_name == '') $filter_name = $this->filter_name; |
975 | 975 | if ($globalDBdriver == 'mysql') { |
@@ -977,15 +977,15 @@ discard block |
||
977 | 977 | } else { |
978 | 978 | $query = "UPDATE stats SET cnt = :cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
979 | 979 | } |
980 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
980 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
981 | 981 | try { |
982 | 982 | $sth = $this->db->prepare($query); |
983 | 983 | $sth->execute($query_values); |
984 | - } catch(PDOException $e) { |
|
984 | + } catch (PDOException $e) { |
|
985 | 985 | return "error : ".$e->getMessage(); |
986 | 986 | } |
987 | 987 | } |
988 | - public function updateStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
|
988 | + public function updateStat($type, $cnt, $stats_date, $stats_airline = '', $filter_name = '') { |
|
989 | 989 | global $globalDBdriver; |
990 | 990 | if ($filter_name == '') $filter_name = $this->filter_name; |
991 | 991 | if ($globalDBdriver == 'mysql') { |
@@ -994,11 +994,11 @@ discard block |
||
994 | 994 | //$query = "INSERT INTO stats (stats_type,cnt,stats_date) VALUES (:type,:cnt,:stats_date) ON DUPLICATE KEY UPDATE cnt = cnt+:cnt, stats_date = :date"; |
995 | 995 | $query = "UPDATE stats SET cnt = cnt+:cnt WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats (stats_type,cnt,stats_date,stats_airline,filter_name) SELECT :type,:cnt,:stats_date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats WHERE stats_type = :type AND stats_date = :stats_date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
996 | 996 | } |
997 | - $query_values = array(':type' => $type,':cnt' => $cnt,':stats_date' => $stats_date,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
997 | + $query_values = array(':type' => $type, ':cnt' => $cnt, ':stats_date' => $stats_date, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
998 | 998 | try { |
999 | 999 | $sth = $this->db->prepare($query); |
1000 | 1000 | $sth->execute($query_values); |
1001 | - } catch(PDOException $e) { |
|
1001 | + } catch (PDOException $e) { |
|
1002 | 1002 | return "error : ".$e->getMessage(); |
1003 | 1003 | } |
1004 | 1004 | } |
@@ -1022,75 +1022,75 @@ discard block |
||
1022 | 1022 | } |
1023 | 1023 | */ |
1024 | 1024 | |
1025 | - public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
|
1025 | + public function getStatsSource($stats_type, $year = '', $month = '', $day = '') { |
|
1026 | 1026 | global $globalDBdriver; |
1027 | 1027 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
1028 | 1028 | $query_values = array(); |
1029 | 1029 | if ($globalDBdriver == 'mysql') { |
1030 | 1030 | if ($year != '') { |
1031 | 1031 | $query .= ' AND YEAR(stats_date) = :year'; |
1032 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1032 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1033 | 1033 | } |
1034 | 1034 | if ($month != '') { |
1035 | 1035 | $query .= ' AND MONTH(stats_date) = :month'; |
1036 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1036 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1037 | 1037 | } |
1038 | 1038 | if ($day != '') { |
1039 | 1039 | $query .= ' AND DAY(stats_date) = :day'; |
1040 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1040 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1041 | 1041 | } |
1042 | 1042 | } else { |
1043 | 1043 | if ($year != '') { |
1044 | 1044 | $query .= ' AND EXTRACT(YEAR FROM stats_date) = :year'; |
1045 | - $query_values = array_merge($query_values,array(':year' => $year)); |
|
1045 | + $query_values = array_merge($query_values, array(':year' => $year)); |
|
1046 | 1046 | } |
1047 | 1047 | if ($month != '') { |
1048 | 1048 | $query .= ' AND EXTRACT(MONTH FROM stats_date) = :month'; |
1049 | - $query_values = array_merge($query_values,array(':month' => $month)); |
|
1049 | + $query_values = array_merge($query_values, array(':month' => $month)); |
|
1050 | 1050 | } |
1051 | 1051 | if ($day != '') { |
1052 | 1052 | $query .= ' AND EXTRACT(DAY FROM stats_date) = :day'; |
1053 | - $query_values = array_merge($query_values,array(':day' => $day)); |
|
1053 | + $query_values = array_merge($query_values, array(':day' => $day)); |
|
1054 | 1054 | } |
1055 | 1055 | } |
1056 | 1056 | $query .= " ORDER BY source_name"; |
1057 | - $query_values = array_merge($query_values,array(':stats_type' => $stats_type)); |
|
1057 | + $query_values = array_merge($query_values, array(':stats_type' => $stats_type)); |
|
1058 | 1058 | try { |
1059 | 1059 | $sth = $this->db->prepare($query); |
1060 | 1060 | $sth->execute($query_values); |
1061 | - } catch(PDOException $e) { |
|
1061 | + } catch (PDOException $e) { |
|
1062 | 1062 | echo "error : ".$e->getMessage(); |
1063 | 1063 | } |
1064 | 1064 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
1065 | 1065 | return $all; |
1066 | 1066 | } |
1067 | 1067 | |
1068 | - public function addStatSource($data,$source_name,$stats_type,$date) { |
|
1068 | + public function addStatSource($data, $source_name, $stats_type, $date) { |
|
1069 | 1069 | global $globalDBdriver; |
1070 | 1070 | if ($globalDBdriver == 'mysql') { |
1071 | 1071 | $query = "INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) VALUES (:data,:source_name,:stats_type,:stats_date) ON DUPLICATE KEY UPDATE source_data = :data"; |
1072 | 1072 | } else { |
1073 | 1073 | $query = "UPDATE stats_source SET source_data = :data WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type; INSERT INTO stats_source (source_data,source_name,stats_type,stats_date) SELECT :data,:source_name,:stats_type,:stats_date WHERE NOT EXISTS (SELECT 1 FROM stats_source WHERE stats_date = :stats_date AND source_name = :source_name AND stats_type = :stats_type);"; |
1074 | 1074 | } |
1075 | - $query_values = array(':data' => $data,':stats_date' => $date,':source_name' => $source_name,':stats_type' => $stats_type); |
|
1075 | + $query_values = array(':data' => $data, ':stats_date' => $date, ':source_name' => $source_name, ':stats_type' => $stats_type); |
|
1076 | 1076 | try { |
1077 | 1077 | $sth = $this->db->prepare($query); |
1078 | 1078 | $sth->execute($query_values); |
1079 | - } catch(PDOException $e) { |
|
1079 | + } catch (PDOException $e) { |
|
1080 | 1080 | return "error : ".$e->getMessage(); |
1081 | 1081 | } |
1082 | 1082 | } |
1083 | - public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
|
1083 | + public function addStatFlight($type, $date_name, $cnt, $stats_airline = '', $filter_name = '') { |
|
1084 | 1084 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
1085 | - $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1085 | + $query_values = array(':type' => $type, ':flight_date' => $date_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1086 | 1086 | try { |
1087 | 1087 | $sth = $this->db->prepare($query); |
1088 | 1088 | $sth->execute($query_values); |
1089 | - } catch(PDOException $e) { |
|
1089 | + } catch (PDOException $e) { |
|
1090 | 1090 | return "error : ".$e->getMessage(); |
1091 | 1091 | } |
1092 | 1092 | } |
1093 | - public function addStatAircraftRegistration($registration,$cnt,$aircraft_icao = '',$airline_icao = '',$filter_name = '',$reset = false) { |
|
1093 | + public function addStatAircraftRegistration($registration, $cnt, $aircraft_icao = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1094 | 1094 | global $globalDBdriver; |
1095 | 1095 | if ($globalDBdriver == 'mysql') { |
1096 | 1096 | if ($reset) { |
@@ -1105,15 +1105,15 @@ discard block |
||
1105 | 1105 | $query = "UPDATE stats_registration SET cnt = cnt+:cnt WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_registration (aircraft_icao,registration,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:registration,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_registration WHERE registration = :registration AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1106 | 1106 | } |
1107 | 1107 | } |
1108 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':registration' => $registration,':cnt' => $cnt,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1108 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':registration' => $registration, ':cnt' => $cnt, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1109 | 1109 | try { |
1110 | 1110 | $sth = $this->db->prepare($query); |
1111 | 1111 | $sth->execute($query_values); |
1112 | - } catch(PDOException $e) { |
|
1112 | + } catch (PDOException $e) { |
|
1113 | 1113 | return "error : ".$e->getMessage(); |
1114 | 1114 | } |
1115 | 1115 | } |
1116 | - public function addStatCallsign($callsign_icao,$cnt,$airline_icao = '', $filter_name = '', $reset = false) { |
|
1116 | + public function addStatCallsign($callsign_icao, $cnt, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1117 | 1117 | global $globalDBdriver; |
1118 | 1118 | if ($globalDBdriver == 'mysql') { |
1119 | 1119 | if ($reset) { |
@@ -1128,15 +1128,15 @@ discard block |
||
1128 | 1128 | $query = "UPDATE stats_callsign SET cnt = cnt+:cnt WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name; INSERT INTO stats_callsign (callsign_icao,airline_icao,cnt,filter_name) SELECT :callsign_icao,:airline_icao,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_callsign WHERE callsign_icao = :callsign_icao AND filter_name = :filter_name);"; |
1129 | 1129 | } |
1130 | 1130 | } |
1131 | - $query_values = array(':callsign_icao' => $callsign_icao,':airline_icao' => $airline_icao,':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1131 | + $query_values = array(':callsign_icao' => $callsign_icao, ':airline_icao' => $airline_icao, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1132 | 1132 | try { |
1133 | 1133 | $sth = $this->db->prepare($query); |
1134 | 1134 | $sth->execute($query_values); |
1135 | - } catch(PDOException $e) { |
|
1135 | + } catch (PDOException $e) { |
|
1136 | 1136 | return "error : ".$e->getMessage(); |
1137 | 1137 | } |
1138 | 1138 | } |
1139 | - public function addStatCountry($iso2,$iso3,$name,$cnt,$filter_name = '',$reset = false) { |
|
1139 | + public function addStatCountry($iso2, $iso3, $name, $cnt, $filter_name = '', $reset = false) { |
|
1140 | 1140 | global $globalDBdriver; |
1141 | 1141 | if ($globalDBdriver == 'mysql') { |
1142 | 1142 | if ($reset) { |
@@ -1151,15 +1151,15 @@ discard block |
||
1151 | 1151 | $query = "UPDATE stats_country SET cnt = cnt+:cnt WHERE iso2 = :iso2 AND filter_name = :filter_name; INSERT INTO stats_country (iso2,iso3,name,cnt,filter_name) SELECT :iso2,:iso3,:name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_country WHERE iso2 = :iso2 AND filter_name = :filter_name);"; |
1152 | 1152 | } |
1153 | 1153 | } |
1154 | - $query_values = array(':iso2' => $iso2,':iso3' => $iso3,':name' => $name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1154 | + $query_values = array(':iso2' => $iso2, ':iso3' => $iso3, ':name' => $name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1155 | 1155 | try { |
1156 | 1156 | $sth = $this->db->prepare($query); |
1157 | 1157 | $sth->execute($query_values); |
1158 | - } catch(PDOException $e) { |
|
1158 | + } catch (PDOException $e) { |
|
1159 | 1159 | return "error : ".$e->getMessage(); |
1160 | 1160 | } |
1161 | 1161 | } |
1162 | - public function addStatAircraft($aircraft_icao,$cnt,$aircraft_name = '',$aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1162 | + public function addStatAircraft($aircraft_icao, $cnt, $aircraft_name = '', $aircraft_manufacturer = '', $airline_icao = '', $filter_name = '', $reset = false) { |
|
1163 | 1163 | global $globalDBdriver; |
1164 | 1164 | if ($globalDBdriver == 'mysql') { |
1165 | 1165 | if ($reset) { |
@@ -1174,15 +1174,15 @@ discard block |
||
1174 | 1174 | $query = "UPDATE stats_aircraft SET cnt = cnt+:cnt, aircraft_name = :aircraft_name, aircraft_manufacturer = :aircraft_manufacturer, filter_name = :filter_name WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_aircraft (aircraft_icao,aircraft_name,aircraft_manufacturer,cnt,stats_airline,filter_name) SELECT :aircraft_icao,:aircraft_name,:aircraft_manufacturer,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_aircraft WHERE aircraft_icao = :aircraft_icao AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1175 | 1175 | } |
1176 | 1176 | } |
1177 | - $query_values = array(':aircraft_icao' => $aircraft_icao,':aircraft_name' => $aircraft_name,':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer,':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1177 | + $query_values = array(':aircraft_icao' => $aircraft_icao, ':aircraft_name' => $aircraft_name, ':cnt' => $cnt, ':aircraft_manufacturer' => $aircraft_manufacturer, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1178 | 1178 | try { |
1179 | 1179 | $sth = $this->db->prepare($query); |
1180 | 1180 | $sth->execute($query_values); |
1181 | - } catch(PDOException $e) { |
|
1181 | + } catch (PDOException $e) { |
|
1182 | 1182 | return "error : ".$e->getMessage(); |
1183 | 1183 | } |
1184 | 1184 | } |
1185 | - public function addStatAirline($airline_icao,$cnt,$airline_name = '',$filter_name = '', $reset = false) { |
|
1185 | + public function addStatAirline($airline_icao, $cnt, $airline_name = '', $filter_name = '', $reset = false) { |
|
1186 | 1186 | global $globalDBdriver; |
1187 | 1187 | if ($globalDBdriver == 'mysql') { |
1188 | 1188 | if ($reset) { |
@@ -1197,15 +1197,15 @@ discard block |
||
1197 | 1197 | $query = "UPDATE stats_airline SET cnt = cnt+:cnt WHERE airline_icao = :airline_icao AND filter_name = :filter_name; INSERT INTO stats_airline (airline_icao,airline_name,cnt,filter_name) SELECT :airline_icao,:airline_name,:cnt,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airline WHERE airline_icao = :airline_icao AND filter_name = :filter_name);"; |
1198 | 1198 | } |
1199 | 1199 | } |
1200 | - $query_values = array(':airline_icao' => $airline_icao,':airline_name' => $airline_name,':cnt' => $cnt,':filter_name' => $filter_name); |
|
1200 | + $query_values = array(':airline_icao' => $airline_icao, ':airline_name' => $airline_name, ':cnt' => $cnt, ':filter_name' => $filter_name); |
|
1201 | 1201 | try { |
1202 | 1202 | $sth = $this->db->prepare($query); |
1203 | 1203 | $sth->execute($query_values); |
1204 | - } catch(PDOException $e) { |
|
1204 | + } catch (PDOException $e) { |
|
1205 | 1205 | return "error : ".$e->getMessage(); |
1206 | 1206 | } |
1207 | 1207 | } |
1208 | - public function addStatOwner($owner_name,$cnt,$stats_airline = '', $filter_name = '', $reset = false) { |
|
1208 | + public function addStatOwner($owner_name, $cnt, $stats_airline = '', $filter_name = '', $reset = false) { |
|
1209 | 1209 | global $globalDBdriver; |
1210 | 1210 | if ($globalDBdriver == 'mysql') { |
1211 | 1211 | if ($reset) { |
@@ -1220,15 +1220,15 @@ discard block |
||
1220 | 1220 | $query = "UPDATE stats_owner SET cnt = cnt+:cnt WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_owner (owner_name,cnt,stats_airline,filter_name) SELECT :owner_name,:cnt,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_owner WHERE owner_name = :owner_name AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1221 | 1221 | } |
1222 | 1222 | } |
1223 | - $query_values = array(':owner_name' => $owner_name,':cnt' => $cnt,':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
|
1223 | + $query_values = array(':owner_name' => $owner_name, ':cnt' => $cnt, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name); |
|
1224 | 1224 | try { |
1225 | 1225 | $sth = $this->db->prepare($query); |
1226 | 1226 | $sth->execute($query_values); |
1227 | - } catch(PDOException $e) { |
|
1227 | + } catch (PDOException $e) { |
|
1228 | 1228 | return "error : ".$e->getMessage(); |
1229 | 1229 | } |
1230 | 1230 | } |
1231 | - public function addStatPilot($pilot_id,$cnt,$pilot_name,$stats_airline = '',$filter_name = '',$format_source = '',$reset = false) { |
|
1231 | + public function addStatPilot($pilot_id, $cnt, $pilot_name, $stats_airline = '', $filter_name = '', $format_source = '', $reset = false) { |
|
1232 | 1232 | global $globalDBdriver; |
1233 | 1233 | if ($globalDBdriver == 'mysql') { |
1234 | 1234 | if ($reset) { |
@@ -1243,15 +1243,15 @@ discard block |
||
1243 | 1243 | $query = "UPDATE stats_pilot SET cnt = cnt+:cnt, pilot_name = :pilot_name WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source; INSERT INTO stats_pilot (pilot_id,cnt,pilot_name,stats_airline,filter_name,format_source) SELECT :pilot_id,:cnt,:pilot_name,:stats_airline,:filter_name,:format_source WHERE NOT EXISTS (SELECT 1 FROM stats_pilot WHERE pilot_id = :pilot_id AND stats_airline = :stats_airline AND filter_name = :filter_name AND format_source = :format_source);"; |
1244 | 1244 | } |
1245 | 1245 | } |
1246 | - $query_values = array(':pilot_id' => $pilot_id,':cnt' => $cnt,':pilot_name' => $pilot_name,':stats_airline' => $stats_airline,':filter_name' => $filter_name,':format_source' => $format_source); |
|
1246 | + $query_values = array(':pilot_id' => $pilot_id, ':cnt' => $cnt, ':pilot_name' => $pilot_name, ':stats_airline' => $stats_airline, ':filter_name' => $filter_name, ':format_source' => $format_source); |
|
1247 | 1247 | try { |
1248 | 1248 | $sth = $this->db->prepare($query); |
1249 | 1249 | $sth->execute($query_values); |
1250 | - } catch(PDOException $e) { |
|
1250 | + } catch (PDOException $e) { |
|
1251 | 1251 | return "error : ".$e->getMessage(); |
1252 | 1252 | } |
1253 | 1253 | } |
1254 | - public function addStatDepartureAirports($airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1254 | + public function addStatDepartureAirports($airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1255 | 1255 | global $globalDBdriver; |
1256 | 1256 | if ($airport_icao != '') { |
1257 | 1257 | if ($globalDBdriver == 'mysql') { |
@@ -1267,16 +1267,16 @@ discard block |
||
1267 | 1267 | $query = "UPDATE stats_airport SET departure = departure+:departure WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1268 | 1268 | } |
1269 | 1269 | } |
1270 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1270 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1271 | 1271 | try { |
1272 | 1272 | $sth = $this->db->prepare($query); |
1273 | 1273 | $sth->execute($query_values); |
1274 | - } catch(PDOException $e) { |
|
1274 | + } catch (PDOException $e) { |
|
1275 | 1275 | return "error : ".$e->getMessage(); |
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | } |
1279 | - public function addStatDepartureAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$departure,$airline_icao = '',$filter_name = '') { |
|
1279 | + public function addStatDepartureAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $departure, $airline_icao = '', $filter_name = '') { |
|
1280 | 1280 | global $globalDBdriver; |
1281 | 1281 | if ($airport_icao != '') { |
1282 | 1282 | if ($globalDBdriver == 'mysql') { |
@@ -1284,16 +1284,16 @@ discard block |
||
1284 | 1284 | } else { |
1285 | 1285 | $query = "UPDATE stats_airport SET departure = :departure WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,departure,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:departure,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1286 | 1286 | } |
1287 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':departure' => $departure,':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1287 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':departure' => $departure, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1288 | 1288 | try { |
1289 | 1289 | $sth = $this->db->prepare($query); |
1290 | 1290 | $sth->execute($query_values); |
1291 | - } catch(PDOException $e) { |
|
1291 | + } catch (PDOException $e) { |
|
1292 | 1292 | return "error : ".$e->getMessage(); |
1293 | 1293 | } |
1294 | 1294 | } |
1295 | 1295 | } |
1296 | - public function addStatArrivalAirports($airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '',$reset = false) { |
|
1296 | + public function addStatArrivalAirports($airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '', $reset = false) { |
|
1297 | 1297 | global $globalDBdriver; |
1298 | 1298 | if ($airport_icao != '') { |
1299 | 1299 | if ($globalDBdriver == 'mysql') { |
@@ -1309,16 +1309,16 @@ discard block |
||
1309 | 1309 | $query = "UPDATE stats_airport SET arrival = arrival+:arrival WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'yearly',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'yearly' AND stats_airline = :stats_airline AND date = :date AND filter_name = :filter_name);"; |
1310 | 1310 | } |
1311 | 1311 | } |
1312 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival,':date' => date('Y').'-01-01 00:00:00',':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1312 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => date('Y').'-01-01 00:00:00', ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1313 | 1313 | try { |
1314 | 1314 | $sth = $this->db->prepare($query); |
1315 | 1315 | $sth->execute($query_values); |
1316 | - } catch(PDOException $e) { |
|
1316 | + } catch (PDOException $e) { |
|
1317 | 1317 | return "error : ".$e->getMessage(); |
1318 | 1318 | } |
1319 | 1319 | } |
1320 | 1320 | } |
1321 | - public function addStatArrivalAirportsDaily($date,$airport_icao,$airport_name,$airport_city,$airport_country,$arrival,$airline_icao = '',$filter_name = '') { |
|
1321 | + public function addStatArrivalAirportsDaily($date, $airport_icao, $airport_name, $airport_city, $airport_country, $arrival, $airline_icao = '', $filter_name = '') { |
|
1322 | 1322 | global $globalDBdriver; |
1323 | 1323 | if ($airport_icao != '') { |
1324 | 1324 | if ($globalDBdriver == 'mysql') { |
@@ -1326,11 +1326,11 @@ discard block |
||
1326 | 1326 | } else { |
1327 | 1327 | $query = "UPDATE stats_airport SET arrival = :arrival WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name; INSERT INTO stats_airport (airport_icao,airport_name,airport_city,airport_country,arrival,stats_type,date,stats_airline,filter_name) SELECT :airport_icao,:airport_name,:airport_city,:airport_country,:arrival,'daily',:date,:stats_airline,:filter_name WHERE NOT EXISTS (SELECT 1 FROM stats_airport WHERE airport_icao = :airport_icao AND stats_type = 'daily' AND date = :date AND stats_airline = :stats_airline AND filter_name = :filter_name);"; |
1328 | 1328 | } |
1329 | - $query_values = array(':airport_icao' => $airport_icao,':airport_name' => $airport_name,':airport_city' => $airport_city,':airport_country' => $airport_country,':arrival' => $arrival, ':date' => $date,':stats_airline' => $airline_icao,':filter_name' => $filter_name); |
|
1329 | + $query_values = array(':airport_icao' => $airport_icao, ':airport_name' => $airport_name, ':airport_city' => $airport_city, ':airport_country' => $airport_country, ':arrival' => $arrival, ':date' => $date, ':stats_airline' => $airline_icao, ':filter_name' => $filter_name); |
|
1330 | 1330 | try { |
1331 | 1331 | $sth = $this->db->prepare($query); |
1332 | 1332 | $sth->execute($query_values); |
1333 | - } catch(PDOException $e) { |
|
1333 | + } catch (PDOException $e) { |
|
1334 | 1334 | return "error : ".$e->getMessage(); |
1335 | 1335 | } |
1336 | 1336 | } |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | try { |
1343 | 1343 | $sth = $this->db->prepare($query); |
1344 | 1344 | $sth->execute($query_values); |
1345 | - } catch(PDOException $e) { |
|
1345 | + } catch (PDOException $e) { |
|
1346 | 1346 | return "error : ".$e->getMessage(); |
1347 | 1347 | } |
1348 | 1348 | } |
@@ -1352,7 +1352,7 @@ discard block |
||
1352 | 1352 | try { |
1353 | 1353 | $sth = $this->db->prepare($query); |
1354 | 1354 | $sth->execute($query_values); |
1355 | - } catch(PDOException $e) { |
|
1355 | + } catch (PDOException $e) { |
|
1356 | 1356 | return "error : ".$e->getMessage(); |
1357 | 1357 | } |
1358 | 1358 | } |
@@ -1362,13 +1362,13 @@ discard block |
||
1362 | 1362 | try { |
1363 | 1363 | $sth = $this->db->prepare($query); |
1364 | 1364 | $sth->execute($query_values); |
1365 | - } catch(PDOException $e) { |
|
1365 | + } catch (PDOException $e) { |
|
1366 | 1366 | return "error : ".$e->getMessage(); |
1367 | 1367 | } |
1368 | 1368 | } |
1369 | 1369 | |
1370 | 1370 | public function addOldStats() { |
1371 | - global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters,$globalDeleteLastYearStats,$globalStatsReset,$globalStatsResetYear; |
|
1371 | + global $globalDebug, $globalArchiveMonths, $globalArchive, $globalArchiveYear, $globalDBdriver, $globalStatsFilters, $globalDeleteLastYearStats, $globalStatsReset, $globalStatsResetYear; |
|
1372 | 1372 | $Common = new Common(); |
1373 | 1373 | $Connection = new Connection(); |
1374 | 1374 | date_default_timezone_set('UTC'); |
@@ -1385,40 +1385,40 @@ discard block |
||
1385 | 1385 | $Spotter = new Spotter($this->db); |
1386 | 1386 | |
1387 | 1387 | if ($globalDebug) echo 'Count all aircraft types...'."\n"; |
1388 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day); |
|
1388 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day); |
|
1389 | 1389 | foreach ($alldata as $number) { |
1390 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'','',$reset); |
|
1390 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', '', $reset); |
|
1391 | 1391 | } |
1392 | 1392 | if ($globalDebug) echo 'Count all airlines...'."\n"; |
1393 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day); |
|
1393 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day); |
|
1394 | 1394 | foreach ($alldata as $number) { |
1395 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],'',$reset); |
|
1395 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], '', $reset); |
|
1396 | 1396 | } |
1397 | 1397 | if ($globalDebug) echo 'Count all registrations...'."\n"; |
1398 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day); |
|
1398 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day); |
|
1399 | 1399 | foreach ($alldata as $number) { |
1400 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'','',$reset); |
|
1400 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', '', $reset); |
|
1401 | 1401 | } |
1402 | 1402 | if ($globalDebug) echo 'Count all callsigns...'."\n"; |
1403 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day); |
|
1403 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day); |
|
1404 | 1404 | foreach ($alldata as $number) { |
1405 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
1405 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1406 | 1406 | } |
1407 | 1407 | if ($globalDebug) echo 'Count all owners...'."\n"; |
1408 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day); |
|
1408 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day); |
|
1409 | 1409 | foreach ($alldata as $number) { |
1410 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'','',$reset); |
|
1410 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', '', $reset); |
|
1411 | 1411 | } |
1412 | 1412 | if ($globalDebug) echo 'Count all pilots...'."\n"; |
1413 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day); |
|
1413 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day); |
|
1414 | 1414 | foreach ($alldata as $number) { |
1415 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'','',$number['format_source'],$reset); |
|
1415 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', '', $number['format_source'], $reset); |
|
1416 | 1416 | } |
1417 | 1417 | |
1418 | 1418 | if ($globalDebug) echo 'Count all departure airports...'."\n"; |
1419 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day); |
|
1419 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day); |
|
1420 | 1420 | if ($globalDebug) echo 'Count all detected departure airports...'."\n"; |
1421 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day); |
|
1421 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day); |
|
1422 | 1422 | if ($globalDebug) echo 'Order departure airports...'."\n"; |
1423 | 1423 | $alldata = array(); |
1424 | 1424 | |
@@ -1436,14 +1436,14 @@ discard block |
||
1436 | 1436 | foreach ($alldata as $key => $row) { |
1437 | 1437 | $count[$key] = $row['airport_departure_icao_count']; |
1438 | 1438 | } |
1439 | - array_multisort($count,SORT_DESC,$alldata); |
|
1439 | + array_multisort($count, SORT_DESC, $alldata); |
|
1440 | 1440 | foreach ($alldata as $number) { |
1441 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'','',$reset); |
|
1441 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', '', $reset); |
|
1442 | 1442 | } |
1443 | 1443 | if ($globalDebug) echo 'Count all arrival airports...'."\n"; |
1444 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day); |
|
1444 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day); |
|
1445 | 1445 | if ($globalDebug) echo 'Count all detected arrival airports...'."\n"; |
1446 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day); |
|
1446 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day); |
|
1447 | 1447 | if ($globalDebug) echo 'Order arrival airports...'."\n"; |
1448 | 1448 | $alldata = array(); |
1449 | 1449 | foreach ($pall as $value) { |
@@ -1460,16 +1460,16 @@ discard block |
||
1460 | 1460 | foreach ($alldata as $key => $row) { |
1461 | 1461 | $count[$key] = $row['airport_arrival_icao_count']; |
1462 | 1462 | } |
1463 | - array_multisort($count,SORT_DESC,$alldata); |
|
1463 | + array_multisort($count, SORT_DESC, $alldata); |
|
1464 | 1464 | foreach ($alldata as $number) { |
1465 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'','',$reset); |
|
1465 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', '', $reset); |
|
1466 | 1466 | } |
1467 | 1467 | if ($Connection->tableExists('countries')) { |
1468 | 1468 | if ($globalDebug) echo 'Count all flights by countries...'."\n"; |
1469 | 1469 | $SpotterArchive = new SpotterArchive(); |
1470 | - $alldata = $SpotterArchive->countAllFlightOverCountries(false,0,$last_update_day); |
|
1470 | + $alldata = $SpotterArchive->countAllFlightOverCountries(false, 0, $last_update_day); |
|
1471 | 1471 | foreach ($alldata as $number) { |
1472 | - $this->addStatCountry($number['flight_country_iso2'],$number['flight_country_iso3'],$number['flight_country'],$number['flight_count'],'',$reset); |
|
1472 | + $this->addStatCountry($number['flight_country_iso2'], $number['flight_country_iso3'], $number['flight_country'], $number['flight_count'], '', $reset); |
|
1473 | 1473 | } |
1474 | 1474 | } |
1475 | 1475 | |
@@ -1483,37 +1483,37 @@ discard block |
||
1483 | 1483 | $lastyear = false; |
1484 | 1484 | foreach ($alldata as $number) { |
1485 | 1485 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1486 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1486 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1487 | 1487 | } |
1488 | 1488 | if ($globalDebug) echo 'Count all military flights by months...'."\n"; |
1489 | 1489 | $alldata = $Spotter->countAllMilitaryMonths(); |
1490 | 1490 | foreach ($alldata as $number) { |
1491 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1491 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1492 | 1492 | } |
1493 | 1493 | if ($globalDebug) echo 'Count all owners by months...'."\n"; |
1494 | 1494 | $alldata = $Spotter->countAllMonthsOwners(); |
1495 | 1495 | foreach ($alldata as $number) { |
1496 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1496 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1497 | 1497 | } |
1498 | 1498 | if ($globalDebug) echo 'Count all pilots by months...'."\n"; |
1499 | 1499 | $alldata = $Spotter->countAllMonthsPilots(); |
1500 | 1500 | foreach ($alldata as $number) { |
1501 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1501 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1502 | 1502 | } |
1503 | 1503 | if ($globalDebug) echo 'Count all airlines by months...'."\n"; |
1504 | 1504 | $alldata = $Spotter->countAllMonthsAirlines(); |
1505 | 1505 | foreach ($alldata as $number) { |
1506 | - $this->addStat('airlines_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1506 | + $this->addStat('airlines_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1507 | 1507 | } |
1508 | 1508 | if ($globalDebug) echo 'Count all aircrafts by months...'."\n"; |
1509 | 1509 | $alldata = $Spotter->countAllMonthsAircrafts(); |
1510 | 1510 | foreach ($alldata as $number) { |
1511 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1511 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1512 | 1512 | } |
1513 | 1513 | if ($globalDebug) echo 'Count all real arrivals by months...'."\n"; |
1514 | 1514 | $alldata = $Spotter->countAllMonthsRealArrivals(); |
1515 | 1515 | foreach ($alldata as $number) { |
1516 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name']))); |
|
1516 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name']))); |
|
1517 | 1517 | } |
1518 | 1518 | if ($globalDebug) echo 'Airports data...'."\n"; |
1519 | 1519 | if ($globalDebug) echo '...Departure'."\n"; |
@@ -1558,7 +1558,7 @@ discard block |
||
1558 | 1558 | } |
1559 | 1559 | $alldata = $pall; |
1560 | 1560 | foreach ($alldata as $number) { |
1561 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count']); |
|
1561 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count']); |
|
1562 | 1562 | } |
1563 | 1563 | echo '...Arrival'."\n"; |
1564 | 1564 | $pall = $Spotter->getLast7DaysAirportsArrival(); |
@@ -1600,7 +1600,7 @@ discard block |
||
1600 | 1600 | } |
1601 | 1601 | $alldata = $pall; |
1602 | 1602 | foreach ($alldata as $number) { |
1603 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count']); |
|
1603 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count']); |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | 1606 | echo 'Flights data...'."\n"; |
@@ -1608,28 +1608,28 @@ discard block |
||
1608 | 1608 | echo '-> countAllDatesLastMonth...'."\n"; |
1609 | 1609 | $alldata = $Spotter->countAllDatesLastMonth(); |
1610 | 1610 | foreach ($alldata as $number) { |
1611 | - $this->addStatFlight('month',$number['date_name'],$number['date_count']); |
|
1611 | + $this->addStatFlight('month', $number['date_name'], $number['date_count']); |
|
1612 | 1612 | } |
1613 | 1613 | echo '-> countAllDates...'."\n"; |
1614 | 1614 | $previousdata = $this->countAllDates(); |
1615 | 1615 | $previousdatabyairlines = $this->countAllDatesByAirlines(); |
1616 | 1616 | $this->deleteStatFlight('date'); |
1617 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates()); |
|
1617 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates()); |
|
1618 | 1618 | $values = array(); |
1619 | 1619 | foreach ($alldata as $cnt) { |
1620 | 1620 | $values[] = $cnt['date_count']; |
1621 | 1621 | } |
1622 | - array_multisort($values,SORT_DESC,$alldata); |
|
1623 | - array_splice($alldata,11); |
|
1622 | + array_multisort($values, SORT_DESC, $alldata); |
|
1623 | + array_splice($alldata, 11); |
|
1624 | 1624 | foreach ($alldata as $number) { |
1625 | - $this->addStatFlight('date',$number['date_name'],$number['date_count']); |
|
1625 | + $this->addStatFlight('date', $number['date_name'], $number['date_count']); |
|
1626 | 1626 | } |
1627 | 1627 | |
1628 | 1628 | $this->deleteStatFlight('hour'); |
1629 | 1629 | echo '-> countAllHours...'."\n"; |
1630 | 1630 | $alldata = $Spotter->countAllHours('hour'); |
1631 | 1631 | foreach ($alldata as $number) { |
1632 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count']); |
|
1632 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count']); |
|
1633 | 1633 | } |
1634 | 1634 | |
1635 | 1635 | |
@@ -1638,34 +1638,34 @@ discard block |
||
1638 | 1638 | echo '--- Stats by airlines ---'."\n"; |
1639 | 1639 | if ($globalDebug) echo 'Count all aircraft types by airlines...'."\n"; |
1640 | 1640 | $Spotter = new Spotter($this->db); |
1641 | - $alldata = $Spotter->countAllAircraftTypesByAirlines(false,0,$last_update_day); |
|
1641 | + $alldata = $Spotter->countAllAircraftTypesByAirlines(false, 0, $last_update_day); |
|
1642 | 1642 | foreach ($alldata as $number) { |
1643 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],$number['airline_icao'],'',$reset); |
|
1643 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], $number['airline_icao'], '', $reset); |
|
1644 | 1644 | } |
1645 | 1645 | if ($globalDebug) echo 'Count all aircraft registrations by airlines...'."\n"; |
1646 | - $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false,0,$last_update_day); |
|
1646 | + $alldata = $Spotter->countAllAircraftRegistrationsByAirlines(false, 0, $last_update_day); |
|
1647 | 1647 | foreach ($alldata as $number) { |
1648 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],$number['airline_icao'],'',$reset); |
|
1648 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], $number['airline_icao'], '', $reset); |
|
1649 | 1649 | } |
1650 | 1650 | if ($globalDebug) echo 'Count all callsigns by airlines...'."\n"; |
1651 | - $alldata = $Spotter->countAllCallsignsByAirlines(false,0,$last_update_day); |
|
1651 | + $alldata = $Spotter->countAllCallsignsByAirlines(false, 0, $last_update_day); |
|
1652 | 1652 | foreach ($alldata as $number) { |
1653 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],$number['airline_icao'],'',$reset); |
|
1653 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], $number['airline_icao'], '', $reset); |
|
1654 | 1654 | } |
1655 | 1655 | if ($globalDebug) echo 'Count all owners by airlines...'."\n"; |
1656 | - $alldata = $Spotter->countAllOwnersByAirlines(false,0,$last_update_day); |
|
1656 | + $alldata = $Spotter->countAllOwnersByAirlines(false, 0, $last_update_day); |
|
1657 | 1657 | foreach ($alldata as $number) { |
1658 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],$number['airline_icao'],'',$reset); |
|
1658 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], $number['airline_icao'], '', $reset); |
|
1659 | 1659 | } |
1660 | 1660 | if ($globalDebug) echo 'Count all pilots by airlines...'."\n"; |
1661 | - $alldata = $Spotter->countAllPilotsByAirlines(false,0,$last_update_day); |
|
1661 | + $alldata = $Spotter->countAllPilotsByAirlines(false, 0, $last_update_day); |
|
1662 | 1662 | foreach ($alldata as $number) { |
1663 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],$number['airline_icao'],'',$number['format_source'],$reset); |
|
1663 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], $number['airline_icao'], '', $number['format_source'], $reset); |
|
1664 | 1664 | } |
1665 | 1665 | if ($globalDebug) echo 'Count all departure airports by airlines...'."\n"; |
1666 | - $pall = $Spotter->countAllDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1666 | + $pall = $Spotter->countAllDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1667 | 1667 | if ($globalDebug) echo 'Count all detected departure airports by airlines...'."\n"; |
1668 | - $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false,0,$last_update_day); |
|
1668 | + $dall = $Spotter->countAllDetectedDepartureAirportsByAirlines(false, 0, $last_update_day); |
|
1669 | 1669 | if ($globalDebug) echo 'Order detected departure airports by airlines...'."\n"; |
1670 | 1670 | //$alldata = array(); |
1671 | 1671 | foreach ($dall as $value) { |
@@ -1685,12 +1685,12 @@ discard block |
||
1685 | 1685 | } |
1686 | 1686 | $alldata = $pall; |
1687 | 1687 | foreach ($alldata as $number) { |
1688 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],$number['airline_icao'],'',$reset); |
|
1688 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], $number['airline_icao'], '', $reset); |
|
1689 | 1689 | } |
1690 | 1690 | if ($globalDebug) echo 'Count all arrival airports by airlines...'."\n"; |
1691 | - $pall = $Spotter->countAllArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1691 | + $pall = $Spotter->countAllArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1692 | 1692 | if ($globalDebug) echo 'Count all detected arrival airports by airlines...'."\n"; |
1693 | - $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false,0,$last_update_day); |
|
1693 | + $dall = $Spotter->countAllDetectedArrivalAirportsByAirlines(false, 0, $last_update_day); |
|
1694 | 1694 | if ($globalDebug) echo 'Order arrival airports by airlines...'."\n"; |
1695 | 1695 | //$alldata = array(); |
1696 | 1696 | foreach ($dall as $value) { |
@@ -1710,7 +1710,7 @@ discard block |
||
1710 | 1710 | } |
1711 | 1711 | $alldata = $pall; |
1712 | 1712 | foreach ($alldata as $number) { |
1713 | - if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],$number['airline_icao'],'',$reset); |
|
1713 | + if ($number['airline_icao'] != '') echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], $number['airline_icao'], '', $reset); |
|
1714 | 1714 | } |
1715 | 1715 | if ($globalDebug) echo 'Count all flights by months by airlines...'."\n"; |
1716 | 1716 | $Spotter = new Spotter($this->db); |
@@ -1718,27 +1718,27 @@ discard block |
||
1718 | 1718 | $lastyear = false; |
1719 | 1719 | foreach ($alldata as $number) { |
1720 | 1720 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1721 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1721 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1722 | 1722 | } |
1723 | 1723 | if ($globalDebug) echo 'Count all owners by months by airlines...'."\n"; |
1724 | 1724 | $alldata = $Spotter->countAllMonthsOwnersByAirlines(); |
1725 | 1725 | foreach ($alldata as $number) { |
1726 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1726 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1727 | 1727 | } |
1728 | 1728 | if ($globalDebug) echo 'Count all pilots by months by airlines...'."\n"; |
1729 | 1729 | $alldata = $Spotter->countAllMonthsPilotsByAirlines(); |
1730 | 1730 | foreach ($alldata as $number) { |
1731 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1731 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1732 | 1732 | } |
1733 | 1733 | if ($globalDebug) echo 'Count all aircrafts by months by airlines...'."\n"; |
1734 | 1734 | $alldata = $Spotter->countAllMonthsAircraftsByAirlines(); |
1735 | 1735 | foreach ($alldata as $number) { |
1736 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1736 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1737 | 1737 | } |
1738 | 1738 | if ($globalDebug) echo 'Count all real arrivals by months by airlines...'."\n"; |
1739 | 1739 | $alldata = $Spotter->countAllMonthsRealArrivalsByAirlines(); |
1740 | 1740 | foreach ($alldata as $number) { |
1741 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),$number['airline_icao']); |
|
1741 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), $number['airline_icao']); |
|
1742 | 1742 | } |
1743 | 1743 | if ($globalDebug) echo '...Departure'."\n"; |
1744 | 1744 | $pall = $Spotter->getLast7DaysAirportsDepartureByAirlines(); |
@@ -1761,7 +1761,7 @@ discard block |
||
1761 | 1761 | } |
1762 | 1762 | $alldata = $pall; |
1763 | 1763 | foreach ($alldata as $number) { |
1764 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],$number['airline_icao']); |
|
1764 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], $number['airline_icao']); |
|
1765 | 1765 | } |
1766 | 1766 | if ($globalDebug) echo '...Arrival'."\n"; |
1767 | 1767 | $pall = $Spotter->getLast7DaysAirportsArrivalByAirlines(); |
@@ -1784,32 +1784,32 @@ discard block |
||
1784 | 1784 | } |
1785 | 1785 | $alldata = $pall; |
1786 | 1786 | foreach ($alldata as $number) { |
1787 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],$number['airline_icao']); |
|
1787 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], $number['airline_icao']); |
|
1788 | 1788 | } |
1789 | 1789 | |
1790 | 1790 | if ($globalDebug) echo 'Flights data...'."\n"; |
1791 | 1791 | if ($globalDebug) echo '-> countAllDatesLastMonth...'."\n"; |
1792 | 1792 | $alldata = $Spotter->countAllDatesLastMonthByAirlines(); |
1793 | 1793 | foreach ($alldata as $number) { |
1794 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], $number['airline_icao']); |
|
1794 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1795 | 1795 | } |
1796 | 1796 | if ($globalDebug) echo '-> countAllDates...'."\n"; |
1797 | 1797 | //$previousdata = $this->countAllDatesByAirlines(); |
1798 | - $alldata = $Common->array_merge_noappend($previousdatabyairlines,$Spotter->countAllDatesByAirlines()); |
|
1798 | + $alldata = $Common->array_merge_noappend($previousdatabyairlines, $Spotter->countAllDatesByAirlines()); |
|
1799 | 1799 | $values = array(); |
1800 | 1800 | foreach ($alldata as $cnt) { |
1801 | 1801 | $values[] = $cnt['date_count']; |
1802 | 1802 | } |
1803 | - array_multisort($values,SORT_DESC,$alldata); |
|
1804 | - array_splice($alldata,11); |
|
1803 | + array_multisort($values, SORT_DESC, $alldata); |
|
1804 | + array_splice($alldata, 11); |
|
1805 | 1805 | foreach ($alldata as $number) { |
1806 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],$number['airline_icao']); |
|
1806 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], $number['airline_icao']); |
|
1807 | 1807 | } |
1808 | 1808 | |
1809 | 1809 | if ($globalDebug) echo '-> countAllHours...'."\n"; |
1810 | 1810 | $alldata = $Spotter->countAllHoursByAirlines('hour'); |
1811 | 1811 | foreach ($alldata as $number) { |
1812 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],$number['airline_icao']); |
|
1812 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], $number['airline_icao']); |
|
1813 | 1813 | } |
1814 | 1814 | |
1815 | 1815 | |
@@ -1828,32 +1828,32 @@ discard block |
||
1828 | 1828 | // Count by filter |
1829 | 1829 | if ($globalDebug) echo '--- Stats for filter '.$filter_name.' ---'."\n"; |
1830 | 1830 | $Spotter = new Spotter($this->db); |
1831 | - $alldata = $Spotter->countAllAircraftTypes(false,0,$last_update_day,$filter); |
|
1831 | + $alldata = $Spotter->countAllAircraftTypes(false, 0, $last_update_day, $filter); |
|
1832 | 1832 | foreach ($alldata as $number) { |
1833 | - $this->addStatAircraft($number['aircraft_icao'],$number['aircraft_icao_count'],$number['aircraft_name'],$number['aircraft_manufacturer'],'',$filter_name,$reset); |
|
1833 | + $this->addStatAircraft($number['aircraft_icao'], $number['aircraft_icao_count'], $number['aircraft_name'], $number['aircraft_manufacturer'], '', $filter_name, $reset); |
|
1834 | 1834 | } |
1835 | - $alldata = $Spotter->countAllAirlines(false,0,$last_update_day,$filter); |
|
1835 | + $alldata = $Spotter->countAllAirlines(false, 0, $last_update_day, $filter); |
|
1836 | 1836 | foreach ($alldata as $number) { |
1837 | - $this->addStatAirline($number['airline_icao'],$number['airline_count'],$number['airline_name'],$filter_name,$reset); |
|
1837 | + $this->addStatAirline($number['airline_icao'], $number['airline_count'], $number['airline_name'], $filter_name, $reset); |
|
1838 | 1838 | } |
1839 | - $alldata = $Spotter->countAllAircraftRegistrations(false,0,$last_update_day,$filter); |
|
1839 | + $alldata = $Spotter->countAllAircraftRegistrations(false, 0, $last_update_day, $filter); |
|
1840 | 1840 | foreach ($alldata as $number) { |
1841 | - $this->addStatAircraftRegistration($number['registration'],$number['aircraft_registration_count'],$number['aircraft_icao'],'',$filter_name,$reset); |
|
1841 | + $this->addStatAircraftRegistration($number['registration'], $number['aircraft_registration_count'], $number['aircraft_icao'], '', $filter_name, $reset); |
|
1842 | 1842 | } |
1843 | - $alldata = $Spotter->countAllCallsigns(false,0,$last_update_day,$filter); |
|
1843 | + $alldata = $Spotter->countAllCallsigns(false, 0, $last_update_day, $filter); |
|
1844 | 1844 | foreach ($alldata as $number) { |
1845 | - $this->addStatCallsign($number['callsign_icao'],$number['callsign_icao_count'],'',$filter_name,$reset); |
|
1845 | + $this->addStatCallsign($number['callsign_icao'], $number['callsign_icao_count'], '', $filter_name, $reset); |
|
1846 | 1846 | } |
1847 | - $alldata = $Spotter->countAllOwners(false,0,$last_update_day,$filter); |
|
1847 | + $alldata = $Spotter->countAllOwners(false, 0, $last_update_day, $filter); |
|
1848 | 1848 | foreach ($alldata as $number) { |
1849 | - $this->addStatOwner($number['owner_name'],$number['owner_count'],'',$filter_name,$reset); |
|
1849 | + $this->addStatOwner($number['owner_name'], $number['owner_count'], '', $filter_name, $reset); |
|
1850 | 1850 | } |
1851 | - $alldata = $Spotter->countAllPilots(false,0,$last_update_day,$filter); |
|
1851 | + $alldata = $Spotter->countAllPilots(false, 0, $last_update_day, $filter); |
|
1852 | 1852 | foreach ($alldata as $number) { |
1853 | - $this->addStatPilot($number['pilot_id'],$number['pilot_count'],$number['pilot_name'],'',$filter_name,$number['format_source'],$reset); |
|
1853 | + $this->addStatPilot($number['pilot_id'], $number['pilot_count'], $number['pilot_name'], '', $filter_name, $number['format_source'], $reset); |
|
1854 | 1854 | } |
1855 | - $pall = $Spotter->countAllDepartureAirports(false,0,$last_update_day,$filter); |
|
1856 | - $dall = $Spotter->countAllDetectedDepartureAirports(false,0,$last_update_day,$filter); |
|
1855 | + $pall = $Spotter->countAllDepartureAirports(false, 0, $last_update_day, $filter); |
|
1856 | + $dall = $Spotter->countAllDetectedDepartureAirports(false, 0, $last_update_day, $filter); |
|
1857 | 1857 | $alldata = array(); |
1858 | 1858 | foreach ($pall as $value) { |
1859 | 1859 | $icao = $value['airport_departure_icao']; |
@@ -1869,12 +1869,12 @@ discard block |
||
1869 | 1869 | foreach ($alldata as $key => $row) { |
1870 | 1870 | $count[$key] = $row['airport_departure_icao_count']; |
1871 | 1871 | } |
1872 | - array_multisort($count,SORT_DESC,$alldata); |
|
1872 | + array_multisort($count, SORT_DESC, $alldata); |
|
1873 | 1873 | foreach ($alldata as $number) { |
1874 | - echo $this->addStatDepartureAirports($number['airport_departure_icao'],$number['airport_departure_name'],$number['airport_departure_city'],$number['airport_departure_country'],$number['airport_departure_icao_count'],'',$filter_name,$reset); |
|
1874 | + echo $this->addStatDepartureAirports($number['airport_departure_icao'], $number['airport_departure_name'], $number['airport_departure_city'], $number['airport_departure_country'], $number['airport_departure_icao_count'], '', $filter_name, $reset); |
|
1875 | 1875 | } |
1876 | - $pall = $Spotter->countAllArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1877 | - $dall = $Spotter->countAllDetectedArrivalAirports(false,0,$last_update_day,false,$filter); |
|
1876 | + $pall = $Spotter->countAllArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1877 | + $dall = $Spotter->countAllDetectedArrivalAirports(false, 0, $last_update_day, false, $filter); |
|
1878 | 1878 | $alldata = array(); |
1879 | 1879 | foreach ($pall as $value) { |
1880 | 1880 | $icao = $value['airport_arrival_icao']; |
@@ -1890,40 +1890,40 @@ discard block |
||
1890 | 1890 | foreach ($alldata as $key => $row) { |
1891 | 1891 | $count[$key] = $row['airport_arrival_icao_count']; |
1892 | 1892 | } |
1893 | - array_multisort($count,SORT_DESC,$alldata); |
|
1893 | + array_multisort($count, SORT_DESC, $alldata); |
|
1894 | 1894 | foreach ($alldata as $number) { |
1895 | - echo $this->addStatArrivalAirports($number['airport_arrival_icao'],$number['airport_arrival_name'],$number['airport_arrival_city'],$number['airport_arrival_country'],$number['airport_arrival_icao_count'],'',$filter_name,$reset); |
|
1895 | + echo $this->addStatArrivalAirports($number['airport_arrival_icao'], $number['airport_arrival_name'], $number['airport_arrival_city'], $number['airport_arrival_country'], $number['airport_arrival_icao_count'], '', $filter_name, $reset); |
|
1896 | 1896 | } |
1897 | 1897 | $Spotter = new Spotter($this->db); |
1898 | 1898 | $alldata = $Spotter->countAllMonths($filter); |
1899 | 1899 | $lastyear = false; |
1900 | 1900 | foreach ($alldata as $number) { |
1901 | 1901 | if ($number['year_name'] != date('Y')) $lastyear = true; |
1902 | - $this->addStat('flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1902 | + $this->addStat('flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1903 | 1903 | } |
1904 | 1904 | $alldata = $Spotter->countAllMonthsOwners($filter); |
1905 | 1905 | foreach ($alldata as $number) { |
1906 | - $this->addStat('owners_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1906 | + $this->addStat('owners_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1907 | 1907 | } |
1908 | 1908 | $alldata = $Spotter->countAllMonthsPilots($filter); |
1909 | 1909 | foreach ($alldata as $number) { |
1910 | - $this->addStat('pilots_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1910 | + $this->addStat('pilots_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1911 | 1911 | } |
1912 | 1912 | $alldata = $Spotter->countAllMilitaryMonths($filter); |
1913 | 1913 | foreach ($alldata as $number) { |
1914 | - $this->addStat('military_flights_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1914 | + $this->addStat('military_flights_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1915 | 1915 | } |
1916 | 1916 | $alldata = $Spotter->countAllMonthsAircrafts($filter); |
1917 | 1917 | foreach ($alldata as $number) { |
1918 | - $this->addStat('aircrafts_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1918 | + $this->addStat('aircrafts_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1919 | 1919 | } |
1920 | 1920 | $alldata = $Spotter->countAllMonthsRealArrivals($filter); |
1921 | 1921 | foreach ($alldata as $number) { |
1922 | - $this->addStat('realarrivals_bymonth',$number['date_count'],date('Y-m-d H:i:s',mktime(0,0,0,$number['month_name'],1,$number['year_name'])),'',$filter_name); |
|
1922 | + $this->addStat('realarrivals_bymonth', $number['date_count'], date('Y-m-d H:i:s', mktime(0, 0, 0, $number['month_name'], 1, $number['year_name'])), '', $filter_name); |
|
1923 | 1923 | } |
1924 | 1924 | echo '...Departure'."\n"; |
1925 | - $pall = $Spotter->getLast7DaysAirportsDeparture('',$filter); |
|
1926 | - $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('',$filter); |
|
1925 | + $pall = $Spotter->getLast7DaysAirportsDeparture('', $filter); |
|
1926 | + $dall = $Spotter->getLast7DaysDetectedAirportsDeparture('', $filter); |
|
1927 | 1927 | foreach ($dall as $value) { |
1928 | 1928 | $icao = $value['departure_airport_icao']; |
1929 | 1929 | $ddate = $value['date']; |
@@ -1941,11 +1941,11 @@ discard block |
||
1941 | 1941 | } |
1942 | 1942 | $alldata = $pall; |
1943 | 1943 | foreach ($alldata as $number) { |
1944 | - $this->addStatDepartureAirportsDaily($number['date'],$number['departure_airport_icao'],$number['departure_airport_name'],$number['departure_airport_city'],$number['departure_airport_country'],$number['departure_airport_count'],'',$filter_name); |
|
1944 | + $this->addStatDepartureAirportsDaily($number['date'], $number['departure_airport_icao'], $number['departure_airport_name'], $number['departure_airport_city'], $number['departure_airport_country'], $number['departure_airport_count'], '', $filter_name); |
|
1945 | 1945 | } |
1946 | 1946 | echo '...Arrival'."\n"; |
1947 | - $pall = $Spotter->getLast7DaysAirportsArrival('',$filter); |
|
1948 | - $dall = $Spotter->getLast7DaysDetectedAirportsArrival('',$filter); |
|
1947 | + $pall = $Spotter->getLast7DaysAirportsArrival('', $filter); |
|
1948 | + $dall = $Spotter->getLast7DaysDetectedAirportsArrival('', $filter); |
|
1949 | 1949 | foreach ($dall as $value) { |
1950 | 1950 | $icao = $value['arrival_airport_icao']; |
1951 | 1951 | $ddate = $value['date']; |
@@ -1963,40 +1963,40 @@ discard block |
||
1963 | 1963 | } |
1964 | 1964 | $alldata = $pall; |
1965 | 1965 | foreach ($alldata as $number) { |
1966 | - $this->addStatArrivalAirportsDaily($number['date'],$number['arrival_airport_icao'],$number['arrival_airport_name'],$number['arrival_airport_city'],$number['arrival_airport_country'],$number['arrival_airport_count'],'',$filter_name); |
|
1966 | + $this->addStatArrivalAirportsDaily($number['date'], $number['arrival_airport_icao'], $number['arrival_airport_name'], $number['arrival_airport_city'], $number['arrival_airport_country'], $number['arrival_airport_count'], '', $filter_name); |
|
1967 | 1967 | } |
1968 | 1968 | |
1969 | 1969 | echo 'Flights data...'."\n"; |
1970 | 1970 | echo '-> countAllDatesLastMonth...'."\n"; |
1971 | 1971 | $alldata = $Spotter->countAllDatesLastMonth($filter); |
1972 | 1972 | foreach ($alldata as $number) { |
1973 | - $this->addStatFlight('month',$number['date_name'],$number['date_count'], '',$filter_name); |
|
1973 | + $this->addStatFlight('month', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1974 | 1974 | } |
1975 | 1975 | echo '-> countAllDates...'."\n"; |
1976 | - $previousdata = $this->countAllDates('',$filter_name); |
|
1977 | - $alldata = $Common->array_merge_noappend($previousdata,$Spotter->countAllDates($filter)); |
|
1976 | + $previousdata = $this->countAllDates('', $filter_name); |
|
1977 | + $alldata = $Common->array_merge_noappend($previousdata, $Spotter->countAllDates($filter)); |
|
1978 | 1978 | $values = array(); |
1979 | 1979 | foreach ($alldata as $cnt) { |
1980 | 1980 | $values[] = $cnt['date_count']; |
1981 | 1981 | } |
1982 | - array_multisort($values,SORT_DESC,$alldata); |
|
1983 | - array_splice($alldata,11); |
|
1982 | + array_multisort($values, SORT_DESC, $alldata); |
|
1983 | + array_splice($alldata, 11); |
|
1984 | 1984 | foreach ($alldata as $number) { |
1985 | - $this->addStatFlight('date',$number['date_name'],$number['date_count'],'',$filter_name); |
|
1985 | + $this->addStatFlight('date', $number['date_name'], $number['date_count'], '', $filter_name); |
|
1986 | 1986 | } |
1987 | 1987 | |
1988 | 1988 | echo '-> countAllHours...'."\n"; |
1989 | - $alldata = $Spotter->countAllHours('hour',$filter); |
|
1989 | + $alldata = $Spotter->countAllHours('hour', $filter); |
|
1990 | 1990 | foreach ($alldata as $number) { |
1991 | - $this->addStatFlight('hour',$number['hour_name'],$number['hour_count'],'',$filter_name); |
|
1991 | + $this->addStatFlight('hour', $number['hour_name'], $number['hour_count'], '', $filter_name); |
|
1992 | 1992 | } |
1993 | 1993 | echo 'Insert last stats update date...'."\n"; |
1994 | 1994 | date_default_timezone_set('UTC'); |
1995 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y-m-d G:i:s')); |
|
1995 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y-m-d G:i:s')); |
|
1996 | 1996 | if (isset($filter['DeleteLastYearStats']) && $filter['DeleteLastYearStats'] == true) { |
1997 | - if (date('Y',strtotime($last_update_day)) != date('Y')) { |
|
1997 | + if (date('Y', strtotime($last_update_day)) != date('Y')) { |
|
1998 | 1998 | $this->deleteOldStats($filter_name); |
1999 | - $this->addLastStatsUpdate('last_update_stats_'.$filter_name,date('Y').'-01-01 00:00:00'); |
|
1999 | + $this->addLastStatsUpdate('last_update_stats_'.$filter_name, date('Y').'-01-01 00:00:00'); |
|
2000 | 2000 | } |
2001 | 2001 | } |
2002 | 2002 | |
@@ -2009,16 +2009,16 @@ discard block |
||
2009 | 2009 | // SUM all previous month to put as year |
2010 | 2010 | $previous_year = date('Y'); |
2011 | 2011 | $previous_year--; |
2012 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2013 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2014 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2015 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year),$previous_year.'-01-01 00:00:00'); |
|
2012 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2013 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2014 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2015 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year), $previous_year.'-01-01 00:00:00'); |
|
2016 | 2016 | $allairlines = $this->getAllAirlineNames(); |
2017 | 2017 | foreach ($allairlines as $data) { |
2018 | - $this->addStat('aircrafts_byyear',$this->getSumStats('aircrafts_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2019 | - $this->addStat('airlines_byyear',$this->getSumStats('airlines_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2020 | - $this->addStat('owner_byyear',$this->getSumStats('owner_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2021 | - $this->addStat('pilot_byyear',$this->getSumStats('pilot_bymonth',$previous_year,$data['airline_icao']),$previous_year.'-01-01 00:00:00',$data['airline_icao']); |
|
2018 | + $this->addStat('aircrafts_byyear', $this->getSumStats('aircrafts_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2019 | + $this->addStat('airlines_byyear', $this->getSumStats('airlines_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2020 | + $this->addStat('owner_byyear', $this->getSumStats('owner_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2021 | + $this->addStat('pilot_byyear', $this->getSumStats('pilot_bymonth', $previous_year, $data['airline_icao']), $previous_year.'-01-01 00:00:00', $data['airline_icao']); |
|
2022 | 2022 | } |
2023 | 2023 | |
2024 | 2024 | if (isset($globalArchiveYear) && $globalArchiveYear) { |
@@ -2027,7 +2027,7 @@ discard block |
||
2027 | 2027 | try { |
2028 | 2028 | $sth = $this->db->prepare($query); |
2029 | 2029 | $sth->execute(); |
2030 | - } catch(PDOException $e) { |
|
2030 | + } catch (PDOException $e) { |
|
2031 | 2031 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2032 | 2032 | } |
2033 | 2033 | } |
@@ -2036,15 +2036,15 @@ discard block |
||
2036 | 2036 | try { |
2037 | 2037 | $sth = $this->db->prepare($query); |
2038 | 2038 | $sth->execute(); |
2039 | - } catch(PDOException $e) { |
|
2039 | + } catch (PDOException $e) { |
|
2040 | 2040 | return "error : ".$e->getMessage().' - query : '.$query."\n"; |
2041 | 2041 | } |
2042 | 2042 | } |
2043 | 2043 | if (isset($globalDeleteLastYearStats) && $globalDeleteLastYearStats) { |
2044 | 2044 | $last_update = $this->getLastStatsUpdate('last_update_stats'); |
2045 | - if (date('Y',strtotime($last_update[0]['value'])) != date('Y')) { |
|
2045 | + if (date('Y', strtotime($last_update[0]['value'])) != date('Y')) { |
|
2046 | 2046 | $this->deleteOldStats(); |
2047 | - $this->addLastStatsUpdate('last_update_stats',date('Y').'-01-01 00:00:00'); |
|
2047 | + $this->addLastStatsUpdate('last_update_stats', date('Y').'-01-01 00:00:00'); |
|
2048 | 2048 | $lastyearupdate = true; |
2049 | 2049 | } |
2050 | 2050 | } |
@@ -2066,7 +2066,7 @@ discard block |
||
2066 | 2066 | try { |
2067 | 2067 | $sth = $this->db->prepare($query); |
2068 | 2068 | $sth->execute(); |
2069 | - } catch(PDOException $e) { |
|
2069 | + } catch (PDOException $e) { |
|
2070 | 2070 | return "error : ".$e->getMessage(); |
2071 | 2071 | } |
2072 | 2072 | } |
@@ -2080,14 +2080,14 @@ discard block |
||
2080 | 2080 | try { |
2081 | 2081 | $sth = $this->db->prepare($query); |
2082 | 2082 | $sth->execute(); |
2083 | - } catch(PDOException $e) { |
|
2083 | + } catch (PDOException $e) { |
|
2084 | 2084 | return "error : ".$e->getMessage(); |
2085 | 2085 | } |
2086 | 2086 | } |
2087 | 2087 | if (!isset($lastyearupdate)) { |
2088 | 2088 | echo 'Insert last stats update date...'."\n"; |
2089 | 2089 | date_default_timezone_set('UTC'); |
2090 | - $this->addLastStatsUpdate('last_update_stats',date('Y-m-d G:i:s')); |
|
2090 | + $this->addLastStatsUpdate('last_update_stats', date('Y-m-d G:i:s')); |
|
2091 | 2091 | } |
2092 | 2092 | if ($globalStatsResetYear) { |
2093 | 2093 | require_once(dirname(__FILE__).'/../install/class.settings.php'); |
@@ -13,13 +13,13 @@ discard block |
||
13 | 13 | * @param Array $headers header to submit with the form |
14 | 14 | * @return String the result |
15 | 15 | */ |
16 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
|
16 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '') { |
|
17 | 17 | $ch = curl_init(); |
18 | 18 | curl_setopt($ch, CURLOPT_URL, $url); |
19 | 19 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
20 | 20 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
21 | 21 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
22 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
22 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
23 | 23 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
24 | 24 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
25 | 25 | if ($useragent == '') { |
@@ -29,13 +29,13 @@ discard block |
||
29 | 29 | } |
30 | 30 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
31 | 31 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
32 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
32 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
33 | 33 | if ($type == 'post') { |
34 | 34 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
35 | 35 | if (is_array($data)) { |
36 | 36 | curl_setopt($ch, CURLOPT_POST, count($data)); |
37 | 37 | $data_string = ''; |
38 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
38 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
39 | 39 | rtrim($data_string, '&'); |
40 | 40 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
41 | 41 | } else { |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | if ($cookie != '') { |
49 | 49 | if (is_array($cookie)) { |
50 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
50 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
51 | 51 | } else { |
52 | 52 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
53 | 53 | } |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | $result = curl_exec($ch); |
59 | 59 | $info = curl_getinfo($ch); |
60 | 60 | curl_close($ch); |
61 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
61 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
62 | 62 | echo "Cloudflare Detected\n"; |
63 | 63 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
64 | 64 | $useragent = UAgent::random(); |
65 | 65 | cloudflare::useUserAgent($useragent); |
66 | 66 | if ($clearanceCookie = cloudflare::bypass($url)) { |
67 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
67 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
68 | 68 | } |
69 | 69 | } else { |
70 | 70 | return $result; |
@@ -105,27 +105,27 @@ discard block |
||
105 | 105 | if ($data == '') return array(); |
106 | 106 | $html = str_get_html($data); |
107 | 107 | if ($html === false) return array(); |
108 | - $tabledata=array(); |
|
109 | - foreach($html->find('tr') as $element) |
|
108 | + $tabledata = array(); |
|
109 | + foreach ($html->find('tr') as $element) |
|
110 | 110 | { |
111 | 111 | $td = array(); |
112 | - foreach( $element->find('th') as $row) |
|
112 | + foreach ($element->find('th') as $row) |
|
113 | 113 | { |
114 | 114 | $td [] = trim($row->plaintext); |
115 | 115 | } |
116 | - $td=array_filter($td); |
|
116 | + $td = array_filter($td); |
|
117 | 117 | $tabledata[] = $td; |
118 | 118 | |
119 | 119 | $td = array(); |
120 | 120 | $tdi = array(); |
121 | - foreach( $element->find('td') as $row) |
|
121 | + foreach ($element->find('td') as $row) |
|
122 | 122 | { |
123 | 123 | $td [] = trim($row->plaintext); |
124 | 124 | $tdi [] = trim($row->innertext); |
125 | 125 | } |
126 | - $td=array_filter($td); |
|
127 | - $tdi=array_filter($tdi); |
|
128 | - $tabledata[]=array_merge($td,$tdi); |
|
126 | + $td = array_filter($td); |
|
127 | + $tdi = array_filter($tdi); |
|
128 | + $tabledata[] = array_merge($td, $tdi); |
|
129 | 129 | } |
130 | 130 | $html->clear(); |
131 | 131 | unset($html); |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | public function text2array($data) { |
141 | 141 | $html = str_get_html($data); |
142 | 142 | if ($html === false) return array(); |
143 | - $tabledata=array(); |
|
144 | - foreach($html->find('p') as $element) |
|
143 | + $tabledata = array(); |
|
144 | + foreach ($html->find('p') as $element) |
|
145 | 145 | { |
146 | 146 | $tabledata [] = trim($element->plaintext); |
147 | 147 | } |
@@ -161,11 +161,11 @@ discard block |
||
161 | 161 | */ |
162 | 162 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
163 | 163 | if ($lat == $latc && $lon == $lonc) return 0; |
164 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
164 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
165 | 165 | if ($unit == "km") { |
166 | - return round($dist * 1.609344); |
|
166 | + return round($dist*1.609344); |
|
167 | 167 | } elseif ($unit == "m") { |
168 | - return round($dist * 1.609344 * 1000); |
|
168 | + return round($dist*1.609344*1000); |
|
169 | 169 | } elseif ($unit == "mile" || $unit == "mi") { |
170 | 170 | return round($dist); |
171 | 171 | } elseif ($unit == "nm") { |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | * @param float $distance distance covered |
182 | 182 | * @return whether distance is realistic |
183 | 183 | */ |
184 | - public function withinThreshold ($timeDifference, $distance) { |
|
184 | + public function withinThreshold($timeDifference, $distance) { |
|
185 | 185 | $x = abs($timeDifference); |
186 | 186 | $d = abs($distance); |
187 | 187 | if ($x == 0 || $d == 0) return true; |
@@ -197,12 +197,12 @@ discard block |
||
197 | 197 | return ($array !== array_values($array)); |
198 | 198 | } |
199 | 199 | |
200 | - public function isInteger($input){ |
|
200 | + public function isInteger($input) { |
|
201 | 201 | return(ctype_digit(strval($input))); |
202 | 202 | } |
203 | 203 | |
204 | 204 | |
205 | - public function convertDec($dms,$latlong) { |
|
205 | + public function convertDec($dms, $latlong) { |
|
206 | 206 | if ($latlong == 'latitude') { |
207 | 207 | $deg = substr($dms, 0, 2); |
208 | 208 | $min = substr($dms, 2, 4); |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | $deg = substr($dms, 0, 3); |
211 | 211 | $min = substr($dms, 3, 5); |
212 | 212 | } |
213 | - return $deg+(($min*60)/3600); |
|
213 | + return $deg + (($min*60)/3600); |
|
214 | 214 | } |
215 | 215 | |
216 | 216 | /** |
@@ -222,8 +222,8 @@ discard block |
||
222 | 222 | public function xcopy($source, $dest) |
223 | 223 | { |
224 | 224 | $files = glob($source.'*.*'); |
225 | - foreach($files as $file){ |
|
226 | - $file_to_go = str_replace($source,$dest,$file); |
|
225 | + foreach ($files as $file) { |
|
226 | + $file_to_go = str_replace($source, $dest, $file); |
|
227 | 227 | copy($file, $file_to_go); |
228 | 228 | } |
229 | 229 | return true; |
@@ -234,9 +234,9 @@ discard block |
||
234 | 234 | * @param String $url url to check |
235 | 235 | * @return bool Return true on succes false on failure |
236 | 236 | */ |
237 | - public function urlexist($url){ |
|
238 | - $headers=get_headers($url); |
|
239 | - return stripos($headers[0],"200 OK")?true:false; |
|
237 | + public function urlexist($url) { |
|
238 | + $headers = get_headers($url); |
|
239 | + return stripos($headers[0], "200 OK") ? true : false; |
|
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | public function hex2str($hex) { |
248 | 248 | $str = ''; |
249 | 249 | $hexln = strlen($hex); |
250 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
250 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
251 | 251 | return $str; |
252 | 252 | } |
253 | 253 | |
@@ -256,33 +256,33 @@ discard block |
||
256 | 256 | //difference in longitudinal coordinates |
257 | 257 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
258 | 258 | //difference in the phi of latitudinal coordinates |
259 | - $dPhi = log(tan(deg2rad($lat2) / 2 + pi() / 4) / tan(deg2rad($lat1) / 2 + pi() / 4)); |
|
259 | + $dPhi = log(tan(deg2rad($lat2)/2 + pi()/4)/tan(deg2rad($lat1)/2 + pi()/4)); |
|
260 | 260 | //we need to recalculate $dLon if it is greater than pi |
261 | - if(abs($dLon) > pi()) { |
|
262 | - if($dLon > 0) { |
|
263 | - $dLon = (2 * pi() - $dLon) * -1; |
|
261 | + if (abs($dLon) > pi()) { |
|
262 | + if ($dLon > 0) { |
|
263 | + $dLon = (2*pi() - $dLon)*-1; |
|
264 | 264 | } else { |
265 | - $dLon = 2 * pi() + $dLon; |
|
265 | + $dLon = 2*pi() + $dLon; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | //return the angle, normalized |
269 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
269 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
270 | 270 | } |
271 | 271 | |
272 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.1) { |
|
272 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.1) { |
|
273 | 273 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
274 | - $a = -($lon2-$lon1); |
|
274 | + $a = -($lon2 - $lon1); |
|
275 | 275 | $b = $lat2 - $lat1; |
276 | - $c = -($a*$lat1+$b*$lon1); |
|
277 | - $d = $a*$lat3+$b*$lon3+$c; |
|
276 | + $c = -($a*$lat1 + $b*$lon1); |
|
277 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
278 | 278 | if ($d > -$approx && $d < $approx) return true; |
279 | 279 | else return false; |
280 | 280 | } |
281 | 281 | |
282 | 282 | public function array_merge_noappend() { |
283 | 283 | $output = array(); |
284 | - foreach(func_get_args() as $array) { |
|
285 | - foreach($array as $key => $value) { |
|
284 | + foreach (func_get_args() as $array) { |
|
285 | + foreach ($array as $key => $value) { |
|
286 | 286 | $output[$key] = isset($output[$key]) ? |
287 | 287 | array_merge($output[$key], $value) : $value; |
288 | 288 | } |
@@ -323,34 +323,34 @@ discard block |
||
323 | 323 | return $result; |
324 | 324 | } |
325 | 325 | |
326 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1){ |
|
326 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1) { |
|
327 | 327 | global $globalMapRefresh; |
328 | 328 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
329 | 329 | $r = 6378; |
330 | 330 | $latitude = deg2rad($latitude); |
331 | 331 | $longitude = deg2rad($longitude); |
332 | 332 | $bearing = deg2rad($heading); |
333 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
334 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
335 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
333 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
334 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
335 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
336 | 336 | } |
337 | 337 | |
338 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
338 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
339 | 339 | // distance in meter |
340 | 340 | $R = 6378.14; |
341 | - $latitude1 = $latitude * (M_PI/180); |
|
342 | - $longitude1 = $longitude * (M_PI/180); |
|
343 | - $brng = $bearing * (M_PI/180); |
|
341 | + $latitude1 = $latitude*(M_PI/180); |
|
342 | + $longitude1 = $longitude*(M_PI/180); |
|
343 | + $brng = $bearing*(M_PI/180); |
|
344 | 344 | $d = $distance; |
345 | 345 | |
346 | 346 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
347 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
347 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
348 | 348 | |
349 | - $latitude2 = $latitude2 * (180/M_PI); |
|
350 | - $longitude2 = $longitude2 * (180/M_PI); |
|
349 | + $latitude2 = $latitude2*(180/M_PI); |
|
350 | + $longitude2 = $longitude2*(180/M_PI); |
|
351 | 351 | |
352 | - $flat = round ($latitude2,6); |
|
353 | - $flong = round ($longitude2,6); |
|
352 | + $flat = round($latitude2, 6); |
|
353 | + $flong = round($longitude2, 6); |
|
354 | 354 | /* |
355 | 355 | $dx = $distance*cos($bearing); |
356 | 356 | $dy = $distance*sin($bearing); |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | $flong = $longitude + $dlong; |
360 | 360 | $flat = $latitude + $dlat; |
361 | 361 | */ |
362 | - return array('latitude' => $flat,'longitude' => $flong); |
|
362 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
363 | 363 | } |
364 | 364 | |
365 | 365 | /** |
@@ -373,14 +373,14 @@ discard block |
||
373 | 373 | * @param integer $level GZIP compression level (default: 9) |
374 | 374 | * @return string New filename (with .gz appended) if success, or false if operation fails |
375 | 375 | */ |
376 | - public function gzCompressFile($source, $level = 9){ |
|
377 | - $dest = $source . '.gz'; |
|
378 | - $mode = 'wb' . $level; |
|
376 | + public function gzCompressFile($source, $level = 9) { |
|
377 | + $dest = $source.'.gz'; |
|
378 | + $mode = 'wb'.$level; |
|
379 | 379 | $error = false; |
380 | 380 | if ($fp_out = gzopen($dest, $mode)) { |
381 | - if ($fp_in = fopen($source,'rb')) { |
|
381 | + if ($fp_in = fopen($source, 'rb')) { |
|
382 | 382 | while (!feof($fp_in)) |
383 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
383 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
384 | 384 | fclose($fp_in); |
385 | 385 | } else { |
386 | 386 | $error = true; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | public function remove_accents($string) { |
399 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
399 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
400 | 400 | $chars = array( |
401 | 401 | // Decompositions for Latin-1 Supplement |
402 | 402 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
454 | 454 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
455 | 455 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
456 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
456 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
457 | 457 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
458 | 458 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
459 | 459 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
470 | 470 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
471 | 471 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
472 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
473 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
474 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
475 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
476 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
477 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
478 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
472 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
473 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
474 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
475 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
476 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
477 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
478 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
479 | 479 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
480 | 480 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
481 | 481 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |