@@ -21,7 +21,7 @@ |
||
21 | 21 | } |
22 | 22 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
24 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | require_once('header.php'); |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } else { |
20 | 20 | $title = _("Statistics").' - '._("Most common Country a flight was over"); |
21 | 21 | } |
22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
23 | 23 | if ($airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | } |
49 | 49 | |
50 | 50 | if ($type == 'aircraft') { |
51 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name); |
|
51 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name); |
|
52 | 52 | } elseif ($type == 'marine') { |
53 | 53 | $flightover_array = $Marine->countAllMarineOverCountries(); |
54 | 54 | } elseif ($type == 'tracker') { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
63 | 63 | print 'var series = ['; |
64 | 64 | $flightover_data = ''; |
65 | -foreach($flightover_array as $flightover_item) |
|
65 | +foreach ($flightover_array as $flightover_item) |
|
66 | 66 | { |
67 | 67 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
68 | 68 | } |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | print '</thead>'; |
112 | 112 | print '<tbody>'; |
113 | 113 | $i = 1; |
114 | - array_splice($flightover_array,10); |
|
115 | - foreach($flightover_array as $flightover_item) |
|
114 | + array_splice($flightover_array, 10); |
|
115 | + foreach ($flightover_array as $flightover_item) |
|
116 | 116 | { |
117 | 117 | print '<tr>'; |
118 | 118 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -4,7 +4,9 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Stats = new Stats(); |
6 | 6 | |
7 | -if (!isset($filter_name)) $filter_name = ''; |
|
7 | +if (!isset($filter_name)) { |
|
8 | + $filter_name = ''; |
|
9 | +} |
|
8 | 10 | $type = 'aircraft'; |
9 | 11 | if (isset($_GET['marine'])) { |
10 | 12 | $type = 'marine'; |
@@ -21,8 +23,10 @@ discard block |
||
21 | 23 | } |
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | -} |
|
26 | + if (isset($globalFilter['airline'])) { |
|
27 | + $airline_icao = $globalFilter['airline'][0]; |
|
28 | + } |
|
29 | + } |
|
26 | 30 | |
27 | 31 | require_once('header.php'); |
28 | 32 | include('statistics-sub-menu.php'); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | ?> |
38 | 38 | </div> |
39 | 39 | <?php |
40 | - if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) { |
|
40 | + if (!isset($year) || (isset($year) && $year == '') && !isset($month) || (isset($month) && $month == '')) { |
|
41 | 41 | ?> |
42 | 42 | <div class="sub-menu sub-menu-container"> |
43 | 43 | <ul class="nav"> |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | </ul> |
96 | 96 | </li> |
97 | 97 | <?php |
98 | - if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
98 | + if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
99 | 99 | ?> |
100 | 100 | <li class="dropdown"> |
101 | 101 | <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | </ul> |
108 | 108 | </li> |
109 | 109 | <?php |
110 | - } |
|
110 | + } |
|
111 | 111 | ?> |
112 | 112 | <?php |
113 | 113 | } elseif ($type == 'marine' || $type == 'tracker') { |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | </ul> |
128 | 128 | </div> |
129 | 129 | <?php |
130 | - } else { |
|
130 | + } else { |
|
131 | 131 | ?> |
132 | 132 | <div class="sub-menu sub-menu-container"> |
133 | 133 | <ul class="nav"> |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | </li> |
190 | 190 | --> |
191 | 191 | <?php |
192 | - if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
192 | + if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
|
193 | 193 | ?> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | </li> |
204 | 204 | --> |
205 | 205 | <?php |
206 | - } |
|
206 | + } |
|
207 | 207 | ?> |
208 | 208 | <?php |
209 | 209 | } elseif ($type == 'marine' || $type == 'tracker') { |
@@ -224,5 +224,5 @@ discard block |
||
224 | 224 | </ul> |
225 | 225 | </div> |
226 | 226 | <?php |
227 | - } |
|
227 | + } |
|
228 | 228 | ?> |
229 | 229 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | } else { |
23 | 23 | print '<option value="all">All</option>'; |
24 | 24 | } |
25 | - foreach($airlines as $airline) { |
|
25 | + foreach ($airlines as $airline) { |
|
26 | 26 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
27 | 27 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
28 | 28 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | if (!isset($type) || $type == 'aircraft') { |
46 | 46 | ?> |
47 | 47 | <li class="dropdown"> |
48 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
48 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
49 | 49 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
50 | 50 | </a> |
51 | 51 | <ul class="dropdown-menu"> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | </ul> |
57 | 57 | </li> |
58 | 58 | <li class="dropdown"> |
59 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
59 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
60 | 60 | <?php echo _("Airline"); ?> <span class="caret"></span> |
61 | 61 | </a> |
62 | 62 | <ul class="dropdown-menu" role="menu"> |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | </ul> |
67 | 67 | </li> |
68 | 68 | <li class="dropdown"> |
69 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
69 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
70 | 70 | <?php echo _("Airport"); ?> <span class="caret"></span> |
71 | 71 | </a> |
72 | 72 | <ul class="dropdown-menu" role="menu"> |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | </ul> |
78 | 78 | </li> |
79 | 79 | <li class="dropdown"> |
80 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
80 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
81 | 81 | <?php echo _("Route"); ?> <span class="caret"></span> |
82 | 82 | </a> |
83 | 83 | <ul class="dropdown-menu" role="menu"> |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | </ul> |
87 | 87 | </li> |
88 | 88 | <li class="dropdown"> |
89 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
89 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
90 | 90 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
91 | 91 | </a> |
92 | 92 | <ul class="dropdown-menu" role="menu"> |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
99 | 99 | ?> |
100 | 100 | <li class="dropdown"> |
101 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
101 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
102 | 102 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
103 | 103 | </a> |
104 | 104 | <ul class="dropdown-menu" role="menu"> |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } elseif ($type == 'marine' || $type == 'tracker') { |
114 | 114 | ?> |
115 | 115 | <li class="dropdown"> |
116 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
116 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
117 | 117 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
118 | 118 | </a> |
119 | 119 | <ul class="dropdown-menu" role="menu"> |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if (!isset($type) || $type == 'aircraft') { |
136 | 136 | ?> |
137 | 137 | <li class="dropdown"> |
138 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
138 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
139 | 139 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
140 | 140 | </a> |
141 | 141 | <ul class="dropdown-menu"> |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | </ul> |
147 | 147 | </li> |
148 | 148 | <li class="dropdown"> |
149 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
149 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
150 | 150 | <?php echo _("Airline"); ?> <span class="caret"></span> |
151 | 151 | </a> |
152 | 152 | <ul class="dropdown-menu" role="menu"> |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | </ul> |
157 | 157 | </li> |
158 | 158 | <li class="dropdown"> |
159 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
159 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
160 | 160 | <?php echo _("Airport"); ?> <span class="caret"></span> |
161 | 161 | </a> |
162 | 162 | <ul class="dropdown-menu" role="menu"> |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | </li> |
169 | 169 | <!-- |
170 | 170 | <li class="dropdown"> |
171 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
171 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
172 | 172 | <?php echo _("Route"); ?> <span class="caret"></span> |
173 | 173 | </a> |
174 | 174 | <ul class="dropdown-menu" role="menu"> |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | --> |
180 | 180 | <!-- |
181 | 181 | <li class="dropdown"> |
182 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
182 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
183 | 183 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
184 | 184 | </a> |
185 | 185 | <ul class="dropdown-menu" role="menu"> |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | ?> |
194 | 194 | <!-- |
195 | 195 | <li class="dropdown"> |
196 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
196 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
197 | 197 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
198 | 198 | </a> |
199 | 199 | <ul class="dropdown-menu" role="menu"> |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } elseif ($type == 'marine' || $type == 'tracker') { |
210 | 210 | ?> |
211 | 211 | <li class="dropdown"> |
212 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
212 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
213 | 213 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
214 | 214 | </a> |
215 | 215 | <ul class="dropdown-menu" role="menu"> |
@@ -4,7 +4,13 @@ discard block |
||
4 | 4 | <div class="stats_airline"> |
5 | 5 | |
6 | 6 | <form id="changedate" method="post"> |
7 | - <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') echo $year.'-'; ?><?php if (isset($month) && $month != '') echo $month; ?>" /> |
|
7 | + <input type="month" name="date" onchange="statsdatechange(this);" value="<?php if (isset($year) && $year != '') { |
|
8 | + echo $year.'-'; |
|
9 | +} |
|
10 | +?><?php if (isset($month) && $month != '') { |
|
11 | + echo $month; |
|
12 | +} |
|
13 | +?>" /> |
|
8 | 14 | </form> |
9 | 15 | <?php |
10 | 16 | if (!isset($type) || $type == 'aircraft') { |
@@ -15,7 +21,9 @@ discard block |
||
15 | 21 | <?php |
16 | 22 | require_once('require/class.Stats.php'); |
17 | 23 | $Stats = new Stats(); |
18 | - if (!isset($filter_name)) $filter_name = ''; |
|
24 | + if (!isset($filter_name)) { |
|
25 | + $filter_name = ''; |
|
26 | + } |
|
19 | 27 | $airlines = $Stats->getAllAirlineNames($filter_name); |
20 | 28 | if (isset($airline_icao) && ($airline_icao == '' || $airline_icao == 'all')) { |
21 | 29 | print '<option value="all" selected>All</option>'; |
@@ -49,10 +57,22 @@ discard block |
||
49 | 57 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
50 | 58 | </a> |
51 | 59 | <ul class="dropdown-menu"> |
52 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
53 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Registration"); ?></a></li> |
|
54 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
55 | - <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Country"); ?></a></li> |
|
60 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
61 | + echo '/'.$airline_icao; |
|
62 | +} |
|
63 | +?>"><?php echo _("Aircraft"); ?></a></li> |
|
64 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
65 | + echo '/'.$airline_icao; |
|
66 | +} |
|
67 | +?>"><?php echo _("Registration"); ?></a></li> |
|
68 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
69 | + echo '/'.$airline_icao; |
|
70 | +} |
|
71 | +?>"><?php echo _("Manufacturer"); ?></a></li> |
|
72 | + <li><a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
73 | + echo '/'.$airline_icao; |
|
74 | +} |
|
75 | +?>"><?php echo _("Country"); ?></a></li> |
|
56 | 76 | </ul> |
57 | 77 | </li> |
58 | 78 | <li class="dropdown"> |
@@ -60,9 +80,18 @@ discard block |
||
60 | 80 | <?php echo _("Airline"); ?> <span class="caret"></span> |
61 | 81 | </a> |
62 | 82 | <ul class="dropdown-menu" role="menu"> |
63 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline"); ?></a></li> |
|
64 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
65 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Callsign"); ?></a></li> |
|
83 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
84 | + echo '/'.$airline_icao; |
|
85 | +} |
|
86 | +?>"><?php echo _("Airline"); ?></a></li> |
|
87 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
88 | + echo '/'.$airline_icao; |
|
89 | +} |
|
90 | +?>"><?php echo _("Airline by Country"); ?></a></li> |
|
91 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
92 | + echo '/'.$airline_icao; |
|
93 | +} |
|
94 | +?>"><?php echo _("Callsign"); ?></a></li> |
|
66 | 95 | </ul> |
67 | 96 | </li> |
68 | 97 | <li class="dropdown"> |
@@ -70,10 +99,22 @@ discard block |
||
70 | 99 | <?php echo _("Airport"); ?> <span class="caret"></span> |
71 | 100 | </a> |
72 | 101 | <ul class="dropdown-menu" role="menu"> |
73 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
74 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
75 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
76 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
102 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
103 | + echo '/'.$airline_icao; |
|
104 | +} |
|
105 | +?>"><?php echo _("Departure Airport"); ?></a></li> |
|
106 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
107 | + echo '/'.$airline_icao; |
|
108 | +} |
|
109 | +?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
110 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
111 | + echo '/'.$airline_icao; |
|
112 | +} |
|
113 | +?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
114 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
115 | + echo '/'.$airline_icao; |
|
116 | +} |
|
117 | +?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
77 | 118 | </ul> |
78 | 119 | </li> |
79 | 120 | <li class="dropdown"> |
@@ -81,8 +122,14 @@ discard block |
||
81 | 122 | <?php echo _("Route"); ?> <span class="caret"></span> |
82 | 123 | </a> |
83 | 124 | <ul class="dropdown-menu" role="menu"> |
84 | - <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Airport"); ?></a></li> |
|
85 | - <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
125 | + <li><a href="<?php print $globalURL; ?>/statistics/route-airport<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
126 | + echo '/'.$airline_icao; |
|
127 | +} |
|
128 | +?>"><?php echo _("Route by Airport"); ?></a></li> |
|
129 | + <li><a href="<?php print $globalURL; ?>/statistics/route-waypoint<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
130 | + echo '/'.$airline_icao; |
|
131 | +} |
|
132 | +?>"><?php echo _("Route by Waypoint"); ?></a></li> |
|
86 | 133 | </ul> |
87 | 134 | </li> |
88 | 135 | <li class="dropdown"> |
@@ -90,8 +137,14 @@ discard block |
||
90 | 137 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
91 | 138 | </a> |
92 | 139 | <ul class="dropdown-menu" role="menu"> |
93 | - <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Date"); ?></a></li> |
|
94 | - <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>"><?php echo _("Time"); ?></a></li> |
|
140 | + <li><a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
141 | + echo '/'.$airline_icao; |
|
142 | +} |
|
143 | +?>"><?php echo _("Date"); ?></a></li> |
|
144 | + <li><a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
145 | + echo '/'.$airline_icao; |
|
146 | +} |
|
147 | +?>"><?php echo _("Time"); ?></a></li> |
|
95 | 148 | </ul> |
96 | 149 | </li> |
97 | 150 | <?php |
@@ -139,9 +192,18 @@ discard block |
||
139 | 192 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
140 | 193 | </a> |
141 | 194 | <ul class="dropdown-menu"> |
142 | - <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
143 | - <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
144 | - <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
195 | + <li><a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
196 | + echo '/'.$airline_icao; |
|
197 | +} |
|
198 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Aircraft"); ?></a></li> |
|
199 | + <li><a href="<?php print $globalURL; ?>/statistics/registration<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
200 | + echo '/'.$airline_icao; |
|
201 | +} |
|
202 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Registration"); ?></a></li> |
|
203 | + <li><a href="<?php print $globalURL; ?>/statistics/manufacturer<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
204 | + echo '/'.$airline_icao; |
|
205 | +} |
|
206 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Manufacturer"); ?></a></li> |
|
145 | 207 | <!-- <li><a href="<?php print $globalURL; ?>/statistics/country"><?php echo _("Country"); ?></a></li> --> |
146 | 208 | </ul> |
147 | 209 | </li> |
@@ -150,9 +212,18 @@ discard block |
||
150 | 212 | <?php echo _("Airline"); ?> <span class="caret"></span> |
151 | 213 | </a> |
152 | 214 | <ul class="dropdown-menu" role="menu"> |
153 | - <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
154 | - <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
155 | - <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
215 | + <li><a href="<?php print $globalURL; ?>/statistics/airline<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
216 | + echo '/'.$airline_icao; |
|
217 | +} |
|
218 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline"); ?></a></li> |
|
219 | + <li><a href="<?php print $globalURL; ?>/statistics/airline-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
220 | + echo '/'.$airline_icao; |
|
221 | +} |
|
222 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Airline by Country"); ?></a></li> |
|
223 | + <li><a href="<?php print $globalURL; ?>/statistics/callsign<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
224 | + echo '/'.$airline_icao; |
|
225 | +} |
|
226 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Callsign"); ?></a></li> |
|
156 | 227 | </ul> |
157 | 228 | </li> |
158 | 229 | <li class="dropdown"> |
@@ -160,10 +231,22 @@ discard block |
||
160 | 231 | <?php echo _("Airport"); ?> <span class="caret"></span> |
161 | 232 | </a> |
162 | 233 | <ul class="dropdown-menu" role="menu"> |
163 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
164 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
165 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
166 | - <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
234 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
235 | + echo '/'.$airline_icao; |
|
236 | +} |
|
237 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport"); ?></a></li> |
|
238 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-departure-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
239 | + echo '/'.$airline_icao; |
|
240 | +} |
|
241 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Departure Airport by Country"); ?></a></li> |
|
242 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
243 | + echo '/'.$airline_icao; |
|
244 | +} |
|
245 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport"); ?></a></li> |
|
246 | + <li><a href="<?php print $globalURL; ?>/statistics/airport-arrival-country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
247 | + echo '/'.$airline_icao; |
|
248 | +} |
|
249 | +?>/<?php echo $year.'/'.$month.'/'; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
|
167 | 250 | </ul> |
168 | 251 | </li> |
169 | 252 | <!-- |
@@ -9,25 +9,25 @@ discard block |
||
9 | 9 | require_once(dirname(__FILE__).'/class.Stats.php'); |
10 | 10 | require_once(dirname(__FILE__).'/class.Source.php'); |
11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | class MarineImport { |
16 | - private $all_tracked = array(); |
|
17 | - private $last_delete_hourly = 0; |
|
18 | - private $last_delete = 0; |
|
19 | - private $stats = array(); |
|
20 | - private $tmd = 0; |
|
21 | - private $source_location = array(); |
|
22 | - public $db = null; |
|
23 | - public $nb = 0; |
|
16 | + private $all_tracked = array(); |
|
17 | + private $last_delete_hourly = 0; |
|
18 | + private $last_delete = 0; |
|
19 | + private $stats = array(); |
|
20 | + private $tmd = 0; |
|
21 | + private $source_location = array(); |
|
22 | + public $db = null; |
|
23 | + public $nb = 0; |
|
24 | 24 | |
25 | - public function __construct($dbc = null) { |
|
25 | + public function __construct($dbc = null) { |
|
26 | 26 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
27 | 27 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
28 | - $Connection = new Connection($dbc); |
|
29 | - $this->db = $Connection->db(); |
|
30 | - date_default_timezone_set('UTC'); |
|
28 | + $Connection = new Connection($dbc); |
|
29 | + $this->db = $Connection->db(); |
|
30 | + date_default_timezone_set('UTC'); |
|
31 | 31 | } |
32 | 32 | // Get previous source stats |
33 | 33 | /* |
@@ -46,55 +46,55 @@ discard block |
||
46 | 46 | } |
47 | 47 | */ |
48 | 48 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
49 | - $APRSMarine = new APRSMarine(); |
|
50 | - //$APRSSpotter->connect(); |
|
49 | + $APRSMarine = new APRSMarine(); |
|
50 | + //$APRSSpotter->connect(); |
|
51 | + } |
|
51 | 52 | } |
52 | - } |
|
53 | 53 | |
54 | - public function checkAll() { |
|
54 | + public function checkAll() { |
|
55 | 55 | global $globalDebug; |
56 | 56 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
57 | 57 | foreach ($this->all_tracked as $key => $flight) { |
58 | - if (isset($this->all_tracked[$key]['id'])) { |
|
58 | + if (isset($this->all_tracked[$key]['id'])) { |
|
59 | 59 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
60 | - $Marine = new Marine($this->db); |
|
61 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
62 | - } |
|
60 | + $Marine = new Marine($this->db); |
|
61 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
62 | + } |
|
63 | + } |
|
63 | 64 | } |
64 | - } |
|
65 | 65 | |
66 | - public function del() { |
|
66 | + public function del() { |
|
67 | 67 | global $globalDebug, $globalNoDB, $globalNoImport; |
68 | 68 | // Delete old infos |
69 | 69 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
70 | 70 | foreach ($this->all_tracked as $key => $flight) { |
71 | - if (isset($flight['lastupdate'])) { |
|
72 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
73 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
74 | - if (isset($this->all_tracked[$key]['id'])) { |
|
75 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
76 | - /* |
|
71 | + if (isset($flight['lastupdate'])) { |
|
72 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
73 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
74 | + if (isset($this->all_tracked[$key]['id'])) { |
|
75 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
76 | + /* |
|
77 | 77 | $MarineLive = new MarineLive(); |
78 | 78 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
79 | 79 | $MarineLive->db = null; |
80 | 80 | */ |
81 | - //$real_arrival = $this->arrival($key); |
|
82 | - $Marine = new Marine($this->db); |
|
83 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
81 | + //$real_arrival = $this->arrival($key); |
|
82 | + $Marine = new Marine($this->db); |
|
83 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
84 | 84 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
85 | 85 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
86 | - } |
|
87 | - // Put in archive |
|
86 | + } |
|
87 | + // Put in archive |
|
88 | 88 | // $Marine->db = null; |
89 | 89 | } |
90 | - } |
|
91 | - unset($this->all_tracked[$key]); |
|
92 | - } |
|
93 | - } |
|
94 | - } |
|
95 | - } |
|
90 | + } |
|
91 | + unset($this->all_tracked[$key]); |
|
92 | + } |
|
93 | + } |
|
94 | + } |
|
95 | + } |
|
96 | 96 | |
97 | - public function add($line) { |
|
97 | + public function add($line) { |
|
98 | 98 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
99 | 99 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
100 | 100 | date_default_timezone_set('UTC'); |
@@ -103,8 +103,8 @@ discard block |
||
103 | 103 | |
104 | 104 | // SBS format is CSV format |
105 | 105 | if(is_array($line) && isset($line['mmsi'])) { |
106 | - //print_r($line); |
|
107 | - if (isset($line['mmsi'])) { |
|
106 | + //print_r($line); |
|
107 | + if (isset($line['mmsi'])) { |
|
108 | 108 | |
109 | 109 | /* |
110 | 110 | // Increment message number |
@@ -121,64 +121,64 @@ discard block |
||
121 | 121 | |
122 | 122 | $Common = new Common(); |
123 | 123 | $AIS = new AIS(); |
124 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
125 | - else $id = trim($line['id']); |
|
124 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
125 | + else $id = trim($line['id']); |
|
126 | 126 | |
127 | 127 | if (!isset($this->all_tracked[$id])) { |
128 | - $this->all_tracked[$id] = array(); |
|
129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
130 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
131 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
132 | - if (!isset($line['id'])) { |
|
128 | + $this->all_tracked[$id] = array(); |
|
129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
130 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
131 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
132 | + if (!isset($line['id'])) { |
|
133 | 133 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
134 | 134 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
135 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
136 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
135 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
136 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
140 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
141 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
140 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
141 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
142 | 142 | $Marine = new Marine($this->db); |
143 | 143 | $identity = $Marine->getIdentity($line['mmsi']); |
144 | 144 | if (!empty($identity)) { |
145 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
146 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
145 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
146 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
147 | 147 | } |
148 | 148 | //print_r($identity); |
149 | 149 | unset($Marine); |
150 | 150 | //$dataFound = true; |
151 | - } |
|
151 | + } |
|
152 | 152 | } |
153 | 153 | if (isset($line['type_id'])) { |
154 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
154 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
155 | 155 | } |
156 | 156 | if (isset($line['type']) && $line['type'] != '') { |
157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
158 | 158 | } |
159 | 159 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
160 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
160 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
161 | 161 | } |
162 | 162 | if (isset($line['imo']) && $line['imo'] != '') { |
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
164 | 164 | } |
165 | 165 | if (isset($line['callsign']) && $line['callsign'] != '') { |
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
167 | 167 | } |
168 | 168 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
169 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
169 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
170 | 170 | } |
171 | 171 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
177 | 177 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
178 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
179 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
178 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
179 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
180 | 180 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
181 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
181 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
182 | 182 | $timeelapsed = microtime(true); |
183 | 183 | $Marine = new Marine($this->db); |
184 | 184 | $fromsource = NULL; |
@@ -186,20 +186,20 @@ discard block |
||
186 | 186 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
187 | 187 | $Marine->db = null; |
188 | 188 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
189 | - } |
|
189 | + } |
|
190 | + } |
|
190 | 191 | } |
191 | - } |
|
192 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
192 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
196 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
196 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
197 | 197 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
198 | - } else { |
|
198 | + } else { |
|
199 | 199 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
200 | 200 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
201 | 201 | return ''; |
202 | - } |
|
202 | + } |
|
203 | 203 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
204 | 204 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
205 | 205 | return ''; |
@@ -216,24 +216,24 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | if (isset($line['speed'])) { |
219 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
219 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
221 | 221 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
222 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
223 | - if ($distance > 1000 && $distance < 10000) { |
|
222 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
223 | + if ($distance > 1000 && $distance < 10000) { |
|
224 | 224 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
225 | 225 | $speed = $speed*3.6; |
226 | 226 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
227 | 227 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
228 | - } |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | |
231 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
232 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
233 | - else unset($timediff); |
|
234 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
231 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
232 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
233 | + else unset($timediff); |
|
234 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
235 | 235 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
236 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
236 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
237 | 237 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
238 | 238 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
239 | 239 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -241,211 +241,211 @@ discard block |
||
241 | 241 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
242 | 242 | $timeelapsed = microtime(true); |
243 | 243 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
244 | - $Marine = new Marine($this->db); |
|
245 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
246 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
247 | - $Marine->db = null; |
|
248 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
244 | + $Marine = new Marine($this->db); |
|
245 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
246 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
247 | + $Marine->db = null; |
|
248 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
249 | 249 | } |
250 | 250 | $this->tmd = 0; |
251 | 251 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
252 | - } |
|
252 | + } |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
256 | 256 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
257 | 257 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
258 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
259 | - $dataFound = true; |
|
260 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
258 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
259 | + $dataFound = true; |
|
260 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
261 | 261 | } |
262 | 262 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
263 | 263 | } |
264 | 264 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
265 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
265 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
266 | 266 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
267 | 267 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
268 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
269 | - $dataFound = true; |
|
270 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
268 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
269 | + $dataFound = true; |
|
270 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
271 | 271 | } |
272 | 272 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
273 | 273 | } |
274 | 274 | |
275 | - } else if ($globalDebug && $timediff > 20) { |
|
275 | + } else if ($globalDebug && $timediff > 20) { |
|
276 | 276 | $this->tmd = $this->tmd + 1; |
277 | 277 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
278 | 278 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
279 | 279 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
280 | 280 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
281 | - } |
|
281 | + } |
|
282 | 282 | } |
283 | 283 | if (isset($line['last_update']) && $line['last_update'] != '') { |
284 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
285 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
284 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
285 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
286 | 286 | } |
287 | 287 | if (isset($line['format_source']) && $line['format_source'] != '') { |
288 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
288 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
289 | 289 | } |
290 | 290 | if (isset($line['source_name']) && $line['source_name'] != '') { |
291 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
291 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
292 | 292 | } |
293 | 293 | if (isset($line['status']) && $line['status'] != '') { |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
295 | 295 | } |
296 | 296 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
297 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
298 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
297 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
298 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
299 | 299 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
300 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
300 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
301 | 301 | $Marine = new Marine($this->db); |
302 | 302 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
303 | 303 | unset($Marine); |
304 | - } |
|
304 | + } |
|
305 | + } |
|
305 | 306 | } |
306 | - } |
|
307 | 307 | } |
308 | 308 | |
309 | 309 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
310 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
310 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if (isset($line['heading']) && $line['heading'] != '') { |
314 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
316 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
317 | - //$dataFound = true; |
|
314 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
316 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
317 | + //$dataFound = true; |
|
318 | 318 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
319 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
321 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
322 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
319 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
321 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
322 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
323 | 323 | } |
324 | 324 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
325 | 325 | |
326 | 326 | |
327 | 327 | |
328 | 328 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
329 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
330 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
331 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
332 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
329 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
330 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
331 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
332 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
333 | 333 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
334 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
335 | - $timeelapsed = microtime(true); |
|
336 | - $MarineLive = new MarineLive($this->db); |
|
337 | - if (isset($line['id'])) { |
|
334 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
335 | + $timeelapsed = microtime(true); |
|
336 | + $MarineLive = new MarineLive($this->db); |
|
337 | + if (isset($line['id'])) { |
|
338 | 338 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
339 | 339 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
340 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
340 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
341 | 341 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
342 | 342 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
343 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
343 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
344 | 344 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
345 | 345 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
346 | - } else $recent_ident = ''; |
|
347 | - $MarineLive->db=null; |
|
348 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
349 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
346 | + } else $recent_ident = ''; |
|
347 | + $MarineLive->db=null; |
|
348 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
349 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
350 | 350 | } else $recent_ident = ''; |
351 | - } else { |
|
351 | + } else { |
|
352 | 352 | $recent_ident = ''; |
353 | 353 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
354 | - } |
|
355 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
356 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
357 | - { |
|
354 | + } |
|
355 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
356 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
357 | + { |
|
358 | 358 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
359 | 359 | //adds the spotter data for the archive |
360 | - $highlight = ''; |
|
361 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
362 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
360 | + $highlight = ''; |
|
361 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
362 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
363 | 363 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
364 | - $timeelapsed = microtime(true); |
|
365 | - $Marine = new Marine($this->db); |
|
366 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
367 | - $Marine->db = null; |
|
368 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
369 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
364 | + $timeelapsed = microtime(true); |
|
365 | + $Marine = new Marine($this->db); |
|
366 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
367 | + $Marine->db = null; |
|
368 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
369 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
370 | 370 | } |
371 | - } |
|
372 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
371 | + } |
|
372 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
373 | 373 | // Add source stat in DB |
374 | 374 | $Stats = new Stats($this->db); |
375 | 375 | if (!empty($this->stats)) { |
376 | - if ($globalDebug) echo 'Add source stats : '; |
|
377 | - foreach($this->stats as $date => $data) { |
|
376 | + if ($globalDebug) echo 'Add source stats : '; |
|
377 | + foreach($this->stats as $date => $data) { |
|
378 | 378 | foreach($data as $source => $sourced) { |
379 | - //print_r($sourced); |
|
380 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
381 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
382 | - if (isset($sourced['msg'])) { |
|
383 | - if (time() - $sourced['msg']['date'] > 10) { |
|
384 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
385 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
386 | - unset($this->stats[$date][$source]['msg']); |
|
387 | - } |
|
388 | - } |
|
389 | - } |
|
390 | - if ($date != date('Y-m-d')) { |
|
391 | - unset($this->stats[$date]); |
|
392 | - } |
|
393 | - } |
|
394 | - if ($globalDebug) echo 'Done'."\n"; |
|
379 | + //print_r($sourced); |
|
380 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
381 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
382 | + if (isset($sourced['msg'])) { |
|
383 | + if (time() - $sourced['msg']['date'] > 10) { |
|
384 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
385 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
386 | + unset($this->stats[$date][$source]['msg']); |
|
387 | + } |
|
388 | + } |
|
389 | + } |
|
390 | + if ($date != date('Y-m-d')) { |
|
391 | + unset($this->stats[$date]); |
|
392 | + } |
|
393 | + } |
|
394 | + if ($globalDebug) echo 'Done'."\n"; |
|
395 | 395 | } |
396 | 396 | $Stats->db = null; |
397 | - } |
|
397 | + } |
|
398 | 398 | |
399 | - $this->del(); |
|
399 | + $this->del(); |
|
400 | 400 | //$ignoreImport = false; |
401 | 401 | $this->all_tracked[$id]['addedMarine'] = 1; |
402 | 402 | //print_r($this->all_tracked[$id]); |
403 | 403 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
404 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
405 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
406 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
404 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
405 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
406 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
407 | 407 | $MarineLive = new MarineLive($this->db); |
408 | 408 | $MarineLive->deleteLiveMarineData(); |
409 | 409 | $MarineLive->db=null; |
410 | 410 | if ($globalDebug) echo " Done\n"; |
411 | - } |
|
412 | - $this->last_delete = time(); |
|
411 | + } |
|
412 | + $this->last_delete = time(); |
|
413 | 413 | } |
414 | - } elseif ($recent_ident != '') { |
|
414 | + } elseif ($recent_ident != '') { |
|
415 | 415 | $this->all_tracked[$id]['id'] = $recent_ident; |
416 | 416 | $this->all_tracked[$id]['addedMarine'] = 1; |
417 | 417 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
418 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
418 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
419 | 419 | $Marine = new Marine($this->db); |
420 | 420 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
421 | 421 | $Marine->db = null; |
422 | - } |
|
422 | + } |
|
423 | 423 | } |
424 | 424 | |
425 | - } |
|
425 | + } |
|
426 | + } |
|
426 | 427 | } |
427 | - } |
|
428 | - //adds the spotter LIVE data |
|
429 | - if ($globalDebug) { |
|
428 | + //adds the spotter LIVE data |
|
429 | + if ($globalDebug) { |
|
430 | 430 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
431 | - } |
|
432 | - $ignoreImport = false; |
|
431 | + } |
|
432 | + $ignoreImport = false; |
|
433 | 433 | |
434 | - if (!$ignoreImport) { |
|
434 | + if (!$ignoreImport) { |
|
435 | 435 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
436 | 436 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
437 | 437 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
438 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
438 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
439 | 439 | $timeelapsed = microtime(true); |
440 | 440 | $MarineLive = new MarineLive($this->db); |
441 | 441 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
442 | 442 | $MarineLive->db = null; |
443 | 443 | if ($globalDebug) echo $result."\n"; |
444 | 444 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
445 | - } |
|
445 | + } |
|
446 | 446 | } |
447 | 447 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
448 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
448 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
449 | 449 | } |
450 | 450 | $this->all_tracked[$id]['putinarchive'] = false; |
451 | 451 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if ($stats_heading == 16) $stats_heading = 0; |
478 | 478 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
479 | 479 | for ($i=0;$i<=15;$i++) { |
480 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
480 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
481 | 481 | } |
482 | 482 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
483 | 483 | } else { |
@@ -490,11 +490,11 @@ discard block |
||
490 | 490 | //var_dump($this->stats); |
491 | 491 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
492 | 492 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
493 | - end($this->stats[$current_date][$source]['hist']); |
|
494 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
493 | + end($this->stats[$current_date][$source]['hist']); |
|
494 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
495 | 495 | } else $mini = 0; |
496 | 496 | for ($i=$mini;$i<=$distance;$i+=10) { |
497 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
497 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
498 | 498 | } |
499 | 499 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
500 | 500 | } else { |
@@ -510,24 +510,24 @@ discard block |
||
510 | 510 | |
511 | 511 | |
512 | 512 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
513 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
513 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
514 | 514 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
515 | 515 | $MarineLive = new MarineLive($this->db); |
516 | 516 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
517 | 517 | $MarineLive->db = null; |
518 | 518 | //MarineLive->deleteLiveMarineData(); |
519 | 519 | if ($globalDebug) echo " Done\n"; |
520 | - } |
|
521 | - $this->last_delete_hourly = time(); |
|
520 | + } |
|
521 | + $this->last_delete_hourly = time(); |
|
522 | 522 | } |
523 | 523 | |
524 | - } |
|
525 | - //$ignoreImport = false; |
|
524 | + } |
|
525 | + //$ignoreImport = false; |
|
526 | 526 | } |
527 | 527 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
528 | 528 | if ($send) return $this->all_tracked[$id]; |
529 | - } |
|
529 | + } |
|
530 | + } |
|
530 | 531 | } |
531 | - } |
|
532 | 532 | } |
533 | 533 | ?> |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | if (isset($this->all_tracked[$key]['id'])) { |
59 | 59 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
60 | 60 | $Marine = new Marine($this->db); |
61 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
61 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
70 | 70 | foreach ($this->all_tracked as $key => $flight) { |
71 | 71 | if (isset($flight['lastupdate'])) { |
72 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
72 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
73 | 73 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
74 | 74 | if (isset($this->all_tracked[$key]['id'])) { |
75 | 75 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | //$real_arrival = $this->arrival($key); |
82 | 82 | $Marine = new Marine($this->db); |
83 | 83 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
84 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
84 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime']); |
|
85 | 85 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
86 | 86 | } |
87 | 87 | // Put in archive |
@@ -95,14 +95,14 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | public function add($line) { |
98 | - global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
|
98 | + global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine; |
|
99 | 99 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
100 | 100 | date_default_timezone_set('UTC'); |
101 | 101 | $dataFound = false; |
102 | 102 | $send = false; |
103 | 103 | |
104 | 104 | // SBS format is CSV format |
105 | - if(is_array($line) && isset($line['mmsi'])) { |
|
105 | + if (is_array($line) && isset($line['mmsi'])) { |
|
106 | 106 | //print_r($line); |
107 | 107 | if (isset($line['mmsi'])) { |
108 | 108 | |
@@ -126,18 +126,18 @@ discard block |
||
126 | 126 | |
127 | 127 | if (!isset($this->all_tracked[$id])) { |
128 | 128 | $this->all_tracked[$id] = array(); |
129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
130 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
|
131 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0)); |
|
130 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '')); |
|
131 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
132 | 132 | if (!isset($line['id'])) { |
133 | 133 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
135 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
135 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
136 | 136 | if ($globalAllTracked !== FALSE) $dataFound = true; |
137 | 137 | } |
138 | 138 | |
139 | 139 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
140 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
140 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi'])); |
|
141 | 141 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
142 | 142 | $Marine = new Marine($this->db); |
143 | 143 | $identity = $Marine->getIdentity($line['mmsi']); |
@@ -151,64 +151,64 @@ discard block |
||
151 | 151 | } |
152 | 152 | } |
153 | 153 | if (isset($line['type_id'])) { |
154 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
154 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id']))); |
|
155 | 155 | } |
156 | 156 | if (isset($line['type']) && $line['type'] != '') { |
157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
158 | 158 | } |
159 | 159 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
160 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
160 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type'])); |
|
161 | 161 | } |
162 | 162 | if (isset($line['imo']) && $line['imo'] != '') { |
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo'])); |
|
164 | 164 | } |
165 | 165 | if (isset($line['callsign']) && $line['callsign'] != '') { |
166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign'])); |
|
167 | 167 | } |
168 | 168 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
169 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
169 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code'])); |
|
170 | 170 | } |
171 | 171 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date'])); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | |
176 | 176 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
177 | 177 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
178 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
178 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
179 | 179 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
180 | 180 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
181 | 181 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
182 | 182 | $timeelapsed = microtime(true); |
183 | 183 | $Marine = new Marine($this->db); |
184 | 184 | $fromsource = NULL; |
185 | - $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
185 | + $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
186 | 186 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
187 | 187 | $Marine->db = null; |
188 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
188 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
189 | 189 | } |
190 | 190 | } |
191 | 191 | } |
192 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
192 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
193 | 193 | } |
194 | 194 | |
195 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
|
195 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 20*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
196 | 196 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
198 | 198 | } else { |
199 | 199 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
200 | 200 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
201 | 201 | return ''; |
202 | 202 | } |
203 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
|
203 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time() - 20*60) { |
|
204 | 204 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
205 | 205 | return ''; |
206 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
|
206 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time() + 20*60) { |
|
207 | 207 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
208 | 208 | return ''; |
209 | 209 | } elseif (!isset($line['datetime'])) { |
210 | 210 | date_default_timezone_set('UTC'); |
211 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
211 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
212 | 212 | } else { |
213 | 213 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
214 | 214 | return ''; |
@@ -216,24 +216,24 @@ discard block |
||
216 | 216 | |
217 | 217 | |
218 | 218 | if (isset($line['speed'])) { |
219 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
219 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed']))); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
221 | 221 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
222 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
222 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
223 | 223 | if ($distance > 1000 && $distance < 10000) { |
224 | 224 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
225 | 225 | $speed = $speed*3.6; |
226 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
226 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed))); |
|
227 | 227 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
228 | 228 | } |
229 | 229 | } |
230 | 230 | |
231 | 231 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
232 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
232 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
233 | 233 | else unset($timediff); |
234 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
234 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')))) { |
|
235 | 235 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
236 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
236 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
237 | 237 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
238 | 238 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
239 | 239 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -242,10 +242,10 @@ discard block |
||
242 | 242 | $timeelapsed = microtime(true); |
243 | 243 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
244 | 244 | $Marine = new Marine($this->db); |
245 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
245 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
246 | 246 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
247 | 247 | $Marine->db = null; |
248 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
248 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
249 | 249 | } |
250 | 250 | $this->tmd = 0; |
251 | 251 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
@@ -254,52 +254,52 @@ discard block |
||
254 | 254 | |
255 | 255 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
256 | 256 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
257 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
257 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
258 | 258 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
259 | 259 | $dataFound = true; |
260 | 260 | $this->all_tracked[$id]['time_last_coord'] = time(); |
261 | 261 | } |
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
263 | 263 | } |
264 | 264 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
265 | 265 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
266 | 266 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
267 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
267 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
268 | 268 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
269 | 269 | $dataFound = true; |
270 | 270 | $this->all_tracked[$id]['time_last_coord'] = time(); |
271 | 271 | } |
272 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
272 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
273 | 273 | } |
274 | 274 | |
275 | 275 | } else if ($globalDebug && $timediff > 20) { |
276 | 276 | $this->tmd = $this->tmd + 1; |
277 | 277 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
278 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
279 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
278 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
279 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
280 | 280 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
281 | 281 | } |
282 | 282 | } |
283 | 283 | if (isset($line['last_update']) && $line['last_update'] != '') { |
284 | 284 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
285 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
285 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
286 | 286 | } |
287 | 287 | if (isset($line['format_source']) && $line['format_source'] != '') { |
288 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
288 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
289 | 289 | } |
290 | 290 | if (isset($line['source_name']) && $line['source_name'] != '') { |
291 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
291 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
292 | 292 | } |
293 | 293 | if (isset($line['status']) && $line['status'] != '') { |
294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status'])); |
|
295 | 295 | } |
296 | 296 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
297 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
297 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id'])); |
|
298 | 298 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
299 | 299 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
300 | 300 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
301 | 301 | $Marine = new Marine($this->db); |
302 | - $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
|
302 | + $Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']); |
|
303 | 303 | unset($Marine); |
304 | 304 | } |
305 | 305 | } |
@@ -307,18 +307,18 @@ discard block |
||
307 | 307 | } |
308 | 308 | |
309 | 309 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
310 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
310 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
311 | 311 | } |
312 | 312 | |
313 | 313 | if (isset($line['heading']) && $line['heading'] != '') { |
314 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
316 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
314 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
315 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
316 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
317 | 317 | //$dataFound = true; |
318 | 318 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
319 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
321 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
319 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
321 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
322 | 322 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
323 | 323 | } |
324 | 324 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -328,7 +328,7 @@ discard block |
||
328 | 328 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
329 | 329 | $this->all_tracked[$id]['lastupdate'] = time(); |
330 | 330 | if ($this->all_tracked[$id]['addedMarine'] == 0) { |
331 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
331 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
332 | 332 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
333 | 333 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
334 | 334 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
@@ -336,37 +336,37 @@ discard block |
||
336 | 336 | $MarineLive = new MarineLive($this->db); |
337 | 337 | if (isset($line['id'])) { |
338 | 338 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
339 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
339 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
340 | 340 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
341 | 341 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
342 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
342 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
343 | 343 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
344 | 344 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
345 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
345 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
346 | 346 | } else $recent_ident = ''; |
347 | - $MarineLive->db=null; |
|
347 | + $MarineLive->db = null; |
|
348 | 348 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
349 | 349 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
350 | 350 | } else $recent_ident = ''; |
351 | 351 | } else { |
352 | 352 | $recent_ident = ''; |
353 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
353 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
354 | 354 | } |
355 | 355 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
356 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
356 | + if ($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
357 | 357 | { |
358 | 358 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
359 | 359 | //adds the spotter data for the archive |
360 | 360 | $highlight = ''; |
361 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
361 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
362 | 362 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
363 | 363 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
364 | 364 | $timeelapsed = microtime(true); |
365 | 365 | $Marine = new Marine($this->db); |
366 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
366 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name']); |
|
367 | 367 | $Marine->db = null; |
368 | 368 | if ($globalDebug && isset($result)) echo $result."\n"; |
369 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
369 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
370 | 370 | } |
371 | 371 | } |
372 | 372 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
@@ -374,15 +374,15 @@ discard block |
||
374 | 374 | $Stats = new Stats($this->db); |
375 | 375 | if (!empty($this->stats)) { |
376 | 376 | if ($globalDebug) echo 'Add source stats : '; |
377 | - foreach($this->stats as $date => $data) { |
|
378 | - foreach($data as $source => $sourced) { |
|
377 | + foreach ($this->stats as $date => $data) { |
|
378 | + foreach ($data as $source => $sourced) { |
|
379 | 379 | //print_r($sourced); |
380 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
381 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
380 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date); |
|
381 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date); |
|
382 | 382 | if (isset($sourced['msg'])) { |
383 | 383 | if (time() - $sourced['msg']['date'] > 10) { |
384 | 384 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
385 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
385 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date); |
|
386 | 386 | unset($this->stats[$date][$source]['msg']); |
387 | 387 | } |
388 | 388 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
407 | 407 | $MarineLive = new MarineLive($this->db); |
408 | 408 | $MarineLive->deleteLiveMarineData(); |
409 | - $MarineLive->db=null; |
|
409 | + $MarineLive->db = null; |
|
410 | 410 | if ($globalDebug) echo " Done\n"; |
411 | 411 | } |
412 | 412 | $this->last_delete = time(); |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
418 | 418 | if (isset($globalDaemon) && !$globalDaemon) { |
419 | 419 | $Marine = new Marine($this->db); |
420 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime']); |
|
420 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime']); |
|
421 | 421 | $Marine->db = null; |
422 | 422 | } |
423 | 423 | } |
@@ -432,20 +432,20 @@ discard block |
||
432 | 432 | $ignoreImport = false; |
433 | 433 | |
434 | 434 | if (!$ignoreImport) { |
435 | - if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
435 | + if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
436 | 436 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
437 | 437 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
438 | 438 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
439 | 439 | $timeelapsed = microtime(true); |
440 | 440 | $MarineLive = new MarineLive($this->db); |
441 | - $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
441 | + $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
442 | 442 | $MarineLive->db = null; |
443 | 443 | if ($globalDebug) echo $result."\n"; |
444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
444 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
445 | 445 | } |
446 | 446 | } |
447 | 447 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
448 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
448 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
449 | 449 | } |
450 | 450 | $this->all_tracked[$id]['putinarchive'] = false; |
451 | 451 | |
@@ -464,19 +464,19 @@ discard block |
||
464 | 464 | $latitude = $globalCenterLatitude; |
465 | 465 | $longitude = $globalCenterLongitude; |
466 | 466 | } |
467 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
467 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
468 | 468 | } else { |
469 | 469 | $latitude = $this->source_location[$source]['latitude']; |
470 | 470 | $longitude = $this->source_location[$source]['longitude']; |
471 | 471 | } |
472 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
472 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
473 | 473 | //$stats_heading = $stats_heading%22.5; |
474 | 474 | $stats_heading = round($stats_heading/22.5); |
475 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
475 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
476 | 476 | $current_date = date('Y-m-d'); |
477 | 477 | if ($stats_heading == 16) $stats_heading = 0; |
478 | 478 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
479 | - for ($i=0;$i<=15;$i++) { |
|
479 | + for ($i = 0; $i <= 15; $i++) { |
|
480 | 480 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
481 | 481 | } |
482 | 482 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -491,9 +491,9 @@ discard block |
||
491 | 491 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
492 | 492 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
493 | 493 | end($this->stats[$current_date][$source]['hist']); |
494 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
494 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
495 | 495 | } else $mini = 0; |
496 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
496 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
497 | 497 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
498 | 498 | } |
499 | 499 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | |
506 | 506 | $this->all_tracked[$id]['lastupdate'] = time(); |
507 | 507 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
508 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
508 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
509 | 509 | //$this->del(); |
510 | 510 | |
511 | 511 |
@@ -53,7 +53,9 @@ discard block |
||
53 | 53 | |
54 | 54 | public function checkAll() { |
55 | 55 | global $globalDebug; |
56 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
56 | + if ($globalDebug) { |
|
57 | + echo "Update last seen tracked data...\n"; |
|
58 | + } |
|
57 | 59 | foreach ($this->all_tracked as $key => $flight) { |
58 | 60 | if (isset($this->all_tracked[$key]['id'])) { |
59 | 61 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -66,13 +68,17 @@ discard block |
||
66 | 68 | public function del() { |
67 | 69 | global $globalDebug, $globalNoDB, $globalNoImport; |
68 | 70 | // Delete old infos |
69 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
71 | + if ($globalDebug) { |
|
72 | + echo 'Delete old values and update latest data...'."\n"; |
|
73 | + } |
|
70 | 74 | foreach ($this->all_tracked as $key => $flight) { |
71 | 75 | if (isset($flight['lastupdate'])) { |
72 | 76 | if ($flight['lastupdate'] < (time()-3000)) { |
73 | 77 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
74 | 78 | if (isset($this->all_tracked[$key]['id'])) { |
75 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
79 | + if ($globalDebug) { |
|
80 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
81 | + } |
|
76 | 82 | /* |
77 | 83 | $MarineLive = new MarineLive(); |
78 | 84 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
@@ -82,7 +88,9 @@ discard block |
||
82 | 88 | $Marine = new Marine($this->db); |
83 | 89 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
84 | 90 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
85 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
91 | + if ($globalDebug && $result != 'success') { |
|
92 | + echo '!!! ERROR : '.$result."\n"; |
|
93 | + } |
|
86 | 94 | } |
87 | 95 | // Put in archive |
88 | 96 | // $Marine->db = null; |
@@ -96,7 +104,9 @@ discard block |
||
96 | 104 | |
97 | 105 | public function add($line) { |
98 | 106 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
99 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
107 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
108 | + $globalCoordMinChange = '0.02'; |
|
109 | + } |
|
100 | 110 | date_default_timezone_set('UTC'); |
101 | 111 | $dataFound = false; |
102 | 112 | $send = false; |
@@ -121,8 +131,11 @@ discard block |
||
121 | 131 | |
122 | 132 | $Common = new Common(); |
123 | 133 | $AIS = new AIS(); |
124 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
125 | - else $id = trim($line['id']); |
|
134 | + if (!isset($line['id'])) { |
|
135 | + $id = trim($line['mmsi']); |
|
136 | + } else { |
|
137 | + $id = trim($line['id']); |
|
138 | + } |
|
126 | 139 | |
127 | 140 | if (!isset($this->all_tracked[$id])) { |
128 | 141 | $this->all_tracked[$id] = array(); |
@@ -130,10 +143,16 @@ discard block |
||
130 | 143 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '')); |
131 | 144 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
132 | 145 | if (!isset($line['id'])) { |
133 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
146 | + if (!isset($globalDaemon)) { |
|
147 | + $globalDaemon = TRUE; |
|
148 | + } |
|
134 | 149 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
135 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
136 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
150 | + } else { |
|
151 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
152 | + } |
|
153 | + if ($globalAllTracked !== FALSE) { |
|
154 | + $dataFound = true; |
|
155 | + } |
|
137 | 156 | } |
138 | 157 | |
139 | 158 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
@@ -183,34 +202,49 @@ discard block |
||
183 | 202 | $Marine = new Marine($this->db); |
184 | 203 | $fromsource = NULL; |
185 | 204 | $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
186 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
205 | + if ($globalDebug && $result != 'success') { |
|
206 | + echo '!!! ERROR : '.$result."\n"; |
|
207 | + } |
|
187 | 208 | $Marine->db = null; |
188 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
209 | + if ($globalDebugTimeElapsed) { |
|
210 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
211 | + } |
|
189 | 212 | } |
190 | 213 | } |
191 | 214 | } |
192 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
215 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
216 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
217 | + } |
|
193 | 218 | } |
194 | 219 | |
195 | 220 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
196 | 221 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
197 | 222 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
198 | 223 | } else { |
199 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
200 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
224 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
225 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
226 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
227 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
228 | + } |
|
201 | 229 | return ''; |
202 | 230 | } |
203 | 231 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
204 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
232 | + if ($globalDebug) { |
|
233 | + echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
234 | + } |
|
205 | 235 | return ''; |
206 | 236 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
207 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
237 | + if ($globalDebug) { |
|
238 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
239 | + } |
|
208 | 240 | return ''; |
209 | 241 | } elseif (!isset($line['datetime'])) { |
210 | 242 | date_default_timezone_set('UTC'); |
211 | 243 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
212 | 244 | } else { |
213 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
245 | + if ($globalDebug) { |
|
246 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
247 | + } |
|
214 | 248 | return ''; |
215 | 249 | } |
216 | 250 | |
@@ -223,14 +257,21 @@ discard block |
||
223 | 257 | if ($distance > 1000 && $distance < 10000) { |
224 | 258 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
225 | 259 | $speed = $speed*3.6; |
226 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
227 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
260 | + if ($speed < 1000) { |
|
261 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
262 | + } |
|
263 | + if ($globalDebug) { |
|
264 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
265 | + } |
|
228 | 266 | } |
229 | 267 | } |
230 | 268 | |
231 | 269 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
232 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
233 | - else unset($timediff); |
|
270 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
271 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
272 | + } else { |
|
273 | + unset($timediff); |
|
274 | + } |
|
234 | 275 | if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
235 | 276 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
236 | 277 | if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
@@ -238,22 +279,32 @@ discard block |
||
238 | 279 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
239 | 280 | $this->all_tracked[$id]['putinarchive'] = true; |
240 | 281 | |
241 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
282 | + if ($globalDebug) { |
|
283 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
284 | + } |
|
242 | 285 | $timeelapsed = microtime(true); |
243 | 286 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
244 | 287 | $Marine = new Marine($this->db); |
245 | 288 | $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
246 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
289 | + if (!empty($all_country)) { |
|
290 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
291 | + } |
|
247 | 292 | $Marine->db = null; |
248 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
293 | + if ($globalDebugTimeElapsed) { |
|
294 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
295 | + } |
|
249 | 296 | } |
250 | 297 | $this->tmd = 0; |
251 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
298 | + if ($globalDebug) { |
|
299 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
300 | + } |
|
252 | 301 | } |
253 | 302 | } |
254 | 303 | |
255 | 304 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
256 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
305 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
306 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
307 | + } |
|
257 | 308 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
258 | 309 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
259 | 310 | $dataFound = true; |
@@ -262,8 +313,12 @@ discard block |
||
262 | 313 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
263 | 314 | } |
264 | 315 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
265 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
266 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
316 | + if ($line['longitude'] > 180) { |
|
317 | + $line['longitude'] = $line['longitude'] - 360; |
|
318 | + } |
|
319 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
320 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
321 | + } |
|
267 | 322 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
268 | 323 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
269 | 324 | $dataFound = true; |
@@ -281,7 +336,9 @@ discard block |
||
281 | 336 | } |
282 | 337 | } |
283 | 338 | if (isset($line['last_update']) && $line['last_update'] != '') { |
284 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
339 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
340 | + $dataFound = true; |
|
341 | + } |
|
285 | 342 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
286 | 343 | } |
287 | 344 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -311,15 +368,21 @@ discard block |
||
311 | 368 | } |
312 | 369 | |
313 | 370 | if (isset($line['heading']) && $line['heading'] != '') { |
314 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
371 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
372 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
373 | + } |
|
315 | 374 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
316 | 375 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
317 | 376 | //$dataFound = true; |
318 | 377 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
319 | 378 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
320 | 379 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
321 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
322 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
380 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
381 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
382 | + } |
|
383 | + if ($globalDebug) { |
|
384 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
385 | + } |
|
323 | 386 | } |
324 | 387 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
325 | 388 | |
@@ -331,23 +394,38 @@ discard block |
||
331 | 394 | if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
332 | 395 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
333 | 396 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
334 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
397 | + if ($globalDebug) { |
|
398 | + echo "Check if aircraft is already in DB..."; |
|
399 | + } |
|
335 | 400 | $timeelapsed = microtime(true); |
336 | 401 | $MarineLive = new MarineLive($this->db); |
337 | 402 | if (isset($line['id'])) { |
338 | 403 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
339 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
404 | + if ($globalDebugTimeElapsed) { |
|
405 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
406 | + } |
|
340 | 407 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
341 | 408 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
342 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
409 | + if ($globalDebugTimeElapsed) { |
|
410 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
411 | + } |
|
343 | 412 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
344 | 413 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
345 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
346 | - } else $recent_ident = ''; |
|
414 | + if ($globalDebugTimeElapsed) { |
|
415 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
416 | + } |
|
417 | + } else { |
|
418 | + $recent_ident = ''; |
|
419 | + } |
|
347 | 420 | $MarineLive->db=null; |
348 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
349 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
350 | - } else $recent_ident = ''; |
|
421 | + if ($globalDebug && $recent_ident == '') { |
|
422 | + echo " Not in DB.\n"; |
|
423 | + } elseif ($globalDebug && $recent_ident != '') { |
|
424 | + echo " Already in DB.\n"; |
|
425 | + } |
|
426 | + } else { |
|
427 | + $recent_ident = ''; |
|
428 | + } |
|
351 | 429 | } else { |
352 | 430 | $recent_ident = ''; |
353 | 431 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -355,30 +433,44 @@ discard block |
||
355 | 433 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
356 | 434 | if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
357 | 435 | { |
358 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
436 | + if ($globalDebug) { |
|
437 | + echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
438 | + } |
|
359 | 439 | //adds the spotter data for the archive |
360 | 440 | $highlight = ''; |
361 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
441 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
442 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
443 | + } |
|
362 | 444 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
363 | 445 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
364 | 446 | $timeelapsed = microtime(true); |
365 | 447 | $Marine = new Marine($this->db); |
366 | 448 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
367 | 449 | $Marine->db = null; |
368 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
369 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
450 | + if ($globalDebug && isset($result)) { |
|
451 | + echo $result."\n"; |
|
452 | + } |
|
453 | + if ($globalDebugTimeElapsed) { |
|
454 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
455 | + } |
|
370 | 456 | } |
371 | 457 | } |
372 | 458 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
373 | 459 | // Add source stat in DB |
374 | 460 | $Stats = new Stats($this->db); |
375 | 461 | if (!empty($this->stats)) { |
376 | - if ($globalDebug) echo 'Add source stats : '; |
|
462 | + if ($globalDebug) { |
|
463 | + echo 'Add source stats : '; |
|
464 | + } |
|
377 | 465 | foreach($this->stats as $date => $data) { |
378 | 466 | foreach($data as $source => $sourced) { |
379 | 467 | //print_r($sourced); |
380 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
381 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
468 | + if (isset($sourced['polar'])) { |
|
469 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
470 | + } |
|
471 | + if (isset($sourced['hist'])) { |
|
472 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
473 | + } |
|
382 | 474 | if (isset($sourced['msg'])) { |
383 | 475 | if (time() - $sourced['msg']['date'] > 10) { |
384 | 476 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -391,7 +483,9 @@ discard block |
||
391 | 483 | unset($this->stats[$date]); |
392 | 484 | } |
393 | 485 | } |
394 | - if ($globalDebug) echo 'Done'."\n"; |
|
486 | + if ($globalDebug) { |
|
487 | + echo 'Done'."\n"; |
|
488 | + } |
|
395 | 489 | } |
396 | 490 | $Stats->db = null; |
397 | 491 | } |
@@ -401,13 +495,17 @@ discard block |
||
401 | 495 | $this->all_tracked[$id]['addedMarine'] = 1; |
402 | 496 | //print_r($this->all_tracked[$id]); |
403 | 497 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
404 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
498 | + if ($globalDebug) { |
|
499 | + echo "---- Deleting Live Marine data older than 9 hours..."; |
|
500 | + } |
|
405 | 501 | //MarineLive->deleteLiveMarineDataNotUpdated(); |
406 | 502 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
407 | 503 | $MarineLive = new MarineLive($this->db); |
408 | 504 | $MarineLive->deleteLiveMarineData(); |
409 | 505 | $MarineLive->db=null; |
410 | - if ($globalDebug) echo " Done\n"; |
|
506 | + if ($globalDebug) { |
|
507 | + echo " Done\n"; |
|
508 | + } |
|
411 | 509 | } |
412 | 510 | $this->last_delete = time(); |
413 | 511 | } |
@@ -433,15 +531,21 @@ discard block |
||
433 | 531 | |
434 | 532 | if (!$ignoreImport) { |
435 | 533 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
436 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
534 | + if ($globalDebug) { |
|
535 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
536 | + } |
|
437 | 537 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
438 | 538 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
439 | 539 | $timeelapsed = microtime(true); |
440 | 540 | $MarineLive = new MarineLive($this->db); |
441 | 541 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
442 | 542 | $MarineLive->db = null; |
443 | - if ($globalDebug) echo $result."\n"; |
|
444 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
543 | + if ($globalDebug) { |
|
544 | + echo $result."\n"; |
|
545 | + } |
|
546 | + if ($globalDebugTimeElapsed) { |
|
547 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
548 | + } |
|
445 | 549 | } |
446 | 550 | } |
447 | 551 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
@@ -453,7 +557,9 @@ discard block |
||
453 | 557 | |
454 | 558 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
455 | 559 | $source = $this->all_tracked[$id]['source_name']; |
456 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
560 | + if ($source == '') { |
|
561 | + $source = $this->all_tracked[$id]['format_source']; |
|
562 | + } |
|
457 | 563 | if (!isset($this->source_location[$source])) { |
458 | 564 | $Location = new Source(); |
459 | 565 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -474,7 +580,9 @@ discard block |
||
474 | 580 | $stats_heading = round($stats_heading/22.5); |
475 | 581 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
476 | 582 | $current_date = date('Y-m-d'); |
477 | - if ($stats_heading == 16) $stats_heading = 0; |
|
583 | + if ($stats_heading == 16) { |
|
584 | + $stats_heading = 0; |
|
585 | + } |
|
478 | 586 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
479 | 587 | for ($i=0;$i<=15;$i++) { |
480 | 588 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -492,7 +600,9 @@ discard block |
||
492 | 600 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
493 | 601 | end($this->stats[$current_date][$source]['hist']); |
494 | 602 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
495 | - } else $mini = 0; |
|
603 | + } else { |
|
604 | + $mini = 0; |
|
605 | + } |
|
496 | 606 | for ($i=$mini;$i<=$distance;$i+=10) { |
497 | 607 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
498 | 608 | } |
@@ -504,19 +614,27 @@ discard block |
||
504 | 614 | |
505 | 615 | |
506 | 616 | $this->all_tracked[$id]['lastupdate'] = time(); |
507 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
508 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
617 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
618 | + $send = true; |
|
619 | + } |
|
620 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
621 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
622 | + } |
|
509 | 623 | //$this->del(); |
510 | 624 | |
511 | 625 | |
512 | 626 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
513 | 627 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
514 | - if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
628 | + if ($globalDebug) { |
|
629 | + echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
630 | + } |
|
515 | 631 | $MarineLive = new MarineLive($this->db); |
516 | 632 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
517 | 633 | $MarineLive->db = null; |
518 | 634 | //MarineLive->deleteLiveMarineData(); |
519 | - if ($globalDebug) echo " Done\n"; |
|
635 | + if ($globalDebug) { |
|
636 | + echo " Done\n"; |
|
637 | + } |
|
520 | 638 | } |
521 | 639 | $this->last_delete_hourly = time(); |
522 | 640 | } |
@@ -525,7 +643,9 @@ discard block |
||
525 | 643 | //$ignoreImport = false; |
526 | 644 | } |
527 | 645 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
528 | - if ($send) return $this->all_tracked[$id]; |
|
646 | + if ($send) { |
|
647 | + return $this->all_tracked[$id]; |
|
648 | + } |
|
529 | 649 | } |
530 | 650 | } |
531 | 651 | } |
@@ -79,23 +79,23 @@ discard block |
||
79 | 79 | <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
80 | 80 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
81 | 81 | <?php |
82 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
82 | + if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
83 | 83 | ?> |
84 | 84 | <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
85 | 85 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
86 | 86 | <?php |
87 | - } else { |
|
88 | - ?> |
|
87 | + } else { |
|
88 | + ?> |
|
89 | 89 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
90 | 90 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
91 | 91 | <?php |
92 | - } |
|
93 | - ?> |
|
92 | + } |
|
93 | + ?> |
|
94 | 94 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
95 | 95 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
96 | 96 | <?php |
97 | - if ($airline_icao == '') { |
|
98 | - ?> |
|
97 | + if ($airline_icao == '') { |
|
98 | + ?> |
|
99 | 99 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
100 | 100 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
101 | 101 | <?php |
@@ -138,39 +138,39 @@ discard block |
||
138 | 138 | <div class="col-md-6"> |
139 | 139 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
140 | 140 | <?php |
141 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
143 | - else { |
|
144 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
145 | - $aircraft_data = ''; |
|
146 | - foreach($aircraft_array as $aircraft_item) |
|
147 | - { |
|
148 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | - } |
|
151 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
152 | - print 'var series = ['.$aircraft_data.'];'; |
|
153 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
154 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
155 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
156 | - print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
157 | - print 'dataset'; |
|
158 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
159 | - print '</script>'; |
|
160 | - } |
|
161 | - ?> |
|
141 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
142 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
143 | + else { |
|
144 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
145 | + $aircraft_data = ''; |
|
146 | + foreach($aircraft_array as $aircraft_item) |
|
147 | + { |
|
148 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | + else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | + } |
|
151 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
152 | + print 'var series = ['.$aircraft_data.'];'; |
|
153 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
154 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
155 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
156 | + print 'var aircraftype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
157 | + print 'dataset'; |
|
158 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
159 | + print '</script>'; |
|
160 | + } |
|
161 | + ?> |
|
162 | 162 | <div class="more"> |
163 | 163 | <?php |
164 | - if ($year != '' && $month != '') { |
|
165 | - ?> |
|
164 | + if ($year != '' && $month != '') { |
|
165 | + ?> |
|
166 | 166 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
167 | 167 | <?php |
168 | - } else { |
|
169 | - ?> |
|
168 | + } else { |
|
169 | + ?> |
|
170 | 170 | <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
171 | 171 | <?php |
172 | - } |
|
173 | - ?> |
|
172 | + } |
|
173 | + ?> |
|
174 | 174 | </div> |
175 | 175 | </div> |
176 | 176 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -223,29 +223,29 @@ discard block |
||
223 | 223 | <div class="col-md-6"> |
224 | 224 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
225 | 225 | <?php |
226 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
227 | - if (count($marine_array) == 0) print _("No data available"); |
|
228 | - else { |
|
229 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
230 | - $marine_data = ''; |
|
231 | - foreach($marine_array as $marine_item) |
|
232 | - { |
|
233 | - $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
234 | - } |
|
235 | - $marine_data = substr($marine_data, 0, -1); |
|
236 | - print 'var series = ['.$marine_data.'];'; |
|
237 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
238 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
239 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
240 | - print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
241 | - print 'dataset'; |
|
242 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
243 | - print '</script>'; |
|
244 | - } |
|
245 | - ?> |
|
226 | + $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
227 | + if (count($marine_array) == 0) print _("No data available"); |
|
228 | + else { |
|
229 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
230 | + $marine_data = ''; |
|
231 | + foreach($marine_array as $marine_item) |
|
232 | + { |
|
233 | + $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
234 | + } |
|
235 | + $marine_data = substr($marine_data, 0, -1); |
|
236 | + print 'var series = ['.$marine_data.'];'; |
|
237 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
238 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
239 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
240 | + print 'var marinetype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
241 | + print 'dataset'; |
|
242 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
243 | + print '</script>'; |
|
244 | + } |
|
245 | + ?> |
|
246 | 246 | <div class="more"> |
247 | 247 | <?php |
248 | - /* |
|
248 | + /* |
|
249 | 249 | if ($year != '' && $month != '') { |
250 | 250 | ?> |
251 | 251 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | <?php |
257 | 257 | } |
258 | 258 | */ |
259 | - ?> |
|
259 | + ?> |
|
260 | 260 | </div> |
261 | 261 | </div> |
262 | 262 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -271,29 +271,29 @@ discard block |
||
271 | 271 | <div class="col-md-6"> |
272 | 272 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
273 | 273 | <?php |
274 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
275 | - if (count($tracker_array) == 0) print _("No data available"); |
|
276 | - else { |
|
277 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
278 | - $tracker_data = ''; |
|
279 | - foreach($tracker_array as $tracker_item) |
|
280 | - { |
|
281 | - $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
282 | - } |
|
283 | - $tracker_data = substr($tracker_data, 0, -1); |
|
284 | - print 'var series = ['.$tracker_data.'];'; |
|
285 | - print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
286 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
287 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
288 | - print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
289 | - print 'dataset'; |
|
290 | - print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
291 | - print '</script>'; |
|
292 | - } |
|
293 | - ?> |
|
274 | + $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
275 | + if (count($tracker_array) == 0) print _("No data available"); |
|
276 | + else { |
|
277 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
278 | + $tracker_data = ''; |
|
279 | + foreach($tracker_array as $tracker_item) |
|
280 | + { |
|
281 | + $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
282 | + } |
|
283 | + $tracker_data = substr($tracker_data, 0, -1); |
|
284 | + print 'var series = ['.$tracker_data.'];'; |
|
285 | + print 'var dataset = [];var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
286 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
287 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
288 | + print 'var trackertype = new d3pie("chart1",{"header":{"title":{"fontSize":24,"font":"open sans"},"subtitle":{"color":"#999999","fontSize":12,"font":"open sans"},"titleSubtitlePadding":9},"footer":{"color":"#999999","fontSize":10,"font":"open sans","location":"bottom-left"},"size":{"canvasWidth":700,"pieOuterRadius":"60%"},"data":{"sortOrder":"value-desc","content":'; |
|
289 | + print 'dataset'; |
|
290 | + print '},"labels":{"outer":{"pieDistance":32},"inner":{"hideWhenLessThanPercentage":3},"mainLabel":{"fontSize":11},"percentage":{"color":"#ffffff","decimalPlaces":0},"value":{"color":"#adadad","fontSize":11},"lines":{"enabled":true},"truncation":{"enabled":true}},"effects":{"pullOutSegmentOnClick":{"effect":"linear","speed":400,"size":8}},"misc":{"gradient":{"enabled":true,"percentage":100}}});'; |
|
291 | + print '</script>'; |
|
292 | + } |
|
293 | + ?> |
|
294 | 294 | <div class="more"> |
295 | 295 | <?php |
296 | - /* |
|
296 | + /* |
|
297 | 297 | if ($year != '' && $month != '') { |
298 | 298 | ?> |
299 | 299 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | <?php |
305 | 305 | } |
306 | 306 | */ |
307 | - ?> |
|
307 | + ?> |
|
308 | 308 | </div> |
309 | 309 | </div> |
310 | 310 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | } |
20 | 20 | |
21 | 21 | if (!isset($filter_name)) $filter_name = ''; |
22 | -$airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
22 | +$airline_icao = (string) filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
23 | 23 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | 24 | if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
25 | 25 | } |
@@ -34,8 +34,8 @@ discard block |
||
34 | 34 | $title = _("Statistics"); |
35 | 35 | } |
36 | 36 | |
37 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
38 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
37 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
38 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
39 | 39 | |
40 | 40 | require_once('header.php'); |
41 | 41 | |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | date_default_timezone_set('UTC'); |
63 | 63 | $lastupdate = strtotime($last_update[0]['value']); |
64 | 64 | if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
65 | - print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
|
65 | + print '<i>Last update: '.date('Y-m-d G:i:s', $lastupdate).'</i>'; |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | ?> |
@@ -74,30 +74,30 @@ discard block |
||
74 | 74 | <?php |
75 | 75 | if ($type == 'aircraft') { |
76 | 76 | ?> |
77 | - <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Flights"); ?></span> |
|
78 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
79 | - <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
80 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
77 | + <span><span class="badge"><?php print number_format($Stats->countOverallFlights($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Flights"); ?></span> |
|
78 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
79 | + <span><span class="badge"><?php print number_format($Stats->countOverallArrival($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Arrivals seen"); ?></span> |
|
80 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
81 | 81 | <?php |
82 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
82 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
83 | 83 | ?> |
84 | - <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
85 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
84 | + <span><span class="badge"><?php print number_format($Stats->countOverallPilots($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Pilots"); ?></span> |
|
85 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
86 | 86 | <?php |
87 | 87 | } else { |
88 | 88 | ?> |
89 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
90 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
89 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
90 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
91 | 91 | <?php |
92 | 92 | } |
93 | 93 | ?> |
94 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
95 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
94 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
95 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
96 | 96 | <?php |
97 | 97 | if ($airline_icao == '') { |
98 | 98 | ?> |
99 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
100 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
99 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
100 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
101 | 101 | <?php |
102 | 102 | } |
103 | 103 | ?> |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | if (!(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS)) { |
106 | 106 | if ($airline_icao == '' || $airline_icao == 'all') { |
107 | 107 | ?> |
108 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
109 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
108 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
109 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
110 | 110 | <?php |
111 | 111 | } |
112 | 112 | } |
@@ -114,22 +114,22 @@ discard block |
||
114 | 114 | <?php |
115 | 115 | } elseif ($type == 'marine') { |
116 | 116 | ?> |
117 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
118 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
119 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
120 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
117 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
118 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
119 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
120 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
121 | 121 | <?php |
122 | 122 | } elseif ($type == 'tracker') { |
123 | 123 | ?> |
124 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
125 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
126 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
127 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
124 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
125 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
126 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
127 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
128 | 128 | <?php |
129 | 129 | } |
130 | 130 | ?> |
131 | 131 | </p> |
132 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
132 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
133 | 133 | <div class="specific-stats"> |
134 | 134 | <?php |
135 | 135 | if ($type == 'aircraft') { |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | <div class="col-md-6"> |
139 | 139 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
140 | 140 | <?php |
141 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
141 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
142 | 142 | if (count($aircraft_array) == 0) print _("No data available"); |
143 | 143 | else { |
144 | 144 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
145 | 145 | $aircraft_data = ''; |
146 | - foreach($aircraft_array as $aircraft_item) |
|
146 | + foreach ($aircraft_array as $aircraft_item) |
|
147 | 147 | { |
148 | 148 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
149 | 149 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
@@ -173,17 +173,17 @@ discard block |
||
173 | 173 | ?> |
174 | 174 | </div> |
175 | 175 | </div> |
176 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
176 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
177 | 177 | <?php |
178 | 178 | // echo $airline_icao; |
179 | 179 | if ($airline_icao == '' || $airline_icao == 'all') { |
180 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
180 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
181 | 181 | if (count($airline_array) > 0) { |
182 | 182 | print '<div class="col-md-6">'; |
183 | 183 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
184 | 184 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
185 | 185 | $airline_data = ''; |
186 | - foreach($airline_array as $airline_item) |
|
186 | + foreach ($airline_array as $airline_item) |
|
187 | 187 | { |
188 | 188 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
189 | 189 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | ?> |
211 | 211 | </div> |
212 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
212 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
213 | 213 | <?php |
214 | 214 | } |
215 | 215 | ?> |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | <div class="col-md-6"> |
224 | 224 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
225 | 225 | <?php |
226 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
226 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
227 | 227 | if (count($marine_array) == 0) print _("No data available"); |
228 | 228 | else { |
229 | 229 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
230 | 230 | $marine_data = ''; |
231 | - foreach($marine_array as $marine_item) |
|
231 | + foreach ($marine_array as $marine_item) |
|
232 | 232 | { |
233 | 233 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
234 | 234 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | ?> |
260 | 260 | </div> |
261 | 261 | </div> |
262 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
262 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
263 | 263 | <!-- </div>--> |
264 | 264 | <?php |
265 | 265 | } |
@@ -271,12 +271,12 @@ discard block |
||
271 | 271 | <div class="col-md-6"> |
272 | 272 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
273 | 273 | <?php |
274 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
274 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
275 | 275 | if (count($tracker_array) == 0) print _("No data available"); |
276 | 276 | else { |
277 | 277 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
278 | 278 | $tracker_data = ''; |
279 | - foreach($tracker_array as $tracker_item) |
|
279 | + foreach ($tracker_array as $tracker_item) |
|
280 | 280 | { |
281 | 281 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
282 | 282 | } |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | ?> |
308 | 308 | </div> |
309 | 309 | </div> |
310 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
310 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
311 | 311 | <!-- </div>--> |
312 | 312 | <?php |
313 | 313 | } |
@@ -317,8 +317,8 @@ discard block |
||
317 | 317 | ?> |
318 | 318 | <div class="row column"> |
319 | 319 | <?php |
320 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
321 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
320 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
321 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
322 | 322 | if (empty($flightover_array)) { |
323 | 323 | print '<div class="col-md-12">'; |
324 | 324 | } else { |
@@ -327,12 +327,12 @@ discard block |
||
327 | 327 | ?> |
328 | 328 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 329 | <?php |
330 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
330 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
331 | 331 | if (count($pilot_array) == 0) print _("No data available"); |
332 | 332 | else { |
333 | 333 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 334 | $pilot_data = ''; |
335 | - foreach($pilot_array as $pilot_item) |
|
335 | + foreach ($pilot_array as $pilot_item) |
|
336 | 336 | { |
337 | 337 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
338 | 338 | } |
@@ -354,19 +354,19 @@ discard block |
||
354 | 354 | ?> |
355 | 355 | </div> |
356 | 356 | |
357 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
357 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
358 | 358 | <?php |
359 | 359 | } else { |
360 | 360 | ?> |
361 | 361 | <div class="col-md-6"> |
362 | 362 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
363 | 363 | <?php |
364 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
364 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
365 | 365 | if (count($owner_array) == 0) print _("No data available"); |
366 | 366 | else { |
367 | 367 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
368 | 368 | $owner_data = ''; |
369 | - foreach($owner_array as $owner_item) |
|
369 | + foreach ($owner_array as $owner_item) |
|
370 | 370 | { |
371 | 371 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
372 | 372 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | </div> |
387 | 387 | </div> |
388 | 388 | |
389 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
389 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
390 | 390 | <?php |
391 | 391 | } |
392 | 392 | if (!empty($flightover_array)) { |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 401 | print 'var series = ['; |
402 | 402 | $flightover_data = ''; |
403 | - foreach($flightover_array as $flightover_item) |
|
403 | + foreach ($flightover_array as $flightover_item) |
|
404 | 404 | { |
405 | 405 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
406 | 406 | } |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | } |
447 | 447 | ?> |
448 | 448 | </div> |
449 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
449 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
450 | 450 | |
451 | 451 | |
452 | 452 | </div> |
@@ -466,7 +466,7 @@ discard block |
||
466 | 466 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
467 | 467 | print 'var series = ['; |
468 | 468 | $flightover_data = ''; |
469 | - foreach($flightover_array as $flightover_item) |
|
469 | + foreach ($flightover_array as $flightover_item) |
|
470 | 470 | { |
471 | 471 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
472 | 472 | } |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
527 | 527 | print 'var series = ['; |
528 | 528 | $flightover_data = ''; |
529 | - foreach($flightover_array as $flightover_item) |
|
529 | + foreach ($flightover_array as $flightover_item) |
|
530 | 530 | { |
531 | 531 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
532 | 532 | } |
@@ -579,14 +579,14 @@ discard block |
||
579 | 579 | <div class="row column"> |
580 | 580 | <div class="col-md-6"> |
581 | 581 | <?php |
582 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
582 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
583 | 583 | if (count($airport_airport_array) > 0) { |
584 | 584 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
585 | 585 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
586 | 586 | print "\n"; |
587 | 587 | print 'var series = ['; |
588 | 588 | $airport_data = ''; |
589 | - foreach($airport_airport_array as $airport_item) |
|
589 | + foreach ($airport_airport_array as $airport_item) |
|
590 | 590 | { |
591 | 591 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
592 | 592 | } |
@@ -637,18 +637,18 @@ discard block |
||
637 | 637 | } |
638 | 638 | ?> |
639 | 639 | </div> |
640 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
640 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
641 | 641 | |
642 | 642 | <div class="col-md-6"> |
643 | 643 | <?php |
644 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
644 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
645 | 645 | if (count($airport_airport_array2) > 0) { |
646 | 646 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
647 | 647 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
648 | 648 | print "\n"; |
649 | 649 | print 'var series = ['; |
650 | 650 | $airport_data = ''; |
651 | - foreach($airport_airport_array2 as $airport_item) |
|
651 | + foreach ($airport_airport_array2 as $airport_item) |
|
652 | 652 | { |
653 | 653 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
654 | 654 | } |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | ?> |
701 | 701 | </div> |
702 | 702 | </div> |
703 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
703 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
704 | 704 | <?php |
705 | 705 | } |
706 | 706 | ?> |
@@ -714,19 +714,19 @@ discard block |
||
714 | 714 | <div class="col-md-6"> |
715 | 715 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
716 | 716 | <?php |
717 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
717 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
718 | 718 | if (count($year_array) == 0) print _("No data available"); |
719 | 719 | else { |
720 | 720 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
721 | 721 | $year_data = ''; |
722 | 722 | $year_cnt = ''; |
723 | - foreach($year_array as $year_item) |
|
723 | + foreach ($year_array as $year_item) |
|
724 | 724 | { |
725 | 725 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
726 | 726 | $year_cnt .= $year_item['date_count'].','; |
727 | 727 | } |
728 | 728 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
729 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
729 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
730 | 730 | print 'c3.generate({ |
731 | 731 | bindto: "#chart8", |
732 | 732 | data: { x: "x", |
@@ -739,23 +739,23 @@ discard block |
||
739 | 739 | <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
740 | 740 | </div> |
741 | 741 | </div> |
742 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
742 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
743 | 743 | <div class="col-md-6"> |
744 | 744 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
745 | 745 | <?php |
746 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
746 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
747 | 747 | if (count($month_array) == 0) print _("No data available"); |
748 | 748 | else { |
749 | 749 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
750 | 750 | $month_data = ''; |
751 | 751 | $month_cnt = ''; |
752 | - foreach($month_array as $month_item) |
|
752 | + foreach ($month_array as $month_item) |
|
753 | 753 | { |
754 | 754 | $month_data .= '"'.$month_item['date_name'].'",'; |
755 | 755 | $month_cnt .= $month_item['date_count'].','; |
756 | 756 | } |
757 | 757 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
758 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
758 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
759 | 759 | print 'c3.generate({ |
760 | 760 | bindto: "#chart9", |
761 | 761 | data: { x: "x", |
@@ -768,24 +768,24 @@ discard block |
||
768 | 768 | <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
769 | 769 | </div> |
770 | 770 | </div> |
771 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
771 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
772 | 772 | |
773 | 773 | <div class="col-md-6"> |
774 | 774 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
775 | 775 | <?php |
776 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
776 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
777 | 777 | if (empty($date_array)) print _("No data available"); |
778 | 778 | else { |
779 | 779 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
780 | 780 | $date_data = ''; |
781 | 781 | $date_cnt = ''; |
782 | - foreach($date_array as $date_item) |
|
782 | + foreach ($date_array as $date_item) |
|
783 | 783 | { |
784 | 784 | $date_data .= '"'.$date_item['date_name'].'",'; |
785 | 785 | $date_cnt .= $date_item['date_count'].','; |
786 | 786 | } |
787 | 787 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
788 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
788 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
789 | 789 | print 'c3.generate({ |
790 | 790 | bindto: "#chart5", |
791 | 791 | data: { x: "x", |
@@ -798,23 +798,23 @@ discard block |
||
798 | 798 | <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
799 | 799 | </div> |
800 | 800 | </div> |
801 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
801 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
802 | 802 | <div class="col-md-6"> |
803 | 803 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
804 | 804 | <?php |
805 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
805 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
806 | 806 | if (empty($hour_array)) print _("No data available"); |
807 | 807 | else { |
808 | 808 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
809 | 809 | $hour_data = ''; |
810 | 810 | $hour_cnt = ''; |
811 | - foreach($hour_array as $hour_item) |
|
811 | + foreach ($hour_array as $hour_item) |
|
812 | 812 | { |
813 | 813 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
814 | 814 | $hour_cnt .= $hour_item['hour_count'].','; |
815 | 815 | } |
816 | 816 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
817 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
817 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
818 | 818 | print 'c3.generate({ |
819 | 819 | bindto: "#chart6", |
820 | 820 | data: { |
@@ -827,7 +827,7 @@ discard block |
||
827 | 827 | <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
828 | 828 | </div> |
829 | 829 | </div> |
830 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
830 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
831 | 831 | </div> |
832 | 832 | <?php |
833 | 833 | } |
@@ -845,19 +845,19 @@ discard block |
||
845 | 845 | <div class="col-md-6"> |
846 | 846 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
847 | 847 | <?php |
848 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
848 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
849 | 849 | if (count($year_array) == 0) print _("No data available"); |
850 | 850 | else { |
851 | 851 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
852 | 852 | $year_data = ''; |
853 | 853 | $year_cnt = ''; |
854 | - foreach($year_array as $year_item) |
|
854 | + foreach ($year_array as $year_item) |
|
855 | 855 | { |
856 | 856 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
857 | 857 | $year_cnt .= $year_item['date_count'].','; |
858 | 858 | } |
859 | 859 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
860 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
860 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
861 | 861 | print 'c3.generate({ |
862 | 862 | bindto: "#chart8", |
863 | 863 | data: { x: "x", |
@@ -871,23 +871,23 @@ discard block |
||
871 | 871 | </div> |
872 | 872 | </div> |
873 | 873 | |
874 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
874 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
875 | 875 | <div class="col-md-6"> |
876 | 876 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
877 | 877 | <?php |
878 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
878 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
879 | 879 | if (count($month_array) == 0) print _("No data available"); |
880 | 880 | else { |
881 | 881 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
882 | 882 | $month_data = ''; |
883 | 883 | $month_cnt = ''; |
884 | - foreach($month_array as $month_item) |
|
884 | + foreach ($month_array as $month_item) |
|
885 | 885 | { |
886 | 886 | $month_data .= '"'.$month_item['date_name'].'",'; |
887 | 887 | $month_cnt .= $month_item['date_count'].','; |
888 | 888 | } |
889 | 889 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
890 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
890 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
891 | 891 | print 'c3.generate({ |
892 | 892 | bindto: "#chart9", |
893 | 893 | data: { x: "x", |
@@ -900,24 +900,24 @@ discard block |
||
900 | 900 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
901 | 901 | </div> |
902 | 902 | </div> |
903 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
903 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
904 | 904 | |
905 | 905 | <div class="col-md-6"> |
906 | 906 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
907 | 907 | <?php |
908 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
908 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
909 | 909 | if (empty($date_array)) print _("No data available"); |
910 | 910 | else { |
911 | 911 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
912 | 912 | $date_data = ''; |
913 | 913 | $date_cnt = ''; |
914 | - foreach($date_array as $date_item) |
|
914 | + foreach ($date_array as $date_item) |
|
915 | 915 | { |
916 | 916 | $date_data .= '"'.$date_item['date_name'].'",'; |
917 | 917 | $date_cnt .= $date_item['date_count'].','; |
918 | 918 | } |
919 | 919 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
920 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
920 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
921 | 921 | print 'c3.generate({ |
922 | 922 | bindto: "#chart5", |
923 | 923 | data: { x: "x", |
@@ -930,23 +930,23 @@ discard block |
||
930 | 930 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
931 | 931 | </div> |
932 | 932 | </div> |
933 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
933 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
934 | 934 | <div class="col-md-6"> |
935 | 935 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
936 | 936 | <?php |
937 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
937 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
938 | 938 | if (empty($hour_array)) print _("No data available"); |
939 | 939 | else { |
940 | 940 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
941 | 941 | $hour_data = ''; |
942 | 942 | $hour_cnt = ''; |
943 | - foreach($hour_array as $hour_item) |
|
943 | + foreach ($hour_array as $hour_item) |
|
944 | 944 | { |
945 | 945 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
946 | 946 | $hour_cnt .= $hour_item['hour_count'].','; |
947 | 947 | } |
948 | 948 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
949 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
949 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
950 | 950 | print 'c3.generate({ |
951 | 951 | bindto: "#chart6", |
952 | 952 | data: { |
@@ -959,7 +959,7 @@ discard block |
||
959 | 959 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
960 | 960 | </div> |
961 | 961 | </div> |
962 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
962 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
963 | 963 | </div> |
964 | 964 | <?php |
965 | 965 | } |
@@ -983,13 +983,13 @@ discard block |
||
983 | 983 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
984 | 984 | $year_data = ''; |
985 | 985 | $year_cnt = ''; |
986 | - foreach($year_array as $year_item) |
|
986 | + foreach ($year_array as $year_item) |
|
987 | 987 | { |
988 | 988 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
989 | 989 | $year_cnt .= $year_item['date_count'].','; |
990 | 990 | } |
991 | 991 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
992 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
992 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
993 | 993 | print 'c3.generate({ |
994 | 994 | bindto: "#chart8", |
995 | 995 | data: { x: "x", |
@@ -1003,7 +1003,7 @@ discard block |
||
1003 | 1003 | </div> |
1004 | 1004 | </div> |
1005 | 1005 | |
1006 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1006 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1007 | 1007 | <div class="col-md-6"> |
1008 | 1008 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1009 | 1009 | <?php |
@@ -1013,13 +1013,13 @@ discard block |
||
1013 | 1013 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1014 | 1014 | $month_data = ''; |
1015 | 1015 | $month_cnt = ''; |
1016 | - foreach($month_array as $month_item) |
|
1016 | + foreach ($month_array as $month_item) |
|
1017 | 1017 | { |
1018 | 1018 | $month_data .= '"'.$month_item['date_name'].'",'; |
1019 | 1019 | $month_cnt .= $month_item['date_count'].','; |
1020 | 1020 | } |
1021 | 1021 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1022 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1022 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1023 | 1023 | print 'c3.generate({ |
1024 | 1024 | bindto: "#chart9", |
1025 | 1025 | data: { x: "x", |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1033 | 1033 | </div> |
1034 | 1034 | </div> |
1035 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1035 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1036 | 1036 | |
1037 | 1037 | <div class="col-md-6"> |
1038 | 1038 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1043,13 +1043,13 @@ discard block |
||
1043 | 1043 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1044 | 1044 | $date_data = ''; |
1045 | 1045 | $date_cnt = ''; |
1046 | - foreach($date_array as $date_item) |
|
1046 | + foreach ($date_array as $date_item) |
|
1047 | 1047 | { |
1048 | 1048 | $date_data .= '"'.$date_item['date_name'].'",'; |
1049 | 1049 | $date_cnt .= $date_item['date_count'].','; |
1050 | 1050 | } |
1051 | 1051 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1052 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1052 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1053 | 1053 | print 'c3.generate({ |
1054 | 1054 | bindto: "#chart5", |
1055 | 1055 | data: { x: "x", |
@@ -1062,23 +1062,23 @@ discard block |
||
1062 | 1062 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1063 | 1063 | </div> |
1064 | 1064 | </div> |
1065 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1065 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1066 | 1066 | <div class="col-md-6"> |
1067 | 1067 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1068 | 1068 | <?php |
1069 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1069 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1070 | 1070 | if (empty($hour_array)) print _("No data available"); |
1071 | 1071 | else { |
1072 | 1072 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1073 | 1073 | $hour_data = ''; |
1074 | 1074 | $hour_cnt = ''; |
1075 | - foreach($hour_array as $hour_item) |
|
1075 | + foreach ($hour_array as $hour_item) |
|
1076 | 1076 | { |
1077 | 1077 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1078 | 1078 | $hour_cnt .= $hour_item['hour_count'].','; |
1079 | 1079 | } |
1080 | 1080 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1081 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1081 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1082 | 1082 | print 'c3.generate({ |
1083 | 1083 | bindto: "#chart6", |
1084 | 1084 | data: { |
@@ -1091,7 +1091,7 @@ discard block |
||
1091 | 1091 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1092 | 1092 | </div> |
1093 | 1093 | </div> |
1094 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1094 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1095 | 1095 | </div> |
1096 | 1096 | <?php |
1097 | 1097 | } |
@@ -1115,13 +1115,13 @@ discard block |
||
1115 | 1115 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1116 | 1116 | $year_data = ''; |
1117 | 1117 | $year_cnt = ''; |
1118 | - foreach($year_array as $year_item) |
|
1118 | + foreach ($year_array as $year_item) |
|
1119 | 1119 | { |
1120 | 1120 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1121 | 1121 | $year_cnt .= $year_item['count'].','; |
1122 | 1122 | } |
1123 | 1123 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1124 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1124 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1125 | 1125 | print 'c3.generate({ |
1126 | 1126 | bindto: "#chart32", |
1127 | 1127 | data: { x: "x", |
@@ -1134,7 +1134,7 @@ discard block |
||
1134 | 1134 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1135 | 1135 | </div> |
1136 | 1136 | </div> |
1137 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1137 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1138 | 1138 | |
1139 | 1139 | <div class="row column"> |
1140 | 1140 | <div class="col-md-6"> |
@@ -1146,13 +1146,13 @@ discard block |
||
1146 | 1146 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1147 | 1147 | $year_data = ''; |
1148 | 1148 | $year_cnt = ''; |
1149 | - foreach($year_array as $year_item) |
|
1149 | + foreach ($year_array as $year_item) |
|
1150 | 1150 | { |
1151 | 1151 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1152 | 1152 | $year_cnt .= $year_item['count'].','; |
1153 | 1153 | } |
1154 | 1154 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1155 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1155 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1156 | 1156 | print 'c3.generate({ |
1157 | 1157 | bindto: "#chart33", |
1158 | 1158 | data: { x: "x", |
@@ -1165,7 +1165,7 @@ discard block |
||
1165 | 1165 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1166 | 1166 | </div> |
1167 | 1167 | </div> |
1168 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1168 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1169 | 1169 | <br/> |
1170 | 1170 | <?php |
1171 | 1171 | } |
@@ -1181,15 +1181,15 @@ discard block |
||
1181 | 1181 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1182 | 1182 | if ($year == '' && $month == '') { |
1183 | 1183 | if ($type == 'aircraft') { |
1184 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1184 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1185 | 1185 | } elseif ($type == 'marine') { |
1186 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1186 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1187 | 1187 | } |
1188 | 1188 | } else { |
1189 | 1189 | if ($type == 'aircraft') { |
1190 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1190 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1191 | 1191 | } elseif ($type == 'marine') { |
1192 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1192 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1193 | 1193 | } |
1194 | 1194 | } |
1195 | 1195 | if (!empty($polar)) { |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | unset($polar_data); |
1199 | 1199 | $Spotter = new Spotter(); |
1200 | 1200 | $data = json_decode($eachpolar['source_data']); |
1201 | - foreach($data as $value => $key) { |
|
1201 | + foreach ($data as $value => $key) { |
|
1202 | 1202 | $direction = $Spotter->parseDirection(($value*22.5)); |
1203 | 1203 | $distance = $key; |
1204 | 1204 | $unit = 'km'; |
@@ -1218,7 +1218,7 @@ discard block |
||
1218 | 1218 | ?> |
1219 | 1219 | <div class="col-md-6"> |
1220 | 1220 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1221 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1221 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1222 | 1222 | <script> |
1223 | 1223 | (function() { |
1224 | 1224 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | color: color, |
1243 | 1243 | unit: '<?php echo $unit; ?>' |
1244 | 1244 | }; |
1245 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1245 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1246 | 1246 | })(); |
1247 | 1247 | </script> |
1248 | 1248 | </div> |
@@ -1257,15 +1257,15 @@ discard block |
||
1257 | 1257 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1258 | 1258 | if ($year == '' && $month == '') { |
1259 | 1259 | if ($type == 'aircraft') { |
1260 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1260 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1261 | 1261 | } elseif ($type == 'marine') { |
1262 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1262 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1263 | 1263 | } |
1264 | 1264 | } else { |
1265 | 1265 | if ($type == 'aircraft') { |
1266 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1266 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1267 | 1267 | } elseif ($type == 'marine') { |
1268 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1268 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1269 | 1269 | } |
1270 | 1270 | } |
1271 | 1271 | if (!empty($msg)) { |
@@ -1273,13 +1273,13 @@ discard block |
||
1273 | 1273 | foreach ($msg as $eachmsg) { |
1274 | 1274 | //$eachmsg = $msg[0]; |
1275 | 1275 | $data = $eachmsg['source_data']; |
1276 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1276 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1277 | 1277 | else $max = 500; |
1278 | 1278 | ?> |
1279 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1279 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1280 | 1280 | <script> |
1281 | 1281 | var g = new JustGage({ |
1282 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1282 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1283 | 1283 | value: <?php echo $data; ?>, |
1284 | 1284 | min: 0, |
1285 | 1285 | max: <?php print $max; ?>, |
@@ -1301,15 +1301,15 @@ discard block |
||
1301 | 1301 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1302 | 1302 | if ($year == '' && $month == '') { |
1303 | 1303 | if ($type == 'aircraft') { |
1304 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1304 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1305 | 1305 | } elseif ($type == 'marine') { |
1306 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1306 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1307 | 1307 | } |
1308 | 1308 | } else { |
1309 | 1309 | if ($type == 'aircraft') { |
1310 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1310 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1311 | 1311 | } elseif ($type == 'marine') { |
1312 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1312 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1313 | 1313 | } |
1314 | 1314 | } |
1315 | 1315 | foreach ($hist as $hists) { |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | $source = $hists['source_name']; |
1320 | 1320 | $hist_array = json_decode($hists['source_data']); |
1321 | 1321 | $unit = 'km'; |
1322 | - foreach($hist_array as $distance => $nb) |
|
1322 | + foreach ($hist_array as $distance => $nb) |
|
1323 | 1323 | { |
1324 | 1324 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1325 | 1325 | $distance = round($distance*0.539957); |
@@ -1340,18 +1340,18 @@ discard block |
||
1340 | 1340 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1341 | 1341 | ?> |
1342 | 1342 | <div class="col-md-6"> |
1343 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1343 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1344 | 1344 | <?php |
1345 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1345 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1346 | 1346 | print 'c3.generate({ |
1347 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1347 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1348 | 1348 | data: { x: "x", |
1349 | 1349 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1350 | 1350 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1351 | 1351 | print '</script>'; |
1352 | 1352 | ?> |
1353 | 1353 | </div> |
1354 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1354 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1355 | 1355 | <?php |
1356 | 1356 | } |
1357 | 1357 | ?> |
@@ -18,11 +18,15 @@ discard block |
||
18 | 18 | require_once('require/class.Spotter.php'); |
19 | 19 | } |
20 | 20 | |
21 | -if (!isset($filter_name)) $filter_name = ''; |
|
21 | +if (!isset($filter_name)) { |
|
22 | + $filter_name = ''; |
|
23 | +} |
|
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | -} |
|
26 | + if (isset($globalFilter['airline'])) { |
|
27 | + $airline_icao = $globalFilter['airline'][0]; |
|
28 | + } |
|
29 | + } |
|
26 | 30 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
27 | 31 | $Spotter = new Spotter(); |
28 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -53,7 +57,12 @@ discard block |
||
53 | 57 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
54 | 58 | <div class="column"> |
55 | 59 | <div class="info"> |
56 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
60 | + <h1><?php if (isset($airline_name)) { |
|
61 | + echo _("Statistics for ").$airline_name; |
|
62 | +} else { |
|
63 | + echo _("Statistics"); |
|
64 | +} |
|
65 | +?></h1> |
|
57 | 66 | <?php |
58 | 67 | if ($type == 'aircraft') { |
59 | 68 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -61,7 +70,9 @@ discard block |
||
61 | 70 | if (isset($last_update[0]['value'])) { |
62 | 71 | date_default_timezone_set('UTC'); |
63 | 72 | $lastupdate = strtotime($last_update[0]['value']); |
64 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
73 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
74 | + date_default_timezone_set($globalTimezone); |
|
75 | + } |
|
65 | 76 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
66 | 77 | } |
67 | 78 | } |
@@ -139,14 +150,18 @@ discard block |
||
139 | 150 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
140 | 151 | <?php |
141 | 152 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
143 | - else { |
|
153 | + if (count($aircraft_array) == 0) { |
|
154 | + print _("No data available"); |
|
155 | + } else { |
|
144 | 156 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
145 | 157 | $aircraft_data = ''; |
146 | 158 | foreach($aircraft_array as $aircraft_item) |
147 | 159 | { |
148 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
160 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
161 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
162 | + } else { |
|
163 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
164 | + } |
|
150 | 165 | } |
151 | 166 | $aircraft_data = substr($aircraft_data, 0, -1); |
152 | 167 | print 'var series = ['.$aircraft_data.'];'; |
@@ -163,11 +178,17 @@ discard block |
||
163 | 178 | <?php |
164 | 179 | if ($year != '' && $month != '') { |
165 | 180 | ?> |
166 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
181 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
182 | + echo '/'.$airline_icao; |
|
183 | +} |
|
184 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
167 | 185 | <?php |
168 | 186 | } else { |
169 | 187 | ?> |
170 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
188 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
189 | + echo '/'.$airline_icao; |
|
190 | +} |
|
191 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
171 | 192 | <?php |
172 | 193 | } |
173 | 194 | ?> |
@@ -198,11 +219,15 @@ discard block |
||
198 | 219 | print '</script>'; |
199 | 220 | if ($year != '' && $month != '') { |
200 | 221 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
201 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
222 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
223 | + echo '/'.$airline_icao; |
|
224 | + } |
|
202 | 225 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
203 | 226 | } else { |
204 | 227 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
205 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
228 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
229 | + echo '/'.$airline_icao; |
|
230 | + } |
|
206 | 231 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
207 | 232 | } |
208 | 233 | print '</div>'; |
@@ -224,8 +249,9 @@ discard block |
||
224 | 249 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
225 | 250 | <?php |
226 | 251 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
227 | - if (count($marine_array) == 0) print _("No data available"); |
|
228 | - else { |
|
252 | + if (count($marine_array) == 0) { |
|
253 | + print _("No data available"); |
|
254 | + } else { |
|
229 | 255 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
230 | 256 | $marine_data = ''; |
231 | 257 | foreach($marine_array as $marine_item) |
@@ -272,8 +298,9 @@ discard block |
||
272 | 298 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
273 | 299 | <?php |
274 | 300 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
275 | - if (count($tracker_array) == 0) print _("No data available"); |
|
276 | - else { |
|
301 | + if (count($tracker_array) == 0) { |
|
302 | + print _("No data available"); |
|
303 | + } else { |
|
277 | 304 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
278 | 305 | $tracker_data = ''; |
279 | 306 | foreach($tracker_array as $tracker_item) |
@@ -328,8 +355,9 @@ discard block |
||
328 | 355 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 356 | <?php |
330 | 357 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
331 | - if (count($pilot_array) == 0) print _("No data available"); |
|
332 | - else { |
|
358 | + if (count($pilot_array) == 0) { |
|
359 | + print _("No data available"); |
|
360 | + } else { |
|
333 | 361 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 362 | $pilot_data = ''; |
335 | 363 | foreach($pilot_array as $pilot_item) |
@@ -348,7 +376,9 @@ discard block |
||
348 | 376 | } |
349 | 377 | print '<div class="more">'; |
350 | 378 | print '<a href="'.$globalURL.'/statistics/pilot'; |
351 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
379 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
380 | + echo '/'.$airline_icao; |
|
381 | + } |
|
352 | 382 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
353 | 383 | print '</div>'; |
354 | 384 | ?> |
@@ -362,8 +392,9 @@ discard block |
||
362 | 392 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
363 | 393 | <?php |
364 | 394 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
365 | - if (count($owner_array) == 0) print _("No data available"); |
|
366 | - else { |
|
395 | + if (count($owner_array) == 0) { |
|
396 | + print _("No data available"); |
|
397 | + } else { |
|
367 | 398 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
368 | 399 | $owner_data = ''; |
369 | 400 | foreach($owner_array as $owner_item) |
@@ -382,7 +413,10 @@ discard block |
||
382 | 413 | } |
383 | 414 | ?> |
384 | 415 | <div class="more"> |
385 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
416 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
417 | + echo '/'.$airline_icao; |
|
418 | +} |
|
419 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
386 | 420 | </div> |
387 | 421 | </div> |
388 | 422 | |
@@ -395,8 +429,9 @@ discard block |
||
395 | 429 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
396 | 430 | <?php |
397 | 431 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
398 | - if (count($flightover_array) == 0) print _("No data available"); |
|
399 | - else { |
|
432 | + if (count($flightover_array) == 0) { |
|
433 | + print _("No data available"); |
|
434 | + } else { |
|
400 | 435 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 436 | print 'var series = ['; |
402 | 437 | $flightover_data = ''; |
@@ -439,7 +474,10 @@ discard block |
||
439 | 474 | } |
440 | 475 | ?> |
441 | 476 | <div class="more"> |
442 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
477 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
478 | + echo '/'.$airline_icao; |
|
479 | +} |
|
480 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
443 | 481 | </div> |
444 | 482 | </div> |
445 | 483 | <?php |
@@ -461,8 +499,9 @@ discard block |
||
461 | 499 | <div class="col-md-6"> |
462 | 500 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
463 | 501 | <?php |
464 | - if (count($flightover_array) == 0) print _("No data available"); |
|
465 | - else { |
|
502 | + if (count($flightover_array) == 0) { |
|
503 | + print _("No data available"); |
|
504 | + } else { |
|
466 | 505 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
467 | 506 | print 'var series = ['; |
468 | 507 | $flightover_data = ''; |
@@ -521,8 +560,9 @@ discard block |
||
521 | 560 | <div class="col-md-6"> |
522 | 561 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
523 | 562 | <?php |
524 | - if (count($flightover_array) == 0) print _("No data available"); |
|
525 | - else { |
|
563 | + if (count($flightover_array) == 0) { |
|
564 | + print _("No data available"); |
|
565 | + } else { |
|
526 | 566 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
527 | 567 | print 'var series = ['; |
528 | 568 | $flightover_data = ''; |
@@ -632,7 +672,9 @@ discard block |
||
632 | 672 | });"; |
633 | 673 | print '</script>'; |
634 | 674 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
635 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
675 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
676 | + echo '/'.$airline_icao; |
|
677 | + } |
|
636 | 678 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
637 | 679 | } |
638 | 680 | ?> |
@@ -694,7 +736,9 @@ discard block |
||
694 | 736 | });"; |
695 | 737 | print '</script>'; |
696 | 738 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
697 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
739 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
740 | + echo '/'.$airline_icao; |
|
741 | + } |
|
698 | 742 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
699 | 743 | } |
700 | 744 | ?> |
@@ -715,8 +759,9 @@ discard block |
||
715 | 759 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
716 | 760 | <?php |
717 | 761 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
718 | - if (count($year_array) == 0) print _("No data available"); |
|
719 | - else { |
|
762 | + if (count($year_array) == 0) { |
|
763 | + print _("No data available"); |
|
764 | + } else { |
|
720 | 765 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
721 | 766 | $year_data = ''; |
722 | 767 | $year_cnt = ''; |
@@ -736,7 +781,10 @@ discard block |
||
736 | 781 | } |
737 | 782 | ?> |
738 | 783 | <div class="more"> |
739 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
784 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
785 | + echo '/'.$airline_icao; |
|
786 | +} |
|
787 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
740 | 788 | </div> |
741 | 789 | </div> |
742 | 790 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -744,8 +792,9 @@ discard block |
||
744 | 792 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
745 | 793 | <?php |
746 | 794 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
747 | - if (count($month_array) == 0) print _("No data available"); |
|
748 | - else { |
|
795 | + if (count($month_array) == 0) { |
|
796 | + print _("No data available"); |
|
797 | + } else { |
|
749 | 798 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
750 | 799 | $month_data = ''; |
751 | 800 | $month_cnt = ''; |
@@ -765,7 +814,10 @@ discard block |
||
765 | 814 | } |
766 | 815 | ?> |
767 | 816 | <div class="more"> |
768 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
817 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
818 | + echo '/'.$airline_icao; |
|
819 | +} |
|
820 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
769 | 821 | </div> |
770 | 822 | </div> |
771 | 823 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -774,8 +826,9 @@ discard block |
||
774 | 826 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
775 | 827 | <?php |
776 | 828 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
777 | - if (empty($date_array)) print _("No data available"); |
|
778 | - else { |
|
829 | + if (empty($date_array)) { |
|
830 | + print _("No data available"); |
|
831 | + } else { |
|
779 | 832 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
780 | 833 | $date_data = ''; |
781 | 834 | $date_cnt = ''; |
@@ -795,7 +848,10 @@ discard block |
||
795 | 848 | } |
796 | 849 | ?> |
797 | 850 | <div class="more"> |
798 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
851 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
852 | + echo '/'.$airline_icao; |
|
853 | +} |
|
854 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
799 | 855 | </div> |
800 | 856 | </div> |
801 | 857 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -803,8 +859,9 @@ discard block |
||
803 | 859 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
804 | 860 | <?php |
805 | 861 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
806 | - if (empty($hour_array)) print _("No data available"); |
|
807 | - else { |
|
862 | + if (empty($hour_array)) { |
|
863 | + print _("No data available"); |
|
864 | + } else { |
|
808 | 865 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
809 | 866 | $hour_data = ''; |
810 | 867 | $hour_cnt = ''; |
@@ -824,7 +881,10 @@ discard block |
||
824 | 881 | } |
825 | 882 | ?> |
826 | 883 | <div class="more"> |
827 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
884 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
885 | + echo '/'.$airline_icao; |
|
886 | +} |
|
887 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
828 | 888 | </div> |
829 | 889 | </div> |
830 | 890 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -846,8 +906,9 @@ discard block |
||
846 | 906 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
847 | 907 | <?php |
848 | 908 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
849 | - if (count($year_array) == 0) print _("No data available"); |
|
850 | - else { |
|
909 | + if (count($year_array) == 0) { |
|
910 | + print _("No data available"); |
|
911 | + } else { |
|
851 | 912 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
852 | 913 | $year_data = ''; |
853 | 914 | $year_cnt = ''; |
@@ -876,8 +937,9 @@ discard block |
||
876 | 937 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
877 | 938 | <?php |
878 | 939 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
879 | - if (count($month_array) == 0) print _("No data available"); |
|
880 | - else { |
|
940 | + if (count($month_array) == 0) { |
|
941 | + print _("No data available"); |
|
942 | + } else { |
|
881 | 943 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
882 | 944 | $month_data = ''; |
883 | 945 | $month_cnt = ''; |
@@ -906,8 +968,9 @@ discard block |
||
906 | 968 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
907 | 969 | <?php |
908 | 970 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
909 | - if (empty($date_array)) print _("No data available"); |
|
910 | - else { |
|
971 | + if (empty($date_array)) { |
|
972 | + print _("No data available"); |
|
973 | + } else { |
|
911 | 974 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
912 | 975 | $date_data = ''; |
913 | 976 | $date_cnt = ''; |
@@ -935,8 +998,9 @@ discard block |
||
935 | 998 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
936 | 999 | <?php |
937 | 1000 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
938 | - if (empty($hour_array)) print _("No data available"); |
|
939 | - else { |
|
1001 | + if (empty($hour_array)) { |
|
1002 | + print _("No data available"); |
|
1003 | + } else { |
|
940 | 1004 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
941 | 1005 | $hour_data = ''; |
942 | 1006 | $hour_cnt = ''; |
@@ -978,8 +1042,9 @@ discard block |
||
978 | 1042 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
979 | 1043 | <?php |
980 | 1044 | $year_array = $Tracker->countAllMonthsLastYear(true); |
981 | - if (count($year_array) == 0) print _("No data available"); |
|
982 | - else { |
|
1045 | + if (count($year_array) == 0) { |
|
1046 | + print _("No data available"); |
|
1047 | + } else { |
|
983 | 1048 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
984 | 1049 | $year_data = ''; |
985 | 1050 | $year_cnt = ''; |
@@ -1008,8 +1073,9 @@ discard block |
||
1008 | 1073 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1009 | 1074 | <?php |
1010 | 1075 | $month_array = $Tracker->countAllDatesLastMonth(); |
1011 | - if (count($month_array) == 0) print _("No data available"); |
|
1012 | - else { |
|
1076 | + if (count($month_array) == 0) { |
|
1077 | + print _("No data available"); |
|
1078 | + } else { |
|
1013 | 1079 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1014 | 1080 | $month_data = ''; |
1015 | 1081 | $month_cnt = ''; |
@@ -1038,8 +1104,9 @@ discard block |
||
1038 | 1104 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1039 | 1105 | <?php |
1040 | 1106 | $date_array = $Tracker->countAllDatesLast7Days(); |
1041 | - if (empty($date_array)) print _("No data available"); |
|
1042 | - else { |
|
1107 | + if (empty($date_array)) { |
|
1108 | + print _("No data available"); |
|
1109 | + } else { |
|
1043 | 1110 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1044 | 1111 | $date_data = ''; |
1045 | 1112 | $date_cnt = ''; |
@@ -1067,8 +1134,9 @@ discard block |
||
1067 | 1134 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1068 | 1135 | <?php |
1069 | 1136 | $hour_array = $Tracker->countAllHours('hour',true); |
1070 | - if (empty($hour_array)) print _("No data available"); |
|
1071 | - else { |
|
1137 | + if (empty($hour_array)) { |
|
1138 | + print _("No data available"); |
|
1139 | + } else { |
|
1072 | 1140 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1073 | 1141 | $hour_data = ''; |
1074 | 1142 | $hour_cnt = ''; |
@@ -1110,8 +1178,9 @@ discard block |
||
1110 | 1178 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1111 | 1179 | <?php |
1112 | 1180 | $year_array = $Stats->countFatalitiesByYear(); |
1113 | - if (count($year_array) == 0) print _("No data available"); |
|
1114 | - else { |
|
1181 | + if (count($year_array) == 0) { |
|
1182 | + print _("No data available"); |
|
1183 | + } else { |
|
1115 | 1184 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1116 | 1185 | $year_data = ''; |
1117 | 1186 | $year_cnt = ''; |
@@ -1141,8 +1210,9 @@ discard block |
||
1141 | 1210 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1142 | 1211 | <?php |
1143 | 1212 | $year_array = $Stats->countFatalitiesLast12Months(); |
1144 | - if (count($year_array) == 0) print _("No data available"); |
|
1145 | - else { |
|
1213 | + if (count($year_array) == 0) { |
|
1214 | + print _("No data available"); |
|
1215 | + } else { |
|
1146 | 1216 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1147 | 1217 | $year_data = ''; |
1148 | 1218 | $year_cnt = ''; |
@@ -1212,8 +1282,11 @@ discard block |
||
1212 | 1282 | $distance = $distance; |
1213 | 1283 | $unit = 'km'; |
1214 | 1284 | } |
1215 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1216 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1285 | + if (!isset($polar_data)) { |
|
1286 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1287 | + } else { |
|
1288 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1289 | + } |
|
1217 | 1290 | } |
1218 | 1291 | ?> |
1219 | 1292 | <div class="col-md-6"> |
@@ -1273,9 +1346,12 @@ discard block |
||
1273 | 1346 | foreach ($msg as $eachmsg) { |
1274 | 1347 | //$eachmsg = $msg[0]; |
1275 | 1348 | $data = $eachmsg['source_data']; |
1276 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1277 | - else $max = 500; |
|
1278 | -?> |
|
1349 | + if ($data > 500) { |
|
1350 | + $max = (round(($data+100)/100))*100; |
|
1351 | + } else { |
|
1352 | + $max = 500; |
|
1353 | + } |
|
1354 | + ?> |
|
1279 | 1355 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1280 | 1356 | <script> |
1281 | 1357 | var g = new JustGage({ |