@@ -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 | <!-- |
@@ -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,38 +138,38 @@ 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 | - $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | - } |
|
150 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
151 | - print 'var series = ['.$aircraft_data.'];'; |
|
152 | - 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);'; |
|
153 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
154 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
155 | - 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":'; |
|
156 | - print 'dataset'; |
|
157 | - 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}}});'; |
|
158 | - print '</script>'; |
|
159 | - } |
|
160 | - ?> |
|
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 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | + } |
|
150 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
151 | + print 'var series = ['.$aircraft_data.'];'; |
|
152 | + 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);'; |
|
153 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
154 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
155 | + 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":'; |
|
156 | + print 'dataset'; |
|
157 | + 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}}});'; |
|
158 | + print '</script>'; |
|
159 | + } |
|
160 | + ?> |
|
161 | 161 | <div class="more"> |
162 | 162 | <?php |
163 | - if ($year != '' && $month != '') { |
|
164 | - ?> |
|
163 | + if ($year != '' && $month != '') { |
|
164 | + ?> |
|
165 | 165 | <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> |
166 | 166 | <?php |
167 | - } else { |
|
168 | - ?> |
|
167 | + } else { |
|
168 | + ?> |
|
169 | 169 | <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> |
170 | 170 | <?php |
171 | - } |
|
172 | - ?> |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | </div> |
174 | 174 | </div> |
175 | 175 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -222,29 +222,29 @@ discard block |
||
222 | 222 | <div class="col-md-6"> |
223 | 223 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
224 | 224 | <?php |
225 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month,$day); |
|
226 | - if (count($marine_array) == 0) print _("No data available"); |
|
227 | - else { |
|
228 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
229 | - $marine_data = ''; |
|
230 | - foreach($marine_array as $marine_item) |
|
231 | - { |
|
232 | - $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
233 | - } |
|
234 | - $marine_data = substr($marine_data, 0, -1); |
|
235 | - print 'var series = ['.$marine_data.'];'; |
|
236 | - 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);'; |
|
237 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
238 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
239 | - 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":'; |
|
240 | - print 'dataset'; |
|
241 | - 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}}});'; |
|
242 | - print '</script>'; |
|
243 | - } |
|
244 | - ?> |
|
225 | + $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month,$day); |
|
226 | + if (count($marine_array) == 0) print _("No data available"); |
|
227 | + else { |
|
228 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
229 | + $marine_data = ''; |
|
230 | + foreach($marine_array as $marine_item) |
|
231 | + { |
|
232 | + $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
233 | + } |
|
234 | + $marine_data = substr($marine_data, 0, -1); |
|
235 | + print 'var series = ['.$marine_data.'];'; |
|
236 | + 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);'; |
|
237 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
238 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
239 | + 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":'; |
|
240 | + print 'dataset'; |
|
241 | + 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}}});'; |
|
242 | + print '</script>'; |
|
243 | + } |
|
244 | + ?> |
|
245 | 245 | <div class="more"> |
246 | 246 | <?php |
247 | - /* |
|
247 | + /* |
|
248 | 248 | if ($year != '' && $month != '') { |
249 | 249 | ?> |
250 | 250 | <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> |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | <?php |
256 | 256 | } |
257 | 257 | */ |
258 | - ?> |
|
258 | + ?> |
|
259 | 259 | </div> |
260 | 260 | </div> |
261 | 261 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -270,29 +270,29 @@ discard block |
||
270 | 270 | <div class="col-md-6"> |
271 | 271 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
272 | 272 | <?php |
273 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month,$day); |
|
274 | - if (count($tracker_array) == 0) print _("No data available"); |
|
275 | - else { |
|
276 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
277 | - $tracker_data = ''; |
|
278 | - foreach($tracker_array as $tracker_item) |
|
279 | - { |
|
280 | - $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
281 | - } |
|
282 | - $tracker_data = substr($tracker_data, 0, -1); |
|
283 | - print 'var series = ['.$tracker_data.'];'; |
|
284 | - 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);'; |
|
285 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
286 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
287 | - 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":'; |
|
288 | - print 'dataset'; |
|
289 | - 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}}});'; |
|
290 | - print '</script>'; |
|
291 | - } |
|
292 | - ?> |
|
273 | + $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month,$day); |
|
274 | + if (count($tracker_array) == 0) print _("No data available"); |
|
275 | + else { |
|
276 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
277 | + $tracker_data = ''; |
|
278 | + foreach($tracker_array as $tracker_item) |
|
279 | + { |
|
280 | + $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
281 | + } |
|
282 | + $tracker_data = substr($tracker_data, 0, -1); |
|
283 | + print 'var series = ['.$tracker_data.'];'; |
|
284 | + 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);'; |
|
285 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
286 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
287 | + 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":'; |
|
288 | + print 'dataset'; |
|
289 | + 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}}});'; |
|
290 | + print '</script>'; |
|
291 | + } |
|
292 | + ?> |
|
293 | 293 | <div class="more"> |
294 | 294 | <?php |
295 | - /* |
|
295 | + /* |
|
296 | 296 | if ($year != '' && $month != '') { |
297 | 297 | ?> |
298 | 298 | <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> |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | <?php |
304 | 304 | } |
305 | 305 | */ |
306 | - ?> |
|
306 | + ?> |
|
307 | 307 | </div> |
308 | 308 | </div> |
309 | 309 | <!-- <?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 | $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
149 | 149 | } |
@@ -172,17 +172,17 @@ discard block |
||
172 | 172 | ?> |
173 | 173 | </div> |
174 | 174 | </div> |
175 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
175 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
176 | 176 | <?php |
177 | 177 | // echo $airline_icao; |
178 | 178 | if ($airline_icao == '' || $airline_icao == 'all') { |
179 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
179 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
180 | 180 | if (count($airline_array) > 0) { |
181 | 181 | print '<div class="col-md-6">'; |
182 | 182 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
183 | 183 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
184 | 184 | $airline_data = ''; |
185 | - foreach($airline_array as $airline_item) |
|
185 | + foreach ($airline_array as $airline_item) |
|
186 | 186 | { |
187 | 187 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
188 | 188 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | } |
209 | 209 | ?> |
210 | 210 | </div> |
211 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
211 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
212 | 212 | <?php |
213 | 213 | } |
214 | 214 | ?> |
@@ -222,12 +222,12 @@ discard block |
||
222 | 222 | <div class="col-md-6"> |
223 | 223 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
224 | 224 | <?php |
225 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month,$day); |
|
225 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month, $day); |
|
226 | 226 | if (count($marine_array) == 0) print _("No data available"); |
227 | 227 | else { |
228 | 228 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
229 | 229 | $marine_data = ''; |
230 | - foreach($marine_array as $marine_item) |
|
230 | + foreach ($marine_array as $marine_item) |
|
231 | 231 | { |
232 | 232 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
233 | 233 | } |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | ?> |
259 | 259 | </div> |
260 | 260 | </div> |
261 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
261 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
262 | 262 | <!-- </div>--> |
263 | 263 | <?php |
264 | 264 | } |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | <div class="col-md-6"> |
271 | 271 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
272 | 272 | <?php |
273 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month,$day); |
|
273 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month, $day); |
|
274 | 274 | if (count($tracker_array) == 0) print _("No data available"); |
275 | 275 | else { |
276 | 276 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
277 | 277 | $tracker_data = ''; |
278 | - foreach($tracker_array as $tracker_item) |
|
278 | + foreach ($tracker_array as $tracker_item) |
|
279 | 279 | { |
280 | 280 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
281 | 281 | } |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | ?> |
307 | 307 | </div> |
308 | 308 | </div> |
309 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
309 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
310 | 310 | <!-- </div>--> |
311 | 311 | <?php |
312 | 312 | } |
@@ -316,8 +316,8 @@ discard block |
||
316 | 316 | ?> |
317 | 317 | <div class="row column"> |
318 | 318 | <?php |
319 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
320 | - if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
319 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
320 | + if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
|
321 | 321 | if (empty($flightover_array)) { |
322 | 322 | print '<div class="col-md-12">'; |
323 | 323 | } else { |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | ?> |
327 | 327 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
328 | 328 | <?php |
329 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
329 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
330 | 330 | if (count($pilot_array) == 0) print _("No data available"); |
331 | 331 | else { |
332 | 332 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
333 | 333 | $pilot_data = ''; |
334 | - foreach($pilot_array as $pilot_item) |
|
334 | + foreach ($pilot_array as $pilot_item) |
|
335 | 335 | { |
336 | 336 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
337 | 337 | } |
@@ -353,19 +353,19 @@ discard block |
||
353 | 353 | ?> |
354 | 354 | </div> |
355 | 355 | |
356 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
356 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
357 | 357 | <?php |
358 | 358 | } else { |
359 | 359 | ?> |
360 | 360 | <div class="col-md-6"> |
361 | 361 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
362 | 362 | <?php |
363 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
363 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
364 | 364 | if (count($owner_array) == 0) print _("No data available"); |
365 | 365 | else { |
366 | 366 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
367 | 367 | $owner_data = ''; |
368 | - foreach($owner_array as $owner_item) |
|
368 | + foreach ($owner_array as $owner_item) |
|
369 | 369 | { |
370 | 370 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
371 | 371 | } |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | </div> |
386 | 386 | </div> |
387 | 387 | |
388 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
388 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
389 | 389 | <?php |
390 | 390 | } |
391 | 391 | if (!empty($flightover_array)) { |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
400 | 400 | print 'var series = ['; |
401 | 401 | $flightover_data = ''; |
402 | - foreach($flightover_array as $flightover_item) |
|
402 | + foreach ($flightover_array as $flightover_item) |
|
403 | 403 | { |
404 | 404 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
405 | 405 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | ?> |
447 | 447 | </div> |
448 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
448 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
449 | 449 | |
450 | 450 | |
451 | 451 | </div> |
@@ -465,7 +465,7 @@ discard block |
||
465 | 465 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
466 | 466 | print 'var series = ['; |
467 | 467 | $flightover_data = ''; |
468 | - foreach($flightover_array as $flightover_item) |
|
468 | + foreach ($flightover_array as $flightover_item) |
|
469 | 469 | { |
470 | 470 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
471 | 471 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
526 | 526 | print 'var series = ['; |
527 | 527 | $flightover_data = ''; |
528 | - foreach($flightover_array as $flightover_item) |
|
528 | + foreach ($flightover_array as $flightover_item) |
|
529 | 529 | { |
530 | 530 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
531 | 531 | } |
@@ -578,14 +578,14 @@ discard block |
||
578 | 578 | <div class="row column"> |
579 | 579 | <div class="col-md-6"> |
580 | 580 | <?php |
581 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
581 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
582 | 582 | if (count($airport_airport_array) > 0) { |
583 | 583 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
584 | 584 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
585 | 585 | print "\n"; |
586 | 586 | print 'var series = ['; |
587 | 587 | $airport_data = ''; |
588 | - foreach($airport_airport_array as $airport_item) |
|
588 | + foreach ($airport_airport_array as $airport_item) |
|
589 | 589 | { |
590 | 590 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
591 | 591 | } |
@@ -636,18 +636,18 @@ discard block |
||
636 | 636 | } |
637 | 637 | ?> |
638 | 638 | </div> |
639 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
639 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
640 | 640 | |
641 | 641 | <div class="col-md-6"> |
642 | 642 | <?php |
643 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
643 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
644 | 644 | if (count($airport_airport_array2) > 0) { |
645 | 645 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
646 | 646 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
647 | 647 | print "\n"; |
648 | 648 | print 'var series = ['; |
649 | 649 | $airport_data = ''; |
650 | - foreach($airport_airport_array2 as $airport_item) |
|
650 | + foreach ($airport_airport_array2 as $airport_item) |
|
651 | 651 | { |
652 | 652 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
653 | 653 | } |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | ?> |
700 | 700 | </div> |
701 | 701 | </div> |
702 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
702 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
703 | 703 | <?php |
704 | 704 | } |
705 | 705 | ?> |
@@ -713,19 +713,19 @@ discard block |
||
713 | 713 | <div class="col-md-6"> |
714 | 714 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
715 | 715 | <?php |
716 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
716 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
717 | 717 | if (count($year_array) == 0) print _("No data available"); |
718 | 718 | else { |
719 | 719 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
720 | 720 | $year_data = ''; |
721 | 721 | $year_cnt = ''; |
722 | - foreach($year_array as $year_item) |
|
722 | + foreach ($year_array as $year_item) |
|
723 | 723 | { |
724 | 724 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
725 | 725 | $year_cnt .= $year_item['date_count'].','; |
726 | 726 | } |
727 | 727 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
728 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
728 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
729 | 729 | print 'c3.generate({ |
730 | 730 | bindto: "#chart8", |
731 | 731 | data: { x: "x", |
@@ -738,23 +738,23 @@ discard block |
||
738 | 738 | <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> |
739 | 739 | </div> |
740 | 740 | </div> |
741 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
741 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
742 | 742 | <div class="col-md-6"> |
743 | 743 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
744 | 744 | <?php |
745 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
745 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
746 | 746 | if (count($month_array) == 0) print _("No data available"); |
747 | 747 | else { |
748 | 748 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
749 | 749 | $month_data = ''; |
750 | 750 | $month_cnt = ''; |
751 | - foreach($month_array as $month_item) |
|
751 | + foreach ($month_array as $month_item) |
|
752 | 752 | { |
753 | 753 | $month_data .= '"'.$month_item['date_name'].'",'; |
754 | 754 | $month_cnt .= $month_item['date_count'].','; |
755 | 755 | } |
756 | 756 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
757 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
757 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
758 | 758 | print 'c3.generate({ |
759 | 759 | bindto: "#chart9", |
760 | 760 | data: { x: "x", |
@@ -767,24 +767,24 @@ discard block |
||
767 | 767 | <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> |
768 | 768 | </div> |
769 | 769 | </div> |
770 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
770 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
771 | 771 | |
772 | 772 | <div class="col-md-6"> |
773 | 773 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
774 | 774 | <?php |
775 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
775 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
776 | 776 | if (empty($date_array)) print _("No data available"); |
777 | 777 | else { |
778 | 778 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
779 | 779 | $date_data = ''; |
780 | 780 | $date_cnt = ''; |
781 | - foreach($date_array as $date_item) |
|
781 | + foreach ($date_array as $date_item) |
|
782 | 782 | { |
783 | 783 | $date_data .= '"'.$date_item['date_name'].'",'; |
784 | 784 | $date_cnt .= $date_item['date_count'].','; |
785 | 785 | } |
786 | 786 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
787 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
787 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
788 | 788 | print 'c3.generate({ |
789 | 789 | bindto: "#chart5", |
790 | 790 | data: { x: "x", |
@@ -797,23 +797,23 @@ discard block |
||
797 | 797 | <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> |
798 | 798 | </div> |
799 | 799 | </div> |
800 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
800 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
801 | 801 | <div class="col-md-6"> |
802 | 802 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
803 | 803 | <?php |
804 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
804 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
805 | 805 | if (empty($hour_array)) print _("No data available"); |
806 | 806 | else { |
807 | 807 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
808 | 808 | $hour_data = ''; |
809 | 809 | $hour_cnt = ''; |
810 | - foreach($hour_array as $hour_item) |
|
810 | + foreach ($hour_array as $hour_item) |
|
811 | 811 | { |
812 | 812 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
813 | 813 | $hour_cnt .= $hour_item['hour_count'].','; |
814 | 814 | } |
815 | 815 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
816 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
816 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
817 | 817 | print 'c3.generate({ |
818 | 818 | bindto: "#chart6", |
819 | 819 | data: { |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | <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> |
827 | 827 | </div> |
828 | 828 | </div> |
829 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
829 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
830 | 830 | </div> |
831 | 831 | <?php |
832 | 832 | } |
@@ -844,19 +844,19 @@ discard block |
||
844 | 844 | <div class="col-md-6"> |
845 | 845 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
846 | 846 | <?php |
847 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
847 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
848 | 848 | if (count($year_array) == 0) print _("No data available"); |
849 | 849 | else { |
850 | 850 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
851 | 851 | $year_data = ''; |
852 | 852 | $year_cnt = ''; |
853 | - foreach($year_array as $year_item) |
|
853 | + foreach ($year_array as $year_item) |
|
854 | 854 | { |
855 | 855 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
856 | 856 | $year_cnt .= $year_item['date_count'].','; |
857 | 857 | } |
858 | 858 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
859 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
859 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
860 | 860 | print 'c3.generate({ |
861 | 861 | bindto: "#chart8", |
862 | 862 | data: { x: "x", |
@@ -870,23 +870,23 @@ discard block |
||
870 | 870 | </div> |
871 | 871 | </div> |
872 | 872 | |
873 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
873 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
874 | 874 | <div class="col-md-6"> |
875 | 875 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
876 | 876 | <?php |
877 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
877 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
878 | 878 | if (count($month_array) == 0) print _("No data available"); |
879 | 879 | else { |
880 | 880 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
881 | 881 | $month_data = ''; |
882 | 882 | $month_cnt = ''; |
883 | - foreach($month_array as $month_item) |
|
883 | + foreach ($month_array as $month_item) |
|
884 | 884 | { |
885 | 885 | $month_data .= '"'.$month_item['date_name'].'",'; |
886 | 886 | $month_cnt .= $month_item['date_count'].','; |
887 | 887 | } |
888 | 888 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
889 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
889 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
890 | 890 | print 'c3.generate({ |
891 | 891 | bindto: "#chart9", |
892 | 892 | data: { x: "x", |
@@ -899,24 +899,24 @@ discard block |
||
899 | 899 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
900 | 900 | </div> |
901 | 901 | </div> |
902 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
902 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
903 | 903 | |
904 | 904 | <div class="col-md-6"> |
905 | 905 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
906 | 906 | <?php |
907 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
907 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
908 | 908 | if (empty($date_array)) print _("No data available"); |
909 | 909 | else { |
910 | 910 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
911 | 911 | $date_data = ''; |
912 | 912 | $date_cnt = ''; |
913 | - foreach($date_array as $date_item) |
|
913 | + foreach ($date_array as $date_item) |
|
914 | 914 | { |
915 | 915 | $date_data .= '"'.$date_item['date_name'].'",'; |
916 | 916 | $date_cnt .= $date_item['date_count'].','; |
917 | 917 | } |
918 | 918 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
919 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
919 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
920 | 920 | print 'c3.generate({ |
921 | 921 | bindto: "#chart5", |
922 | 922 | data: { x: "x", |
@@ -929,23 +929,23 @@ discard block |
||
929 | 929 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
930 | 930 | </div> |
931 | 931 | </div> |
932 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
932 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
933 | 933 | <div class="col-md-6"> |
934 | 934 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
935 | 935 | <?php |
936 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
936 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
937 | 937 | if (empty($hour_array)) print _("No data available"); |
938 | 938 | else { |
939 | 939 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
940 | 940 | $hour_data = ''; |
941 | 941 | $hour_cnt = ''; |
942 | - foreach($hour_array as $hour_item) |
|
942 | + foreach ($hour_array as $hour_item) |
|
943 | 943 | { |
944 | 944 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
945 | 945 | $hour_cnt .= $hour_item['hour_count'].','; |
946 | 946 | } |
947 | 947 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
948 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
948 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
949 | 949 | print 'c3.generate({ |
950 | 950 | bindto: "#chart6", |
951 | 951 | data: { |
@@ -958,7 +958,7 @@ discard block |
||
958 | 958 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
959 | 959 | </div> |
960 | 960 | </div> |
961 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
961 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
962 | 962 | </div> |
963 | 963 | <?php |
964 | 964 | } |
@@ -982,13 +982,13 @@ discard block |
||
982 | 982 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
983 | 983 | $year_data = ''; |
984 | 984 | $year_cnt = ''; |
985 | - foreach($year_array as $year_item) |
|
985 | + foreach ($year_array as $year_item) |
|
986 | 986 | { |
987 | 987 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
988 | 988 | $year_cnt .= $year_item['date_count'].','; |
989 | 989 | } |
990 | 990 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
991 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
991 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
992 | 992 | print 'c3.generate({ |
993 | 993 | bindto: "#chart8", |
994 | 994 | data: { x: "x", |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | </div> |
1003 | 1003 | </div> |
1004 | 1004 | |
1005 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1005 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1006 | 1006 | <div class="col-md-6"> |
1007 | 1007 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1008 | 1008 | <?php |
@@ -1012,13 +1012,13 @@ discard block |
||
1012 | 1012 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1013 | 1013 | $month_data = ''; |
1014 | 1014 | $month_cnt = ''; |
1015 | - foreach($month_array as $month_item) |
|
1015 | + foreach ($month_array as $month_item) |
|
1016 | 1016 | { |
1017 | 1017 | $month_data .= '"'.$month_item['date_name'].'",'; |
1018 | 1018 | $month_cnt .= $month_item['date_count'].','; |
1019 | 1019 | } |
1020 | 1020 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1021 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1021 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1022 | 1022 | print 'c3.generate({ |
1023 | 1023 | bindto: "#chart9", |
1024 | 1024 | data: { x: "x", |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1032 | 1032 | </div> |
1033 | 1033 | </div> |
1034 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1034 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1035 | 1035 | |
1036 | 1036 | <div class="col-md-6"> |
1037 | 1037 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1042,13 +1042,13 @@ discard block |
||
1042 | 1042 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1043 | 1043 | $date_data = ''; |
1044 | 1044 | $date_cnt = ''; |
1045 | - foreach($date_array as $date_item) |
|
1045 | + foreach ($date_array as $date_item) |
|
1046 | 1046 | { |
1047 | 1047 | $date_data .= '"'.$date_item['date_name'].'",'; |
1048 | 1048 | $date_cnt .= $date_item['date_count'].','; |
1049 | 1049 | } |
1050 | 1050 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1051 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1051 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1052 | 1052 | print 'c3.generate({ |
1053 | 1053 | bindto: "#chart5", |
1054 | 1054 | data: { x: "x", |
@@ -1061,23 +1061,23 @@ discard block |
||
1061 | 1061 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1062 | 1062 | </div> |
1063 | 1063 | </div> |
1064 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1064 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1065 | 1065 | <div class="col-md-6"> |
1066 | 1066 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1067 | 1067 | <?php |
1068 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1068 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1069 | 1069 | if (empty($hour_array)) print _("No data available"); |
1070 | 1070 | else { |
1071 | 1071 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1072 | 1072 | $hour_data = ''; |
1073 | 1073 | $hour_cnt = ''; |
1074 | - foreach($hour_array as $hour_item) |
|
1074 | + foreach ($hour_array as $hour_item) |
|
1075 | 1075 | { |
1076 | 1076 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1077 | 1077 | $hour_cnt .= $hour_item['hour_count'].','; |
1078 | 1078 | } |
1079 | 1079 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1080 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1080 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1081 | 1081 | print 'c3.generate({ |
1082 | 1082 | bindto: "#chart6", |
1083 | 1083 | data: { |
@@ -1090,7 +1090,7 @@ discard block |
||
1090 | 1090 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1091 | 1091 | </div> |
1092 | 1092 | </div> |
1093 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1093 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1094 | 1094 | </div> |
1095 | 1095 | <?php |
1096 | 1096 | } |
@@ -1114,13 +1114,13 @@ discard block |
||
1114 | 1114 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1115 | 1115 | $year_data = ''; |
1116 | 1116 | $year_cnt = ''; |
1117 | - foreach($year_array as $year_item) |
|
1117 | + foreach ($year_array as $year_item) |
|
1118 | 1118 | { |
1119 | 1119 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1120 | 1120 | $year_cnt .= $year_item['count'].','; |
1121 | 1121 | } |
1122 | 1122 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1123 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1123 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1124 | 1124 | print 'c3.generate({ |
1125 | 1125 | bindto: "#chart32", |
1126 | 1126 | data: { x: "x", |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1134 | 1134 | </div> |
1135 | 1135 | </div> |
1136 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1136 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1137 | 1137 | |
1138 | 1138 | <div class="row column"> |
1139 | 1139 | <div class="col-md-6"> |
@@ -1145,13 +1145,13 @@ discard block |
||
1145 | 1145 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1146 | 1146 | $year_data = ''; |
1147 | 1147 | $year_cnt = ''; |
1148 | - foreach($year_array as $year_item) |
|
1148 | + foreach ($year_array as $year_item) |
|
1149 | 1149 | { |
1150 | 1150 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1151 | 1151 | $year_cnt .= $year_item['count'].','; |
1152 | 1152 | } |
1153 | 1153 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1154 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1154 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1155 | 1155 | print 'c3.generate({ |
1156 | 1156 | bindto: "#chart33", |
1157 | 1157 | data: { x: "x", |
@@ -1164,7 +1164,7 @@ discard block |
||
1164 | 1164 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1165 | 1165 | </div> |
1166 | 1166 | </div> |
1167 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1167 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1168 | 1168 | <br/> |
1169 | 1169 | <?php |
1170 | 1170 | } |
@@ -1182,9 +1182,9 @@ discard block |
||
1182 | 1182 | <?php |
1183 | 1183 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1184 | 1184 | if ($year == '' && $month == '') { |
1185 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1185 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1186 | 1186 | } else { |
1187 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1187 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1188 | 1188 | } |
1189 | 1189 | if (!empty($polar)) { |
1190 | 1190 | print '<h2>'._("Coverage pattern").'</h2>'; |
@@ -1192,7 +1192,7 @@ discard block |
||
1192 | 1192 | unset($polar_data); |
1193 | 1193 | $Spotter = new Spotter(); |
1194 | 1194 | $data = json_decode($eachpolar['source_data']); |
1195 | - foreach($data as $value => $key) { |
|
1195 | + foreach ($data as $value => $key) { |
|
1196 | 1196 | $direction = $Spotter->parseDirection(($value*22.5)); |
1197 | 1197 | $distance = $key; |
1198 | 1198 | $unit = 'km'; |
@@ -1212,7 +1212,7 @@ discard block |
||
1212 | 1212 | ?> |
1213 | 1213 | <div class="col-md-6"> |
1214 | 1214 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1215 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1215 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1216 | 1216 | <script> |
1217 | 1217 | (function() { |
1218 | 1218 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1236,7 +1236,7 @@ discard block |
||
1236 | 1236 | color: color, |
1237 | 1237 | unit: '<?php echo $unit; ?>' |
1238 | 1238 | }; |
1239 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1239 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1240 | 1240 | })(); |
1241 | 1241 | </script> |
1242 | 1242 | </div> |
@@ -1250,22 +1250,22 @@ discard block |
||
1250 | 1250 | <?php |
1251 | 1251 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1252 | 1252 | if ($year == '' && $month == '') { |
1253 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1253 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1254 | 1254 | } else { |
1255 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1255 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1256 | 1256 | } |
1257 | 1257 | if (!empty($msg)) { |
1258 | 1258 | print '<h2>'._("Messages received").'</h2>'; |
1259 | 1259 | foreach ($msg as $eachmsg) { |
1260 | 1260 | //$eachmsg = $msg[0]; |
1261 | 1261 | $data = $eachmsg['source_data']; |
1262 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1262 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1263 | 1263 | else $max = 500; |
1264 | 1264 | ?> |
1265 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1265 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1266 | 1266 | <script> |
1267 | 1267 | var g = new JustGage({ |
1268 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1268 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1269 | 1269 | value: <?php echo $data; ?>, |
1270 | 1270 | min: 0, |
1271 | 1271 | max: <?php print $max; ?>, |
@@ -1286,9 +1286,9 @@ discard block |
||
1286 | 1286 | <?php |
1287 | 1287 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1288 | 1288 | if ($year == '' && $month == '') { |
1289 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1289 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1290 | 1290 | } else { |
1291 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1291 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1292 | 1292 | } |
1293 | 1293 | foreach ($hist as $hists) { |
1294 | 1294 | //$hist_data = ''; |
@@ -1297,7 +1297,7 @@ discard block |
||
1297 | 1297 | $source = $hists['source_name']; |
1298 | 1298 | $hist_array = json_decode($hists['source_data']); |
1299 | 1299 | $unit = 'km'; |
1300 | - foreach($hist_array as $distance => $nb) |
|
1300 | + foreach ($hist_array as $distance => $nb) |
|
1301 | 1301 | { |
1302 | 1302 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1303 | 1303 | $distance = round($distance*0.539957); |
@@ -1318,18 +1318,18 @@ discard block |
||
1318 | 1318 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1319 | 1319 | ?> |
1320 | 1320 | <div class="col-md-6"> |
1321 | - <h2><?php echo sprintf(_("Flights Distance for %s"),$source); ?></h2> |
|
1321 | + <h2><?php echo sprintf(_("Flights Distance for %s"), $source); ?></h2> |
|
1322 | 1322 | <?php |
1323 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1323 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1324 | 1324 | print 'c3.generate({ |
1325 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1325 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1326 | 1326 | data: { x: "x", |
1327 | 1327 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1328 | 1328 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1329 | 1329 | print '</script>'; |
1330 | 1330 | ?> |
1331 | 1331 | </div> |
1332 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1332 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1333 | 1333 | <?php |
1334 | 1334 | } |
1335 | 1335 | ?> |
@@ -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,8 +150,9 @@ 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) |
@@ -162,11 +174,17 @@ discard block |
||
162 | 174 | <?php |
163 | 175 | if ($year != '' && $month != '') { |
164 | 176 | ?> |
165 | - <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> |
|
177 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
178 | + echo '/'.$airline_icao; |
|
179 | +} |
|
180 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
166 | 181 | <?php |
167 | 182 | } else { |
168 | 183 | ?> |
169 | - <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> |
|
184 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
185 | + echo '/'.$airline_icao; |
|
186 | +} |
|
187 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
170 | 188 | <?php |
171 | 189 | } |
172 | 190 | ?> |
@@ -197,11 +215,15 @@ discard block |
||
197 | 215 | print '</script>'; |
198 | 216 | if ($year != '' && $month != '') { |
199 | 217 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
200 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
218 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
219 | + echo '/'.$airline_icao; |
|
220 | + } |
|
201 | 221 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
202 | 222 | } else { |
203 | 223 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
204 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
224 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
225 | + echo '/'.$airline_icao; |
|
226 | + } |
|
205 | 227 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
206 | 228 | } |
207 | 229 | print '</div>'; |
@@ -223,8 +245,9 @@ discard block |
||
223 | 245 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
224 | 246 | <?php |
225 | 247 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month,$day); |
226 | - if (count($marine_array) == 0) print _("No data available"); |
|
227 | - else { |
|
248 | + if (count($marine_array) == 0) { |
|
249 | + print _("No data available"); |
|
250 | + } else { |
|
228 | 251 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
229 | 252 | $marine_data = ''; |
230 | 253 | foreach($marine_array as $marine_item) |
@@ -271,8 +294,9 @@ discard block |
||
271 | 294 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
272 | 295 | <?php |
273 | 296 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month,$day); |
274 | - if (count($tracker_array) == 0) print _("No data available"); |
|
275 | - else { |
|
297 | + if (count($tracker_array) == 0) { |
|
298 | + print _("No data available"); |
|
299 | + } else { |
|
276 | 300 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
277 | 301 | $tracker_data = ''; |
278 | 302 | foreach($tracker_array as $tracker_item) |
@@ -327,8 +351,9 @@ discard block |
||
327 | 351 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
328 | 352 | <?php |
329 | 353 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
330 | - if (count($pilot_array) == 0) print _("No data available"); |
|
331 | - else { |
|
354 | + if (count($pilot_array) == 0) { |
|
355 | + print _("No data available"); |
|
356 | + } else { |
|
332 | 357 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
333 | 358 | $pilot_data = ''; |
334 | 359 | foreach($pilot_array as $pilot_item) |
@@ -347,7 +372,9 @@ discard block |
||
347 | 372 | } |
348 | 373 | print '<div class="more">'; |
349 | 374 | print '<a href="'.$globalURL.'/statistics/pilot'; |
350 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
375 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
376 | + echo '/'.$airline_icao; |
|
377 | + } |
|
351 | 378 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
352 | 379 | print '</div>'; |
353 | 380 | ?> |
@@ -361,8 +388,9 @@ discard block |
||
361 | 388 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
362 | 389 | <?php |
363 | 390 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
364 | - if (count($owner_array) == 0) print _("No data available"); |
|
365 | - else { |
|
391 | + if (count($owner_array) == 0) { |
|
392 | + print _("No data available"); |
|
393 | + } else { |
|
366 | 394 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
367 | 395 | $owner_data = ''; |
368 | 396 | foreach($owner_array as $owner_item) |
@@ -381,7 +409,10 @@ discard block |
||
381 | 409 | } |
382 | 410 | ?> |
383 | 411 | <div class="more"> |
384 | - <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> |
|
412 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
413 | + echo '/'.$airline_icao; |
|
414 | +} |
|
415 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
385 | 416 | </div> |
386 | 417 | </div> |
387 | 418 | |
@@ -394,8 +425,9 @@ discard block |
||
394 | 425 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
395 | 426 | <?php |
396 | 427 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
397 | - if (count($flightover_array) == 0) print _("No data available"); |
|
398 | - else { |
|
428 | + if (count($flightover_array) == 0) { |
|
429 | + print _("No data available"); |
|
430 | + } else { |
|
399 | 431 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
400 | 432 | print 'var series = ['; |
401 | 433 | $flightover_data = ''; |
@@ -438,7 +470,10 @@ discard block |
||
438 | 470 | } |
439 | 471 | ?> |
440 | 472 | <div class="more"> |
441 | - <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> |
|
473 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
474 | + echo '/'.$airline_icao; |
|
475 | +} |
|
476 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
442 | 477 | </div> |
443 | 478 | </div> |
444 | 479 | <?php |
@@ -460,8 +495,9 @@ discard block |
||
460 | 495 | <div class="col-md-6"> |
461 | 496 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
462 | 497 | <?php |
463 | - if (count($flightover_array) == 0) print _("No data available"); |
|
464 | - else { |
|
498 | + if (count($flightover_array) == 0) { |
|
499 | + print _("No data available"); |
|
500 | + } else { |
|
465 | 501 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
466 | 502 | print 'var series = ['; |
467 | 503 | $flightover_data = ''; |
@@ -520,8 +556,9 @@ discard block |
||
520 | 556 | <div class="col-md-6"> |
521 | 557 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
522 | 558 | <?php |
523 | - if (count($flightover_array) == 0) print _("No data available"); |
|
524 | - else { |
|
559 | + if (count($flightover_array) == 0) { |
|
560 | + print _("No data available"); |
|
561 | + } else { |
|
525 | 562 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
526 | 563 | print 'var series = ['; |
527 | 564 | $flightover_data = ''; |
@@ -631,7 +668,9 @@ discard block |
||
631 | 668 | });"; |
632 | 669 | print '</script>'; |
633 | 670 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
634 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
671 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
672 | + echo '/'.$airline_icao; |
|
673 | + } |
|
635 | 674 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
636 | 675 | } |
637 | 676 | ?> |
@@ -693,7 +732,9 @@ discard block |
||
693 | 732 | });"; |
694 | 733 | print '</script>'; |
695 | 734 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
696 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
735 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
736 | + echo '/'.$airline_icao; |
|
737 | + } |
|
697 | 738 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
698 | 739 | } |
699 | 740 | ?> |
@@ -714,8 +755,9 @@ discard block |
||
714 | 755 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
715 | 756 | <?php |
716 | 757 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
717 | - if (count($year_array) == 0) print _("No data available"); |
|
718 | - else { |
|
758 | + if (count($year_array) == 0) { |
|
759 | + print _("No data available"); |
|
760 | + } else { |
|
719 | 761 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
720 | 762 | $year_data = ''; |
721 | 763 | $year_cnt = ''; |
@@ -735,7 +777,10 @@ discard block |
||
735 | 777 | } |
736 | 778 | ?> |
737 | 779 | <div class="more"> |
738 | - <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> |
|
780 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
781 | + echo '/'.$airline_icao; |
|
782 | +} |
|
783 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
739 | 784 | </div> |
740 | 785 | </div> |
741 | 786 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -743,8 +788,9 @@ discard block |
||
743 | 788 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
744 | 789 | <?php |
745 | 790 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
746 | - if (count($month_array) == 0) print _("No data available"); |
|
747 | - else { |
|
791 | + if (count($month_array) == 0) { |
|
792 | + print _("No data available"); |
|
793 | + } else { |
|
748 | 794 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
749 | 795 | $month_data = ''; |
750 | 796 | $month_cnt = ''; |
@@ -764,7 +810,10 @@ discard block |
||
764 | 810 | } |
765 | 811 | ?> |
766 | 812 | <div class="more"> |
767 | - <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> |
|
813 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
814 | + echo '/'.$airline_icao; |
|
815 | +} |
|
816 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
768 | 817 | </div> |
769 | 818 | </div> |
770 | 819 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -773,8 +822,9 @@ discard block |
||
773 | 822 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
774 | 823 | <?php |
775 | 824 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
776 | - if (empty($date_array)) print _("No data available"); |
|
777 | - else { |
|
825 | + if (empty($date_array)) { |
|
826 | + print _("No data available"); |
|
827 | + } else { |
|
778 | 828 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
779 | 829 | $date_data = ''; |
780 | 830 | $date_cnt = ''; |
@@ -794,7 +844,10 @@ discard block |
||
794 | 844 | } |
795 | 845 | ?> |
796 | 846 | <div class="more"> |
797 | - <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> |
|
847 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
848 | + echo '/'.$airline_icao; |
|
849 | +} |
|
850 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
798 | 851 | </div> |
799 | 852 | </div> |
800 | 853 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -802,8 +855,9 @@ discard block |
||
802 | 855 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
803 | 856 | <?php |
804 | 857 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
805 | - if (empty($hour_array)) print _("No data available"); |
|
806 | - else { |
|
858 | + if (empty($hour_array)) { |
|
859 | + print _("No data available"); |
|
860 | + } else { |
|
807 | 861 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
808 | 862 | $hour_data = ''; |
809 | 863 | $hour_cnt = ''; |
@@ -823,7 +877,10 @@ discard block |
||
823 | 877 | } |
824 | 878 | ?> |
825 | 879 | <div class="more"> |
826 | - <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> |
|
880 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
881 | + echo '/'.$airline_icao; |
|
882 | +} |
|
883 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
827 | 884 | </div> |
828 | 885 | </div> |
829 | 886 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -845,8 +902,9 @@ discard block |
||
845 | 902 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
846 | 903 | <?php |
847 | 904 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
848 | - if (count($year_array) == 0) print _("No data available"); |
|
849 | - else { |
|
905 | + if (count($year_array) == 0) { |
|
906 | + print _("No data available"); |
|
907 | + } else { |
|
850 | 908 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
851 | 909 | $year_data = ''; |
852 | 910 | $year_cnt = ''; |
@@ -875,8 +933,9 @@ discard block |
||
875 | 933 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
876 | 934 | <?php |
877 | 935 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
878 | - if (count($month_array) == 0) print _("No data available"); |
|
879 | - else { |
|
936 | + if (count($month_array) == 0) { |
|
937 | + print _("No data available"); |
|
938 | + } else { |
|
880 | 939 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
881 | 940 | $month_data = ''; |
882 | 941 | $month_cnt = ''; |
@@ -905,8 +964,9 @@ discard block |
||
905 | 964 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
906 | 965 | <?php |
907 | 966 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
908 | - if (empty($date_array)) print _("No data available"); |
|
909 | - else { |
|
967 | + if (empty($date_array)) { |
|
968 | + print _("No data available"); |
|
969 | + } else { |
|
910 | 970 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
911 | 971 | $date_data = ''; |
912 | 972 | $date_cnt = ''; |
@@ -934,8 +994,9 @@ discard block |
||
934 | 994 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
935 | 995 | <?php |
936 | 996 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
937 | - if (empty($hour_array)) print _("No data available"); |
|
938 | - else { |
|
997 | + if (empty($hour_array)) { |
|
998 | + print _("No data available"); |
|
999 | + } else { |
|
939 | 1000 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
940 | 1001 | $hour_data = ''; |
941 | 1002 | $hour_cnt = ''; |
@@ -977,8 +1038,9 @@ discard block |
||
977 | 1038 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
978 | 1039 | <?php |
979 | 1040 | $year_array = $Tracker->countAllMonthsLastYear(true); |
980 | - if (count($year_array) == 0) print _("No data available"); |
|
981 | - else { |
|
1041 | + if (count($year_array) == 0) { |
|
1042 | + print _("No data available"); |
|
1043 | + } else { |
|
982 | 1044 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
983 | 1045 | $year_data = ''; |
984 | 1046 | $year_cnt = ''; |
@@ -1007,8 +1069,9 @@ discard block |
||
1007 | 1069 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1008 | 1070 | <?php |
1009 | 1071 | $month_array = $Tracker->countAllDatesLastMonth(); |
1010 | - if (count($month_array) == 0) print _("No data available"); |
|
1011 | - else { |
|
1072 | + if (count($month_array) == 0) { |
|
1073 | + print _("No data available"); |
|
1074 | + } else { |
|
1012 | 1075 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1013 | 1076 | $month_data = ''; |
1014 | 1077 | $month_cnt = ''; |
@@ -1037,8 +1100,9 @@ discard block |
||
1037 | 1100 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1038 | 1101 | <?php |
1039 | 1102 | $date_array = $Tracker->countAllDatesLast7Days(); |
1040 | - if (empty($date_array)) print _("No data available"); |
|
1041 | - else { |
|
1103 | + if (empty($date_array)) { |
|
1104 | + print _("No data available"); |
|
1105 | + } else { |
|
1042 | 1106 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1043 | 1107 | $date_data = ''; |
1044 | 1108 | $date_cnt = ''; |
@@ -1066,8 +1130,9 @@ discard block |
||
1066 | 1130 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1067 | 1131 | <?php |
1068 | 1132 | $hour_array = $Tracker->countAllHours('hour',true); |
1069 | - if (empty($hour_array)) print _("No data available"); |
|
1070 | - else { |
|
1133 | + if (empty($hour_array)) { |
|
1134 | + print _("No data available"); |
|
1135 | + } else { |
|
1071 | 1136 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1072 | 1137 | $hour_data = ''; |
1073 | 1138 | $hour_cnt = ''; |
@@ -1109,8 +1174,9 @@ discard block |
||
1109 | 1174 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1110 | 1175 | <?php |
1111 | 1176 | $year_array = $Stats->countFatalitiesByYear(); |
1112 | - if (count($year_array) == 0) print _("No data available"); |
|
1113 | - else { |
|
1177 | + if (count($year_array) == 0) { |
|
1178 | + print _("No data available"); |
|
1179 | + } else { |
|
1114 | 1180 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1115 | 1181 | $year_data = ''; |
1116 | 1182 | $year_cnt = ''; |
@@ -1140,8 +1206,9 @@ discard block |
||
1140 | 1206 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1141 | 1207 | <?php |
1142 | 1208 | $year_array = $Stats->countFatalitiesLast12Months(); |
1143 | - if (count($year_array) == 0) print _("No data available"); |
|
1144 | - else { |
|
1209 | + if (count($year_array) == 0) { |
|
1210 | + print _("No data available"); |
|
1211 | + } else { |
|
1145 | 1212 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1146 | 1213 | $year_data = ''; |
1147 | 1214 | $year_cnt = ''; |
@@ -1206,8 +1273,11 @@ discard block |
||
1206 | 1273 | $distance = $distance; |
1207 | 1274 | $unit = 'km'; |
1208 | 1275 | } |
1209 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1210 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1276 | + if (!isset($polar_data)) { |
|
1277 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1278 | + } else { |
|
1279 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1280 | + } |
|
1211 | 1281 | } |
1212 | 1282 | ?> |
1213 | 1283 | <div class="col-md-6"> |
@@ -1259,9 +1329,12 @@ discard block |
||
1259 | 1329 | foreach ($msg as $eachmsg) { |
1260 | 1330 | //$eachmsg = $msg[0]; |
1261 | 1331 | $data = $eachmsg['source_data']; |
1262 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1263 | - else $max = 500; |
|
1264 | -?> |
|
1332 | + if ($data > 500) { |
|
1333 | + $max = (round(($data+100)/100))*100; |
|
1334 | + } else { |
|
1335 | + $max = 500; |
|
1336 | + } |
|
1337 | + ?> |
|
1265 | 1338 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1266 | 1339 | <script> |
1267 | 1340 | var g = new JustGage({ |
@@ -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 | } |