@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<option></option>'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
26 | + if (empty($airport_names)) { |
|
27 | + $airport_names = $Spotter->getAllAirportNames(); |
|
28 | + } |
|
27 | 29 | ksort($airport_names); |
28 | 30 | foreach($airport_names as $airport_name) |
29 | 31 | { |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['airport'])) { |
7 | - header('Location: '.$globalURL.'/airport'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/airport'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $airport_array = $Spotter->getAllAirportInfo($airport); |
13 | 13 | |
14 | 14 | if (!empty($airport_array)) |
15 | 15 | { |
16 | 16 | //$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
17 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | require_once('header.php'); |
19 | 19 | print '<div class="select-item">'; |
20 | 20 | print '<form action="'.$globalURL.'/airport" method="post">'; |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | $airport_names = $Stats->getAllAirportNames(); |
25 | 25 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
26 | 26 | ksort($airport_names); |
27 | - foreach($airport_names as $airport_name) |
|
27 | + foreach ($airport_names as $airport_name) |
|
28 | 28 | { |
29 | - if($airport == $airport_name['airport_icao']) |
|
29 | + if ($airport == $airport_name['airport_icao']) |
|
30 | 30 | { |
31 | 31 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
32 | 32 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | include('airport-sub-menu.php'); |
58 | 58 | print '<div class="column">'; |
59 | 59 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
60 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
60 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
61 | 61 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByAirport($airport); |
62 | 62 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
63 | 63 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
66 | 66 | print 'var series = ['; |
67 | 67 | $country_data = ''; |
68 | - foreach($airport_country_array as $airport_item) |
|
68 | + foreach ($airport_country_array as $airport_item) |
|
69 | 69 | { |
70 | 70 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
71 | 71 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | print '</thead>'; |
114 | 114 | print '<tbody>'; |
115 | 115 | $i = 1; |
116 | - foreach($airport_country_array as $airport_item) |
|
116 | + foreach ($airport_country_array as $airport_item) |
|
117 | 117 | { |
118 | 118 | print '<tr>'; |
119 | 119 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['airport'])) { |
7 | - header('Location: '.$globalURL.'/airport'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/airport'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<option></option>'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
26 | + if (empty($airport_names)) { |
|
27 | + $airport_names = $Spotter->getAllAirportNames(); |
|
28 | + } |
|
27 | 29 | ksort($airport_names); |
28 | 30 | foreach($airport_names as $airport_name) |
29 | 31 | { |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | //$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
13 | 13 | $airport_array = $Spotter->getAllAirportInfo($airport); |
14 | 14 | |
15 | 15 | if (!empty($airport_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Routes to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($airport == $airport_name['airport_icao']) |
|
30 | + if ($airport == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Routes").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common routes to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $route_array = $Spotter->countAllRoutesByAirport($airport); |
64 | 64 | if (!empty($route_array)) |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | print '</thead>'; |
75 | 75 | print '<tbody>'; |
76 | 76 | $i = 1; |
77 | - foreach($route_array as $route_item) |
|
77 | + foreach ($route_array as $route_item) |
|
78 | 78 | { |
79 | 79 | print '<tr>'; |
80 | 80 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['airport'])) { |
7 | - header('Location: '.$globalURL.'/airport'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/airport'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<option></option>'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
26 | + if (empty($airport_names)) { |
|
27 | + $airport_names = $Spotter->getAllAirportNames(); |
|
28 | + } |
|
27 | 29 | ksort($airport_names); |
28 | 30 | foreach($airport_names as $airport_name) |
29 | 31 | { |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | $airport_array = $Spotter->getAllAirportInfo($airport); |
13 | 13 | |
14 | 14 | if (!empty($airport_array)) |
15 | 15 | { |
16 | 16 | //$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
17 | - $title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Aircraft by Registration to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($_GET['airport'] == $airport_name['airport_icao']) |
|
30 | + if ($_GET['airport'] == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $aircraft_array = $Spotter->countAllAircraftRegistrationByAirport($airport); |
64 | 64 | if (!empty($aircraft_array)) |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | print '</thead>'; |
76 | 76 | print '<tbody>'; |
77 | 77 | $i = 1; |
78 | - foreach($aircraft_array as $aircraft_item) |
|
78 | + foreach ($aircraft_array as $aircraft_item) |
|
79 | 79 | { |
80 | 80 | print '<tr>'; |
81 | 81 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -23,7 +23,9 @@ |
||
23 | 23 | print '<option></option>'; |
24 | 24 | $Stats = new Stats(); |
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
26 | + if (empty($airport_names)) { |
|
27 | + $airport_names = $Spotter->getAllAirportNames(); |
|
28 | + } |
|
27 | 29 | ksort($airport_names); |
28 | 30 | foreach($airport_names as $airport_name) |
29 | 31 | { |
@@ -4,8 +4,8 @@ |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['airport'])) { |
7 | - header('Location: '.$globalURL.'/airport'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/airport'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -7,14 +7,14 @@ discard block |
||
7 | 7 | header('Location: '.$globalURL.'/airport'); |
8 | 8 | die(); |
9 | 9 | } |
10 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
10 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
11 | 11 | $Spotter = new Spotter(); |
12 | 12 | //$spotter_array = $Spotter->getSpotterDataByAirport($airport,"0,1",""); |
13 | 13 | $airport_array = $Spotter->getAllAirportInfo($airport); |
14 | 14 | |
15 | 15 | if (!empty($airport_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
17 | + $title = sprintf(_("Most Common Time of Day to/from %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -25,9 +25,9 @@ discard block |
||
25 | 25 | $airport_names = $Stats->getAllAirportNames(); |
26 | 26 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
27 | 27 | ksort($airport_names); |
28 | - foreach($airport_names as $airport_name) |
|
28 | + foreach ($airport_names as $airport_name) |
|
29 | 29 | { |
30 | - if($airport == $airport_name['airport_icao']) |
|
30 | + if ($airport == $airport_name['airport_icao']) |
|
31 | 31 | { |
32 | 32 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
33 | 33 | } else { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | include('airport-sub-menu.php'); |
59 | 59 | print '<div class="column">'; |
60 | 60 | print '<h2>'._("Most Common Time of Day").'</h2>'; |
61 | - print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
61 | + print '<p>'.sprintf(_("The statistic below shows the most common time of day to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
62 | 62 | |
63 | 63 | $hour_array = $Spotter->countAllHoursByAirport($airport); |
64 | 64 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | $hour_data = ''; |
69 | 69 | $hour_cnt = ''; |
70 | 70 | $last = 0; |
71 | - foreach($hour_array as $hour_item) |
|
71 | + foreach ($hour_array as $hour_item) |
|
72 | 72 | { |
73 | - while($last != $hour_item['hour_name']) { |
|
73 | + while ($last != $hour_item['hour_name']) { |
|
74 | 74 | $hour_data .= '"'.$last.':00",'; |
75 | 75 | $hour_cnt .= '0,'; |
76 | 76 | $last++; |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | $hour_cnt .= $hour_item['hour_count'].','; |
81 | 81 | } |
82 | 82 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
83 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
83 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
84 | 84 | print 'c3.generate({ |
85 | 85 | bindto: "#chartHour", |
86 | 86 | data: { |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | print '</thead>'; |
104 | 104 | print '<tbody>'; |
105 | 105 | $i = 1; |
106 | - foreach($hour_array as $hour_item) |
|
106 | + foreach ($hour_array as $hour_item) |
|
107 | 107 | { |
108 | 108 | print '<tr>'; |
109 | 109 | print '<td>'.$hour_item['hour_name'].':00</td>'; |
@@ -19,10 +19,10 @@ discard block |
||
19 | 19 | if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes(); |
20 | 20 | $previous = null; |
21 | 21 | print '<div class="alphabet-legend">'; |
22 | - foreach($aircraft_types as $value) { |
|
22 | + foreach ($aircraft_types as $value) { |
|
23 | 23 | //$firstLetter = substr($value['aircraft_name'], 0, 1); |
24 | 24 | $firstLetter = substr($value['aircraft_manufacturer'], 0, 1); |
25 | - if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
|
25 | + if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
|
26 | 26 | { |
27 | 27 | if ($previous !== null) print ' | '; |
28 | 28 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
@@ -31,12 +31,12 @@ discard block |
||
31 | 31 | } |
32 | 32 | print '</div>'; |
33 | 33 | $previous = null; |
34 | - foreach($aircraft_types as $value) { |
|
34 | + foreach ($aircraft_types as $value) { |
|
35 | 35 | //$firstLetter = substr($value['aircraft_name'], 0, 1); |
36 | 36 | $firstLetter = substr($value['aircraft_manufacturer'], 0, 1); |
37 | 37 | if ($firstLetter != "") |
38 | 38 | { |
39 | - if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
|
39 | + if ($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
|
40 | 40 | { |
41 | 41 | if ($previous !== null) print '</div>'; |
42 | 42 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
@@ -16,7 +16,9 @@ discard block |
||
16 | 16 | print '<h1>'._("Aircraft Types").'</h1>'; |
17 | 17 | |
18 | 18 | $aircraft_types = $Stats->getAllAircraftTypes(); |
19 | - if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
19 | + if (empty($aircraft_types) || $aircraft_types[0]['aircraft_manufacturer'] == '') { |
|
20 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
21 | + } |
|
20 | 22 | $previous = null; |
21 | 23 | print '<div class="alphabet-legend">'; |
22 | 24 | foreach($aircraft_types as $value) { |
@@ -24,10 +26,14 @@ discard block |
||
24 | 26 | $firstLetter = substr($value['aircraft_manufacturer'], 0, 1); |
25 | 27 | if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
26 | 28 | { |
27 | - if ($previous !== null) print ' | '; |
|
29 | + if ($previous !== null) { |
|
30 | + print ' | '; |
|
31 | + } |
|
28 | 32 | print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>'; |
29 | 33 | } |
30 | - if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter; |
|
34 | + if ($firstLetter != '(' && $firstLetter != ')') { |
|
35 | + $previous = $firstLetter; |
|
36 | + } |
|
31 | 37 | } |
32 | 38 | print '</div>'; |
33 | 39 | $previous = null; |
@@ -38,10 +44,14 @@ discard block |
||
38 | 44 | { |
39 | 45 | if($previous !== $firstLetter && $firstLetter != '(' && $firstLetter != ')') |
40 | 46 | { |
41 | - if ($previous !== null) print '</div>'; |
|
47 | + if ($previous !== null) { |
|
48 | + print '</div>'; |
|
49 | + } |
|
42 | 50 | print '<a name="'.$firstLetter.'"></a><h4 class="alphabet-header">'.$firstLetter.'</h4><div class="alphabet">'; |
43 | 51 | } |
44 | - if ($firstLetter != '(' && $firstLetter != ')') $previous = $firstLetter; |
|
52 | + if ($firstLetter != '(' && $firstLetter != ')') { |
|
53 | + $previous = $firstLetter; |
|
54 | + } |
|
45 | 55 | print '<div class="alphabet-item">'; |
46 | 56 | print '<a href="'.$globalURL.'/aircraft/'.$value['aircraft_icao'].'">'; |
47 | 57 | if ($value['aircraft_name'] == '') { |
@@ -23,12 +23,12 @@ |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
26 | - * Get Accidents data from DB |
|
27 | - * @param String $limit Limit |
|
28 | - * @param String $type Set type accident or incident |
|
29 | - * @param String $date get data for a date |
|
30 | - * @return Array Return Accidents data in array |
|
31 | - */ |
|
26 | + * Get Accidents data from DB |
|
27 | + * @param String $limit Limit |
|
28 | + * @param String $type Set type accident or incident |
|
29 | + * @param String $date get data for a date |
|
30 | + * @return Array Return Accidents data in array |
|
31 | + */ |
|
32 | 32 | public function getAccidentData($limit = '',$type = '',$date = '') { |
33 | 33 | global $globalURL, $globalDBdriver; |
34 | 34 | $Image = new Image($this->db); |
@@ -42,20 +42,20 @@ discard block |
||
42 | 42 | * @param String $date get data for a date |
43 | 43 | * @return Array Return Accidents data in array |
44 | 44 | */ |
45 | - public function getAccidentData($limit = '',$type = '',$date = '') { |
|
45 | + public function getAccidentData($limit = '', $type = '', $date = '') { |
|
46 | 46 | global $globalURL, $globalDBdriver; |
47 | 47 | $Image = new Image($this->db); |
48 | 48 | $Spotter = new Spotter($this->db); |
49 | 49 | $Translation = new Translation($this->db); |
50 | - $date = filter_var($date,FILTER_SANITIZE_STRING); |
|
50 | + $date = filter_var($date, FILTER_SANITIZE_STRING); |
|
51 | 51 | date_default_timezone_set('UTC'); |
52 | 52 | $result = array(); |
53 | 53 | $limit_query = ''; |
54 | 54 | if ($limit != "") |
55 | 55 | { |
56 | 56 | $limit_array = explode(",", $limit); |
57 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
58 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
57 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
58 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
59 | 59 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
60 | 60 | { |
61 | 61 | $limit_query = " LIMIT ".$limit_array[1]." OFFSET ".$limit_array[0]; |
@@ -64,29 +64,29 @@ discard block |
||
64 | 64 | |
65 | 65 | if ($type != '') { |
66 | 66 | if ($date != '') { |
67 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
67 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
68 | 68 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
69 | 69 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
70 | - $query_values = array(':type' => $type,':date' => $date); |
|
71 | - } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/",$date)) { |
|
70 | + $query_values = array(':type' => $type, ':date' => $date); |
|
71 | + } elseif (preg_match("/^[0-9]{4}-[0-9]{2}$/", $date)) { |
|
72 | 72 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND date BETWEEN :dated AND :datef GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
73 | - $query_values = array(':type' => $type,':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
74 | - } elseif (preg_match("/^[0-9]{4}$/",$date)) { |
|
73 | + $query_values = array(':type' => $type, ':dated' => $date.'-01', ':datef' => $date.'-31'); |
|
74 | + } elseif (preg_match("/^[0-9]{4}$/", $date)) { |
|
75 | 75 | if ($globalDBdriver == 'mysql') { |
76 | 76 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND YEAR(date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
77 | 77 | } else { |
78 | 78 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND EXTRACT(YEAR FROM date) = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
79 | 79 | } |
80 | - $query_values = array(':type' => $type,':date' => $date); |
|
80 | + $query_values = array(':type' => $type, ':date' => $date); |
|
81 | 81 | } else { |
82 | 82 | $date = $date.'%'; |
83 | 83 | if ($globalDBdriver == 'mysql') { |
84 | 84 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND DATE_FORMAT(date,'%Y-%m-%d') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
85 | - $query_values = array(':type' => $type,':date' => $date); |
|
85 | + $query_values = array(':type' => $type, ':date' => $date); |
|
86 | 86 | } else { |
87 | 87 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
88 | 88 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE type = :type AND to_char(date,'YYYY-MM-DD') LIKE :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
89 | - $query_values = array(':type' => $type,':date' => $date); |
|
89 | + $query_values = array(':type' => $type, ':date' => $date); |
|
90 | 90 | } |
91 | 91 | } |
92 | 92 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } else { |
99 | 99 | if ($date != '') { |
100 | - if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/",$date)) { |
|
100 | + if (preg_match("/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/", $date)) { |
|
101 | 101 | $query = "SELECT * FROM accidents WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
102 | 102 | //$query = "SELECT accidents.registration, accidents.ident, accidents.date, accidents.url, accidents.country, accidents.place, accidents.title, accidents.fatalities, accidents.type, accidents.ident, accidents.aircraft_manufacturer, accidents.aircraft_name, accidents.airline_name, accidents.airline_icao, spotter_output.flightaware_id FROM accidents LEFT OUTER JOIN spotter_output ON accidents.registration = spotter_output.registration WHERE accidents_id IN (SELECT max(accidents_id) FROM accidents WHERE date = :date GROUP BY registration) ORDER BY accidents.date DESC".$limit_query; |
103 | 103 | } else { |
@@ -116,17 +116,17 @@ discard block |
||
116 | 116 | try { |
117 | 117 | $sth = $this->db->prepare($query); |
118 | 118 | $sth->execute($query_values); |
119 | - } catch(PDOException $e) { |
|
119 | + } catch (PDOException $e) { |
|
120 | 120 | echo "error : ".$e->getMessage(); |
121 | 121 | } |
122 | 122 | $i = 0; |
123 | 123 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
124 | - if (preg_match('/^[\w\-]+$/',$row['registration'])) { |
|
124 | + if (preg_match('/^[\w\-]+$/', $row['registration'])) { |
|
125 | 125 | $data = array(); |
126 | 126 | if ($row['registration'] != '') { |
127 | 127 | $image_array = $Image->getSpotterImage($row['registration']); |
128 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
129 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
128 | + if (count($image_array) > 0) $data = array_merge($data, array('image' => $image_array[0]['image'], 'image_thumbnail' => $image_array[0]['image_thumbnail'], 'image_copyright' => $image_array[0]['image_copyright'], 'image_source' => $image_array[0]['image_source'], 'image_source_website' => $image_array[0]['image_source_website'])); |
|
129 | + else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
130 | 130 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
131 | 131 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
132 | 132 | if (!empty($aircraft_info)) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $data['aircraft_name'] = $aircraft_info[0]['type']; |
135 | 135 | $data['aircraft_manufacturer'] = $aircraft_info[0]['manufacturer']; |
136 | 136 | } else { |
137 | - $data = array_merge($data,array('aircraft_type' => 'NA')); |
|
137 | + $data = array_merge($data, array('aircraft_type' => 'NA')); |
|
138 | 138 | } |
139 | 139 | $owner_data = $Spotter->getAircraftOwnerByRegistration($row['registration']); |
140 | 140 | if (!empty($owner_data)) { |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | $data['aircraft_base'] = $owner_data['base']; |
143 | 143 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
144 | 144 | } |
145 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
145 | + } else $data = array_merge($data, array('image' => '', 'image_thumbnail' => '', 'image_copyright' => '', 'image_source' => '', 'image_source_website' => '')); |
|
146 | 146 | if ($row['registration'] == '') $row['registration'] = 'NA'; |
147 | 147 | if ($row['ident'] == '') $row['ident'] = 'NA'; |
148 | - $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
|
148 | + $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'], 0, 3)); |
|
149 | 149 | if (isset($identicao[0])) { |
150 | - if (substr($row['ident'],0,2) == 'AF') { |
|
151 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
152 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
153 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
154 | - $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
|
150 | + if (substr($row['ident'], 0, 2) == 'AF') { |
|
151 | + if (filter_var(substr($row['ident'], 2), FILTER_VALIDATE_INT, array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
152 | + else $icao = 'AFR'.ltrim(substr($row['ident'], 2), '0'); |
|
153 | + } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'], 2), '0'); |
|
154 | + $data = array_merge($data, array('airline_icao' => $identicao[0]['icao'], 'airline_name' => $identicao[0]['name'])); |
|
155 | 155 | } else $icao = $row['ident']; |
156 | - $icao = $Translation->checkTranslation($icao,false); |
|
156 | + $icao = $Translation->checkTranslation($icao, false); |
|
157 | 157 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
158 | 158 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
159 | 159 | //echo 'Check airline info... for '.$row['airline_name'].' '; |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | if (!empty($airline_info)) { |
163 | 163 | //echo 'data found !'."\n"; |
164 | 164 | //print_r($airline_info); |
165 | - $data = array_merge($data,$airline_info); |
|
165 | + $data = array_merge($data, $airline_info); |
|
166 | 166 | } |
167 | 167 | //else echo 'No data...'."\n"; |
168 | 168 | } |
169 | - $data = array_merge($row,$data); |
|
169 | + $data = array_merge($row, $data); |
|
170 | 170 | if ($data['ident'] == null) $data['ident'] = $icao; |
171 | 171 | if ($data['title'] == null) { |
172 | 172 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
173 | 173 | } else $data['message'] = strtolower($data['title']); |
174 | - $ids = $Spotter->getAllIDByRegistration($data['registration'],true); |
|
174 | + $ids = $Spotter->getAllIDByRegistration($data['registration'], true); |
|
175 | 175 | $date = $data['date']; |
176 | 176 | if (isset($ids[$date])) { |
177 | 177 | $data['spotted'] = TRUE; |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | try { |
204 | 204 | $sth = $this->db->prepare($query); |
205 | 205 | $sth->execute(); |
206 | - } catch(PDOException $e) { |
|
206 | + } catch (PDOException $e) { |
|
207 | 207 | echo "Error : ".$e->getMessage(); |
208 | 208 | } |
209 | 209 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | try { |
224 | 224 | $sth = $this->db->prepare($query); |
225 | 225 | $sth->execute(); |
226 | - } catch(PDOException $e) { |
|
226 | + } catch (PDOException $e) { |
|
227 | 227 | echo "Error : ".$e->getMessage(); |
228 | 228 | } |
229 | 229 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -238,15 +238,15 @@ discard block |
||
238 | 238 | if ($globalDebug) echo 'Import '.$file."\n"; |
239 | 239 | $result = array(); |
240 | 240 | if (file_exists($file)) { |
241 | - if (($handle = fopen($file,'r')) !== FALSE) { |
|
242 | - while (($data = fgetcsv($handle,2000,",")) !== FALSE) { |
|
241 | + if (($handle = fopen($file, 'r')) !== FALSE) { |
|
242 | + while (($data = fgetcsv($handle, 2000, ",")) !== FALSE) { |
|
243 | 243 | if (isset($data[1]) && $data[1] != '0000-00-00 00:00:00') { |
244 | - $result[] = array('registration' => $data[0],'date' => strtotime($data[1]),'url' => $data[2],'country' => $data[3],'place' => $data[4],'title' => $data[5],'fatalities' => $data[6],'latitude' => $data[7],'longitude' => $data[8],'type' => $data[9],'ident' => $data[10],'aircraft_manufacturer' => $data[11],'aircraft_name' => $data[12],'operator' => $data[13],'source' => 'website_fam'); |
|
244 | + $result[] = array('registration' => $data[0], 'date' => strtotime($data[1]), 'url' => $data[2], 'country' => $data[3], 'place' => $data[4], 'title' => $data[5], 'fatalities' => $data[6], 'latitude' => $data[7], 'longitude' => $data[8], 'type' => $data[9], 'ident' => $data[10], 'aircraft_manufacturer' => $data[11], 'aircraft_name' => $data[12], 'operator' => $data[13], 'source' => 'website_fam'); |
|
245 | 245 | } |
246 | 246 | } |
247 | 247 | fclose($handle); |
248 | 248 | } |
249 | - if (!empty($result)) $this->add($result,true); |
|
249 | + if (!empty($result)) $this->add($result, true); |
|
250 | 250 | elseif ($globalDebug) echo 'Nothing to import'; |
251 | 251 | } |
252 | 252 | } |
@@ -262,8 +262,8 @@ discard block |
||
262 | 262 | $all_md5_new = array(); |
263 | 263 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
264 | 264 | if ($this->check_accidents_nb() > 0) { |
265 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
266 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
265 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
266 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
267 | 267 | if (isset($data[1])) { |
268 | 268 | $year = $data[0]; |
269 | 269 | $all_md5[$year] = $data[1]; |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | } |
274 | 274 | } |
275 | 275 | } |
276 | - $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5',dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
276 | + $Common->download('http://data.flightairmap.fr/data/cr/cr-all.md5', dirname(__FILE__).'/../install/tmp/cr-all.md5'); |
|
277 | 277 | if (file_exists(dirname(__FILE__).'/../install/tmp/cr-all.md5')) { |
278 | - if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5','r')) !== FALSE) { |
|
279 | - while (($data = fgetcsv($handle,2000,"\t")) !== FALSE) { |
|
278 | + if (($handle = fopen(dirname(__FILE__).'/../install/tmp/cr-all.md5', 'r')) !== FALSE) { |
|
279 | + while (($data = fgetcsv($handle, 2000, "\t")) !== FALSE) { |
|
280 | 280 | if (isset($data[1])) { |
281 | 281 | $year = $data[0]; |
282 | 282 | $all_md5_new[$year] = $data[1]; |
@@ -285,10 +285,10 @@ discard block |
||
285 | 285 | fclose($handle); |
286 | 286 | } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
287 | 287 | } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
288 | - $result = $Common->arr_diff($all_md5_new,$all_md5); |
|
288 | + $result = $Common->arr_diff($all_md5_new, $all_md5); |
|
289 | 289 | if (empty($result) && $globalDebug) echo 'Nothing to update'; |
290 | 290 | foreach ($result as $file => $md5) { |
291 | - $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
|
291 | + $Common->download('http://data.flightairmap.fr/data/cr/'.$file, dirname(__FILE__).'/../install/tmp/'.$file); |
|
292 | 292 | if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
293 | 293 | elseif ($globalDebug) echo 'Download '.$file.' failed'; |
294 | 294 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | * Add data to DB |
299 | 299 | * @param Array $crash An array with accidents/incidents data |
300 | 300 | */ |
301 | - public function add($crash,$new = false) { |
|
301 | + public function add($crash, $new = false) { |
|
302 | 302 | global $globalTransaction, $globalDebug, $globalAircraftImageFetch; |
303 | 303 | require_once('class.Connection.php'); |
304 | 304 | require_once('class.Image.php'); |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | $sthd->execute(array(':source' => $crash[0]['source'])); |
315 | 315 | } |
316 | 316 | if ($globalTransaction) $Connection->db->beginTransaction(); |
317 | - $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
|
317 | + $initial_array = array('ident' => null, 'type' => 'accident', 'url' => null, 'registration' => null, 'date' => null, 'place' => null, 'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '', 'source' => '', 'aircraft_manufacturer' => null, 'aircraft_name' => null, 'operator' => null); |
|
318 | 318 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
319 | 319 | $sth_check = $Connection->db->prepare($query_check); |
320 | 320 | $query = 'INSERT INTO accidents (aircraft_manufacturer,aircraft_name,ident,registration,date,url,country,place,title,fatalities,latitude,longitude,type,airline_name,source) VALUES (:aircraft_manufacturer,:aircraft_name,:ident,:registration,:date,:url,:country,:place,:title,:fatalities,:latitude,:longitude,:type,:airline_name,:source)'; |
@@ -327,15 +327,15 @@ discard block |
||
327 | 327 | $cr = array_map(function($value) { |
328 | 328 | return $value === "" ? NULL : $value; |
329 | 329 | }, $cr); |
330 | - if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
|
331 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
332 | - $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
|
330 | + if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/', $cr['registration'])) { |
|
331 | + if (strpos($cr['registration'], '-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
332 | + $query_check_values = array(':registration' => $cr['registration'], ':date' => date('Y-m-d', $cr['date']), ':type' => $cr['type'], ':source' => $cr['source']); |
|
333 | 333 | $sth_check->execute($query_check_values); |
334 | 334 | $result_check = $sth_check->fetchAll(PDO::FETCH_ASSOC); |
335 | 335 | if ($result_check[0]['nb'] == 0) { |
336 | - $query_values = array(':registration' => trim($cr['registration']),':date' => date('Y-m-d',$cr['date']),':url' => $cr['url'],':country' => $cr['country'],':place' => $cr['place'],':title' => $cr['title'],':fatalities' => $cr['fatalities'],':latitude' => $cr['latitude'],':longitude' => $cr['longitude'],':type' => $cr['type'],':source' => $cr['source'],':ident' => $cr['ident'],':aircraft_manufacturer' => $cr['aircraft_manufacturer'],':aircraft_name' => $cr['aircraft_name'],':airline_name' => $cr['operator']); |
|
336 | + $query_values = array(':registration' => trim($cr['registration']), ':date' => date('Y-m-d', $cr['date']), ':url' => $cr['url'], ':country' => $cr['country'], ':place' => $cr['place'], ':title' => $cr['title'], ':fatalities' => $cr['fatalities'], ':latitude' => $cr['latitude'], ':longitude' => $cr['longitude'], ':type' => $cr['type'], ':source' => $cr['source'], ':ident' => $cr['ident'], ':aircraft_manufacturer' => $cr['aircraft_manufacturer'], ':aircraft_name' => $cr['aircraft_name'], ':airline_name' => $cr['operator']); |
|
337 | 337 | $sth->execute($query_values); |
338 | - if ($globalAircraftImageFetch && $cr['date'] > time()-(30*86400)) { |
|
338 | + if ($globalAircraftImageFetch && $cr['date'] > time() - (30*86400)) { |
|
339 | 339 | $imgchk = $Image->getSpotterImage($cr['registration']); |
340 | 340 | if (empty($imgchk)) { |
341 | 341 | if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...'; |
@@ -345,16 +345,16 @@ discard block |
||
345 | 345 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
346 | 346 | } |
347 | 347 | if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type']; |
348 | - $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
|
348 | + $Spotter->setHighlightFlightByRegistration($cr['registration'], $cr['title'], date('Y-m-d', $cr['date'])); |
|
349 | 349 | } |
350 | 350 | } |
351 | - if ($globalTransaction && $j % 1000 == 0) { |
|
351 | + if ($globalTransaction && $j%1000 == 0) { |
|
352 | 352 | $Connection->db->commit(); |
353 | 353 | $Connection->db->beginTransaction(); |
354 | 354 | } |
355 | 355 | } |
356 | 356 | if ($globalTransaction) $Connection->db->commit(); |
357 | - } catch(PDOException $e) { |
|
357 | + } catch (PDOException $e) { |
|
358 | 358 | if ($globalTransaction) $Connection->db->rollBack(); |
359 | 359 | echo $e->getMessage(); |
360 | 360 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | $Connection = new Connection(); |
373 | 373 | $sth = $Connection->db->prepare($query); |
374 | 374 | $sth->execute(); |
375 | - } catch(PDOException $e) { |
|
375 | + } catch (PDOException $e) { |
|
376 | 376 | return "error : ".$e->getMessage(); |
377 | 377 | } |
378 | 378 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | $Connection = new Connection(); |
391 | 391 | $sth = $Connection->db->prepare($query); |
392 | 392 | $sth->execute(); |
393 | - } catch(PDOException $e) { |
|
393 | + } catch (PDOException $e) { |
|
394 | 394 | return "error : ".$e->getMessage(); |
395 | 395 | } |
396 | 396 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -405,7 +405,7 @@ discard block |
||
405 | 405 | $Connection = new Connection(); |
406 | 406 | $sth = $Connection->db->prepare($query); |
407 | 407 | $sth->execute(); |
408 | - } catch(PDOException $e) { |
|
408 | + } catch (PDOException $e) { |
|
409 | 409 | return "error : ".$e->getMessage(); |
410 | 410 | } |
411 | 411 | } |
@@ -20,7 +20,9 @@ discard block |
||
20 | 20 | public function __construct($dbc = null) { |
21 | 21 | $Connection = new Connection($dbc); |
22 | 22 | $this->db = $Connection->db(); |
23 | - if ($this->db === null) die('Error: No DB connection. (Accident)'); |
|
23 | + if ($this->db === null) { |
|
24 | + die('Error: No DB connection. (Accident)'); |
|
25 | + } |
|
24 | 26 | } |
25 | 27 | |
26 | 28 | /* |
@@ -125,8 +127,11 @@ discard block |
||
125 | 127 | $data = array(); |
126 | 128 | if ($row['registration'] != '') { |
127 | 129 | $image_array = $Image->getSpotterImage($row['registration']); |
128 | - if (count($image_array) > 0) $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
129 | - else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
130 | + if (count($image_array) > 0) { |
|
131 | + $data = array_merge($data,array('image' => $image_array[0]['image'],'image_thumbnail' => $image_array[0]['image_thumbnail'],'image_copyright' => $image_array[0]['image_copyright'],'image_source' => $image_array[0]['image_source'],'image_source_website' => $image_array[0]['image_source_website'])); |
|
132 | + } else { |
|
133 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
134 | + } |
|
130 | 135 | $aircraft_type = $Spotter->getAllAircraftTypeByRegistration($row['registration']); |
131 | 136 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_type); |
132 | 137 | if (!empty($aircraft_info)) { |
@@ -142,17 +147,30 @@ discard block |
||
142 | 147 | $data['aircraft_base'] = $owner_data['base']; |
143 | 148 | $data['aircraft_date_first_reg'] = $owner_data['date_first_reg']; |
144 | 149 | } |
145 | - } else $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
146 | - if ($row['registration'] == '') $row['registration'] = 'NA'; |
|
147 | - if ($row['ident'] == '') $row['ident'] = 'NA'; |
|
150 | + } else { |
|
151 | + $data = array_merge($data,array('image' => '','image_thumbnail' => '','image_copyright' => '','image_source' => '','image_source_website' => '')); |
|
152 | + } |
|
153 | + if ($row['registration'] == '') { |
|
154 | + $row['registration'] = 'NA'; |
|
155 | + } |
|
156 | + if ($row['ident'] == '') { |
|
157 | + $row['ident'] = 'NA'; |
|
158 | + } |
|
148 | 159 | $identicao = $Spotter->getAllAirlineInfo(substr($row['ident'],0,3)); |
149 | 160 | if (isset($identicao[0])) { |
150 | 161 | if (substr($row['ident'],0,2) == 'AF') { |
151 | - if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) $icao = $row['ident']; |
|
152 | - else $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
153 | - } else $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
162 | + if (filter_var(substr($row['ident'],2),FILTER_VALIDATE_INT,array("flags"=>FILTER_FLAG_ALLOW_OCTAL))) { |
|
163 | + $icao = $row['ident']; |
|
164 | + } else { |
|
165 | + $icao = 'AFR'.ltrim(substr($row['ident'],2),'0'); |
|
166 | + } |
|
167 | + } else { |
|
168 | + $icao = $identicao[0]['icao'].ltrim(substr($row['ident'],2),'0'); |
|
169 | + } |
|
154 | 170 | $data = array_merge($data,array('airline_icao' => $identicao[0]['icao'],'airline_name' => $identicao[0]['name'])); |
155 | - } else $icao = $row['ident']; |
|
171 | + } else { |
|
172 | + $icao = $row['ident']; |
|
173 | + } |
|
156 | 174 | $icao = $Translation->checkTranslation($icao,false); |
157 | 175 | //$data = array_merge($data,array('registration' => $row['registration'], 'date' => $row['date'], 'ident' => $icao,'url' => $row['url'])); |
158 | 176 | if ($row['airline_name'] != '' && !isset($data['airline_name'])) { |
@@ -167,10 +185,14 @@ discard block |
||
167 | 185 | //else echo 'No data...'."\n"; |
168 | 186 | } |
169 | 187 | $data = array_merge($row,$data); |
170 | - if ($data['ident'] == null) $data['ident'] = $icao; |
|
188 | + if ($data['ident'] == null) { |
|
189 | + $data['ident'] = $icao; |
|
190 | + } |
|
171 | 191 | if ($data['title'] == null) { |
172 | 192 | $data['message'] = $row['type'].' of '.$row['registration'].' at '.$row['place'].','.$row['country']; |
173 | - } else $data['message'] = strtolower($data['title']); |
|
193 | + } else { |
|
194 | + $data['message'] = strtolower($data['title']); |
|
195 | + } |
|
174 | 196 | $ids = $Spotter->getAllIDByRegistration($data['registration'],true); |
175 | 197 | $date = $data['date']; |
176 | 198 | if (isset($ids[$date])) { |
@@ -189,8 +211,9 @@ discard block |
||
189 | 211 | if (isset($result)) { |
190 | 212 | $result[0]['query_number_rows'] = $i; |
191 | 213 | return $result; |
214 | + } else { |
|
215 | + return array(); |
|
192 | 216 | } |
193 | - else return array(); |
|
194 | 217 | } |
195 | 218 | |
196 | 219 | /* |
@@ -235,7 +258,9 @@ discard block |
||
235 | 258 | */ |
236 | 259 | public function import($file) { |
237 | 260 | global $globalTransaction, $globalDebug; |
238 | - if ($globalDebug) echo 'Import '.$file."\n"; |
|
261 | + if ($globalDebug) { |
|
262 | + echo 'Import '.$file."\n"; |
|
263 | + } |
|
239 | 264 | $result = array(); |
240 | 265 | if (file_exists($file)) { |
241 | 266 | if (($handle = fopen($file,'r')) !== FALSE) { |
@@ -246,8 +271,11 @@ discard block |
||
246 | 271 | } |
247 | 272 | fclose($handle); |
248 | 273 | } |
249 | - if (!empty($result)) $this->add($result,true); |
|
250 | - elseif ($globalDebug) echo 'Nothing to import'; |
|
274 | + if (!empty($result)) { |
|
275 | + $this->add($result,true); |
|
276 | + } elseif ($globalDebug) { |
|
277 | + echo 'Nothing to import'; |
|
278 | + } |
|
251 | 279 | } |
252 | 280 | } |
253 | 281 | |
@@ -283,14 +311,23 @@ discard block |
||
283 | 311 | } |
284 | 312 | } |
285 | 313 | fclose($handle); |
286 | - } elseif ($globalDebug) echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
287 | - } elseif ($globalDebug) echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
314 | + } elseif ($globalDebug) { |
|
315 | + echo "Can't open ".dirname(__FILE__).'/../install/tmp/cr-all.md5'; |
|
316 | + } |
|
317 | + } elseif ($globalDebug) { |
|
318 | + echo 'Download cr-all.md5 failed. '.dirname(__FILE__).'/../install/tmp/cr-all.md5 not here.'; |
|
319 | + } |
|
288 | 320 | $result = $Common->arr_diff($all_md5_new,$all_md5); |
289 | - if (empty($result) && $globalDebug) echo 'Nothing to update'; |
|
321 | + if (empty($result) && $globalDebug) { |
|
322 | + echo 'Nothing to update'; |
|
323 | + } |
|
290 | 324 | foreach ($result as $file => $md5) { |
291 | 325 | $Common->download('http://data.flightairmap.fr/data/cr/'.$file,dirname(__FILE__).'/../install/tmp/'.$file); |
292 | - if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
293 | - elseif ($globalDebug) echo 'Download '.$file.' failed'; |
|
326 | + if (file_exists(dirname(__FILE__).'/../install/tmp/'.$file)) { |
|
327 | + $this->import(dirname(__FILE__).'/../install/tmp/'.$file); |
|
328 | + } elseif ($globalDebug) { |
|
329 | + echo 'Download '.$file.' failed'; |
|
330 | + } |
|
294 | 331 | } |
295 | 332 | } |
296 | 333 | |
@@ -307,13 +344,17 @@ discard block |
||
307 | 344 | $Image = new Image($this->db); |
308 | 345 | $Spotter = new Spotter($this->db); |
309 | 346 | |
310 | - if (empty($crash)) return false; |
|
347 | + if (empty($crash)) { |
|
348 | + return false; |
|
349 | + } |
|
311 | 350 | if (!$new) { |
312 | 351 | $query_delete = 'DELETE FROM accidents WHERE source = :source'; |
313 | 352 | $sthd = $Connection->db->prepare($query_delete); |
314 | 353 | $sthd->execute(array(':source' => $crash[0]['source'])); |
315 | 354 | } |
316 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
355 | + if ($globalTransaction) { |
|
356 | + $Connection->db->beginTransaction(); |
|
357 | + } |
|
317 | 358 | $initial_array = array('ident' => null,'type' => 'accident','url' => null,'registration' => null, 'date' => null, 'place' => null,'country' => null, 'latitude' => null, 'longitude' => null, 'fatalities' => null, 'title' => '','source' => '','aircraft_manufacturer' => null,'aircraft_name' => null,'operator' => null); |
318 | 359 | $query_check = 'SELECT COUNT(*) as nb FROM accidents WHERE registration = :registration AND date = :date AND type = :type AND source = :source'; |
319 | 360 | $sth_check = $Connection->db->prepare($query_check); |
@@ -328,7 +369,9 @@ discard block |
||
328 | 369 | return $value === "" ? NULL : $value; |
329 | 370 | }, $cr); |
330 | 371 | if ($cr['date'] != '' && $cr['registration'] != null && $cr['registration'] != '' && $cr['registration'] != '?' && $cr['registration'] != '-' && strtolower($cr['registration']) != 'unknown' && $cr['date'] < time() && !preg_match('/\s/',$cr['registration'])) { |
331 | - if (strpos($cr['registration'],'-') === FALSE) $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
372 | + if (strpos($cr['registration'],'-') === FALSE) { |
|
373 | + $cr['registration'] = $Spotter->convertAircraftRegistration($cr['registration']); |
|
374 | + } |
|
332 | 375 | $query_check_values = array(':registration' => $cr['registration'],':date' => date('Y-m-d',$cr['date']),':type' => $cr['type'],':source' => $cr['source']); |
333 | 376 | $sth_check->execute($query_check_values); |
334 | 377 | $result_check = $sth_check->fetchAll(PDO::FETCH_ASSOC); |
@@ -338,13 +381,19 @@ discard block |
||
338 | 381 | if ($globalAircraftImageFetch && $cr['date'] > time()-(30*86400)) { |
339 | 382 | $imgchk = $Image->getSpotterImage($cr['registration']); |
340 | 383 | if (empty($imgchk)) { |
341 | - if ($globalDebug) echo "\t".'Get image for '.$cr['registration'].'...'; |
|
384 | + if ($globalDebug) { |
|
385 | + echo "\t".'Get image for '.$cr['registration'].'...'; |
|
386 | + } |
|
342 | 387 | $Image->addSpotterImage($cr['registration']); |
343 | - if ($globalDebug) echo "\t".'Done'."\n"; |
|
388 | + if ($globalDebug) { |
|
389 | + echo "\t".'Done'."\n"; |
|
390 | + } |
|
344 | 391 | } |
345 | 392 | // elseif ($globalDebug) echo 'Image already in DB'."\n"; |
346 | 393 | } |
347 | - if ($cr['title'] == '') $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
394 | + if ($cr['title'] == '') { |
|
395 | + $cr['title'] = $cr['registration'].' '.$cr['type']; |
|
396 | + } |
|
348 | 397 | $Spotter->setHighlightFlightByRegistration($cr['registration'],$cr['title'],date('Y-m-d',$cr['date'])); |
349 | 398 | } |
350 | 399 | } |
@@ -353,9 +402,13 @@ discard block |
||
353 | 402 | $Connection->db->beginTransaction(); |
354 | 403 | } |
355 | 404 | } |
356 | - if ($globalTransaction) $Connection->db->commit(); |
|
405 | + if ($globalTransaction) { |
|
406 | + $Connection->db->commit(); |
|
407 | + } |
|
357 | 408 | } catch(PDOException $e) { |
358 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
409 | + if ($globalTransaction) { |
|
410 | + $Connection->db->rollBack(); |
|
411 | + } |
|
359 | 412 | echo $e->getMessage(); |
360 | 413 | } |
361 | 414 | $sth_check->closeCursor(); |
@@ -394,8 +447,11 @@ discard block |
||
394 | 447 | return "error : ".$e->getMessage(); |
395 | 448 | } |
396 | 449 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
397 | - if ($row['nb'] > 0) return false; |
|
398 | - else return true; |
|
450 | + if ($row['nb'] > 0) { |
|
451 | + return false; |
|
452 | + } else { |
|
453 | + return true; |
|
454 | + } |
|
399 | 455 | } |
400 | 456 | |
401 | 457 | public static function insert_last_accidents_update() { |
@@ -58,8 +58,12 @@ |
||
58 | 58 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
59 | 59 | include('table-output.php'); |
60 | 60 | print '<div class="pagination">'; |
61 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
62 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
61 | + if ($limit_previous_1 >= 0) { |
|
62 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
63 | + } |
|
64 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
65 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
66 | + } |
|
63 | 67 | print '</div>'; |
64 | 68 | } |
65 | 69 | print '</div>'; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $page_url = $globalURL.'/accident-latest'; |
10 | 10 | |
11 | -if(!isset($_GET['limit'])) |
|
11 | +if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | print '<div class="table column">'; |
35 | 35 | print '<p>'._("The table below shows the latest Accidents.").'</p>'; |
36 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident'); |
|
36 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident'); |
|
37 | 37 | if (!empty($spotter_array) && isset($spotter_array[0]['query_number_rows']) && $spotter_array[0]['query_number_rows'] != 0) { |
38 | 38 | include('table-output.php'); |
39 | 39 | print '<div class="pagination">'; |
@@ -4,7 +4,9 @@ |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
7 | -if (!isset($filter_name)) $filter_name = ''; |
|
7 | +if (!isset($filter_name)) { |
|
8 | + $filter_name = ''; |
|
9 | +} |
|
8 | 10 | require_once('header.php'); |
9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Airline by Country"); |
7 | 7 | if (!isset($filter_name)) $filter_name = ''; |
8 | 8 | require_once('header.php'); |
9 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
10 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
9 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
11 | 11 | include('statistics-sub-menu.php'); |
12 | 12 | |
13 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | </div> |
19 | 19 | <p>'._("Below are the <strong>Top 10</strong> countries that an airline belongs to.").'</p>'; |
20 | 20 | |
21 | -$airline_array = $Stats->countAllAirlineCountries(true,$filter_name,$year,$month); |
|
21 | +$airline_array = $Stats->countAllAirlineCountries(true, $filter_name, $year, $month); |
|
22 | 22 | if (count($airline_array) > 0) { |
23 | 23 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
24 | 24 | $country_data = ''; |
25 | -foreach($airline_array as $airline_item) |
|
25 | +foreach ($airline_array as $airline_item) |
|
26 | 26 | { |
27 | 27 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
28 | 28 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | print '</thead>'; |
70 | 70 | print '<tbody>'; |
71 | 71 | $i = 1; |
72 | - foreach($airline_array as $airline_item) |
|
72 | + foreach ($airline_array as $airline_item) |
|
73 | 73 | { |
74 | 74 | print '<tr>'; |
75 | 75 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,7 +5,9 @@ |
||
5 | 5 | $Stats = new Stats(); |
6 | 6 | $title = _("Statistics").' - '._("Most common Airline"); |
7 | 7 | require_once('header.php'); |
8 | -if (!isset($filter_name)) $filter_name = ''; |
|
8 | +if (!isset($filter_name)) { |
|
9 | + $filter_name = ''; |
|
10 | +} |
|
9 | 11 | $year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
10 | 12 | $month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
11 | 13 | include('statistics-sub-menu.php'); |
@@ -6,8 +6,8 @@ discard block |
||
6 | 6 | $title = _("Statistics").' - '._("Most common Airline"); |
7 | 7 | require_once('header.php'); |
8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
9 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
10 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
9 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
10 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
11 | 11 | include('statistics-sub-menu.php'); |
12 | 12 | |
13 | 13 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | </div> |
18 | 18 | <p>'._("Below are the <strong>Top 10</strong> most common airlines.").'</p>'; |
19 | 19 | |
20 | -$airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
20 | +$airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
21 | 21 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
22 | 22 | $airline_data = ''; |
23 | -foreach($airline_array as $airline_item) |
|
23 | +foreach ($airline_array as $airline_item) |
|
24 | 24 | { |
25 | 25 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
26 | 26 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | print '</thead>'; |
48 | 48 | print '<tbody>'; |
49 | 49 | $i = 1; |
50 | - foreach($airline_array as $airline_item) |
|
50 | + foreach ($airline_array as $airline_item) |
|
51 | 51 | { |
52 | 52 | print '<tr>'; |
53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |