@@ -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 | <!-- |
@@ -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 |
@@ -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,83 +103,83 @@ 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 |
111 | 111 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
112 | - $current_date = date('Y-m-d'); |
|
113 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
114 | - else $source = ''; |
|
115 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
116 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
117 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
118 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
119 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
112 | + $current_date = date('Y-m-d'); |
|
113 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
114 | + else $source = ''; |
|
115 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
116 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
117 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
118 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
119 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | |
123 | 123 | $Common = new Common(); |
124 | 124 | $AIS = new AIS(); |
125 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
126 | - else $id = trim($line['id']); |
|
125 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
126 | + else $id = trim($line['id']); |
|
127 | 127 | |
128 | 128 | if (!isset($this->all_tracked[$id])) { |
129 | - $this->all_tracked[$id] = array(); |
|
130 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
131 | - $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' => '')); |
|
132 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
133 | - if (!isset($line['id'])) { |
|
129 | + $this->all_tracked[$id] = array(); |
|
130 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
131 | + $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' => '')); |
|
132 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
133 | + if (!isset($line['id'])) { |
|
134 | 134 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
135 | 135 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
136 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
137 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
136 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
137 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
141 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
142 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
141 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
142 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
143 | 143 | $Marine = new Marine($this->db); |
144 | 144 | $identity = $Marine->getIdentity($line['mmsi']); |
145 | 145 | if (!empty($identity)) { |
146 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
147 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
146 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
147 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
148 | 148 | } |
149 | 149 | //print_r($identity); |
150 | 150 | unset($Marine); |
151 | 151 | //$dataFound = true; |
152 | - } |
|
152 | + } |
|
153 | 153 | } |
154 | 154 | if (isset($line['type_id'])) { |
155 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
155 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
156 | 156 | } |
157 | 157 | if (isset($line['type']) && $line['type'] != '') { |
158 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
158 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
159 | 159 | } |
160 | 160 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
162 | 162 | } |
163 | 163 | if (isset($line['imo']) && $line['imo'] != '') { |
164 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
164 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
165 | 165 | } |
166 | 166 | if (isset($line['callsign']) && $line['callsign'] != '') { |
167 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
167 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
168 | 168 | } |
169 | 169 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
170 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
170 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
171 | 171 | } |
172 | 172 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
173 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
173 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | |
177 | 177 | //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'])) { |
178 | 178 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
180 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
180 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
181 | 181 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
182 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
182 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
183 | 183 | $timeelapsed = microtime(true); |
184 | 184 | $Marine = new Marine($this->db); |
185 | 185 | $fromsource = NULL; |
@@ -187,20 +187,20 @@ discard block |
||
187 | 187 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
188 | 188 | $Marine->db = null; |
189 | 189 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
190 | - } |
|
190 | + } |
|
191 | + } |
|
191 | 192 | } |
192 | - } |
|
193 | - 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 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
197 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
197 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
198 | 198 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
199 | - } else { |
|
199 | + } else { |
|
200 | 200 | 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"; |
201 | 201 | 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"; |
202 | 202 | return ''; |
203 | - } |
|
203 | + } |
|
204 | 204 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
205 | 205 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
206 | 206 | return ''; |
@@ -217,24 +217,24 @@ discard block |
||
217 | 217 | |
218 | 218 | |
219 | 219 | if (isset($line['speed'])) { |
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
221 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
221 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
222 | 222 | } 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'])) { |
223 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
224 | - if ($distance > 1000 && $distance < 10000) { |
|
223 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
224 | + if ($distance > 1000 && $distance < 10000) { |
|
225 | 225 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
226 | 226 | $speed = $speed*3.6; |
227 | 227 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
228 | 228 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
229 | - } |
|
229 | + } |
|
230 | 230 | } |
231 | 231 | |
232 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
233 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
234 | - else unset($timediff); |
|
235 | - 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')))) { |
|
232 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
233 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
234 | + else unset($timediff); |
|
235 | + 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')))) { |
|
236 | 236 | 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'])) { |
237 | - 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 | + 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 | 238 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
239 | 239 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
240 | 240 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -242,211 +242,211 @@ discard block |
||
242 | 242 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
243 | 243 | $timeelapsed = microtime(true); |
244 | 244 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
245 | - $Marine = new Marine($this->db); |
|
246 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
247 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
248 | - $Marine->db = null; |
|
249 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
245 | + $Marine = new Marine($this->db); |
|
246 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
247 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
248 | + $Marine->db = null; |
|
249 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
250 | 250 | } |
251 | 251 | $this->tmd = 0; |
252 | 252 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
253 | - } |
|
253 | + } |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
257 | 257 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
258 | 258 | 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') { |
259 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
260 | - $dataFound = true; |
|
261 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
259 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
260 | + $dataFound = true; |
|
261 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
262 | 262 | } |
263 | 263 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
264 | 264 | } |
265 | 265 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
266 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
266 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
267 | 267 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
268 | 268 | 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') { |
269 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
270 | - $dataFound = true; |
|
271 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
269 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
270 | + $dataFound = true; |
|
271 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
272 | 272 | } |
273 | 273 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
274 | 274 | } |
275 | 275 | |
276 | - } else if ($globalDebug && $timediff > 20) { |
|
276 | + } else if ($globalDebug && $timediff > 20) { |
|
277 | 277 | $this->tmd = $this->tmd + 1; |
278 | 278 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
279 | 279 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
280 | 280 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
281 | 281 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
282 | - } |
|
282 | + } |
|
283 | 283 | } |
284 | 284 | if (isset($line['last_update']) && $line['last_update'] != '') { |
285 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
286 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
285 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
286 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
287 | 287 | } |
288 | 288 | if (isset($line['format_source']) && $line['format_source'] != '') { |
289 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
289 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
290 | 290 | } |
291 | 291 | if (isset($line['source_name']) && $line['source_name'] != '') { |
292 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
292 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
293 | 293 | } |
294 | 294 | if (isset($line['status']) && $line['status'] != '') { |
295 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
295 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
296 | 296 | } |
297 | 297 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
298 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
299 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
298 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
299 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
300 | 300 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
301 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
301 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
302 | 302 | $Marine = new Marine($this->db); |
303 | 303 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
304 | 304 | unset($Marine); |
305 | - } |
|
305 | + } |
|
306 | + } |
|
306 | 307 | } |
307 | - } |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
311 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
311 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | if (isset($line['heading']) && $line['heading'] != '') { |
315 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
316 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
317 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
318 | - //$dataFound = true; |
|
315 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
316 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
317 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
318 | + //$dataFound = true; |
|
319 | 319 | } 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']) { |
320 | - $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']); |
|
321 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
322 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
323 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
320 | + $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']); |
|
321 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
322 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
323 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
324 | 324 | } |
325 | 325 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
326 | 326 | |
327 | 327 | |
328 | 328 | |
329 | 329 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
330 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
331 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
332 | - 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'])) { |
|
333 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
330 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
331 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
332 | + 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'])) { |
|
333 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
334 | 334 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
335 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
336 | - $timeelapsed = microtime(true); |
|
337 | - $MarineLive = new MarineLive($this->db); |
|
338 | - if (isset($line['id'])) { |
|
335 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
336 | + $timeelapsed = microtime(true); |
|
337 | + $MarineLive = new MarineLive($this->db); |
|
338 | + if (isset($line['id'])) { |
|
339 | 339 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
340 | 340 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
341 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
341 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
342 | 342 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
343 | 343 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
344 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
344 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
345 | 345 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
346 | 346 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
347 | - } else $recent_ident = ''; |
|
348 | - $MarineLive->db=null; |
|
349 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
350 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
347 | + } else $recent_ident = ''; |
|
348 | + $MarineLive->db=null; |
|
349 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
350 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
351 | 351 | } else $recent_ident = ''; |
352 | - } else { |
|
352 | + } else { |
|
353 | 353 | $recent_ident = ''; |
354 | 354 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
355 | - } |
|
356 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
357 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
358 | - { |
|
355 | + } |
|
356 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
357 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
358 | + { |
|
359 | 359 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
360 | 360 | //adds the spotter data for the archive |
361 | - $highlight = ''; |
|
362 | - 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'))); |
|
363 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
361 | + $highlight = ''; |
|
362 | + 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'))); |
|
363 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
364 | 364 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
365 | - $timeelapsed = microtime(true); |
|
366 | - $Marine = new Marine($this->db); |
|
367 | - $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']); |
|
368 | - $Marine->db = null; |
|
369 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
370 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
365 | + $timeelapsed = microtime(true); |
|
366 | + $Marine = new Marine($this->db); |
|
367 | + $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']); |
|
368 | + $Marine->db = null; |
|
369 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
370 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
371 | 371 | } |
372 | - } |
|
373 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
372 | + } |
|
373 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
374 | 374 | // Add source stat in DB |
375 | 375 | $Stats = new Stats($this->db); |
376 | 376 | if (!empty($this->stats)) { |
377 | - if ($globalDebug) echo 'Add source stats : '; |
|
378 | - foreach($this->stats as $date => $data) { |
|
377 | + if ($globalDebug) echo 'Add source stats : '; |
|
378 | + foreach($this->stats as $date => $data) { |
|
379 | 379 | foreach($data as $source => $sourced) { |
380 | - //print_r($sourced); |
|
381 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
382 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
383 | - if (isset($sourced['msg'])) { |
|
384 | - if (time() - $sourced['msg']['date'] > 10) { |
|
385 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
386 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
387 | - unset($this->stats[$date][$source]['msg']); |
|
388 | - } |
|
389 | - } |
|
390 | - } |
|
391 | - if ($date != date('Y-m-d')) { |
|
392 | - unset($this->stats[$date]); |
|
393 | - } |
|
394 | - } |
|
395 | - if ($globalDebug) echo 'Done'."\n"; |
|
380 | + //print_r($sourced); |
|
381 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
382 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
383 | + if (isset($sourced['msg'])) { |
|
384 | + if (time() - $sourced['msg']['date'] > 10) { |
|
385 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
386 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
387 | + unset($this->stats[$date][$source]['msg']); |
|
388 | + } |
|
389 | + } |
|
390 | + } |
|
391 | + if ($date != date('Y-m-d')) { |
|
392 | + unset($this->stats[$date]); |
|
393 | + } |
|
394 | + } |
|
395 | + if ($globalDebug) echo 'Done'."\n"; |
|
396 | 396 | } |
397 | 397 | $Stats->db = null; |
398 | - } |
|
398 | + } |
|
399 | 399 | |
400 | - $this->del(); |
|
400 | + $this->del(); |
|
401 | 401 | //$ignoreImport = false; |
402 | 402 | $this->all_tracked[$id]['addedMarine'] = 1; |
403 | 403 | //print_r($this->all_tracked[$id]); |
404 | 404 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
405 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
406 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
407 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
405 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
406 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
407 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
408 | 408 | $MarineLive = new MarineLive($this->db); |
409 | 409 | $MarineLive->deleteLiveMarineData(); |
410 | 410 | $MarineLive->db=null; |
411 | 411 | if ($globalDebug) echo " Done\n"; |
412 | - } |
|
413 | - $this->last_delete = time(); |
|
412 | + } |
|
413 | + $this->last_delete = time(); |
|
414 | 414 | } |
415 | - } elseif ($recent_ident != '') { |
|
415 | + } elseif ($recent_ident != '') { |
|
416 | 416 | $this->all_tracked[$id]['id'] = $recent_ident; |
417 | 417 | $this->all_tracked[$id]['addedMarine'] = 1; |
418 | 418 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
419 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
419 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
420 | 420 | $Marine = new Marine($this->db); |
421 | 421 | $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']); |
422 | 422 | $Marine->db = null; |
423 | - } |
|
423 | + } |
|
424 | 424 | } |
425 | 425 | |
426 | - } |
|
426 | + } |
|
427 | + } |
|
427 | 428 | } |
428 | - } |
|
429 | - //adds the spotter LIVE data |
|
430 | - if ($globalDebug) { |
|
429 | + //adds the spotter LIVE data |
|
430 | + if ($globalDebug) { |
|
431 | 431 | 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"; |
432 | - } |
|
433 | - $ignoreImport = false; |
|
432 | + } |
|
433 | + $ignoreImport = false; |
|
434 | 434 | |
435 | - if (!$ignoreImport) { |
|
435 | + if (!$ignoreImport) { |
|
436 | 436 | 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'])) { |
437 | 437 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
438 | 438 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
439 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
439 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
440 | 440 | $timeelapsed = microtime(true); |
441 | 441 | $MarineLive = new MarineLive($this->db); |
442 | 442 | $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']); |
443 | 443 | $MarineLive->db = null; |
444 | 444 | if ($globalDebug) echo $result."\n"; |
445 | 445 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
446 | - } |
|
446 | + } |
|
447 | 447 | } |
448 | 448 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
449 | - $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 | + $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']); |
|
450 | 450 | } |
451 | 451 | $this->all_tracked[$id]['putinarchive'] = false; |
452 | 452 | |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | if ($stats_heading == 16) $stats_heading = 0; |
479 | 479 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
480 | 480 | for ($i=0;$i<=15;$i++) { |
481 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
481 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
482 | 482 | } |
483 | 483 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
484 | 484 | } else { |
@@ -491,11 +491,11 @@ discard block |
||
491 | 491 | //var_dump($this->stats); |
492 | 492 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
493 | 493 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
494 | - end($this->stats[$current_date][$source]['hist']); |
|
495 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
494 | + end($this->stats[$current_date][$source]['hist']); |
|
495 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
496 | 496 | } else $mini = 0; |
497 | 497 | for ($i=$mini;$i<=$distance;$i+=10) { |
498 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
498 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
499 | 499 | } |
500 | 500 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
501 | 501 | } else { |
@@ -511,24 +511,24 @@ discard block |
||
511 | 511 | |
512 | 512 | |
513 | 513 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
514 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
514 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
515 | 515 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
516 | 516 | $MarineLive = new MarineLive($this->db); |
517 | 517 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
518 | 518 | $MarineLive->db = null; |
519 | 519 | //MarineLive->deleteLiveMarineData(); |
520 | 520 | if ($globalDebug) echo " Done\n"; |
521 | - } |
|
522 | - $this->last_delete_hourly = time(); |
|
521 | + } |
|
522 | + $this->last_delete_hourly = time(); |
|
523 | 523 | } |
524 | 524 | |
525 | - } |
|
526 | - //$ignoreImport = false; |
|
525 | + } |
|
526 | + //$ignoreImport = false; |
|
527 | 527 | } |
528 | 528 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
529 | 529 | if ($send) return $this->all_tracked[$id]; |
530 | - } |
|
530 | + } |
|
531 | + } |
|
531 | 532 | } |
532 | - } |
|
533 | 533 | } |
534 | 534 | ?> |
@@ -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; |
@@ -110,20 +120,30 @@ discard block |
||
110 | 120 | // Increment message number |
111 | 121 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
112 | 122 | $current_date = date('Y-m-d'); |
113 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
114 | - else $source = ''; |
|
115 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
123 | + if (isset($line['source_name'])) { |
|
124 | + $source = $line['source_name']; |
|
125 | + } else { |
|
126 | + $source = ''; |
|
127 | + } |
|
128 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
129 | + $source = $line['format_source']; |
|
130 | + } |
|
116 | 131 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
117 | 132 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
118 | 133 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
119 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
134 | + } else { |
|
135 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
136 | + } |
|
120 | 137 | } |
121 | 138 | |
122 | 139 | |
123 | 140 | $Common = new Common(); |
124 | 141 | $AIS = new AIS(); |
125 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
126 | - else $id = trim($line['id']); |
|
142 | + if (!isset($line['id'])) { |
|
143 | + $id = trim($line['mmsi']); |
|
144 | + } else { |
|
145 | + $id = trim($line['id']); |
|
146 | + } |
|
127 | 147 | |
128 | 148 | if (!isset($this->all_tracked[$id])) { |
129 | 149 | $this->all_tracked[$id] = array(); |
@@ -131,10 +151,16 @@ discard block |
||
131 | 151 | $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' => '')); |
132 | 152 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
133 | 153 | if (!isset($line['id'])) { |
134 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
154 | + if (!isset($globalDaemon)) { |
|
155 | + $globalDaemon = TRUE; |
|
156 | + } |
|
135 | 157 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
136 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
137 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
158 | + } else { |
|
159 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
160 | + } |
|
161 | + if ($globalAllTracked !== FALSE) { |
|
162 | + $dataFound = true; |
|
163 | + } |
|
138 | 164 | } |
139 | 165 | |
140 | 166 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
@@ -184,34 +210,49 @@ discard block |
||
184 | 210 | $Marine = new Marine($this->db); |
185 | 211 | $fromsource = NULL; |
186 | 212 | $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
187 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
213 | + if ($globalDebug && $result != 'success') { |
|
214 | + echo '!!! ERROR : '.$result."\n"; |
|
215 | + } |
|
188 | 216 | $Marine->db = null; |
189 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
217 | + if ($globalDebugTimeElapsed) { |
|
218 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
219 | + } |
|
190 | 220 | } |
191 | 221 | } |
192 | 222 | } |
193 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
223 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
225 | + } |
|
194 | 226 | } |
195 | 227 | |
196 | 228 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
197 | 229 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
198 | 230 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
199 | 231 | } else { |
200 | - 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"; |
|
201 | - 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"; |
|
232 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
233 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
234 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
235 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
236 | + } |
|
202 | 237 | return ''; |
203 | 238 | } |
204 | 239 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
205 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
240 | + if ($globalDebug) { |
|
241 | + echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
242 | + } |
|
206 | 243 | return ''; |
207 | 244 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) > time()+20*60) { |
208 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
245 | + if ($globalDebug) { |
|
246 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
247 | + } |
|
209 | 248 | return ''; |
210 | 249 | } elseif (!isset($line['datetime'])) { |
211 | 250 | date_default_timezone_set('UTC'); |
212 | 251 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
213 | 252 | } else { |
214 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
253 | + if ($globalDebug) { |
|
254 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
|
255 | + } |
|
215 | 256 | return ''; |
216 | 257 | } |
217 | 258 | |
@@ -224,14 +265,21 @@ discard block |
||
224 | 265 | if ($distance > 1000 && $distance < 10000) { |
225 | 266 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
226 | 267 | $speed = $speed*3.6; |
227 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
228 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
268 | + if ($speed < 1000) { |
|
269 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
|
270 | + } |
|
271 | + if ($globalDebug) { |
|
272 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
|
273 | + } |
|
229 | 274 | } |
230 | 275 | } |
231 | 276 | |
232 | 277 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
233 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
234 | - else unset($timediff); |
|
278 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
279 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
280 | + } else { |
|
281 | + unset($timediff); |
|
282 | + } |
|
235 | 283 | 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')))) { |
236 | 284 | 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'])) { |
237 | 285 | 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'])) { |
@@ -239,22 +287,32 @@ discard block |
||
239 | 287 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
240 | 288 | $this->all_tracked[$id]['putinarchive'] = true; |
241 | 289 | |
242 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
290 | + if ($globalDebug) { |
|
291 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
292 | + } |
|
243 | 293 | $timeelapsed = microtime(true); |
244 | 294 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
245 | 295 | $Marine = new Marine($this->db); |
246 | 296 | $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
247 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
297 | + if (!empty($all_country)) { |
|
298 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
299 | + } |
|
248 | 300 | $Marine->db = null; |
249 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
301 | + if ($globalDebugTimeElapsed) { |
|
302 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
303 | + } |
|
250 | 304 | } |
251 | 305 | $this->tmd = 0; |
252 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
306 | + if ($globalDebug) { |
|
307 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
308 | + } |
|
253 | 309 | } |
254 | 310 | } |
255 | 311 | |
256 | 312 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
257 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
313 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
314 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
315 | + } |
|
258 | 316 | 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') { |
259 | 317 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
260 | 318 | $dataFound = true; |
@@ -263,8 +321,12 @@ discard block |
||
263 | 321 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
264 | 322 | } |
265 | 323 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
266 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
267 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
324 | + if ($line['longitude'] > 180) { |
|
325 | + $line['longitude'] = $line['longitude'] - 360; |
|
326 | + } |
|
327 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
328 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
329 | + } |
|
268 | 330 | 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') { |
269 | 331 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
270 | 332 | $dataFound = true; |
@@ -282,7 +344,9 @@ discard block |
||
282 | 344 | } |
283 | 345 | } |
284 | 346 | if (isset($line['last_update']) && $line['last_update'] != '') { |
285 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
347 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
348 | + $dataFound = true; |
|
349 | + } |
|
286 | 350 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
287 | 351 | } |
288 | 352 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -312,15 +376,21 @@ discard block |
||
312 | 376 | } |
313 | 377 | |
314 | 378 | if (isset($line['heading']) && $line['heading'] != '') { |
315 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
379 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
380 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
381 | + } |
|
316 | 382 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
317 | 383 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
318 | 384 | //$dataFound = true; |
319 | 385 | } 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']) { |
320 | 386 | $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']); |
321 | 387 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
322 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
323 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
388 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
389 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
390 | + } |
|
391 | + if ($globalDebug) { |
|
392 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
393 | + } |
|
324 | 394 | } |
325 | 395 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
326 | 396 | |
@@ -332,23 +402,38 @@ discard block |
||
332 | 402 | 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'])) { |
333 | 403 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
334 | 404 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
335 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
405 | + if ($globalDebug) { |
|
406 | + echo "Check if aircraft is already in DB..."; |
|
407 | + } |
|
336 | 408 | $timeelapsed = microtime(true); |
337 | 409 | $MarineLive = new MarineLive($this->db); |
338 | 410 | if (isset($line['id'])) { |
339 | 411 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
340 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
412 | + if ($globalDebugTimeElapsed) { |
|
413 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
414 | + } |
|
341 | 415 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
342 | 416 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
343 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
417 | + if ($globalDebugTimeElapsed) { |
|
418 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
419 | + } |
|
344 | 420 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
345 | 421 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
346 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
347 | - } else $recent_ident = ''; |
|
422 | + if ($globalDebugTimeElapsed) { |
|
423 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
424 | + } |
|
425 | + } else { |
|
426 | + $recent_ident = ''; |
|
427 | + } |
|
348 | 428 | $MarineLive->db=null; |
349 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
350 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
351 | - } else $recent_ident = ''; |
|
429 | + if ($globalDebug && $recent_ident == '') { |
|
430 | + echo " Not in DB.\n"; |
|
431 | + } elseif ($globalDebug && $recent_ident != '') { |
|
432 | + echo " Already in DB.\n"; |
|
433 | + } |
|
434 | + } else { |
|
435 | + $recent_ident = ''; |
|
436 | + } |
|
352 | 437 | } else { |
353 | 438 | $recent_ident = ''; |
354 | 439 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -356,30 +441,44 @@ discard block |
||
356 | 441 | //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
357 | 442 | if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
358 | 443 | { |
359 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
444 | + if ($globalDebug) { |
|
445 | + echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
446 | + } |
|
360 | 447 | //adds the spotter data for the archive |
361 | 448 | $highlight = ''; |
362 | - 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'))); |
|
449 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
450 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
451 | + } |
|
363 | 452 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
364 | 453 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
365 | 454 | $timeelapsed = microtime(true); |
366 | 455 | $Marine = new Marine($this->db); |
367 | 456 | $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']); |
368 | 457 | $Marine->db = null; |
369 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
370 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
458 | + if ($globalDebug && isset($result)) { |
|
459 | + echo $result."\n"; |
|
460 | + } |
|
461 | + if ($globalDebugTimeElapsed) { |
|
462 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
463 | + } |
|
371 | 464 | } |
372 | 465 | } |
373 | 466 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
374 | 467 | // Add source stat in DB |
375 | 468 | $Stats = new Stats($this->db); |
376 | 469 | if (!empty($this->stats)) { |
377 | - if ($globalDebug) echo 'Add source stats : '; |
|
470 | + if ($globalDebug) { |
|
471 | + echo 'Add source stats : '; |
|
472 | + } |
|
378 | 473 | foreach($this->stats as $date => $data) { |
379 | 474 | foreach($data as $source => $sourced) { |
380 | 475 | //print_r($sourced); |
381 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
382 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
476 | + if (isset($sourced['polar'])) { |
|
477 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
478 | + } |
|
479 | + if (isset($sourced['hist'])) { |
|
480 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
481 | + } |
|
383 | 482 | if (isset($sourced['msg'])) { |
384 | 483 | if (time() - $sourced['msg']['date'] > 10) { |
385 | 484 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -392,7 +491,9 @@ discard block |
||
392 | 491 | unset($this->stats[$date]); |
393 | 492 | } |
394 | 493 | } |
395 | - if ($globalDebug) echo 'Done'."\n"; |
|
494 | + if ($globalDebug) { |
|
495 | + echo 'Done'."\n"; |
|
496 | + } |
|
396 | 497 | } |
397 | 498 | $Stats->db = null; |
398 | 499 | } |
@@ -402,13 +503,17 @@ discard block |
||
402 | 503 | $this->all_tracked[$id]['addedMarine'] = 1; |
403 | 504 | //print_r($this->all_tracked[$id]); |
404 | 505 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
405 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
506 | + if ($globalDebug) { |
|
507 | + echo "---- Deleting Live Marine data older than 9 hours..."; |
|
508 | + } |
|
406 | 509 | //MarineLive->deleteLiveMarineDataNotUpdated(); |
407 | 510 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
408 | 511 | $MarineLive = new MarineLive($this->db); |
409 | 512 | $MarineLive->deleteLiveMarineData(); |
410 | 513 | $MarineLive->db=null; |
411 | - if ($globalDebug) echo " Done\n"; |
|
514 | + if ($globalDebug) { |
|
515 | + echo " Done\n"; |
|
516 | + } |
|
412 | 517 | } |
413 | 518 | $this->last_delete = time(); |
414 | 519 | } |
@@ -434,15 +539,21 @@ discard block |
||
434 | 539 | |
435 | 540 | if (!$ignoreImport) { |
436 | 541 | 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'])) { |
437 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
542 | + if ($globalDebug) { |
|
543 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
544 | + } |
|
438 | 545 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
439 | 546 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
440 | 547 | $timeelapsed = microtime(true); |
441 | 548 | $MarineLive = new MarineLive($this->db); |
442 | 549 | $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']); |
443 | 550 | $MarineLive->db = null; |
444 | - if ($globalDebug) echo $result."\n"; |
|
445 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
551 | + if ($globalDebug) { |
|
552 | + echo $result."\n"; |
|
553 | + } |
|
554 | + if ($globalDebugTimeElapsed) { |
|
555 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
556 | + } |
|
446 | 557 | } |
447 | 558 | } |
448 | 559 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
@@ -454,7 +565,9 @@ discard block |
||
454 | 565 | |
455 | 566 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
456 | 567 | $source = $this->all_tracked[$id]['source_name']; |
457 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
568 | + if ($source == '') { |
|
569 | + $source = $this->all_tracked[$id]['format_source']; |
|
570 | + } |
|
458 | 571 | if (!isset($this->source_location[$source])) { |
459 | 572 | $Location = new Source(); |
460 | 573 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -475,7 +588,9 @@ discard block |
||
475 | 588 | $stats_heading = round($stats_heading/22.5); |
476 | 589 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
477 | 590 | $current_date = date('Y-m-d'); |
478 | - if ($stats_heading == 16) $stats_heading = 0; |
|
591 | + if ($stats_heading == 16) { |
|
592 | + $stats_heading = 0; |
|
593 | + } |
|
479 | 594 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
480 | 595 | for ($i=0;$i<=15;$i++) { |
481 | 596 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -493,7 +608,9 @@ discard block |
||
493 | 608 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
494 | 609 | end($this->stats[$current_date][$source]['hist']); |
495 | 610 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
496 | - } else $mini = 0; |
|
611 | + } else { |
|
612 | + $mini = 0; |
|
613 | + } |
|
497 | 614 | for ($i=$mini;$i<=$distance;$i+=10) { |
498 | 615 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
499 | 616 | } |
@@ -505,19 +622,27 @@ discard block |
||
505 | 622 | |
506 | 623 | |
507 | 624 | $this->all_tracked[$id]['lastupdate'] = time(); |
508 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
509 | - } 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"; |
|
625 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
626 | + $send = true; |
|
627 | + } |
|
628 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
629 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
630 | + } |
|
510 | 631 | //$this->del(); |
511 | 632 | |
512 | 633 | |
513 | 634 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
514 | 635 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
515 | - if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
636 | + if ($globalDebug) { |
|
637 | + echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
638 | + } |
|
516 | 639 | $MarineLive = new MarineLive($this->db); |
517 | 640 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
518 | 641 | $MarineLive->db = null; |
519 | 642 | //MarineLive->deleteLiveMarineData(); |
520 | - if ($globalDebug) echo " Done\n"; |
|
643 | + if ($globalDebug) { |
|
644 | + echo " Done\n"; |
|
645 | + } |
|
521 | 646 | } |
522 | 647 | $this->last_delete_hourly = time(); |
523 | 648 | } |
@@ -526,7 +651,9 @@ discard block |
||
526 | 651 | //$ignoreImport = false; |
527 | 652 | } |
528 | 653 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
529 | - if ($send) return $this->all_tracked[$id]; |
|
654 | + if ($send) { |
|
655 | + return $this->all_tracked[$id]; |
|
656 | + } |
|
530 | 657 | } |
531 | 658 | } |
532 | 659 | } |
@@ -18,11 +18,15 @@ discard block |
||
18 | 18 | require_once('require/class.Spotter.php'); |
19 | 19 | } |
20 | 20 | |
21 | -if (!isset($filter_name)) $filter_name = ''; |
|
21 | +if (!isset($filter_name)) { |
|
22 | + $filter_name = ''; |
|
23 | +} |
|
22 | 24 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
23 | 25 | if ($type == 'aircraft' && $airline_icao == '' && isset($globalFilter)) { |
24 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
25 | -} |
|
26 | + if (isset($globalFilter['airline'])) { |
|
27 | + $airline_icao = $globalFilter['airline'][0]; |
|
28 | + } |
|
29 | + } |
|
26 | 30 | if ($type == 'aircraft' && $airline_icao != '' && $airline_icao != 'all') { |
27 | 31 | $Spotter = new Spotter(); |
28 | 32 | $airline_info = $Spotter->getAllAirlineInfo($airline_icao); |
@@ -53,7 +57,12 @@ discard block |
||
53 | 57 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/datamaps.world.min.js"></script> |
54 | 58 | <div class="column"> |
55 | 59 | <div class="info"> |
56 | - <h1><?php if (isset($airline_name)) echo _("Statistics for ").$airline_name; else echo _("Statistics"); ?></h1> |
|
60 | + <h1><?php if (isset($airline_name)) { |
|
61 | + echo _("Statistics for ").$airline_name; |
|
62 | +} else { |
|
63 | + echo _("Statistics"); |
|
64 | +} |
|
65 | +?></h1> |
|
57 | 66 | <?php |
58 | 67 | if ($type == 'aircraft') { |
59 | 68 | $last_update = $Stats->getLastStatsUpdate(); |
@@ -61,7 +70,9 @@ discard block |
||
61 | 70 | if (isset($last_update[0]['value'])) { |
62 | 71 | date_default_timezone_set('UTC'); |
63 | 72 | $lastupdate = strtotime($last_update[0]['value']); |
64 | - if (isset($globalTimezone) && $globalTimezone != '') date_default_timezone_set($globalTimezone); |
|
73 | + if (isset($globalTimezone) && $globalTimezone != '') { |
|
74 | + date_default_timezone_set($globalTimezone); |
|
75 | + } |
|
65 | 76 | print '<i>Last update: '.date('Y-m-d G:i:s',$lastupdate).'</i>'; |
66 | 77 | } |
67 | 78 | } |
@@ -139,14 +150,18 @@ discard block |
||
139 | 150 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
140 | 151 | <?php |
141 | 152 | $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
142 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
143 | - else { |
|
153 | + if (count($aircraft_array) == 0) { |
|
154 | + print _("No data available"); |
|
155 | + } else { |
|
144 | 156 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
145 | 157 | $aircraft_data = ''; |
146 | 158 | foreach($aircraft_array as $aircraft_item) |
147 | 159 | { |
148 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
149 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
160 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') { |
|
161 | + $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
162 | + } else { |
|
163 | + $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
164 | + } |
|
150 | 165 | } |
151 | 166 | $aircraft_data = substr($aircraft_data, 0, -1); |
152 | 167 | print 'var series = ['.$aircraft_data.'];'; |
@@ -163,11 +178,17 @@ discard block |
||
163 | 178 | <?php |
164 | 179 | if ($year != '' && $month != '') { |
165 | 180 | ?> |
166 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
181 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
182 | + echo '/'.$airline_icao; |
|
183 | +} |
|
184 | +?>/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
167 | 185 | <?php |
168 | 186 | } else { |
169 | 187 | ?> |
170 | - <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
188 | + <a href="<?php print $globalURL; ?>/statistics/aircraft<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
189 | + echo '/'.$airline_icao; |
|
190 | +} |
|
191 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
171 | 192 | <?php |
172 | 193 | } |
173 | 194 | ?> |
@@ -198,11 +219,15 @@ discard block |
||
198 | 219 | print '</script>'; |
199 | 220 | if ($year != '' && $month != '') { |
200 | 221 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
201 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
222 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
223 | + echo '/'.$airline_icao; |
|
224 | + } |
|
202 | 225 | print '/'.$year.'/'.$month.'/" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
203 | 226 | } else { |
204 | 227 | print '<div class="more"><a href="'.$globalURL.'/statistics/airline'; |
205 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
228 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
229 | + echo '/'.$airline_icao; |
|
230 | + } |
|
206 | 231 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
207 | 232 | } |
208 | 233 | print '</div>'; |
@@ -224,8 +249,9 @@ discard block |
||
224 | 249 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
225 | 250 | <?php |
226 | 251 | $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
227 | - if (count($marine_array) == 0) print _("No data available"); |
|
228 | - else { |
|
252 | + if (count($marine_array) == 0) { |
|
253 | + print _("No data available"); |
|
254 | + } else { |
|
229 | 255 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
230 | 256 | $marine_data = ''; |
231 | 257 | foreach($marine_array as $marine_item) |
@@ -272,8 +298,9 @@ discard block |
||
272 | 298 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
273 | 299 | <?php |
274 | 300 | $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
275 | - if (count($tracker_array) == 0) print _("No data available"); |
|
276 | - else { |
|
301 | + if (count($tracker_array) == 0) { |
|
302 | + print _("No data available"); |
|
303 | + } else { |
|
277 | 304 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
278 | 305 | $tracker_data = ''; |
279 | 306 | foreach($tracker_array as $tracker_item) |
@@ -328,8 +355,9 @@ discard block |
||
328 | 355 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
329 | 356 | <?php |
330 | 357 | $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
331 | - if (count($pilot_array) == 0) print _("No data available"); |
|
332 | - else { |
|
358 | + if (count($pilot_array) == 0) { |
|
359 | + print _("No data available"); |
|
360 | + } else { |
|
333 | 361 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
334 | 362 | $pilot_data = ''; |
335 | 363 | foreach($pilot_array as $pilot_item) |
@@ -348,7 +376,9 @@ discard block |
||
348 | 376 | } |
349 | 377 | print '<div class="more">'; |
350 | 378 | print '<a href="'.$globalURL.'/statistics/pilot'; |
351 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
379 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
380 | + echo '/'.$airline_icao; |
|
381 | + } |
|
352 | 382 | print'" class="btn btn-default btn" role="button">'._("See full statistic").'»</a>'; |
353 | 383 | print '</div>'; |
354 | 384 | ?> |
@@ -362,8 +392,9 @@ discard block |
||
362 | 392 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
363 | 393 | <?php |
364 | 394 | $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
365 | - if (count($owner_array) == 0) print _("No data available"); |
|
366 | - else { |
|
395 | + if (count($owner_array) == 0) { |
|
396 | + print _("No data available"); |
|
397 | + } else { |
|
367 | 398 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
368 | 399 | $owner_data = ''; |
369 | 400 | foreach($owner_array as $owner_item) |
@@ -382,7 +413,10 @@ discard block |
||
382 | 413 | } |
383 | 414 | ?> |
384 | 415 | <div class="more"> |
385 | - <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
416 | + <a href="<?php print $globalURL; ?>/statistics/owner<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
417 | + echo '/'.$airline_icao; |
|
418 | +} |
|
419 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
386 | 420 | </div> |
387 | 421 | </div> |
388 | 422 | |
@@ -395,8 +429,9 @@ discard block |
||
395 | 429 | <h2><?php echo _("Top 20 Most Common Country a Flight was Over"); ?></h2> |
396 | 430 | <?php |
397 | 431 | //$flightover_array = $Stats->countAllFlightOverCountries(); |
398 | - if (count($flightover_array) == 0) print _("No data available"); |
|
399 | - else { |
|
432 | + if (count($flightover_array) == 0) { |
|
433 | + print _("No data available"); |
|
434 | + } else { |
|
400 | 435 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
401 | 436 | print 'var series = ['; |
402 | 437 | $flightover_data = ''; |
@@ -439,7 +474,10 @@ discard block |
||
439 | 474 | } |
440 | 475 | ?> |
441 | 476 | <div class="more"> |
442 | - <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
477 | + <a href="<?php print $globalURL; ?>/statistics/country<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
478 | + echo '/'.$airline_icao; |
|
479 | +} |
|
480 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
443 | 481 | </div> |
444 | 482 | </div> |
445 | 483 | <?php |
@@ -461,8 +499,9 @@ discard block |
||
461 | 499 | <div class="col-md-6"> |
462 | 500 | <h2><?php echo _("Top 20 Most Common Country a Vessel was inside"); ?></h2> |
463 | 501 | <?php |
464 | - if (count($flightover_array) == 0) print _("No data available"); |
|
465 | - else { |
|
502 | + if (count($flightover_array) == 0) { |
|
503 | + print _("No data available"); |
|
504 | + } else { |
|
466 | 505 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
467 | 506 | print 'var series = ['; |
468 | 507 | $flightover_data = ''; |
@@ -521,8 +560,9 @@ discard block |
||
521 | 560 | <div class="col-md-6"> |
522 | 561 | <h2><?php echo _("Top 20 Most Common Country a Tracker was inside"); ?></h2> |
523 | 562 | <?php |
524 | - if (count($flightover_array) == 0) print _("No data available"); |
|
525 | - else { |
|
563 | + if (count($flightover_array) == 0) { |
|
564 | + print _("No data available"); |
|
565 | + } else { |
|
526 | 566 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
527 | 567 | print 'var series = ['; |
528 | 568 | $flightover_data = ''; |
@@ -632,7 +672,9 @@ discard block |
||
632 | 672 | });"; |
633 | 673 | print '</script>'; |
634 | 674 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-departure'; |
635 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
675 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
676 | + echo '/'.$airline_icao; |
|
677 | + } |
|
636 | 678 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
637 | 679 | } |
638 | 680 | ?> |
@@ -694,7 +736,9 @@ discard block |
||
694 | 736 | });"; |
695 | 737 | print '</script>'; |
696 | 738 | print '<div class="more"><a href="'.$globalURL.'/statistics/airport-arrival'; |
697 | - if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; |
|
739 | + if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
740 | + echo '/'.$airline_icao; |
|
741 | + } |
|
698 | 742 | print '" class="btn btn-default btn" role="button">'._("See full statistic").'»</a></div>'; |
699 | 743 | } |
700 | 744 | ?> |
@@ -715,8 +759,9 @@ discard block |
||
715 | 759 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
716 | 760 | <?php |
717 | 761 | $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
718 | - if (count($year_array) == 0) print _("No data available"); |
|
719 | - else { |
|
762 | + if (count($year_array) == 0) { |
|
763 | + print _("No data available"); |
|
764 | + } else { |
|
720 | 765 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
721 | 766 | $year_data = ''; |
722 | 767 | $year_cnt = ''; |
@@ -736,7 +781,10 @@ discard block |
||
736 | 781 | } |
737 | 782 | ?> |
738 | 783 | <div class="more"> |
739 | - <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
784 | + <a href="<?php print $globalURL; ?>/statistics/year<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
785 | + echo '/'.$airline_icao; |
|
786 | +} |
|
787 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
740 | 788 | </div> |
741 | 789 | </div> |
742 | 790 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -744,8 +792,9 @@ discard block |
||
744 | 792 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
745 | 793 | <?php |
746 | 794 | $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
747 | - if (count($month_array) == 0) print _("No data available"); |
|
748 | - else { |
|
795 | + if (count($month_array) == 0) { |
|
796 | + print _("No data available"); |
|
797 | + } else { |
|
749 | 798 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
750 | 799 | $month_data = ''; |
751 | 800 | $month_cnt = ''; |
@@ -765,7 +814,10 @@ discard block |
||
765 | 814 | } |
766 | 815 | ?> |
767 | 816 | <div class="more"> |
768 | - <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
817 | + <a href="<?php print $globalURL; ?>/statistics/month<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
818 | + echo '/'.$airline_icao; |
|
819 | +} |
|
820 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
769 | 821 | </div> |
770 | 822 | </div> |
771 | 823 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -774,8 +826,9 @@ discard block |
||
774 | 826 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
775 | 827 | <?php |
776 | 828 | $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
777 | - if (empty($date_array)) print _("No data available"); |
|
778 | - else { |
|
829 | + if (empty($date_array)) { |
|
830 | + print _("No data available"); |
|
831 | + } else { |
|
779 | 832 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
780 | 833 | $date_data = ''; |
781 | 834 | $date_cnt = ''; |
@@ -795,7 +848,10 @@ discard block |
||
795 | 848 | } |
796 | 849 | ?> |
797 | 850 | <div class="more"> |
798 | - <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
851 | + <a href="<?php print $globalURL; ?>/statistics/date<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
852 | + echo '/'.$airline_icao; |
|
853 | +} |
|
854 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
799 | 855 | </div> |
800 | 856 | </div> |
801 | 857 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -803,8 +859,9 @@ discard block |
||
803 | 859 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
804 | 860 | <?php |
805 | 861 | $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
806 | - if (empty($hour_array)) print _("No data available"); |
|
807 | - else { |
|
862 | + if (empty($hour_array)) { |
|
863 | + print _("No data available"); |
|
864 | + } else { |
|
808 | 865 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
809 | 866 | $hour_data = ''; |
810 | 867 | $hour_cnt = ''; |
@@ -824,7 +881,10 @@ discard block |
||
824 | 881 | } |
825 | 882 | ?> |
826 | 883 | <div class="more"> |
827 | - <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') echo '/'.$airline_icao; ?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
884 | + <a href="<?php print $globalURL; ?>/statistics/time<?php if (isset($airline_icao) && $airline_icao != '' && $airline_icao != 'all') { |
|
885 | + echo '/'.$airline_icao; |
|
886 | +} |
|
887 | +?>" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
|
828 | 888 | </div> |
829 | 889 | </div> |
830 | 890 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -846,8 +906,9 @@ discard block |
||
846 | 906 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
847 | 907 | <?php |
848 | 908 | $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
849 | - if (count($year_array) == 0) print _("No data available"); |
|
850 | - else { |
|
909 | + if (count($year_array) == 0) { |
|
910 | + print _("No data available"); |
|
911 | + } else { |
|
851 | 912 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
852 | 913 | $year_data = ''; |
853 | 914 | $year_cnt = ''; |
@@ -876,8 +937,9 @@ discard block |
||
876 | 937 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
877 | 938 | <?php |
878 | 939 | $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
879 | - if (count($month_array) == 0) print _("No data available"); |
|
880 | - else { |
|
940 | + if (count($month_array) == 0) { |
|
941 | + print _("No data available"); |
|
942 | + } else { |
|
881 | 943 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
882 | 944 | $month_data = ''; |
883 | 945 | $month_cnt = ''; |
@@ -906,8 +968,9 @@ discard block |
||
906 | 968 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
907 | 969 | <?php |
908 | 970 | $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
909 | - if (empty($date_array)) print _("No data available"); |
|
910 | - else { |
|
971 | + if (empty($date_array)) { |
|
972 | + print _("No data available"); |
|
973 | + } else { |
|
911 | 974 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
912 | 975 | $date_data = ''; |
913 | 976 | $date_cnt = ''; |
@@ -935,8 +998,9 @@ discard block |
||
935 | 998 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
936 | 999 | <?php |
937 | 1000 | $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
938 | - if (empty($hour_array)) print _("No data available"); |
|
939 | - else { |
|
1001 | + if (empty($hour_array)) { |
|
1002 | + print _("No data available"); |
|
1003 | + } else { |
|
940 | 1004 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
941 | 1005 | $hour_data = ''; |
942 | 1006 | $hour_cnt = ''; |
@@ -978,8 +1042,9 @@ discard block |
||
978 | 1042 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
979 | 1043 | <?php |
980 | 1044 | $year_array = $Tracker->countAllMonthsLastYear(true); |
981 | - if (count($year_array) == 0) print _("No data available"); |
|
982 | - else { |
|
1045 | + if (count($year_array) == 0) { |
|
1046 | + print _("No data available"); |
|
1047 | + } else { |
|
983 | 1048 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
984 | 1049 | $year_data = ''; |
985 | 1050 | $year_cnt = ''; |
@@ -1008,8 +1073,9 @@ discard block |
||
1008 | 1073 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1009 | 1074 | <?php |
1010 | 1075 | $month_array = $Tracker->countAllDatesLastMonth(); |
1011 | - if (count($month_array) == 0) print _("No data available"); |
|
1012 | - else { |
|
1076 | + if (count($month_array) == 0) { |
|
1077 | + print _("No data available"); |
|
1078 | + } else { |
|
1013 | 1079 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1014 | 1080 | $month_data = ''; |
1015 | 1081 | $month_cnt = ''; |
@@ -1038,8 +1104,9 @@ discard block |
||
1038 | 1104 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
1039 | 1105 | <?php |
1040 | 1106 | $date_array = $Tracker->countAllDatesLast7Days(); |
1041 | - if (empty($date_array)) print _("No data available"); |
|
1042 | - else { |
|
1107 | + if (empty($date_array)) { |
|
1108 | + print _("No data available"); |
|
1109 | + } else { |
|
1043 | 1110 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1044 | 1111 | $date_data = ''; |
1045 | 1112 | $date_cnt = ''; |
@@ -1067,8 +1134,9 @@ discard block |
||
1067 | 1134 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1068 | 1135 | <?php |
1069 | 1136 | $hour_array = $Tracker->countAllHours('hour',true); |
1070 | - if (empty($hour_array)) print _("No data available"); |
|
1071 | - else { |
|
1137 | + if (empty($hour_array)) { |
|
1138 | + print _("No data available"); |
|
1139 | + } else { |
|
1072 | 1140 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1073 | 1141 | $hour_data = ''; |
1074 | 1142 | $hour_cnt = ''; |
@@ -1110,8 +1178,9 @@ discard block |
||
1110 | 1178 | <h2><?php echo _("Fatalities by Years"); ?></h2> |
1111 | 1179 | <?php |
1112 | 1180 | $year_array = $Stats->countFatalitiesByYear(); |
1113 | - if (count($year_array) == 0) print _("No data available"); |
|
1114 | - else { |
|
1181 | + if (count($year_array) == 0) { |
|
1182 | + print _("No data available"); |
|
1183 | + } else { |
|
1115 | 1184 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1116 | 1185 | $year_data = ''; |
1117 | 1186 | $year_cnt = ''; |
@@ -1141,8 +1210,9 @@ discard block |
||
1141 | 1210 | <h2><?php echo _("Fatalities last 12 Months"); ?></h2> |
1142 | 1211 | <?php |
1143 | 1212 | $year_array = $Stats->countFatalitiesLast12Months(); |
1144 | - if (count($year_array) == 0) print _("No data available"); |
|
1145 | - else { |
|
1213 | + if (count($year_array) == 0) { |
|
1214 | + print _("No data available"); |
|
1215 | + } else { |
|
1146 | 1216 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1147 | 1217 | $year_data = ''; |
1148 | 1218 | $year_cnt = ''; |
@@ -1212,8 +1282,11 @@ discard block |
||
1212 | 1282 | $distance = $distance; |
1213 | 1283 | $unit = 'km'; |
1214 | 1284 | } |
1215 | - if (!isset($polar_data)) $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1216 | - else $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1285 | + if (!isset($polar_data)) { |
|
1286 | + $polar_data = '{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1287 | + } else { |
|
1288 | + $polar_data = $polar_data.',{axis:"'.$direction[0]['direction_shortname'].'",value:'.$key.'}'; |
|
1289 | + } |
|
1217 | 1290 | } |
1218 | 1291 | ?> |
1219 | 1292 | <div class="col-md-6"> |
@@ -1273,9 +1346,12 @@ discard block |
||
1273 | 1346 | foreach ($msg as $eachmsg) { |
1274 | 1347 | //$eachmsg = $msg[0]; |
1275 | 1348 | $data = $eachmsg['source_data']; |
1276 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1277 | - else $max = 500; |
|
1278 | -?> |
|
1349 | + if ($data > 500) { |
|
1350 | + $max = (round(($data+100)/100))*100; |
|
1351 | + } else { |
|
1352 | + $max = 500; |
|
1353 | + } |
|
1354 | + ?> |
|
1279 | 1355 | <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
1280 | 1356 | <script> |
1281 | 1357 | var g = new JustGage({ |
@@ -79,24 +79,24 @@ 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($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
82 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
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 | - } |
|
88 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
89 | - ?> |
|
87 | + } |
|
88 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
89 | + ?> |
|
90 | 90 | <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
91 | 91 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
92 | 92 | <?php |
93 | - } |
|
94 | - ?> |
|
93 | + } |
|
94 | + ?> |
|
95 | 95 | <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
96 | 96 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
97 | 97 | <?php |
98 | - if ($airline_icao == '') { |
|
99 | - ?> |
|
98 | + if ($airline_icao == '') { |
|
99 | + ?> |
|
100 | 100 | <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
101 | 101 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
102 | 102 | <?php |
@@ -139,39 +139,39 @@ discard block |
||
139 | 139 | <div class="col-md-6"> |
140 | 140 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
141 | 141 | <?php |
142 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
143 | - if (count($aircraft_array) == 0) print _("No data available"); |
|
144 | - else { |
|
145 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
146 | - $aircraft_data = ''; |
|
147 | - foreach($aircraft_array as $aircraft_item) |
|
148 | - { |
|
149 | - if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | - else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
151 | - } |
|
152 | - $aircraft_data = substr($aircraft_data, 0, -1); |
|
153 | - print 'var series = ['.$aircraft_data.'];'; |
|
154 | - 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);'; |
|
155 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
156 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
157 | - 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":'; |
|
158 | - print 'dataset'; |
|
159 | - 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}}});'; |
|
160 | - print '</script>'; |
|
161 | - } |
|
162 | - ?> |
|
142 | + $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
143 | + if (count($aircraft_array) == 0) print _("No data available"); |
|
144 | + else { |
|
145 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
146 | + $aircraft_data = ''; |
|
147 | + foreach($aircraft_array as $aircraft_item) |
|
148 | + { |
|
149 | + if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
150 | + else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
|
151 | + } |
|
152 | + $aircraft_data = substr($aircraft_data, 0, -1); |
|
153 | + print 'var series = ['.$aircraft_data.'];'; |
|
154 | + 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);'; |
|
155 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
156 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
157 | + 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":'; |
|
158 | + print 'dataset'; |
|
159 | + 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}}});'; |
|
160 | + print '</script>'; |
|
161 | + } |
|
162 | + ?> |
|
163 | 163 | <div class="more"> |
164 | 164 | <?php |
165 | - if ($year != '' && $month != '') { |
|
166 | - ?> |
|
165 | + if ($year != '' && $month != '') { |
|
166 | + ?> |
|
167 | 167 | <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> |
168 | 168 | <?php |
169 | - } else { |
|
170 | - ?> |
|
169 | + } else { |
|
170 | + ?> |
|
171 | 171 | <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> |
172 | 172 | <?php |
173 | - } |
|
174 | - ?> |
|
173 | + } |
|
174 | + ?> |
|
175 | 175 | </div> |
176 | 176 | </div> |
177 | 177 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -224,29 +224,29 @@ discard block |
||
224 | 224 | <div class="col-md-6"> |
225 | 225 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
226 | 226 | <?php |
227 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
228 | - if (count($marine_array) == 0) print _("No data available"); |
|
229 | - else { |
|
230 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
231 | - $marine_data = ''; |
|
232 | - foreach($marine_array as $marine_item) |
|
233 | - { |
|
234 | - $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
235 | - } |
|
236 | - $marine_data = substr($marine_data, 0, -1); |
|
237 | - print 'var series = ['.$marine_data.'];'; |
|
238 | - 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);'; |
|
239 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
240 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
241 | - 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":'; |
|
242 | - print 'dataset'; |
|
243 | - 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}}});'; |
|
244 | - print '</script>'; |
|
245 | - } |
|
246 | - ?> |
|
227 | + $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
228 | + if (count($marine_array) == 0) print _("No data available"); |
|
229 | + else { |
|
230 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
231 | + $marine_data = ''; |
|
232 | + foreach($marine_array as $marine_item) |
|
233 | + { |
|
234 | + $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
|
235 | + } |
|
236 | + $marine_data = substr($marine_data, 0, -1); |
|
237 | + print 'var series = ['.$marine_data.'];'; |
|
238 | + 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);'; |
|
239 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
240 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
241 | + 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":'; |
|
242 | + print 'dataset'; |
|
243 | + 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}}});'; |
|
244 | + print '</script>'; |
|
245 | + } |
|
246 | + ?> |
|
247 | 247 | <div class="more"> |
248 | 248 | <?php |
249 | - /* |
|
249 | + /* |
|
250 | 250 | if ($year != '' && $month != '') { |
251 | 251 | ?> |
252 | 252 | <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> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | <?php |
258 | 258 | } |
259 | 259 | */ |
260 | - ?> |
|
260 | + ?> |
|
261 | 261 | </div> |
262 | 262 | </div> |
263 | 263 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -272,29 +272,29 @@ discard block |
||
272 | 272 | <div class="col-md-6"> |
273 | 273 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
274 | 274 | <?php |
275 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | - if (count($tracker_array) == 0) print _("No data available"); |
|
277 | - else { |
|
278 | - print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
279 | - $tracker_data = ''; |
|
280 | - foreach($tracker_array as $tracker_item) |
|
281 | - { |
|
282 | - $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
283 | - } |
|
284 | - $tracker_data = substr($tracker_data, 0, -1); |
|
285 | - print 'var series = ['.$tracker_data.'];'; |
|
286 | - 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);'; |
|
287 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
288 | - print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
289 | - 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":'; |
|
290 | - print 'dataset'; |
|
291 | - 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}}});'; |
|
292 | - print '</script>'; |
|
293 | - } |
|
294 | - ?> |
|
275 | + $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
276 | + if (count($tracker_array) == 0) print _("No data available"); |
|
277 | + else { |
|
278 | + print '<div id="chart1" class="chart" width="100%"></div><script>'; |
|
279 | + $tracker_data = ''; |
|
280 | + foreach($tracker_array as $tracker_item) |
|
281 | + { |
|
282 | + $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
|
283 | + } |
|
284 | + $tracker_data = substr($tracker_data, 0, -1); |
|
285 | + print 'var series = ['.$tracker_data.'];'; |
|
286 | + 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);'; |
|
287 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#e6e6f6","#1a3151"]);'; |
|
288 | + print 'series.forEach(function(item){var lab = item[0], value = item[1]; dataset.push({"label":lab,"value":value,"color":paletteScale(value)});});'; |
|
289 | + 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":'; |
|
290 | + print 'dataset'; |
|
291 | + 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}}});'; |
|
292 | + print '</script>'; |
|
293 | + } |
|
294 | + ?> |
|
295 | 295 | <div class="more"> |
296 | 296 | <?php |
297 | - /* |
|
297 | + /* |
|
298 | 298 | if ($year != '' && $month != '') { |
299 | 299 | ?> |
300 | 300 | <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> |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | <?php |
306 | 306 | } |
307 | 307 | */ |
308 | - ?> |
|
308 | + ?> |
|
309 | 309 | </div> |
310 | 310 | </div> |
311 | 311 | <!-- <?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,31 +74,31 @@ 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 | 82 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
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 | } |
88 | 88 | if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
89 | 89 | ?> |
90 | - <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Owners"); ?></span> |
|
91 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
90 | + <span><span class="badge"><?php print number_format($Stats->countOverallOwners($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Owners"); ?></span> |
|
91 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
92 | 92 | <?php |
93 | 93 | } |
94 | 94 | ?> |
95 | - <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao,$filter_name,$year,$month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
96 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
95 | + <span><span class="badge"><?php print number_format($Stats->countOverallAircrafts($airline_icao, $filter_name, $year, $month)); ?></span> <?php echo _("Aircrafts types"); ?></span> |
|
96 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
97 | 97 | <?php |
98 | 98 | if ($airline_icao == '') { |
99 | 99 | ?> |
100 | - <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name,$year,$month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
101 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
100 | + <span><span class="badge"><?php print number_format($Stats->countOverallAirlines($filter_name, $year, $month)); ?></span> <?php echo _("Airlines"); ?></span> |
|
101 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
102 | 102 | <?php |
103 | 103 | } |
104 | 104 | ?> |
@@ -106,8 +106,8 @@ discard block |
||
106 | 106 | if (!(isset($globalVA) && $globalVA) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalphpVMS) && $globalphpVMS) && !(isset($globalVAM) && $globalVAM)) { |
107 | 107 | if ($airline_icao == '' || $airline_icao == 'all') { |
108 | 108 | ?> |
109 | - <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name,$year,$month)); ?></span> <?php echo _("Military"); ?></span> |
|
110 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
109 | + <span><span class="badge"><?php print number_format($Stats->countOverallMilitaryFlights($filter_name, $year, $month)); ?></span> <?php echo _("Military"); ?></span> |
|
110 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
111 | 111 | <?php |
112 | 112 | } |
113 | 113 | } |
@@ -115,22 +115,22 @@ discard block |
||
115 | 115 | <?php |
116 | 116 | } elseif ($type == 'marine') { |
117 | 117 | ?> |
118 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(),$year,$month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
119 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
120 | - <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
121 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
118 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarine(array(), $year, $month)); ?></span> <?php echo _("Vessels"); ?></span> |
|
119 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
120 | + <span><span class="badge"><?php print number_format($Marine->countOverallMarineTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
121 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
122 | 122 | <?php |
123 | 123 | } elseif ($type == 'tracker') { |
124 | 124 | ?> |
125 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(),$year,$month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
126 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
127 | - <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(),$year,$month)); ?></span> <?php echo _("Types"); ?></span> |
|
128 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
125 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTracker(array(), $year, $month)); ?></span> <?php echo _("Trackers"); ?></span> |
|
126 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
127 | + <span><span class="badge"><?php print number_format($Tracker->countOverallTrackerTypes(array(), $year, $month)); ?></span> <?php echo _("Types"); ?></span> |
|
128 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
129 | 129 | <?php |
130 | 130 | } |
131 | 131 | ?> |
132 | 132 | </p> |
133 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
133 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
134 | 134 | <div class="specific-stats"> |
135 | 135 | <?php |
136 | 136 | if ($type == 'aircraft') { |
@@ -139,12 +139,12 @@ discard block |
||
139 | 139 | <div class="col-md-6"> |
140 | 140 | <h2><?php echo _("Top 10 Most Common Aircraft Type"); ?></h2> |
141 | 141 | <?php |
142 | - $aircraft_array = $Stats->countAllAircraftTypes(true,$airline_icao,$filter_name,$year,$month); |
|
142 | + $aircraft_array = $Stats->countAllAircraftTypes(true, $airline_icao, $filter_name, $year, $month); |
|
143 | 143 | if (count($aircraft_array) == 0) print _("No data available"); |
144 | 144 | else { |
145 | 145 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
146 | 146 | $aircraft_data = ''; |
147 | - foreach($aircraft_array as $aircraft_item) |
|
147 | + foreach ($aircraft_array as $aircraft_item) |
|
148 | 148 | { |
149 | 149 | if ($aircraft_item['aircraft_manufacturer'] == 'Not Available') $aircraft_data .= '[" ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
150 | 150 | else $aircraft_data .= '["'.$aircraft_item['aircraft_manufacturer'].' '.$aircraft_item['aircraft_name'].' ('.$aircraft_item['aircraft_icao'].')",'.$aircraft_item['aircraft_icao_count'].'],'; |
@@ -174,17 +174,17 @@ discard block |
||
174 | 174 | ?> |
175 | 175 | </div> |
176 | 176 | </div> |
177 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
177 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
178 | 178 | <?php |
179 | 179 | // echo $airline_icao; |
180 | 180 | if ($airline_icao == '' || $airline_icao == 'all') { |
181 | - $airline_array = $Stats->countAllAirlines(true,$filter_name,$year,$month); |
|
181 | + $airline_array = $Stats->countAllAirlines(true, $filter_name, $year, $month); |
|
182 | 182 | if (count($airline_array) > 0) { |
183 | 183 | print '<div class="col-md-6">'; |
184 | 184 | print '<h2>'._("Top 10 Most Common Airline").'</h2>'; |
185 | 185 | print '<div id="chart2" class="chart" width="100%"></div><script>'; |
186 | 186 | $airline_data = ''; |
187 | - foreach($airline_array as $airline_item) |
|
187 | + foreach ($airline_array as $airline_item) |
|
188 | 188 | { |
189 | 189 | $airline_data .= '["'.$airline_item['airline_name'].' ('.$airline_item['airline_icao'].')",'.$airline_item['airline_count'].'],'; |
190 | 190 | } |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | } |
211 | 211 | ?> |
212 | 212 | </div> |
213 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
213 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
214 | 214 | <?php |
215 | 215 | } |
216 | 216 | ?> |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | <div class="col-md-6"> |
225 | 225 | <h2><?php echo _("Top 10 Most Common Vessel Type"); ?></h2> |
226 | 226 | <?php |
227 | - $marine_array = $Marine->countAllMarineTypes(true,0,'',array(),$year,$month); |
|
227 | + $marine_array = $Marine->countAllMarineTypes(true, 0, '', array(), $year, $month); |
|
228 | 228 | if (count($marine_array) == 0) print _("No data available"); |
229 | 229 | else { |
230 | 230 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
231 | 231 | $marine_data = ''; |
232 | - foreach($marine_array as $marine_item) |
|
232 | + foreach ($marine_array as $marine_item) |
|
233 | 233 | { |
234 | 234 | $marine_data .= '["'.$marine_item['marine_type'].'",'.$marine_item['marine_type_count'].'],'; |
235 | 235 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | ?> |
261 | 261 | </div> |
262 | 262 | </div> |
263 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
263 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
264 | 264 | <!-- </div>--> |
265 | 265 | <?php |
266 | 266 | } |
@@ -272,12 +272,12 @@ discard block |
||
272 | 272 | <div class="col-md-6"> |
273 | 273 | <h2><?php echo _("Top 10 Most Common Tracker Type"); ?></h2> |
274 | 274 | <?php |
275 | - $tracker_array = $Tracker->countAllTrackerTypes(true,0,'',array(),$year,$month); |
|
275 | + $tracker_array = $Tracker->countAllTrackerTypes(true, 0, '', array(), $year, $month); |
|
276 | 276 | if (count($tracker_array) == 0) print _("No data available"); |
277 | 277 | else { |
278 | 278 | print '<div id="chart1" class="chart" width="100%"></div><script>'; |
279 | 279 | $tracker_data = ''; |
280 | - foreach($tracker_array as $tracker_item) |
|
280 | + foreach ($tracker_array as $tracker_item) |
|
281 | 281 | { |
282 | 282 | $tracker_data .= '["'.$tracker_item['tracker_type'].'",'.$tracker_item['tracker_type_count'].'],'; |
283 | 283 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | </div> |
310 | 310 | </div> |
311 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
311 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
312 | 312 | <!-- </div>--> |
313 | 313 | <?php |
314 | 314 | } |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | ?> |
319 | 319 | <div class="row column"> |
320 | 320 | <?php |
321 | - $flightover_array = $Stats->countAllFlightOverCountries(false,$airline_icao,$filter_name,$year,$month); |
|
321 | + $flightover_array = $Stats->countAllFlightOverCountries(false, $airline_icao, $filter_name, $year, $month); |
|
322 | 322 | //if ((isset($globalVA) && $globalVA) ||(isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
323 | 323 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
324 | 324 | if (empty($flightover_array)) { |
@@ -329,12 +329,12 @@ discard block |
||
329 | 329 | ?> |
330 | 330 | <h2><?php echo _("Top 10 Most Common Pilots"); ?></h2> |
331 | 331 | <?php |
332 | - $pilot_array = $Stats->countAllPilots(true,$airline_icao,$filter_name,$year,$month); |
|
332 | + $pilot_array = $Stats->countAllPilots(true, $airline_icao, $filter_name, $year, $month); |
|
333 | 333 | if (count($pilot_array) == 0) print _("No data available"); |
334 | 334 | else { |
335 | 335 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
336 | 336 | $pilot_data = ''; |
337 | - foreach($pilot_array as $pilot_item) |
|
337 | + foreach ($pilot_array as $pilot_item) |
|
338 | 338 | { |
339 | 339 | $pilot_data .= '["'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
340 | 340 | } |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | ?> |
357 | 357 | </div> |
358 | 358 | |
359 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
359 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
360 | 360 | <?php |
361 | 361 | } |
362 | 362 | // else { |
@@ -365,12 +365,12 @@ discard block |
||
365 | 365 | <div class="col-md-6"> |
366 | 366 | <h2><?php echo _("Top 10 Most Common Owners"); ?></h2> |
367 | 367 | <?php |
368 | - $owner_array = $Stats->countAllOwners(true,$airline_icao,$filter_name,$year,$month); |
|
368 | + $owner_array = $Stats->countAllOwners(true, $airline_icao, $filter_name, $year, $month); |
|
369 | 369 | if (count($owner_array) == 0) print _("No data available"); |
370 | 370 | else { |
371 | 371 | print '<div id="chart7" class="chart" width="100%"></div><script>'; |
372 | 372 | $owner_data = ''; |
373 | - foreach($owner_array as $owner_item) |
|
373 | + foreach ($owner_array as $owner_item) |
|
374 | 374 | { |
375 | 375 | $owner_data .= '["'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
376 | 376 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | </div> |
391 | 391 | </div> |
392 | 392 | |
393 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
393 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
394 | 394 | <?php |
395 | 395 | } |
396 | 396 | if (!empty($flightover_array)) { |
@@ -404,7 +404,7 @@ discard block |
||
404 | 404 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
405 | 405 | print 'var series = ['; |
406 | 406 | $flightover_data = ''; |
407 | - foreach($flightover_array as $flightover_item) |
|
407 | + foreach ($flightover_array as $flightover_item) |
|
408 | 408 | { |
409 | 409 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
410 | 410 | } |
@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | } |
451 | 451 | ?> |
452 | 452 | </div> |
453 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
453 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
454 | 454 | |
455 | 455 | |
456 | 456 | </div> |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
471 | 471 | print 'var series = ['; |
472 | 472 | $flightover_data = ''; |
473 | - foreach($flightover_array as $flightover_item) |
|
473 | + foreach ($flightover_array as $flightover_item) |
|
474 | 474 | { |
475 | 475 | $flightover_data .= '[ "'.$flightover_item['marine_country_iso3'].'",'.$flightover_item['marine_count'].'],'; |
476 | 476 | } |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | print '<div id="chart10" class="chart" width="100%"></div><script>'; |
531 | 531 | print 'var series = ['; |
532 | 532 | $flightover_data = ''; |
533 | - foreach($flightover_array as $flightover_item) |
|
533 | + foreach ($flightover_array as $flightover_item) |
|
534 | 534 | { |
535 | 535 | $flightover_data .= '[ "'.$flightover_item['flight_country_iso3'].'",'.$flightover_item['flight_count'].'],'; |
536 | 536 | } |
@@ -583,14 +583,14 @@ discard block |
||
583 | 583 | <div class="row column"> |
584 | 584 | <div class="col-md-6"> |
585 | 585 | <?php |
586 | - $airport_airport_array = $Stats->countAllDepartureAirports(true,$airline_icao,$filter_name,$year,$month); |
|
586 | + $airport_airport_array = $Stats->countAllDepartureAirports(true, $airline_icao, $filter_name, $year, $month); |
|
587 | 587 | if (count($airport_airport_array) > 0) { |
588 | 588 | print '<h2>'._("Top 10 Most Common Departure Airports").'</h2>'; |
589 | 589 | print '<div id="chart3" class="chart" width="100%"></div><script>'; |
590 | 590 | print "\n"; |
591 | 591 | print 'var series = ['; |
592 | 592 | $airport_data = ''; |
593 | - foreach($airport_airport_array as $airport_item) |
|
593 | + foreach ($airport_airport_array as $airport_item) |
|
594 | 594 | { |
595 | 595 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_icao'].'",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
596 | 596 | } |
@@ -641,18 +641,18 @@ discard block |
||
641 | 641 | } |
642 | 642 | ?> |
643 | 643 | </div> |
644 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
644 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
645 | 645 | |
646 | 646 | <div class="col-md-6"> |
647 | 647 | <?php |
648 | - $airport_airport_array2 = $Stats->countAllArrivalAirports(true,$airline_icao,$filter_name,$year,$month); |
|
648 | + $airport_airport_array2 = $Stats->countAllArrivalAirports(true, $airline_icao, $filter_name, $year, $month); |
|
649 | 649 | if (count($airport_airport_array2) > 0) { |
650 | 650 | print '<h2>'._("Top 10 Most Common Arrival Airports").'</h2>'; |
651 | 651 | print '<div id="chart4" class="chart" width="100%"></div><script>'; |
652 | 652 | print "\n"; |
653 | 653 | print 'var series = ['; |
654 | 654 | $airport_data = ''; |
655 | - foreach($airport_airport_array2 as $airport_item) |
|
655 | + foreach ($airport_airport_array2 as $airport_item) |
|
656 | 656 | { |
657 | 657 | $airport_data .= '[ "'.$airport_item['airport_arrival_icao_count'].'", "'.$airport_item['airport_arrival_icao'].'",'.$airport_item['airport_arrival_latitude'].','.$airport_item['airport_arrival_longitude'].'],'; |
658 | 658 | } |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | ?> |
705 | 705 | </div> |
706 | 706 | </div> |
707 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
707 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
708 | 708 | <?php |
709 | 709 | } |
710 | 710 | ?> |
@@ -718,19 +718,19 @@ discard block |
||
718 | 718 | <div class="col-md-6"> |
719 | 719 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
720 | 720 | <?php |
721 | - $year_array = $Stats->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
721 | + $year_array = $Stats->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
722 | 722 | if (count($year_array) == 0) print _("No data available"); |
723 | 723 | else { |
724 | 724 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
725 | 725 | $year_data = ''; |
726 | 726 | $year_cnt = ''; |
727 | - foreach($year_array as $year_item) |
|
727 | + foreach ($year_array as $year_item) |
|
728 | 728 | { |
729 | 729 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
730 | 730 | $year_cnt .= $year_item['date_count'].','; |
731 | 731 | } |
732 | 732 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
733 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
733 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
734 | 734 | print 'c3.generate({ |
735 | 735 | bindto: "#chart8", |
736 | 736 | data: { x: "x", |
@@ -743,23 +743,23 @@ discard block |
||
743 | 743 | <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> |
744 | 744 | </div> |
745 | 745 | </div> |
746 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
746 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
747 | 747 | <div class="col-md-6"> |
748 | 748 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
749 | 749 | <?php |
750 | - $month_array = $Stats->countAllDatesLastMonth($airline_icao,$filter_name); |
|
750 | + $month_array = $Stats->countAllDatesLastMonth($airline_icao, $filter_name); |
|
751 | 751 | if (count($month_array) == 0) print _("No data available"); |
752 | 752 | else { |
753 | 753 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
754 | 754 | $month_data = ''; |
755 | 755 | $month_cnt = ''; |
756 | - foreach($month_array as $month_item) |
|
756 | + foreach ($month_array as $month_item) |
|
757 | 757 | { |
758 | 758 | $month_data .= '"'.$month_item['date_name'].'",'; |
759 | 759 | $month_cnt .= $month_item['date_count'].','; |
760 | 760 | } |
761 | 761 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
762 | - $month_cnt = "['flights',".substr($month_cnt,0,-1)."]"; |
|
762 | + $month_cnt = "['flights',".substr($month_cnt, 0, -1)."]"; |
|
763 | 763 | print 'c3.generate({ |
764 | 764 | bindto: "#chart9", |
765 | 765 | data: { x: "x", |
@@ -772,24 +772,24 @@ discard block |
||
772 | 772 | <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> |
773 | 773 | </div> |
774 | 774 | </div> |
775 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
775 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
776 | 776 | |
777 | 777 | <div class="col-md-6"> |
778 | 778 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
779 | 779 | <?php |
780 | - $date_array = $Stats->countAllDatesLast7Days($airline_icao,$filter_name); |
|
780 | + $date_array = $Stats->countAllDatesLast7Days($airline_icao, $filter_name); |
|
781 | 781 | if (empty($date_array)) print _("No data available"); |
782 | 782 | else { |
783 | 783 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
784 | 784 | $date_data = ''; |
785 | 785 | $date_cnt = ''; |
786 | - foreach($date_array as $date_item) |
|
786 | + foreach ($date_array as $date_item) |
|
787 | 787 | { |
788 | 788 | $date_data .= '"'.$date_item['date_name'].'",'; |
789 | 789 | $date_cnt .= $date_item['date_count'].','; |
790 | 790 | } |
791 | 791 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
792 | - $date_cnt = "['flights',".substr($date_cnt,0,-1)."]"; |
|
792 | + $date_cnt = "['flights',".substr($date_cnt, 0, -1)."]"; |
|
793 | 793 | print 'c3.generate({ |
794 | 794 | bindto: "#chart5", |
795 | 795 | data: { x: "x", |
@@ -802,23 +802,23 @@ discard block |
||
802 | 802 | <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> |
803 | 803 | </div> |
804 | 804 | </div> |
805 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
805 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
806 | 806 | <div class="col-md-6"> |
807 | 807 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
808 | 808 | <?php |
809 | - $hour_array = $Stats->countAllHours('hour',true,$airline_icao,$filter_name); |
|
809 | + $hour_array = $Stats->countAllHours('hour', true, $airline_icao, $filter_name); |
|
810 | 810 | if (empty($hour_array)) print _("No data available"); |
811 | 811 | else { |
812 | 812 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
813 | 813 | $hour_data = ''; |
814 | 814 | $hour_cnt = ''; |
815 | - foreach($hour_array as $hour_item) |
|
815 | + foreach ($hour_array as $hour_item) |
|
816 | 816 | { |
817 | 817 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
818 | 818 | $hour_cnt .= $hour_item['hour_count'].','; |
819 | 819 | } |
820 | 820 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
821 | - $hour_cnt = "['flights',".substr($hour_cnt,0,-1)."]"; |
|
821 | + $hour_cnt = "['flights',".substr($hour_cnt, 0, -1)."]"; |
|
822 | 822 | print 'c3.generate({ |
823 | 823 | bindto: "#chart6", |
824 | 824 | data: { |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | <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> |
832 | 832 | </div> |
833 | 833 | </div> |
834 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
834 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
835 | 835 | </div> |
836 | 836 | <?php |
837 | 837 | } |
@@ -849,19 +849,19 @@ discard block |
||
849 | 849 | <div class="col-md-6"> |
850 | 850 | <h2><?php echo _("Busiest Months of the last 12 Months"); ?></h2> |
851 | 851 | <?php |
852 | - $year_array = $Marine->countAllMonthsLastYear(true,$airline_icao,$filter_name); |
|
852 | + $year_array = $Marine->countAllMonthsLastYear(true, $airline_icao, $filter_name); |
|
853 | 853 | if (count($year_array) == 0) print _("No data available"); |
854 | 854 | else { |
855 | 855 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
856 | 856 | $year_data = ''; |
857 | 857 | $year_cnt = ''; |
858 | - foreach($year_array as $year_item) |
|
858 | + foreach ($year_array as $year_item) |
|
859 | 859 | { |
860 | 860 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
861 | 861 | $year_cnt .= $year_item['date_count'].','; |
862 | 862 | } |
863 | 863 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
864 | - $year_cnt = "['vessels',".substr($year_cnt,0,-1)."]"; |
|
864 | + $year_cnt = "['vessels',".substr($year_cnt, 0, -1)."]"; |
|
865 | 865 | print 'c3.generate({ |
866 | 866 | bindto: "#chart8", |
867 | 867 | data: { x: "x", |
@@ -875,23 +875,23 @@ discard block |
||
875 | 875 | </div> |
876 | 876 | </div> |
877 | 877 | |
878 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
878 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
879 | 879 | <div class="col-md-6"> |
880 | 880 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
881 | 881 | <?php |
882 | - $month_array = $Marine->countAllDatesLastMonth($airline_icao,$filter_name); |
|
882 | + $month_array = $Marine->countAllDatesLastMonth($airline_icao, $filter_name); |
|
883 | 883 | if (count($month_array) == 0) print _("No data available"); |
884 | 884 | else { |
885 | 885 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
886 | 886 | $month_data = ''; |
887 | 887 | $month_cnt = ''; |
888 | - foreach($month_array as $month_item) |
|
888 | + foreach ($month_array as $month_item) |
|
889 | 889 | { |
890 | 890 | $month_data .= '"'.$month_item['date_name'].'",'; |
891 | 891 | $month_cnt .= $month_item['date_count'].','; |
892 | 892 | } |
893 | 893 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
894 | - $month_cnt = "['vessels',".substr($month_cnt,0,-1)."]"; |
|
894 | + $month_cnt = "['vessels',".substr($month_cnt, 0, -1)."]"; |
|
895 | 895 | print 'c3.generate({ |
896 | 896 | bindto: "#chart9", |
897 | 897 | data: { x: "x", |
@@ -904,24 +904,24 @@ discard block |
||
904 | 904 | <a href="<?php print $globalURL; ?>/marine/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
905 | 905 | </div> |
906 | 906 | </div> |
907 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
907 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
908 | 908 | |
909 | 909 | <div class="col-md-6"> |
910 | 910 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
911 | 911 | <?php |
912 | - $date_array = $Marine->countAllDatesLast7Days($airline_icao,$filter_name); |
|
912 | + $date_array = $Marine->countAllDatesLast7Days($airline_icao, $filter_name); |
|
913 | 913 | if (empty($date_array)) print _("No data available"); |
914 | 914 | else { |
915 | 915 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
916 | 916 | $date_data = ''; |
917 | 917 | $date_cnt = ''; |
918 | - foreach($date_array as $date_item) |
|
918 | + foreach ($date_array as $date_item) |
|
919 | 919 | { |
920 | 920 | $date_data .= '"'.$date_item['date_name'].'",'; |
921 | 921 | $date_cnt .= $date_item['date_count'].','; |
922 | 922 | } |
923 | 923 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
924 | - $date_cnt = "['vessels',".substr($date_cnt,0,-1)."]"; |
|
924 | + $date_cnt = "['vessels',".substr($date_cnt, 0, -1)."]"; |
|
925 | 925 | print 'c3.generate({ |
926 | 926 | bindto: "#chart5", |
927 | 927 | data: { x: "x", |
@@ -934,23 +934,23 @@ discard block |
||
934 | 934 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
935 | 935 | </div> |
936 | 936 | </div> |
937 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
937 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
938 | 938 | <div class="col-md-6"> |
939 | 939 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
940 | 940 | <?php |
941 | - $hour_array = $Marine->countAllHours('hour',true,$airline_icao,$filter_name); |
|
941 | + $hour_array = $Marine->countAllHours('hour', true, $airline_icao, $filter_name); |
|
942 | 942 | if (empty($hour_array)) print _("No data available"); |
943 | 943 | else { |
944 | 944 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
945 | 945 | $hour_data = ''; |
946 | 946 | $hour_cnt = ''; |
947 | - foreach($hour_array as $hour_item) |
|
947 | + foreach ($hour_array as $hour_item) |
|
948 | 948 | { |
949 | 949 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
950 | 950 | $hour_cnt .= $hour_item['hour_count'].','; |
951 | 951 | } |
952 | 952 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
953 | - $hour_cnt = "['vessels',".substr($hour_cnt,0,-1)."]"; |
|
953 | + $hour_cnt = "['vessels',".substr($hour_cnt, 0, -1)."]"; |
|
954 | 954 | print 'c3.generate({ |
955 | 955 | bindto: "#chart6", |
956 | 956 | data: { |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | <a href="<?php print $globalURL; ?>/marine/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
964 | 964 | </div> |
965 | 965 | </div> |
966 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
966 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
967 | 967 | </div> |
968 | 968 | <?php |
969 | 969 | } |
@@ -987,13 +987,13 @@ discard block |
||
987 | 987 | print '<div id="chart8" class="chart" width="100%"></div><script>'; |
988 | 988 | $year_data = ''; |
989 | 989 | $year_cnt = ''; |
990 | - foreach($year_array as $year_item) |
|
990 | + foreach ($year_array as $year_item) |
|
991 | 991 | { |
992 | 992 | $year_data .= '"'.$year_item['year_name'].'-'.$year_item['month_name'].'-01'.'",'; |
993 | 993 | $year_cnt .= $year_item['date_count'].','; |
994 | 994 | } |
995 | 995 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
996 | - $year_cnt = "['trackers',".substr($year_cnt,0,-1)."]"; |
|
996 | + $year_cnt = "['trackers',".substr($year_cnt, 0, -1)."]"; |
|
997 | 997 | print 'c3.generate({ |
998 | 998 | bindto: "#chart8", |
999 | 999 | data: { x: "x", |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | </div> |
1008 | 1008 | </div> |
1009 | 1009 | |
1010 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1010 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1011 | 1011 | <div class="col-md-6"> |
1012 | 1012 | <h2><?php echo _("Busiest Day in the last Month"); ?></h2> |
1013 | 1013 | <?php |
@@ -1017,13 +1017,13 @@ discard block |
||
1017 | 1017 | print '<div id="chart9" class="chart" width="100%"></div><script>'; |
1018 | 1018 | $month_data = ''; |
1019 | 1019 | $month_cnt = ''; |
1020 | - foreach($month_array as $month_item) |
|
1020 | + foreach ($month_array as $month_item) |
|
1021 | 1021 | { |
1022 | 1022 | $month_data .= '"'.$month_item['date_name'].'",'; |
1023 | 1023 | $month_cnt .= $month_item['date_count'].','; |
1024 | 1024 | } |
1025 | 1025 | $month_data = "['x',".substr($month_data, 0, -1)."]"; |
1026 | - $month_cnt = "['trackers',".substr($month_cnt,0,-1)."]"; |
|
1026 | + $month_cnt = "['trackers',".substr($month_cnt, 0, -1)."]"; |
|
1027 | 1027 | print 'c3.generate({ |
1028 | 1028 | bindto: "#chart9", |
1029 | 1029 | data: { x: "x", |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | <a href="<?php print $globalURL; ?>/tracker/statistics/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1037 | 1037 | </div> |
1038 | 1038 | </div> |
1039 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1039 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1040 | 1040 | |
1041 | 1041 | <div class="col-md-6"> |
1042 | 1042 | <h2><?php echo _("Busiest Day in the last 7 Days"); ?></h2> |
@@ -1047,13 +1047,13 @@ discard block |
||
1047 | 1047 | print '<div id="chart5" class="chart" width="100%"></div><script>'; |
1048 | 1048 | $date_data = ''; |
1049 | 1049 | $date_cnt = ''; |
1050 | - foreach($date_array as $date_item) |
|
1050 | + foreach ($date_array as $date_item) |
|
1051 | 1051 | { |
1052 | 1052 | $date_data .= '"'.$date_item['date_name'].'",'; |
1053 | 1053 | $date_cnt .= $date_item['date_count'].','; |
1054 | 1054 | } |
1055 | 1055 | $date_data = "['x',".substr($date_data, 0, -1)."]"; |
1056 | - $date_cnt = "['trackers',".substr($date_cnt,0,-1)."]"; |
|
1056 | + $date_cnt = "['trackers',".substr($date_cnt, 0, -1)."]"; |
|
1057 | 1057 | print 'c3.generate({ |
1058 | 1058 | bindto: "#chart5", |
1059 | 1059 | data: { x: "x", |
@@ -1066,23 +1066,23 @@ discard block |
||
1066 | 1066 | <a href="<?php print $globalURL; ?>/marine/statistics/date" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1067 | 1067 | </div> |
1068 | 1068 | </div> |
1069 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1069 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1070 | 1070 | <div class="col-md-6"> |
1071 | 1071 | <h2><?php echo _("Busiest Time of the Day"); ?></h2> |
1072 | 1072 | <?php |
1073 | - $hour_array = $Tracker->countAllHours('hour',true); |
|
1073 | + $hour_array = $Tracker->countAllHours('hour', true); |
|
1074 | 1074 | if (empty($hour_array)) print _("No data available"); |
1075 | 1075 | else { |
1076 | 1076 | print '<div id="chart6" class="chart" width="100%"></div><script>'; |
1077 | 1077 | $hour_data = ''; |
1078 | 1078 | $hour_cnt = ''; |
1079 | - foreach($hour_array as $hour_item) |
|
1079 | + foreach ($hour_array as $hour_item) |
|
1080 | 1080 | { |
1081 | 1081 | $hour_data .= '"'.$hour_item['hour_name'].':00",'; |
1082 | 1082 | $hour_cnt .= $hour_item['hour_count'].','; |
1083 | 1083 | } |
1084 | 1084 | $hour_data = "[".substr($hour_data, 0, -1)."]"; |
1085 | - $hour_cnt = "['trackers',".substr($hour_cnt,0,-1)."]"; |
|
1085 | + $hour_cnt = "['trackers',".substr($hour_cnt, 0, -1)."]"; |
|
1086 | 1086 | print 'c3.generate({ |
1087 | 1087 | bindto: "#chart6", |
1088 | 1088 | data: { |
@@ -1095,7 +1095,7 @@ discard block |
||
1095 | 1095 | <a href="<?php print $globalURL; ?>/tracker/statistics/time" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1096 | 1096 | </div> |
1097 | 1097 | </div> |
1098 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1098 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1099 | 1099 | </div> |
1100 | 1100 | <?php |
1101 | 1101 | } |
@@ -1119,13 +1119,13 @@ discard block |
||
1119 | 1119 | print '<div id="chart32" class="chart" width="100%"></div><script>'; |
1120 | 1120 | $year_data = ''; |
1121 | 1121 | $year_cnt = ''; |
1122 | - foreach($year_array as $year_item) |
|
1122 | + foreach ($year_array as $year_item) |
|
1123 | 1123 | { |
1124 | 1124 | $year_data .= '"'.$year_item['year'].'-01-01",'; |
1125 | 1125 | $year_cnt .= $year_item['count'].','; |
1126 | 1126 | } |
1127 | 1127 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1128 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1128 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1129 | 1129 | print 'c3.generate({ |
1130 | 1130 | bindto: "#chart32", |
1131 | 1131 | data: { x: "x", |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | <a href="<?php print $globalURL; ?>/statistics/fatalities/year" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1139 | 1139 | </div> |
1140 | 1140 | </div> |
1141 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1141 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1142 | 1142 | |
1143 | 1143 | <div class="row column"> |
1144 | 1144 | <div class="col-md-6"> |
@@ -1150,13 +1150,13 @@ discard block |
||
1150 | 1150 | print '<div id="chart33" class="chart" width="100%"></div><script>'; |
1151 | 1151 | $year_data = ''; |
1152 | 1152 | $year_cnt = ''; |
1153 | - foreach($year_array as $year_item) |
|
1153 | + foreach ($year_array as $year_item) |
|
1154 | 1154 | { |
1155 | 1155 | $year_data .= '"'.$year_item['year'].'-'.$year_item['month'].'-01",'; |
1156 | 1156 | $year_cnt .= $year_item['count'].','; |
1157 | 1157 | } |
1158 | 1158 | $year_data = "['x',".substr($year_data, 0, -1)."]"; |
1159 | - $year_cnt = "['flights',".substr($year_cnt,0,-1)."]"; |
|
1159 | + $year_cnt = "['flights',".substr($year_cnt, 0, -1)."]"; |
|
1160 | 1160 | print 'c3.generate({ |
1161 | 1161 | bindto: "#chart33", |
1162 | 1162 | data: { x: "x", |
@@ -1169,7 +1169,7 @@ discard block |
||
1169 | 1169 | <a href="<?php print $globalURL; ?>/statistics/fatalities/month" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
1170 | 1170 | </div> |
1171 | 1171 | </div> |
1172 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1172 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1173 | 1173 | <br/> |
1174 | 1174 | <?php |
1175 | 1175 | } |
@@ -1185,19 +1185,19 @@ discard block |
||
1185 | 1185 | //$polar = $Stats->getStatsSource(date('Y-m-d'),'polar'); |
1186 | 1186 | if ($year == '' && $month == '') { |
1187 | 1187 | if ($type == 'aircraft') { |
1188 | - $polar = $Stats->getStatsSource('polar',date('Y'),date('m'),date('d')); |
|
1188 | + $polar = $Stats->getStatsSource('polar', date('Y'), date('m'), date('d')); |
|
1189 | 1189 | } elseif ($type == 'marine') { |
1190 | - $polar = $Stats->getStatsSource('polar_marine',date('Y'),date('m'),date('d')); |
|
1190 | + $polar = $Stats->getStatsSource('polar_marine', date('Y'), date('m'), date('d')); |
|
1191 | 1191 | } elseif ($type == 'tracker') { |
1192 | - $polar = $Stats->getStatsSource('polar_tracker',date('Y'),date('m'),date('d')); |
|
1192 | + $polar = $Stats->getStatsSource('polar_tracker', date('Y'), date('m'), date('d')); |
|
1193 | 1193 | } |
1194 | 1194 | } else { |
1195 | 1195 | if ($type == 'aircraft') { |
1196 | - $polar = $Stats->getStatsSource('polar',$year,$month); |
|
1196 | + $polar = $Stats->getStatsSource('polar', $year, $month); |
|
1197 | 1197 | } elseif ($type == 'marine') { |
1198 | - $polar = $Stats->getStatsSource('polar_marine',$year,$month); |
|
1198 | + $polar = $Stats->getStatsSource('polar_marine', $year, $month); |
|
1199 | 1199 | } elseif ($type == 'tracker') { |
1200 | - $polar = $Stats->getStatsSource('polar_tracker',$year,$month); |
|
1200 | + $polar = $Stats->getStatsSource('polar_tracker', $year, $month); |
|
1201 | 1201 | } |
1202 | 1202 | } |
1203 | 1203 | if (!empty($polar)) { |
@@ -1206,7 +1206,7 @@ discard block |
||
1206 | 1206 | unset($polar_data); |
1207 | 1207 | $Spotter = new Spotter(); |
1208 | 1208 | $data = json_decode($eachpolar['source_data']); |
1209 | - foreach($data as $value => $key) { |
|
1209 | + foreach ($data as $value => $key) { |
|
1210 | 1210 | $direction = $Spotter->parseDirection(($value*22.5)); |
1211 | 1211 | $distance = $key; |
1212 | 1212 | $unit = 'km'; |
@@ -1226,7 +1226,7 @@ discard block |
||
1226 | 1226 | ?> |
1227 | 1227 | <div class="col-md-6"> |
1228 | 1228 | <h4><?php print $eachpolar['source_name']; ?></h4> |
1229 | - <div id="polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1229 | + <div id="polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>" class="chart" width="100%"></div> |
|
1230 | 1230 | <script> |
1231 | 1231 | (function() { |
1232 | 1232 | var margin = {top: 100, right: 100, bottom: 100, left: 100}, |
@@ -1250,7 +1250,7 @@ discard block |
||
1250 | 1250 | color: color, |
1251 | 1251 | unit: '<?php echo $unit; ?>' |
1252 | 1252 | }; |
1253 | - RadarChart("#polar-<?php print str_replace(' ','_',strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1253 | + RadarChart("#polar-<?php print str_replace(' ', '_', strtolower($eachpolar['source_name'])); ?>", data, radarChartOptions); |
|
1254 | 1254 | })(); |
1255 | 1255 | </script> |
1256 | 1256 | </div> |
@@ -1265,19 +1265,19 @@ discard block |
||
1265 | 1265 | //$msg = $Stats->getStatsSource(date('Y-m-d'),'msg'); |
1266 | 1266 | if ($year == '' && $month == '') { |
1267 | 1267 | if ($type == 'aircraft') { |
1268 | - $msg = $Stats->getStatsSource('msg',date('Y'),date('m'),date('d')); |
|
1268 | + $msg = $Stats->getStatsSource('msg', date('Y'), date('m'), date('d')); |
|
1269 | 1269 | } elseif ($type == 'marine') { |
1270 | - $msg = $Stats->getStatsSource('msg_marine',date('Y'),date('m'),date('d')); |
|
1270 | + $msg = $Stats->getStatsSource('msg_marine', date('Y'), date('m'), date('d')); |
|
1271 | 1271 | } elseif ($type == 'tracker') { |
1272 | - $msg = $Stats->getStatsSource('msg_tracker',date('Y'),date('m'),date('d')); |
|
1272 | + $msg = $Stats->getStatsSource('msg_tracker', date('Y'), date('m'), date('d')); |
|
1273 | 1273 | } |
1274 | 1274 | } else { |
1275 | 1275 | if ($type == 'aircraft') { |
1276 | - $msg = $Stats->getStatsSource('msg',$year,$month); |
|
1276 | + $msg = $Stats->getStatsSource('msg', $year, $month); |
|
1277 | 1277 | } elseif ($type == 'marine') { |
1278 | - $msg = $Stats->getStatsSource('msg_marine',$year,$month); |
|
1278 | + $msg = $Stats->getStatsSource('msg_marine', $year, $month); |
|
1279 | 1279 | } elseif ($type == 'tracker') { |
1280 | - $msg = $Stats->getStatsSource('msg_tracker',$year,$month); |
|
1280 | + $msg = $Stats->getStatsSource('msg_tracker', $year, $month); |
|
1281 | 1281 | } |
1282 | 1282 | } |
1283 | 1283 | if (!empty($msg)) { |
@@ -1285,13 +1285,13 @@ discard block |
||
1285 | 1285 | foreach ($msg as $eachmsg) { |
1286 | 1286 | //$eachmsg = $msg[0]; |
1287 | 1287 | $data = $eachmsg['source_data']; |
1288 | - if ($data > 500) $max = (round(($data+100)/100))*100; |
|
1288 | + if ($data > 500) $max = (round(($data + 100)/100))*100; |
|
1289 | 1289 | else $max = 500; |
1290 | 1290 | ?> |
1291 | - <div id="msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1291 | + <div id="msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>" class="col-md-4"></div> |
|
1292 | 1292 | <script> |
1293 | 1293 | var g = new JustGage({ |
1294 | - id: "msg-<?php print str_replace(' ','_',strtolower($eachmsg['source_name'])); ?>", |
|
1294 | + id: "msg-<?php print str_replace(' ', '_', strtolower($eachmsg['source_name'])); ?>", |
|
1295 | 1295 | value: <?php echo $data; ?>, |
1296 | 1296 | min: 0, |
1297 | 1297 | max: <?php print $max; ?>, |
@@ -1313,19 +1313,19 @@ discard block |
||
1313 | 1313 | //$hist = $Stats->getStatsSource(date('Y-m-d'),'hist'); |
1314 | 1314 | if ($year == '' && $month == '') { |
1315 | 1315 | if ($type == 'aircraft') { |
1316 | - $hist = $Stats->getStatsSource('hist',date('Y'),date('m'),date('d')); |
|
1316 | + $hist = $Stats->getStatsSource('hist', date('Y'), date('m'), date('d')); |
|
1317 | 1317 | } elseif ($type == 'marine') { |
1318 | - $hist = $Stats->getStatsSource('hist_marine',date('Y'),date('m'),date('d')); |
|
1318 | + $hist = $Stats->getStatsSource('hist_marine', date('Y'), date('m'), date('d')); |
|
1319 | 1319 | } elseif ($type == 'tracker') { |
1320 | - $hist = $Stats->getStatsSource('hist_tracker',date('Y'),date('m'),date('d')); |
|
1320 | + $hist = $Stats->getStatsSource('hist_tracker', date('Y'), date('m'), date('d')); |
|
1321 | 1321 | } |
1322 | 1322 | } else { |
1323 | 1323 | if ($type == 'aircraft') { |
1324 | - $hist = $Stats->getStatsSource('hist',$year,$month); |
|
1324 | + $hist = $Stats->getStatsSource('hist', $year, $month); |
|
1325 | 1325 | } elseif ($type == 'marine') { |
1326 | - $hist = $Stats->getStatsSource('hist_marine',$year,$month); |
|
1326 | + $hist = $Stats->getStatsSource('hist_marine', $year, $month); |
|
1327 | 1327 | } elseif ($type == 'tracker') { |
1328 | - $hist = $Stats->getStatsSource('hist_tracker',$year,$month); |
|
1328 | + $hist = $Stats->getStatsSource('hist_tracker', $year, $month); |
|
1329 | 1329 | } |
1330 | 1330 | } |
1331 | 1331 | foreach ($hist as $hists) { |
@@ -1335,7 +1335,7 @@ discard block |
||
1335 | 1335 | $source = $hists['source_name']; |
1336 | 1336 | $hist_array = json_decode($hists['source_data']); |
1337 | 1337 | $unit = 'km'; |
1338 | - foreach($hist_array as $distance => $nb) |
|
1338 | + foreach ($hist_array as $distance => $nb) |
|
1339 | 1339 | { |
1340 | 1340 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
1341 | 1341 | $distance = round($distance*0.539957); |
@@ -1356,18 +1356,18 @@ discard block |
||
1356 | 1356 | $nb_data = "['flights',".substr($nb_data, 0, -1)."]"; |
1357 | 1357 | ?> |
1358 | 1358 | <div class="col-md-6"> |
1359 | - <h2><?php echo sprintf(_("Distance for %s"),$source); ?></h2> |
|
1359 | + <h2><?php echo sprintf(_("Distance for %s"), $source); ?></h2> |
|
1360 | 1360 | <?php |
1361 | - print '<div id="charthist-'.str_replace(' ','_',strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1361 | + print '<div id="charthist-'.str_replace(' ', '_', strtolower($source)).'" class="chart" width="100%"></div><script>'; |
|
1362 | 1362 | print 'c3.generate({ |
1363 | - bindto: "#charthist-'.str_replace(' ','_',strtolower($source)).'", |
|
1363 | + bindto: "#charthist-'.str_replace(' ', '_', strtolower($source)).'", |
|
1364 | 1364 | data: { x: "x", |
1365 | 1365 | columns: ['.$distance_data.','.$nb_data.'], types: { flights: "area"}, colors: { flights: "#1a3151"}}, |
1366 | 1366 | axis: { x: {label : { text: "Distance in '.$unit.'", position: "outer-right"}}, y: { label: "# of Flights"}},legend: { show: false }});'; |
1367 | 1367 | print '</script>'; |
1368 | 1368 | ?> |
1369 | 1369 | </div> |
1370 | - <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
|
1370 | + <!-- <?php print 'Time elapsed : '.(microtime(true) - $beginpage).'s' ?> --> |
|
1371 | 1371 | <?php |
1372 | 1372 | } |
1373 | 1373 | ?> |
@@ -55,23 +55,23 @@ discard block |
||
55 | 55 | $min = true; |
56 | 56 | $allhistory = false; |
57 | 57 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
58 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
59 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
60 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
61 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
62 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
63 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
64 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
65 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
66 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
67 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
68 | 68 | |
69 | 69 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 70 | $min = true; |
71 | 71 | } else $min = false; |
72 | 72 | |
73 | 73 | if (isset($_GET['ident'])) { |
74 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
74 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
75 | 75 | if ($tracker) { |
76 | 76 | $spotter_array = $TrackerLive->getLastLiveTrackerDataByIdent($ident); |
77 | 77 | } elseif ($marine) { |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | } |
86 | 86 | $allhistory = true; |
87 | 87 | } elseif (isset($_GET['flightaware_id'])) { |
88 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
88 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
89 | 89 | $spotter_array = $SpotterLive->getLastLiveSpotterDataById($flightaware_id); |
90 | 90 | if (empty($spotter_array)) { |
91 | 91 | $from_archive = true; |
@@ -93,44 +93,44 @@ discard block |
||
93 | 93 | } |
94 | 94 | $allhistory = true; |
95 | 95 | } elseif (isset($_GET['famtrack_id'])) { |
96 | - $famtrack_id = filter_input(INPUT_GET,'famtrack_id',FILTER_SANITIZE_STRING); |
|
96 | + $famtrack_id = filter_input(INPUT_GET, 'famtrack_id', FILTER_SANITIZE_STRING); |
|
97 | 97 | $spotter_array = $TrackerLive->getLastLiveTrackerDataById($famtrack_id); |
98 | 98 | $allhistory = true; |
99 | 99 | } elseif (isset($_GET['fammarine_id'])) { |
100 | - $fammarine_id = filter_input(INPUT_GET,'fammarine_id',FILTER_SANITIZE_STRING); |
|
100 | + $fammarine_id = filter_input(INPUT_GET, 'fammarine_id', FILTER_SANITIZE_STRING); |
|
101 | 101 | $spotter_array = $MarineLive->getLastLiveMarineDataById($fammarine_id); |
102 | 102 | $allhistory = true; |
103 | 103 | } elseif (isset($_GET['coord']) && (!isset($globalMapPopup) || $globalMapPopup || (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true'))) { |
104 | 104 | //} elseif (isset($_GET['coord'])) { |
105 | 105 | $usecoord = true; |
106 | - $coord = explode(',',$_GET['coord']); |
|
106 | + $coord = explode(',', $_GET['coord']); |
|
107 | 107 | if ($tracker) { |
108 | - $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord,$filter); |
|
108 | + $spotter_array = $TrackerLive->getLiveTrackerDatabyCoord($coord, $filter); |
|
109 | 109 | } elseif ($marine) { |
110 | - $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord,$filter); |
|
110 | + $spotter_array = $MarineLive->getLiveMarineDatabyCoord($coord, $filter); |
|
111 | 111 | } else { |
112 | - $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord,$filter); |
|
112 | + $spotter_array = $SpotterLive->getLiveSpotterDatabyCoord($coord, $filter); |
|
113 | 113 | } |
114 | 114 | } elseif (isset($globalMapUseBbox) && $globalMapUseBbox && isset($_GET['coord']) && $min) { |
115 | 115 | $usecoord = true; |
116 | - $coord = explode(',',$_GET['coord']); |
|
116 | + $coord = explode(',', $_GET['coord']); |
|
117 | 117 | if ($tracker) { |
118 | - $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord,$filter); |
|
118 | + $spotter_array = $TrackerLive->getMinLiveTrackerDatabyCoord($coord, $filter); |
|
119 | 119 | } elseif ($marine) { |
120 | - $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord,$filter); |
|
120 | + $spotter_array = $MarineLive->getMinLiveMarineDatabyCoord($coord, $filter); |
|
121 | 121 | } else { |
122 | - $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord,$filter); |
|
122 | + $spotter_array = $SpotterLive->getMinLiveSpotterDatabyCoord($coord, $filter); |
|
123 | 123 | } |
124 | 124 | } elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed']) && !isset($_GET['tracker']) && !isset($_GET['marine'])) { |
125 | 125 | $from_archive = true; |
126 | 126 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
127 | 127 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
128 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
129 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
130 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
132 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
133 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
128 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
129 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
130 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
132 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
133 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
134 | 134 | } elseif ($min) { |
135 | 135 | if ($tracker) { |
136 | 136 | $spotter_array = $TrackerLive->getMinLiveTrackerData($filter); |
@@ -142,18 +142,18 @@ discard block |
||
142 | 142 | # $min = true; |
143 | 143 | } else { |
144 | 144 | if ($tracker) { |
145 | - $spotter_array = $TrackerLive->getLiveTrackerData('','',$filter); |
|
145 | + $spotter_array = $TrackerLive->getLiveTrackerData('', '', $filter); |
|
146 | 146 | } elseif ($marine) { |
147 | - $spotter_array = $marineLive->getLiveMarineData('','',$filter); |
|
147 | + $spotter_array = $marineLive->getLiveMarineData('', '', $filter); |
|
148 | 148 | } else { |
149 | - $spotter_array = $SpotterLive->getLiveSpotterData('','',$filter); |
|
149 | + $spotter_array = $SpotterLive->getLiveSpotterData('', '', $filter); |
|
150 | 150 | } |
151 | 151 | } |
152 | 152 | |
153 | 153 | if (!empty($spotter_array) || $usecoord) { |
154 | 154 | if ($usecoord) { |
155 | 155 | if (isset($_GET['archive'])) { |
156 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
156 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
157 | 157 | } else { |
158 | 158 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 159 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | if ($flightcnt == '') $flightcnt = 0; |
162 | 162 | } else $flightcnt = 0; |
163 | 163 | |
164 | -$sqltime = round(microtime(true)-$begintime,2); |
|
164 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
165 | 165 | |
166 | 166 | if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
167 | 167 | else $usenextlatlon = true; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | if (!empty($spotter_array) && is_array($spotter_array)) |
179 | 179 | { |
180 | 180 | $output .= '"features": ['; |
181 | - foreach($spotter_array as $spotter_item) |
|
181 | + foreach ($spotter_array as $spotter_item) |
|
182 | 182 | { |
183 | 183 | $j++; |
184 | 184 | date_default_timezone_set('UTC'); |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | */ |
235 | 235 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 236 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
238 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
237 | + if ($compress) $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
238 | + else $output .= '"callsign": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
239 | 239 | //" |
240 | 240 | } else { |
241 | 241 | if ($compress) $output .= '"c": "NA",'; |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
245 | 245 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 246 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | - $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
|
247 | + $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ', '_', $spotter_item['aircraft_name'])).'",'; |
|
248 | 248 | } elseif (isset($spotter_item['aircraft_type'])) { |
249 | 249 | $output .= '"aircraft_name": "NA ('.$spotter_item['aircraft_type'].')",'; |
250 | 250 | } elseif (!$min) { |
@@ -384,16 +384,16 @@ discard block |
||
384 | 384 | else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
385 | 385 | |
386 | 386 | if (isset($archivespeed)) { |
387 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
|
387 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading'], $archivespeed); |
|
388 | 388 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
389 | 389 | } elseif ($usenextlatlon) { |
390 | - $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading']); |
|
390 | + $nextcoord = $Common->nextcoord($spotter_item['latitude'], $spotter_item['longitude'], $spotter_item['ground_speed'], $spotter_item['heading']); |
|
391 | 391 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
392 | 392 | } |
393 | 393 | |
394 | 394 | if (!$min) $output .= '"image": "'.$image.'",'; |
395 | 395 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
396 | - $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
|
396 | + $output .= '"image_copyright": "'.str_replace('"', "'", trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $spotter_item['image_copyright']))).'",'; |
|
397 | 397 | } |
398 | 398 | if (isset($spotter_item['image_source_website'])) { |
399 | 399 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | $output .= '"waypoints": "'.$spotter_item['waypoints'].'",'; |
416 | 416 | } |
417 | 417 | if (isset($spotter_item['acars'])) { |
418 | - $output .= '"acars": "'.trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"), '<br />',$spotter_item['acars']['message'])).'",'; |
|
418 | + $output .= '"acars": "'.trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '<br />', $spotter_item['acars']['message'])).'",'; |
|
419 | 419 | } |
420 | 420 | // type when not aircraft ? |
421 | 421 | if (isset($spotter_item['type'])) { |
@@ -493,7 +493,7 @@ discard block |
||
493 | 493 | |
494 | 494 | } |
495 | 495 | */ |
496 | - $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
|
496 | + $history = filter_input(INPUT_GET, 'history', FILTER_SANITIZE_STRING); |
|
497 | 497 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
498 | 498 | |
499 | 499 | if ( |
@@ -501,11 +501,11 @@ discard block |
||
501 | 501 | || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
502 | 502 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
503 | 503 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
504 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
504 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
505 | 505 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
506 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
506 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['fammarine_id'])) |
|
507 | 507 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
508 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
508 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['famtrackid'])) |
|
509 | 509 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
510 | 510 | ) { |
511 | 511 | if ($tracker) { |
@@ -542,9 +542,9 @@ discard block |
||
542 | 542 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
543 | 543 | } |
544 | 544 | $output_history .= '['; |
545 | - $output_history .= $spotter_history['longitude'].', '; |
|
546 | - $output_history .= $spotter_history['latitude'].', '; |
|
547 | - $output_history .= $spotter_history['altitude']*30.48; |
|
545 | + $output_history .= $spotter_history['longitude'].', '; |
|
546 | + $output_history .= $spotter_history['latitude'].', '; |
|
547 | + $output_history .= $spotter_history['altitude']*30.48; |
|
548 | 548 | $output_history .= '],'; |
549 | 549 | /* |
550 | 550 | if ($from_archive === false) { |
@@ -562,8 +562,8 @@ discard block |
||
562 | 562 | else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
563 | 563 | } else $d = true; |
564 | 564 | $output_history .= '['; |
565 | - $output_history .= $spotter_history['longitude'].', '; |
|
566 | - $output_history .= $spotter_history['latitude']; |
|
565 | + $output_history .= $spotter_history['longitude'].', '; |
|
566 | + $output_history .= $spotter_history['latitude']; |
|
567 | 567 | $output_history .= '],'; |
568 | 568 | /* |
569 | 569 | if ($from_archive === false) { |
@@ -579,9 +579,9 @@ discard block |
||
579 | 579 | |
580 | 580 | if ($from_archive === false) { |
581 | 581 | $output_historyd = '['; |
582 | - $output_historyd .= $spotter_item['longitude'].', '; |
|
583 | - $output_historyd .= $spotter_item['latitude']; |
|
584 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
582 | + $output_historyd .= $spotter_item['longitude'].', '; |
|
583 | + $output_historyd .= $spotter_item['latitude']; |
|
584 | + if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
585 | 585 | $output_historyd .= '],'; |
586 | 586 | //$output_history = $output_historyd.$output_history; |
587 | 587 | $output_history = $output_history.$output_historyd; |
@@ -595,7 +595,7 @@ discard block |
||
595 | 595 | } |
596 | 596 | } |
597 | 597 | |
598 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
598 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
599 | 599 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
600 | 600 | && (isset($spotter_item['departure_airport']) |
601 | 601 | && $spotter_item['departure_airport'] != 'NA' |
@@ -630,7 +630,7 @@ discard block |
||
630 | 630 | |
631 | 631 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
632 | 632 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
633 | - if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
633 | + if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-', '', $history) == str_replace('-', '', $spotter_item['flightaware_id'])) |
|
634 | 634 | || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
635 | 635 | && (isset($spotter_item['arrival_airport']) |
636 | 636 | && $spotter_item['arrival_airport'] != 'NA' |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | $output = substr($output, 0, -1); |
662 | 662 | $output .= ']'; |
663 | 663 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
664 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
664 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
665 | 665 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
666 | 666 | $output .= '"fc": "'.$j.'"'; |
667 | 667 | } else { |
@@ -5,23 +5,23 @@ discard block |
||
5 | 5 | $marine = false; |
6 | 6 | $usecoord = false; |
7 | 7 | if (isset($_GET['tracker'])) { |
8 | - $tracker = true; |
|
8 | + $tracker = true; |
|
9 | 9 | } |
10 | 10 | if (isset($_GET['marine'])) { |
11 | - $marine = true; |
|
11 | + $marine = true; |
|
12 | 12 | } |
13 | 13 | if ($tracker) { |
14 | - require_once('require/class.Tracker.php'); |
|
15 | - require_once('require/class.TrackerLive.php'); |
|
16 | - require_once('require/class.TrackerArchive.php'); |
|
14 | + require_once('require/class.Tracker.php'); |
|
15 | + require_once('require/class.TrackerLive.php'); |
|
16 | + require_once('require/class.TrackerArchive.php'); |
|
17 | 17 | } elseif ($marine) { |
18 | - require_once('require/class.Marine.php'); |
|
19 | - require_once('require/class.MarineLive.php'); |
|
20 | - require_once('require/class.MarineArchive.php'); |
|
18 | + require_once('require/class.Marine.php'); |
|
19 | + require_once('require/class.MarineLive.php'); |
|
20 | + require_once('require/class.MarineArchive.php'); |
|
21 | 21 | } else { |
22 | - require_once('require/class.Spotter.php'); |
|
23 | - require_once('require/class.SpotterLive.php'); |
|
24 | - require_once('require/class.SpotterArchive.php'); |
|
22 | + require_once('require/class.Spotter.php'); |
|
23 | + require_once('require/class.SpotterLive.php'); |
|
24 | + require_once('require/class.SpotterArchive.php'); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | $begintime = microtime(true); |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | $Common = new Common(); |
42 | 42 | |
43 | 43 | if (isset($_GET['download'])) { |
44 | - if ($_GET['download'] == "true") |
|
45 | - { |
|
44 | + if ($_GET['download'] == "true") |
|
45 | + { |
|
46 | 46 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
47 | - } |
|
47 | + } |
|
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
@@ -498,17 +498,17 @@ discard block |
||
498 | 498 | if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
499 | 499 | |
500 | 500 | if ( |
501 | - (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
502 | - || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
501 | + (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
|
502 | + || ((isset($globalMapHistory) && $globalMapHistory) || $allhistory) |
|
503 | 503 | // || (isset($history) && $history != '' && $history != 'NA' && ($history == $spotter_item['ident'] || $history == $spotter_item['flightaware_id'])) |
504 | 504 | // || (isset($history) && $history != '' && $history != 'NA' && $history == $spotter_item['ident']) |
505 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
506 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
507 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
508 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
509 | - || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
510 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
511 | - ) { |
|
505 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
|
506 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id']) |
|
507 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['fammarine_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['fammarine_id'])) |
|
508 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['fammarine_id']) && $_GET['fammarine_id'] == $spotter_item['fammarine_id']) |
|
509 | + || (isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['famtrackid']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['famtrackid'])) |
|
510 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['famtrackid']) && $_GET['famtrackid'] == $spotter_item['famtrackid']) |
|
511 | + ) { |
|
512 | 512 | if ($tracker) { |
513 | 513 | if ($from_archive || $globalArchive) { |
514 | 514 | $spotter_history_array = $TrackerArchive->getAllArchiveTrackerDataById($spotter_item['famtrackid']); |
@@ -597,65 +597,65 @@ discard block |
||
597 | 597 | } |
598 | 598 | |
599 | 599 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
600 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
601 | - && (isset($spotter_item['departure_airport']) |
|
602 | - && $spotter_item['departure_airport'] != 'NA' |
|
603 | - && isset($spotter_item['arrival_airport']) |
|
604 | - && $spotter_item['arrival_airport'] != 'NA' |
|
605 | - && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
606 | - || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
607 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
608 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
609 | - if (isset($spotter_item['departure_airport_latitude'])) { |
|
600 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
601 | + && (isset($spotter_item['departure_airport']) |
|
602 | + && $spotter_item['departure_airport'] != 'NA' |
|
603 | + && isset($spotter_item['arrival_airport']) |
|
604 | + && $spotter_item['arrival_airport'] != 'NA' |
|
605 | + && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
|
606 | + || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
|
607 | + if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
608 | + else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
609 | + if (isset($spotter_item['departure_airport_latitude'])) { |
|
610 | 610 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
611 | - } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
611 | + } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
|
612 | 612 | $dairport = $Spotter->getAllAirportInfo($spotter_item['departure_airport']); |
613 | 613 | if (isset($dairport[0]['latitude'])) { |
614 | - $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
614 | + $output_air .= '['.$dairport[0]['longitude'].','.$dairport[0]['latitude'].'],'; |
|
615 | 615 | } |
616 | - } |
|
617 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
616 | + } |
|
617 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
618 | 618 | $output_air .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].'],'; |
619 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
619 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
620 | 620 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
621 | 621 | if (isset($aairport[0]['latitude'])) { |
622 | - $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
622 | + $output_air .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].'],'; |
|
623 | 623 | } |
624 | - } |
|
625 | - $output_air = substr($output_air, 0, -1); |
|
626 | - $output_air .= ']}},'; |
|
627 | - $output .= $output_air; |
|
628 | - unset($output_air); |
|
624 | + } |
|
625 | + $output_air = substr($output_air, 0, -1); |
|
626 | + $output_air .= ']}},'; |
|
627 | + $output .= $output_air; |
|
628 | + unset($output_air); |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA' && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
632 | 632 | //if (isset($history) && $history != '' && $history == $spotter_item['ident'] && isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA' && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") || (!isset($_COOKIE['MapRoute']) && (!isset($globalMapRoute) || (isset($globalMapRoute) && $globalMapRoute))))) { |
633 | 633 | if (((isset($history) && $history != '' && $history != 'NA' && isset($spotter_item['flightaware_id']) && str_replace('-','',$history) == str_replace('-','',$spotter_item['flightaware_id'])) |
634 | - || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
635 | - && (isset($spotter_item['arrival_airport']) |
|
636 | - && $spotter_item['arrival_airport'] != 'NA' |
|
637 | - && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
638 | - || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
|
639 | - || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
640 | - $havedata = false; |
|
641 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
642 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
643 | - $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
634 | + || (isset($history) && $history == '' && isset($spotter_item['flightaware_id']) && isset($_GET['flightaware_id']) && $_GET['flightaware_id'] == $spotter_item['flightaware_id'])) |
|
635 | + && (isset($spotter_item['arrival_airport']) |
|
636 | + && $spotter_item['arrival_airport'] != 'NA' |
|
637 | + && ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == "true") |
|
638 | + || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
|
639 | + || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
|
640 | + $havedata = false; |
|
641 | + if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
642 | + else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
643 | + $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
|
644 | 644 | |
645 | - if (isset($spotter_item['arrival_airport_latitude'])) { |
|
645 | + if (isset($spotter_item['arrival_airport_latitude'])) { |
|
646 | 646 | $output_dest .= '['.$spotter_item['arrival_airport_longitude'].','.$spotter_item['arrival_airport_latitude'].']'; |
647 | 647 | $havedata = true; |
648 | - } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
648 | + } elseif (isset($spotter_item['arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
|
649 | 649 | $aairport = $Spotter->getAllAirportInfo($spotter_item['arrival_airport']); |
650 | 650 | if (isset($aairport[0]['latitude'])) { |
651 | - $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
652 | - $havedata = true; |
|
651 | + $output_dest .= '['.$aairport[0]['longitude'].','.$aairport[0]['latitude'].']'; |
|
652 | + $havedata = true; |
|
653 | 653 | } |
654 | - } |
|
655 | - //$output_dest = substr($output_dest, 0, -1); |
|
656 | - $output_dest .= ']}},'; |
|
657 | - if ($havedata) $output .= $output_dest; |
|
658 | - unset($output_dest); |
|
654 | + } |
|
655 | + //$output_dest = substr($output_dest, 0, -1); |
|
656 | + $output_dest .= ']}},'; |
|
657 | + if ($havedata) $output .= $output_dest; |
|
658 | + unset($output_dest); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | $output = substr($output, 0, -1); |
@@ -48,27 +48,52 @@ discard block |
||
48 | 48 | } |
49 | 49 | header('Content-Type: text/javascript'); |
50 | 50 | |
51 | -if (!isset($globalJsonCompress)) $compress = true; |
|
52 | -else $compress = $globalJsonCompress; |
|
51 | +if (!isset($globalJsonCompress)) { |
|
52 | + $compress = true; |
|
53 | +} else { |
|
54 | + $compress = $globalJsonCompress; |
|
55 | +} |
|
53 | 56 | |
54 | 57 | $from_archive = false; |
55 | 58 | $min = true; |
56 | 59 | $allhistory = false; |
57 | 60 | $filter['source'] = array(); |
58 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
59 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
60 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
61 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
62 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
63 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
64 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
65 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
66 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
67 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
61 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
62 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
63 | +} |
|
64 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
65 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
66 | +} |
|
67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
68 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
69 | +} |
|
70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
71 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
72 | +} |
|
73 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
74 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
75 | +} |
|
76 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
77 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
78 | +} |
|
79 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
80 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
81 | +} |
|
82 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
83 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | +} |
|
85 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
86 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
87 | +} |
|
88 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
89 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
90 | +} |
|
68 | 91 | |
69 | 92 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
70 | 93 | $min = true; |
71 | -} else $min = false; |
|
94 | +} else { |
|
95 | + $min = false; |
|
96 | +} |
|
72 | 97 | |
73 | 98 | if (isset($_GET['ident'])) { |
74 | 99 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
@@ -157,21 +182,33 @@ discard block |
||
157 | 182 | } else { |
158 | 183 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
159 | 184 | } |
160 | - } else $flightcnt = count($spotter_array); |
|
161 | - if ($flightcnt == '') $flightcnt = 0; |
|
162 | -} else $flightcnt = 0; |
|
185 | + } else { |
|
186 | + $flightcnt = count($spotter_array); |
|
187 | + } |
|
188 | + if ($flightcnt == '') { |
|
189 | + $flightcnt = 0; |
|
190 | + } |
|
191 | + } else { |
|
192 | + $flightcnt = 0; |
|
193 | +} |
|
163 | 194 | |
164 | 195 | $sqltime = round(microtime(true)-$begintime,2); |
165 | 196 | |
166 | -if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) $usenextlatlon = false; |
|
167 | -else $usenextlatlon = true; |
|
197 | +if ((!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation == FALSE) || (isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'false')) { |
|
198 | + $usenextlatlon = false; |
|
199 | +} else { |
|
200 | + $usenextlatlon = true; |
|
201 | +} |
|
168 | 202 | $j = 0; |
169 | 203 | $prev_flightaware_id = ''; |
170 | 204 | $aircrafts_shadow = array(); |
171 | 205 | $output = '{'; |
172 | 206 | $output .= '"type": "FeatureCollection",'; |
173 | - if ($min) $output .= '"minimal": "true",'; |
|
174 | - else $output .= '"minimal": "false",'; |
|
207 | + if ($min) { |
|
208 | + $output .= '"minimal": "true",'; |
|
209 | + } else { |
|
210 | + $output .= '"minimal": "false",'; |
|
211 | + } |
|
175 | 212 | //$output .= '"fc": "'.$flightcnt.'",'; |
176 | 213 | $output .= '"sqt": "'.$sqltime.'",'; |
177 | 214 | |
@@ -215,18 +252,29 @@ discard block |
||
215 | 252 | } |
216 | 253 | $output .= '"properties": {'; |
217 | 254 | if (isset($spotter_item['flightaware_id'])) { |
218 | - if ($compress) $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
219 | - else $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
255 | + if ($compress) { |
|
256 | + $output .= '"fi": "'.$spotter_item['flightaware_id'].'",'; |
|
257 | + } else { |
|
258 | + $output .= '"flightaware_id": "'.$spotter_item['flightaware_id'].'",'; |
|
259 | + } |
|
220 | 260 | } elseif (isset($spotter_item['famtrackid'])) { |
221 | - if ($compress) $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
222 | - else $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
261 | + if ($compress) { |
|
262 | + $output .= '"fti": "'.$spotter_item['famtrackid'].'",'; |
|
263 | + } else { |
|
264 | + $output .= '"famtrackid": "'.$spotter_item['famtrackid'].'",'; |
|
265 | + } |
|
223 | 266 | } elseif (isset($spotter_item['fammarine_id'])) { |
224 | - if ($compress) $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
225 | - else $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
267 | + if ($compress) { |
|
268 | + $output .= '"fmi": "'.$spotter_item['fammarine_id'].'",'; |
|
269 | + } else { |
|
270 | + $output .= '"fammarineid": "'.$spotter_item['fammarine_id'].'",'; |
|
271 | + } |
|
226 | 272 | } |
227 | 273 | $output .= '"fc": "'.$flightcnt.'",'; |
228 | 274 | $output .= '"sqt": "'.$sqltime.'",'; |
229 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
275 | + if (isset($begindate)) { |
|
276 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
277 | + } |
|
230 | 278 | |
231 | 279 | /* |
232 | 280 | if ($min) $output .= '"minimal": "true",'; |
@@ -234,14 +282,22 @@ discard block |
||
234 | 282 | */ |
235 | 283 | //$output .= '"fc": "'.$spotter_item['nb'].'",'; |
236 | 284 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
237 | - if ($compress) $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
238 | - else $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
285 | + if ($compress) { |
|
286 | + $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
287 | + } else { |
|
288 | + $output .= '"callsign": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
289 | + } |
|
239 | 290 | //" |
240 | 291 | } else { |
241 | - if ($compress) $output .= '"c": "NA",'; |
|
242 | - else $output .= '"callsign": "NA",'; |
|
292 | + if ($compress) { |
|
293 | + $output .= '"c": "NA",'; |
|
294 | + } else { |
|
295 | + $output .= '"callsign": "NA",'; |
|
296 | + } |
|
297 | + } |
|
298 | + if (isset($spotter_item['registration'])) { |
|
299 | + $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
243 | 300 | } |
244 | - if (isset($spotter_item['registration'])) $output .= '"registration": "'.$spotter_item['registration'].'",'; |
|
245 | 301 | if (isset($spotter_item['aircraft_name']) && isset($spotter_item['aircraft_type'])) { |
246 | 302 | $output .= '"aircraft_name": "'.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')",'; |
247 | 303 | $output .= '"aircraft_wiki": "http://'.strtolower($globalLanguage).'.wikipedia.org/wiki/'.urlencode(str_replace(' ','_',$spotter_item['aircraft_name'])).'",'; |
@@ -254,16 +310,23 @@ discard block |
||
254 | 310 | $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
255 | 311 | } |
256 | 312 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker) { |
257 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
258 | - else { |
|
313 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
314 | + $spotter_item['aircraft_shadow'] = ''; |
|
315 | + } else { |
|
259 | 316 | $aircraft_icao = $spotter_item['aircraft_icao']; |
260 | - if (isset($aircrafts_shadow[$aircraft_icao])) $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
261 | - else { |
|
317 | + if (isset($aircrafts_shadow[$aircraft_icao])) { |
|
318 | + $spotter_item['aircraft_shadow'] = $aircrafts_shadow[$aircraft_icao]; |
|
319 | + } else { |
|
262 | 320 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
263 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
264 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
265 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
266 | - else $spotter_item['aircraft_shadow'] = ''; |
|
321 | + if (count($aircraft_info) > 0) { |
|
322 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
323 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
324 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
325 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
326 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
327 | + } else { |
|
328 | + $spotter_item['aircraft_shadow'] = ''; |
|
329 | + } |
|
267 | 330 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
268 | 331 | } |
269 | 332 | } |
@@ -271,73 +334,139 @@ discard block |
||
271 | 334 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
272 | 335 | if ($tracker) { |
273 | 336 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
274 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
275 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
337 | + if ($compress) { |
|
338 | + $output .= '"as": "ambulance.png",'; |
|
339 | + } else { |
|
340 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
341 | + } |
|
276 | 342 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
277 | - if ($compress) $output .= '"as": "police.png",'; |
|
278 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
343 | + if ($compress) { |
|
344 | + $output .= '"as": "police.png",'; |
|
345 | + } else { |
|
346 | + $output .= '"aircraft_shadow": "police.png",'; |
|
347 | + } |
|
279 | 348 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
280 | - if ($compress) $output .= '"as": "ship.png",'; |
|
281 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
349 | + if ($compress) { |
|
350 | + $output .= '"as": "ship.png",'; |
|
351 | + } else { |
|
352 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
353 | + } |
|
282 | 354 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
283 | - if ($compress) $output .= '"as": "ship.png",'; |
|
284 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
355 | + if ($compress) { |
|
356 | + $output .= '"as": "ship.png",'; |
|
357 | + } else { |
|
358 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
359 | + } |
|
285 | 360 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
286 | - if ($compress) $output .= '"as": "ship.png",'; |
|
287 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
361 | + if ($compress) { |
|
362 | + $output .= '"as": "ship.png",'; |
|
363 | + } else { |
|
364 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
365 | + } |
|
288 | 366 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
289 | - if ($compress) $output .= '"as": "truck.png",'; |
|
290 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
367 | + if ($compress) { |
|
368 | + $output .= '"as": "truck.png",'; |
|
369 | + } else { |
|
370 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
371 | + } |
|
291 | 372 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
292 | - if ($compress) $output .= '"as": "truck.png",'; |
|
293 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
373 | + if ($compress) { |
|
374 | + $output .= '"as": "truck.png",'; |
|
375 | + } else { |
|
376 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
377 | + } |
|
294 | 378 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
295 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
296 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
379 | + if ($compress) { |
|
380 | + $output .= '"as": "aircraft.png",'; |
|
381 | + } else { |
|
382 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
383 | + } |
|
297 | 384 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
298 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
299 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
385 | + if ($compress) { |
|
386 | + $output .= '"as": "aircraft.png",'; |
|
387 | + } else { |
|
388 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
389 | + } |
|
300 | 390 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
301 | - if ($compress) $output .= '"as": "helico.png",'; |
|
302 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
391 | + if ($compress) { |
|
392 | + $output .= '"as": "helico.png",'; |
|
393 | + } else { |
|
394 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
395 | + } |
|
303 | 396 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
304 | - if ($compress) $output .= '"as": "rail.png",'; |
|
305 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
397 | + if ($compress) { |
|
398 | + $output .= '"as": "rail.png",'; |
|
399 | + } else { |
|
400 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
401 | + } |
|
306 | 402 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
307 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
308 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
403 | + if ($compress) { |
|
404 | + $output .= '"as": "firetruck.png",'; |
|
405 | + } else { |
|
406 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
407 | + } |
|
309 | 408 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
310 | - if ($compress) $output .= '"as": "bus.png",'; |
|
311 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
409 | + if ($compress) { |
|
410 | + $output .= '"as": "bus.png",'; |
|
411 | + } else { |
|
412 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
413 | + } |
|
312 | 414 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
313 | - if ($compress) $output .= '"as": "phone.png",'; |
|
314 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
415 | + if ($compress) { |
|
416 | + $output .= '"as": "phone.png",'; |
|
417 | + } else { |
|
418 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
419 | + } |
|
315 | 420 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
316 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
317 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
421 | + if ($compress) { |
|
422 | + $output .= '"as": "jogger.png",'; |
|
423 | + } else { |
|
424 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
425 | + } |
|
318 | 426 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
319 | - if ($compress) $output .= '"as": "bike.png",'; |
|
320 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
427 | + if ($compress) { |
|
428 | + $output .= '"as": "bike.png",'; |
|
429 | + } else { |
|
430 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
431 | + } |
|
321 | 432 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
322 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
323 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
433 | + if ($compress) { |
|
434 | + $output .= '"as": "motorcycle.png",'; |
|
435 | + } else { |
|
436 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
437 | + } |
|
324 | 438 | } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
325 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
326 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
439 | + if ($compress) { |
|
440 | + $output .= '"as": "balloon.png",'; |
|
441 | + } else { |
|
442 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
443 | + } |
|
327 | 444 | } else { |
328 | - if ($compress) $output .= '"as": "car.png",'; |
|
329 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
445 | + if ($compress) { |
|
446 | + $output .= '"as": "car.png",'; |
|
447 | + } else { |
|
448 | + $output .= '"aircraft_shadow": "car.png",'; |
|
449 | + } |
|
330 | 450 | } |
331 | 451 | } elseif ($marine) { |
332 | - if ($compress) $output .= '"as": "ship.png",'; |
|
333 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
452 | + if ($compress) { |
|
453 | + $output .= '"as": "ship.png",'; |
|
454 | + } else { |
|
455 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
456 | + } |
|
334 | 457 | } else { |
335 | - if ($compress) $output .= '"as": "default.png",'; |
|
336 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
458 | + if ($compress) { |
|
459 | + $output .= '"as": "default.png",'; |
|
460 | + } else { |
|
461 | + $output .= '"aircraft_shadow": "default.png",'; |
|
462 | + } |
|
337 | 463 | } |
338 | 464 | } else { |
339 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
340 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
465 | + if ($compress) { |
|
466 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
467 | + } else { |
|
468 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
469 | + } |
|
341 | 470 | } |
342 | 471 | if (isset($spotter_item['airline_name'])) { |
343 | 472 | $output .= '"airline_name": "'.$spotter_item['airline_name'].'",'; |
@@ -345,8 +474,11 @@ discard block |
||
345 | 474 | $output .= '"airline_name": "NA",'; |
346 | 475 | } |
347 | 476 | if (isset($spotter_item['departure_airport'])) { |
348 | - if ($compress) $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
349 | - else $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
477 | + if ($compress) { |
|
478 | + $output .= '"dac": "'.$spotter_item['departure_airport'].'",'; |
|
479 | + } else { |
|
480 | + $output .= '"departure_airport_code": "'.$spotter_item['departure_airport'].'",'; |
|
481 | + } |
|
350 | 482 | } |
351 | 483 | if (isset($spotter_item['departure_airport_city'])) { |
352 | 484 | $output .= '"departure_airport": "'.$spotter_item['departure_airport_city'].', '.$spotter_item['departure_airport_country'].'",'; |
@@ -358,8 +490,11 @@ discard block |
||
358 | 490 | $output .= '"arrival_airport_time": "'.$spotter_item['arrival_airport_time'].'",'; |
359 | 491 | } |
360 | 492 | if (isset($spotter_item['arrival_airport'])) { |
361 | - if ($compress) $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
362 | - else $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
493 | + if ($compress) { |
|
494 | + $output .= '"aac": "'.$spotter_item['arrival_airport'].'",'; |
|
495 | + } else { |
|
496 | + $output .= '"arrival_airport_code": "'.$spotter_item['arrival_airport'].'",'; |
|
497 | + } |
|
363 | 498 | } |
364 | 499 | if (isset($spotter_item['arrival_airport_city'])) { |
365 | 500 | $output .= '"arrival_airport": "'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].'",'; |
@@ -378,11 +513,17 @@ discard block |
||
378 | 513 | } |
379 | 514 | |
380 | 515 | if (isset($spotter_item['altitude'])) { |
381 | - if ($compress) $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
382 | - else $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
516 | + if ($compress) { |
|
517 | + $output .= '"a": "'.$spotter_item['altitude'].'",'; |
|
518 | + } else { |
|
519 | + $output .= '"altitude": "'.$spotter_item['altitude'].'",'; |
|
520 | + } |
|
521 | + } |
|
522 | + if ($compress) { |
|
523 | + $output .= '"h": "'.$spotter_item['heading'].'",'; |
|
524 | + } else { |
|
525 | + $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
383 | 526 | } |
384 | - if ($compress)$output .= '"h": "'.$spotter_item['heading'].'",'; |
|
385 | - else $output .= '"heading": "'.$spotter_item['heading'].'",'; |
|
386 | 527 | |
387 | 528 | if (isset($archivespeed)) { |
388 | 529 | $nextcoord = $Common->nextcoord($spotter_item['latitude'],$spotter_item['longitude'],$spotter_item['ground_speed'],$spotter_item['heading'],$archivespeed); |
@@ -392,7 +533,9 @@ discard block |
||
392 | 533 | $output .= '"nextlatlon": ['.$nextcoord['latitude'].','.$nextcoord['longitude'].'],'; |
393 | 534 | } |
394 | 535 | |
395 | - if (!$min) $output .= '"image": "'.$image.'",'; |
|
536 | + if (!$min) { |
|
537 | + $output .= '"image": "'.$image.'",'; |
|
538 | + } |
|
396 | 539 | if (isset($spotter_item['image_copyright']) && $spotter_item['image_copyright'] != '') { |
397 | 540 | $output .= '"image_copyright": "'.str_replace('"',"'",trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$spotter_item['image_copyright']))).'",'; |
398 | 541 | } |
@@ -400,8 +543,11 @@ discard block |
||
400 | 543 | $output .= '"image_source_website": "'.urlencode($spotter_item['image_source_website']).'",'; |
401 | 544 | } |
402 | 545 | if (isset($spotter_item['squawk'])) { |
403 | - if ($compress) $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
404 | - else $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
546 | + if ($compress) { |
|
547 | + $output .= '"sq": "'.$spotter_item['squawk'].'",'; |
|
548 | + } else { |
|
549 | + $output .= '"squawk": "'.$spotter_item['squawk'].'",'; |
|
550 | + } |
|
405 | 551 | } |
406 | 552 | if (isset($spotter_item['squawk_usage'])) { |
407 | 553 | $output .= '"squawk_usage": "'.$spotter_item['squawk_usage'].'",'; |
@@ -420,14 +566,23 @@ discard block |
||
420 | 566 | } |
421 | 567 | // type when not aircraft ? |
422 | 568 | if (isset($spotter_item['type'])) { |
423 | - if ($compress) $output .= '"t": "'.$spotter_item['type'].'"'; |
|
424 | - else $output .= '"type": "'.$spotter_item['type'].'"'; |
|
569 | + if ($compress) { |
|
570 | + $output .= '"t": "'.$spotter_item['type'].'"'; |
|
571 | + } else { |
|
572 | + $output .= '"type": "'.$spotter_item['type'].'"'; |
|
573 | + } |
|
425 | 574 | } elseif ($marine) { |
426 | - if ($compress) $output .= '"t": "ship"'; |
|
427 | - else $output .= '"type": "ship"'; |
|
575 | + if ($compress) { |
|
576 | + $output .= '"t": "ship"'; |
|
577 | + } else { |
|
578 | + $output .= '"type": "ship"'; |
|
579 | + } |
|
428 | 580 | } else { |
429 | - if ($compress) $output .= '"t": "aircraft"'; |
|
430 | - else $output .= '"type": "aircraft"'; |
|
581 | + if ($compress) { |
|
582 | + $output .= '"t": "aircraft"'; |
|
583 | + } else { |
|
584 | + $output .= '"type": "aircraft"'; |
|
585 | + } |
|
431 | 586 | } |
432 | 587 | $output .= '},'; |
433 | 588 | $output .= '"geometry": {'; |
@@ -495,7 +650,9 @@ discard block |
||
495 | 650 | } |
496 | 651 | */ |
497 | 652 | $history = filter_input(INPUT_GET,'history',FILTER_SANITIZE_STRING); |
498 | - if ($history == '' && isset($_COOKIE['history'])) $history = $_COOKIE['history']; |
|
653 | + if ($history == '' && isset($_COOKIE['history'])) { |
|
654 | + $history = $_COOKIE['history']; |
|
655 | + } |
|
499 | 656 | |
500 | 657 | if ( |
501 | 658 | (isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true') |
@@ -539,8 +696,11 @@ discard block |
||
539 | 696 | $output_history .= ']}},'; |
540 | 697 | $output .= $output_history; |
541 | 698 | } |
542 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
543 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
699 | + if ($compress) { |
|
700 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history","a": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
701 | + } else { |
|
702 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history","altitude": "'.$alt.'"},"geometry": {"type": "LineString","coordinates": ['; |
|
703 | + } |
|
544 | 704 | } |
545 | 705 | $output_history .= '['; |
546 | 706 | $output_history .= $spotter_history['longitude'].', '; |
@@ -559,9 +719,14 @@ discard block |
||
559 | 719 | $prev_alt = $alt; |
560 | 720 | } else { |
561 | 721 | if ($d == false) { |
562 | - if ($compress) $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
563 | - else $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
564 | - } else $d = true; |
|
722 | + if ($compress) { |
|
723 | + $output_history = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
724 | + } else { |
|
725 | + $output_history = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "history"},"geometry": {"type": "LineString","coordinates": ['; |
|
726 | + } |
|
727 | + } else { |
|
728 | + $d = true; |
|
729 | + } |
|
565 | 730 | $output_history .= '['; |
566 | 731 | $output_history .= $spotter_history['longitude'].', '; |
567 | 732 | $output_history .= $spotter_history['latitude']; |
@@ -582,7 +747,9 @@ discard block |
||
582 | 747 | $output_historyd = '['; |
583 | 748 | $output_historyd .= $spotter_item['longitude'].', '; |
584 | 749 | $output_historyd .= $spotter_item['latitude']; |
585 | - if (isset($spotter_history['altitude'])) $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
750 | + if (isset($spotter_history['altitude'])) { |
|
751 | + $output_historyd .= ','.$spotter_item['altitude']*30.48; |
|
752 | + } |
|
586 | 753 | $output_historyd .= '],'; |
587 | 754 | //$output_history = $output_historyd.$output_history; |
588 | 755 | $output_history = $output_history.$output_historyd; |
@@ -604,8 +771,11 @@ discard block |
||
604 | 771 | && $spotter_item['arrival_airport'] != 'NA' |
605 | 772 | && ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == "true") |
606 | 773 | || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)))) { |
607 | - if ($compress) $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
608 | - else $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
774 | + if ($compress) { |
|
775 | + $output_air = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
776 | + } else { |
|
777 | + $output_air = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "route"},"geometry": {"type": "LineString","coordinates": ['; |
|
778 | + } |
|
609 | 779 | if (isset($spotter_item['departure_airport_latitude'])) { |
610 | 780 | $output_air .= '['.$spotter_item['departure_airport_longitude'].','.$spotter_item['departure_airport_latitude'].'],'; |
611 | 781 | } elseif (isset($spotter_item['departure_airport']) && $spotter_item['departure_airport'] != 'NA') { |
@@ -638,8 +808,11 @@ discard block |
||
638 | 808 | || (!isset($_COOKIE['MapRemainaingRoute']) && (!isset($globalMapRemainingRoute) |
639 | 809 | || (isset($globalMapRemainingRoute) && $globalMapRemainingRoute)))))) { |
640 | 810 | $havedata = false; |
641 | - if ($compress) $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
642 | - else $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
811 | + if ($compress) { |
|
812 | + $output_dest = '{"type": "Feature","properties": {"c": "'.$spotter_item['ident'].'","t": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
813 | + } else { |
|
814 | + $output_dest = '{"type": "Feature","properties": {"callsign": "'.$spotter_item['ident'].'","type": "routedest"},"geometry": {"type": "LineString","coordinates": ['; |
|
815 | + } |
|
643 | 816 | $output_dest .= '['.$spotter_item['longitude'].','.$spotter_item['latitude'].'],'; |
644 | 817 | |
645 | 818 | if (isset($spotter_item['arrival_airport_latitude'])) { |
@@ -654,7 +827,9 @@ discard block |
||
654 | 827 | } |
655 | 828 | //$output_dest = substr($output_dest, 0, -1); |
656 | 829 | $output_dest .= ']}},'; |
657 | - if ($havedata) $output .= $output_dest; |
|
830 | + if ($havedata) { |
|
831 | + $output .= $output_dest; |
|
832 | + } |
|
658 | 833 | unset($output_dest); |
659 | 834 | } |
660 | 835 | } |
@@ -662,7 +837,9 @@ discard block |
||
662 | 837 | $output .= ']'; |
663 | 838 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
664 | 839 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
665 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
840 | + if (isset($begindate)) { |
|
841 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
842 | + } |
|
666 | 843 | $output .= '"fc": "'.$j.'"'; |
667 | 844 | } else { |
668 | 845 | $output .= '"features": '; |
@@ -39,30 +39,30 @@ discard block |
||
39 | 39 | |
40 | 40 | |
41 | 41 | function quaternionrotate($heading, $attitude = 0, $bank = 0) { |
42 | - // Assuming the angles are in radians. |
|
43 | - $c1 = cos($heading/2); |
|
44 | - $s1 = sin($heading/2); |
|
45 | - $c2 = cos($attitude/2); |
|
46 | - $s2 = sin($attitude/2); |
|
47 | - $c3 = cos($bank/2); |
|
48 | - $s3 = sin($bank/2); |
|
49 | - $c1c2 = $c1*$c2; |
|
50 | - $s1s2 = $s1*$s2; |
|
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
42 | + // Assuming the angles are in radians. |
|
43 | + $c1 = cos($heading/2); |
|
44 | + $s1 = sin($heading/2); |
|
45 | + $c2 = cos($attitude/2); |
|
46 | + $s2 = sin($attitude/2); |
|
47 | + $c3 = cos($bank/2); |
|
48 | + $s3 = sin($bank/2); |
|
49 | + $c1c2 = $c1*$c2; |
|
50 | + $s1s2 = $s1*$s2; |
|
51 | + $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
59 | 59 | |
60 | 60 | |
61 | 61 | if (isset($_GET['download'])) { |
62 | - if ($_GET['download'] == "true") |
|
63 | - { |
|
62 | + if ($_GET['download'] == "true") |
|
63 | + { |
|
64 | 64 | header('Content-disposition: attachment; filename="flightairmap.json"'); |
65 | - } |
|
65 | + } |
|
66 | 66 | } |
67 | 67 | header('Content-Type: text/javascript'); |
68 | 68 | |
@@ -229,10 +229,10 @@ discard block |
||
229 | 229 | $image = "images/placeholder_thumb.png"; |
230 | 230 | } |
231 | 231 | |
232 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
233 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
234 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
235 | - if ($prev_flightaware_id != $id) { |
|
232 | + if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
233 | + elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
234 | + elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
235 | + if ($prev_flightaware_id != $id) { |
|
236 | 236 | if ($prev_flightaware_id != '') { |
237 | 237 | $output .= ']'; |
238 | 238 | $output .= '}'; |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
272 | 272 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
273 | 273 | } else $aircraft_shadow = ''; |
274 | - $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
274 | + $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
|
275 | 275 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) { |
276 | 276 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
277 | 277 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
302 | 302 | $output .= ',"color": {"rgba" : ['.$rgb[0].','.$rgb[1].','.$rgb[2].',255]}'; |
303 | 303 | } |
304 | - $output .= '},'; |
|
304 | + $output .= '},'; |
|
305 | 305 | } elseif ($aircraft_icao != '') { |
306 | 306 | $aircraft_info = $Spotter->getAllAircraftInfo($aircraft_icao); |
307 | 307 | if (isset($aircraft_info[0]['engine_type'])) { |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | $s3 = sin($bank/2); |
49 | 49 | $c1c2 = $c1*$c2; |
50 | 50 | $s1s2 = $s1*$s2; |
51 | - $w =$c1c2*$c3 - $s1s2*$s3; |
|
52 | - $x =$c1c2*$s3 + $s1s2*$c3; |
|
53 | - $y =$s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | - $z =$c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | - return array('x' => $x,'y' => $y,'z' => $z,'w' => $w); |
|
51 | + $w = $c1c2*$c3 - $s1s2*$s3; |
|
52 | + $x = $c1c2*$s3 + $s1s2*$c3; |
|
53 | + $y = $s1*$c2*$c3 + $c1*$s2*$s3; |
|
54 | + $z = $c1*$s2*$c3 - $s1*$c2*$s3; |
|
55 | + return array('x' => $x, 'y' => $y, 'z' => $z, 'w' => $w); |
|
56 | 56 | // return array('x' => '0.0','y' => '-0.931','z' => '0.0','w' => '0.365'); |
57 | 57 | |
58 | 58 | } |
@@ -73,16 +73,16 @@ discard block |
||
73 | 73 | $min = false; |
74 | 74 | $allhistory = false; |
75 | 75 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
76 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
77 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
78 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
79 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
80 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
81 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
82 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
83 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
84 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
85 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
86 | 86 | /* |
87 | 87 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 88 | $min = true; |
@@ -129,12 +129,12 @@ discard block |
||
129 | 129 | $from_archive = true; |
130 | 130 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
131 | 131 | // $enddate = filter_input(INPUT_GET,'enddate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
132 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
133 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
134 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
135 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
136 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
137 | - $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
|
132 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
133 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
134 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
135 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
136 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
137 | + $spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate, $enddate, $filter); |
|
138 | 138 | } elseif (isset($_COOKIE['archive']) && isset($_COOKIE['archive_begin']) && isset($_COOKIE['archive_end']) && isset($_COOKIE['archive_speed'])) { |
139 | 139 | $from_archive = true; |
140 | 140 | // $begindate = filter_input(INPUT_GET,'begindate',FILTER_VALIDATE_REGEXP,array("options"=>array("regexp"=>'~^\d{4}/\d{2}/\d{2}$~'))); |
@@ -144,11 +144,11 @@ discard block |
||
144 | 144 | $begindate = $_COOKIE['archive_begin']; |
145 | 145 | $enddate = $_COOKIE['archive_end']; |
146 | 146 | |
147 | - $archivespeed = filter_var($_COOKIE['archive_speed'],FILTER_SANITIZE_NUMBER_INT); |
|
148 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
149 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
147 | + $archivespeed = filter_var($_COOKIE['archive_speed'], FILTER_SANITIZE_NUMBER_INT); |
|
148 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
149 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
150 | 150 | // echo 'Begin : '.$begindate.' - End : '.$enddate."\n"; |
151 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter); |
|
151 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter); |
|
152 | 152 | } elseif ($tracker) { |
153 | 153 | $spotter_array = $TrackerLive->getMinLastLiveTrackerData($filter); |
154 | 154 | } elseif ($marine) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | //print_r($spotter_array); |
160 | 160 | if (!empty($spotter_array)) { |
161 | 161 | if (isset($_GET['archive'])) { |
162 | - $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
|
162 | + $flightcnt = $SpotterArchive->getLiveSpotterCount($begindate, $enddate, $filter); |
|
163 | 163 | } elseif ($tracker) { |
164 | 164 | $flightcnt = $TrackerLive->getLiveTrackerCount($filter); |
165 | 165 | } elseif ($marine) { |
@@ -170,16 +170,16 @@ discard block |
||
170 | 170 | if ($flightcnt == '') $flightcnt = 0; |
171 | 171 | } else $flightcnt = 0; |
172 | 172 | |
173 | -$sqltime = round(microtime(true)-$begintime,2); |
|
173 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
174 | 174 | $minitime = time(); |
175 | 175 | $maxitime = 0; |
176 | 176 | |
177 | 177 | |
178 | 178 | $modelsdb = array(); |
179 | 179 | if (file_exists(dirname(__FILE__).'/models/modelsdb')) { |
180 | - if (($handle = fopen(dirname(__FILE__).'/models/modelsdb','r')) !== FALSE) { |
|
181 | - while (($row = fgetcsv($handle,1000)) !== FALSE) { |
|
182 | - if (isset($row[1]) ){ |
|
180 | + if (($handle = fopen(dirname(__FILE__).'/models/modelsdb', 'r')) !== FALSE) { |
|
181 | + while (($row = fgetcsv($handle, 1000)) !== FALSE) { |
|
182 | + if (isset($row[1])) { |
|
183 | 183 | $model = $row[0]; |
184 | 184 | $modelsdb[$model] = $row[1]; |
185 | 185 | } |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $output .= '},'; |
216 | 216 | if (!empty($spotter_array) && is_array($spotter_array)) |
217 | 217 | { |
218 | - foreach($spotter_array as $spotter_item) |
|
218 | + foreach ($spotter_array as $spotter_item) |
|
219 | 219 | { |
220 | 220 | $j++; |
221 | 221 | //if (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'airwhere') $heightrelative = 'RELATIVE_TO_GROUND'; |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | $output .= '"cartographicDegrees": ['; |
541 | 541 | if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
542 | 542 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
543 | - $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
543 | + $output .= '"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
544 | 544 | $output .= $spotter_item['longitude'].', '; |
545 | 545 | $output .= $spotter_item['latitude']; |
546 | 546 | $prevlong = $spotter_item['longitude']; |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
560 | 560 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
561 | 561 | } else { |
562 | - $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
|
562 | + $output .= ',"'.date("c", strtotime($spotter_item['date'])).'", '; |
|
563 | 563 | if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
564 | 564 | if ($spotter_item['ground_speed'] == 0) { |
565 | 565 | $output .= $prevlong.', '; |
@@ -593,9 +593,9 @@ discard block |
||
593 | 593 | } |
594 | 594 | $output .= ']'; |
595 | 595 | if (isset($globalArchive) && $globalArchive === TRUE) { |
596 | - if ((time()-$globalLiveInterval) > $minitime) $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
597 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
598 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
599 | -$output = str_replace('%maxitime%',date("c",$maxitime),$output); |
|
596 | + if ((time() - $globalLiveInterval) > $minitime) $output = str_replace('%minitime%', date("c", time() - $globalLiveInterval), $output); |
|
597 | + else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
598 | +} else $output = str_replace('%minitime%', date("c", $minitime), $output); |
|
599 | +$output = str_replace('%maxitime%', date("c", $maxitime), $output); |
|
600 | 600 | print $output; |
601 | 601 | ?> |
@@ -8,8 +8,12 @@ discard block |
||
8 | 8 | } |
9 | 9 | $tracker = false; |
10 | 10 | $marine = false; |
11 | -if (isset($_GET['tracker'])) $tracker = true; |
|
12 | -if (isset($_GET['marine'])) $marine = true; |
|
11 | +if (isset($_GET['tracker'])) { |
|
12 | + $tracker = true; |
|
13 | +} |
|
14 | +if (isset($_GET['marine'])) { |
|
15 | + $marine = true; |
|
16 | +} |
|
13 | 17 | if ($tracker) { |
14 | 18 | require_once('require/class.Tracker.php'); |
15 | 19 | require_once('require/class.TrackerLive.php'); |
@@ -66,23 +70,46 @@ discard block |
||
66 | 70 | } |
67 | 71 | header('Content-Type: text/javascript'); |
68 | 72 | |
69 | -if (!isset($globalJsonCompress)) $compress = true; |
|
70 | -else $compress = $globalJsonCompress; |
|
73 | +if (!isset($globalJsonCompress)) { |
|
74 | + $compress = true; |
|
75 | +} else { |
|
76 | + $compress = $globalJsonCompress; |
|
77 | +} |
|
71 | 78 | |
72 | 79 | $from_archive = false; |
73 | 80 | $min = false; |
74 | 81 | $allhistory = false; |
75 | 82 | $filter['source'] = array(); |
76 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
77 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
78 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
79 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
80 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
81 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
82 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
83 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
84 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
85 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
83 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
84 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
85 | +} |
|
86 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
87 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
88 | +} |
|
89 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
90 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
91 | +} |
|
92 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
93 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
94 | +} |
|
95 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
96 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
97 | +} |
|
98 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
99 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
100 | +} |
|
101 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
102 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
103 | +} |
|
104 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
105 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
106 | +} |
|
107 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
108 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
109 | +} |
|
110 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
111 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
112 | +} |
|
86 | 113 | /* |
87 | 114 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
88 | 115 | $min = true; |
@@ -167,8 +194,12 @@ discard block |
||
167 | 194 | } else { |
168 | 195 | $flightcnt = $SpotterLive->getLiveSpotterCount($filter); |
169 | 196 | } |
170 | - if ($flightcnt == '') $flightcnt = 0; |
|
171 | -} else $flightcnt = 0; |
|
197 | + if ($flightcnt == '') { |
|
198 | + $flightcnt = 0; |
|
199 | + } |
|
200 | + } else { |
|
201 | + $flightcnt = 0; |
|
202 | +} |
|
172 | 203 | |
173 | 204 | $sqltime = round(microtime(true)-$begintime,2); |
174 | 205 | $minitime = time(); |
@@ -192,7 +223,9 @@ discard block |
||
192 | 223 | $j = 0; |
193 | 224 | $prev_flightaware_id = ''; |
194 | 225 | $speed = 1; |
195 | -if (isset($archivespeed)) $speed = $archivespeed; |
|
226 | +if (isset($archivespeed)) { |
|
227 | + $speed = $archivespeed; |
|
228 | +} |
|
196 | 229 | $output = '['; |
197 | 230 | if ($tracker) { |
198 | 231 | $output .= '{"id" : "document", "name" : "tracker","version" : "1.0"'; |
@@ -227,9 +260,13 @@ discard block |
||
227 | 260 | $image = "images/placeholder_thumb.png"; |
228 | 261 | } |
229 | 262 | |
230 | - if (isset($spotter_item['flightaware_id'])) $id = $spotter_item['flightaware_id']; |
|
231 | - elseif (isset($spotter_item['famtrackid'])) $id = $spotter_item['famtrackid']; |
|
232 | - elseif (isset($spotter_item['fammarine_id'])) $id = $spotter_item['fammarine_id']; |
|
263 | + if (isset($spotter_item['flightaware_id'])) { |
|
264 | + $id = $spotter_item['flightaware_id']; |
|
265 | + } elseif (isset($spotter_item['famtrackid'])) { |
|
266 | + $id = $spotter_item['famtrackid']; |
|
267 | + } elseif (isset($spotter_item['fammarine_id'])) { |
|
268 | + $id = $spotter_item['fammarine_id']; |
|
269 | + } |
|
233 | 270 | if ($prev_flightaware_id != $id) { |
234 | 271 | if ($prev_flightaware_id != '') { |
235 | 272 | $output .= ']'; |
@@ -271,7 +308,9 @@ discard block |
||
271 | 308 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
272 | 309 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
273 | 310 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
274 | - } else $aircraft_shadow = ''; |
|
311 | + } else { |
|
312 | + $aircraft_shadow = ''; |
|
313 | + } |
|
275 | 314 | $output .= ' "billboard" : {"image" : "'.$globalURL.'/images/aircrafts/new/'.$aircraft_shadow.'","scale" : 0.5'; |
276 | 315 | if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] && isset($_COOKIE['IconColor'])) { |
277 | 316 | $rgb = $Common->hex2rgb($_COOKIE['IconColor']); |
@@ -279,7 +318,9 @@ discard block |
||
279 | 318 | } |
280 | 319 | $output .= '},'; |
281 | 320 | } |
282 | - } else $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
321 | + } else { |
|
322 | + $output .= ' "billboard" : {"image" : "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAfCAYAAACVgY94AAAACXBIWXMAAC4jAAAuIwF4pT92AAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZrIPQLUAoOnaV/Nw+H48PEWhkLnZ2eXk5NhKxEJbYcpXff5nwl/AV/1s+X48/Pf14L7iJIEyXYFHBPjgwsz0TKUcz5IJhGLc5o9H/LcL//wd0yLESWK5WCoU41EScY5EmozzMqUiiUKSKcUl0v9k4t8s+wM+3zUAsGo+AXuRLahdYwP2SycQWHTA4vcAAPK7b8HUKAgDgGiD4c93/+8//UegJQCAZkmScQAAXkQkLlTKsz/HCAAARKCBKrBBG/TBGCzABhzBBdzBC/xgNoRCJMTCQhBCCmSAHHJgKayCQiiGzbAdKmAv1EAdNMBRaIaTcA4uwlW4Dj1wD/phCJ7BKLyBCQRByAgTYSHaiAFiilgjjggXmYX4IcFIBBKLJCDJiBRRIkuRNUgxUopUIFVIHfI9cgI5h1xGupE7yAAygvyGvEcxlIGyUT3UDLVDuag3GoRGogvQZHQxmo8WoJvQcrQaPYw2oefQq2gP2o8+Q8cwwOgYBzPEbDAuxsNCsTgsCZNjy7EirAyrxhqwVqwDu4n1Y8+xdwQSgUXACTYEd0IgYR5BSFhMWE7YSKggHCQ0EdoJNwkDhFHCJyKTqEu0JroR+cQYYjIxh1hILCPWEo8TLxB7iEPENyQSiUMyJ7mQAkmxpFTSEtJG0m5SI+ksqZs0SBojk8naZGuyBzmULCAryIXkneTD5DPkG+Qh8lsKnWJAcaT4U+IoUspqShnlEOU05QZlmDJBVaOaUt2ooVQRNY9aQq2htlKvUYeoEzR1mjnNgxZJS6WtopXTGmgXaPdpr+h0uhHdlR5Ol9BX0svpR+iX6AP0dwwNhhWDx4hnKBmbGAcYZxl3GK+YTKYZ04sZx1QwNzHrmOeZD5lvVVgqtip8FZHKCpVKlSaVGyovVKmqpqreqgtV81XLVI+pXlN9rkZVM1PjqQnUlqtVqp1Q61MbU2epO6iHqmeob1Q/pH5Z/YkGWcNMw09DpFGgsV/jvMYgC2MZs3gsIWsNq4Z1gTXEJrHN2Xx2KruY/R27iz2qqaE5QzNKM1ezUvOUZj8H45hx+Jx0TgnnKKeX836K3hTvKeIpG6Y0TLkxZVxrqpaXllirSKtRq0frvTau7aedpr1Fu1n7gQ5Bx0onXCdHZ4/OBZ3nU9lT3acKpxZNPTr1ri6qa6UbobtEd79up+6Ynr5egJ5Mb6feeb3n+hx9L/1U/W36p/VHDFgGswwkBtsMzhg8xTVxbzwdL8fb8VFDXcNAQ6VhlWGX4YSRudE8o9VGjUYPjGnGXOMk423GbcajJgYmISZLTepN7ppSTbmmKaY7TDtMx83MzaLN1pk1mz0x1zLnm+eb15vft2BaeFostqi2uGVJsuRaplnutrxuhVo5WaVYVVpds0atna0l1rutu6cRp7lOk06rntZnw7Dxtsm2qbcZsOXYBtuutm22fWFnYhdnt8Wuw+6TvZN9un2N/T0HDYfZDqsdWh1+c7RyFDpWOt6azpzuP33F9JbpL2dYzxDP2DPjthPLKcRpnVOb00dnF2e5c4PziIuJS4LLLpc+Lpsbxt3IveRKdPVxXeF60vWdm7Obwu2o26/uNu5p7ofcn8w0nymeWTNz0MPIQ+BR5dE/C5+VMGvfrH5PQ0+BZ7XnIy9jL5FXrdewt6V3qvdh7xc+9j5yn+M+4zw33jLeWV/MN8C3yLfLT8Nvnl+F30N/I/9k/3r/0QCngCUBZwOJgUGBWwL7+Hp8Ib+OPzrbZfay2e1BjKC5QRVBj4KtguXBrSFoyOyQrSH355jOkc5pDoVQfujW0Adh5mGLw34MJ4WHhVeGP45wiFga0TGXNXfR3ENz30T6RJZE3ptnMU85ry1KNSo+qi5qPNo3ujS6P8YuZlnM1VidWElsSxw5LiquNm5svt/87fOH4p3iC+N7F5gvyF1weaHOwvSFpxapLhIsOpZATIhOOJTwQRAqqBaMJfITdyWOCnnCHcJnIi/RNtGI2ENcKh5O8kgqTXqS7JG8NXkkxTOlLOW5hCepkLxMDUzdmzqeFpp2IG0yPTq9MYOSkZBxQqohTZO2Z+pn5mZ2y6xlhbL+xW6Lty8elQfJa7OQrAVZLQq2QqboVFoo1yoHsmdlV2a/zYnKOZarnivN7cyzytuQN5zvn//tEsIS4ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAA7VJREFUeNrEl2uIlWUQx39nXUu0m2uQbZYrbabdLKMs/VBkmHQjioqFIhBS+hKEQpQRgVAf2u5RQkGBRUllRH4I2e5ZUBJlEZVt5i0tTfHStrZ6fn35L70d9n7Obg88vOedmWfmf2bmmZkXlRrtq9V16mZ1iVqqhd5agXvQf1c5zw/V8dXqrqO6dQKwBrgdWApsCb0VqAc2AnOrMVANwIsD4BLgTOBPYB2wHJgEzAG+ANqAu4ZsZYiuX5QwfqI2hvaNulA9J7zLQn8o76vUuuHOwXHqSzH4aIF+TWjnBkSH+nCBf716SP1KPWO4AJ6ltgfIjRW8p9U/1KPz/ry6RT2mIDNF3Zjz19Ya4G1R/J16dgWvQd2pPlXhMdVZPUTgxfCW1wJgXUJpQlvfg8zs8K8r0Caom9QHetG7NGfa1ElDBThRXRtFd/Qh16puKIS3e7+clBjdy7kL1b3q4fzJQQGck5z6Nb97kxujblWf64HXov7Vl/E4YXWccP9AAd6dAx+ox/WTArNzY1t64B0f8K0DyLXuUvRGZfcpCo1VX4tg6wB76WMB0dALf526foAX8cqUot2pGP8B2Kz+krBeNYjS8636dh/8Beo2deoA9TWp76pd6g0q9cDNwKvAD8A84EfglLRBe2g+JWAfcEF68bPABOCoAl/gIPA5MA64FVgGnNhP292W3r0SeB1YVlJXAjcBP8XwyQUj9AKwAzg2+/fQSsBhoJxBAaALaIzenZGnD911wA7gEDAD2FFSpwOzgDHZ5T7+ZSlGd2d6AXgi5+qAn+O5U0PbBVwKtAD3AHuB8f3YGBUdncCGoQ4LE9XtGRqK9LnduVPRIu2BPqwD65IYbS7Qpql7Ql9YoJcy9bwzkgPrfOCj5G33+h54E/g0PAr5thq4ApgyEgNrc27aWwVaPTA1QJ4BjgTGFvhteV40EgPrgvTP7qlmZqFnl9WD+b2posN83E/NrEkOjlI/U1fkfUYa/pe5IE3qZPW8jFOqiyN7p3pAPX04c7AxYSoDDcAjKT2LgLXA6IR2M3Bviv59wDTgQGTPH84Qd8+HXfHcoUws2zM0HMjuUPep+xP2PWpnwtw0GJsldbBpewQwE/gbeDyt7H1gcW53O7AC+A3Yn6+/W+Ld9SnWA15DAVhc8xK2TuA9YHrCuhV4EngFuBx4YagG6qv8cF+T52kB2Zy+e1I8taUacNV+uBdXO7ABmJwJpwx8XQvF9TUCWM64tiQhbq/oMv+7BwFWpQzNT8vbVQul/wwAGzzdmXU1xuUAAAAASUVORK5CYII=","scale" : 0.5},'; |
|
323 | + } |
|
283 | 324 | } elseif ($one3dmodel) { |
284 | 325 | if (isset($globalMap3DForceModel) && $globalMap3DForceModel != '') { |
285 | 326 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$globalMap3DForceModel.'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -310,7 +351,9 @@ discard block |
||
310 | 351 | $spotter_item['engine_type'] = $aircraft_info[0]['engine_type']; |
311 | 352 | $spotter_item['wake_category'] = $aircraft_info[0]['wake_category']; |
312 | 353 | $spotter_item['engine_count'] = $aircraft_info[0]['engine_count']; |
313 | - } else $aircraft_shadow = ''; |
|
354 | + } else { |
|
355 | + $aircraft_shadow = ''; |
|
356 | + } |
|
314 | 357 | if ($aircraft_shadow != '') { |
315 | 358 | if (isset($modelsdb[$aircraft_shadow])) { |
316 | 359 | $output .= '"model": {"gltf" : "'.$globalURL.'/models/'.$modelsdb[$aircraft_shadow].'","scale" : 1.0,"minimumPixelSize": 20'; |
@@ -447,7 +490,9 @@ discard block |
||
447 | 490 | } |
448 | 491 | $output .= '},'; |
449 | 492 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
450 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
493 | + if ($spotter_item['aircraft_icao'] != '') { |
|
494 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
495 | + } |
|
451 | 496 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
452 | 497 | } |
453 | 498 | } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
@@ -469,7 +514,9 @@ discard block |
||
469 | 514 | } |
470 | 515 | $output .= '},'; |
471 | 516 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
472 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
517 | + if ($spotter_item['aircraft_icao'] != '') { |
|
518 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
519 | + } |
|
473 | 520 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
474 | 521 | } |
475 | 522 | } else { |
@@ -482,7 +529,9 @@ discard block |
||
482 | 529 | } |
483 | 530 | $output .= '},'; |
484 | 531 | //if ($spotter_item['aircraft_shadow'] != '') $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
485 | - if ($spotter_item['aircraft_icao'] != '') $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
532 | + if ($spotter_item['aircraft_icao'] != '') { |
|
533 | + $output .= '"aircraft_icao": "'.$spotter_item['aircraft_icao'].'",'; |
|
534 | + } |
|
486 | 535 | $modelsdb[$aircraft_icao] = 'Cesium_Air.glb'; |
487 | 536 | } |
488 | 537 | } elseif ($tracker && isset($spotter_item['type'])) { |
@@ -538,8 +587,12 @@ discard block |
||
538 | 587 | // $output .= '"interpolationDegree" : 5,'; |
539 | 588 | // $output .= '"epoch" : "'.date("c",strtotime($spotter_item['date'])).'", '; |
540 | 589 | $output .= '"cartographicDegrees": ['; |
541 | - if ($minitime > strtotime($spotter_item['date'])) $minitime = strtotime($spotter_item['date']); |
|
542 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
590 | + if ($minitime > strtotime($spotter_item['date'])) { |
|
591 | + $minitime = strtotime($spotter_item['date']); |
|
592 | + } |
|
593 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
594 | + $maxitime = strtotime($spotter_item['date']); |
|
595 | + } |
|
543 | 596 | $output .= '"'.date("c",strtotime($spotter_item['date'])).'", '; |
544 | 597 | $output .= $spotter_item['longitude'].', '; |
545 | 598 | $output .= $spotter_item['latitude']; |
@@ -553,19 +606,26 @@ discard block |
||
553 | 606 | $output .= ', '.round($spotter_item['altitude']*30.48); |
554 | 607 | $prevalt = round($spotter_item['altitude']*30.48); |
555 | 608 | } |
556 | - } else $output .= ', 0'; |
|
609 | + } else { |
|
610 | + $output .= ', 0'; |
|
611 | + } |
|
557 | 612 | //$orientation = '"orientation" : { '; |
558 | 613 | //$orientation .= '"unitQuaternion": ['; |
559 | 614 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
560 | 615 | //$orientation .= '"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
561 | 616 | } else { |
562 | 617 | $output .= ',"'.date("c",strtotime($spotter_item['date'])).'", '; |
563 | - if ($maxitime < strtotime($spotter_item['date'])) $maxitime = strtotime($spotter_item['date']); |
|
618 | + if ($maxitime < strtotime($spotter_item['date'])) { |
|
619 | + $maxitime = strtotime($spotter_item['date']); |
|
620 | + } |
|
564 | 621 | if ($spotter_item['ground_speed'] == 0) { |
565 | 622 | $output .= $prevlong.', '; |
566 | 623 | $output .= $prevlat; |
567 | - if (!$tracker && !$marine) $output .= ', '.$prevalt; |
|
568 | - else $output .= ', 0'; |
|
624 | + if (!$tracker && !$marine) { |
|
625 | + $output .= ', '.$prevalt; |
|
626 | + } else { |
|
627 | + $output .= ', 0'; |
|
628 | + } |
|
569 | 629 | } else { |
570 | 630 | $output .= $spotter_item['longitude'].', '; |
571 | 631 | $output .= $spotter_item['latitude']; |
@@ -577,10 +637,15 @@ discard block |
||
577 | 637 | $output .= ', 0'; |
578 | 638 | } |
579 | 639 | } else { |
580 | - if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
581 | - else $output .= ', '.round($spotter_item['altitude']*30.48); |
|
640 | + if (isset($spotter_item['real_altitude']) && $spotter_item['real_altitude'] != '') { |
|
641 | + $output .= ', '.round($spotter_item['real_altitude']*0.3048); |
|
642 | + } else { |
|
643 | + $output .= ', '.round($spotter_item['altitude']*30.48); |
|
644 | + } |
|
582 | 645 | } |
583 | - } else $output .= ', 0'; |
|
646 | + } else { |
|
647 | + $output .= ', 0'; |
|
648 | + } |
|
584 | 649 | } |
585 | 650 | //$quat = quaternionrotate(deg2rad($spotter_item['heading']),deg2rad(0),deg2rad(0)); |
586 | 651 | //$orientation .= ',"'.date("c",strtotime($spotter_item['date'])).'",'.$quat['x'].','.$quat['y'].','.$quat['z'].','.$quat['w']; |
@@ -593,9 +658,14 @@ discard block |
||
593 | 658 | } |
594 | 659 | $output .= ']'; |
595 | 660 | if (isset($globalArchive) && $globalArchive === TRUE) { |
596 | - if ((time()-$globalLiveInterval) > $minitime) $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
597 | - else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
598 | -} else $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
661 | + if ((time()-$globalLiveInterval) > $minitime) { |
|
662 | + $output = str_replace('%minitime%',date("c",time()-$globalLiveInterval),$output); |
|
663 | + } else { |
|
664 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
665 | + } |
|
666 | + } else { |
|
667 | + $output = str_replace('%minitime%',date("c",$minitime),$output); |
|
668 | +} |
|
599 | 669 | $output = str_replace('%maxitime%',date("c",$maxitime),$output); |
600 | 670 | print $output; |
601 | 671 | ?> |
@@ -40,15 +40,15 @@ |
||
40 | 40 | //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; |
41 | 41 | print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>'; |
42 | 42 | if ($spotter_item['atc_range'] > 0) { |
43 | - print '<div><span>'._("Range").'</span>'; |
|
44 | - print $spotter_item['atc_range']; |
|
45 | - print '</div>'; |
|
43 | + print '<div><span>'._("Range").'</span>'; |
|
44 | + print $spotter_item['atc_range']; |
|
45 | + print '</div>'; |
|
46 | 46 | } |
47 | 47 | print '</div>'; |
48 | 48 | if ($spotter_item['info'] != '') { |
49 | - print '<div class="notamtext"><span>'._("Info").'</span>'; |
|
50 | - print $spotter_item['info']; |
|
51 | - print '</div>'; |
|
49 | + print '<div class="notamtext"><span>'._("Info").'</span>'; |
|
50 | + print $spotter_item['info']; |
|
51 | + print '</div>'; |
|
52 | 52 | } |
53 | 53 | print '</div>'; |
54 | 54 | } |
@@ -5,8 +5,8 @@ discard block |
||
5 | 5 | $ATC = new ATC(); |
6 | 6 | |
7 | 7 | if (isset($_GET['atcid'])) { |
8 | - $atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT); |
|
9 | - $atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING); |
|
8 | + $atcid = filter_input(INPUT_GET, 'atcid', FILTER_SANITIZE_NUMBER_INT); |
|
9 | + $atcident = filter_input(INPUT_GET, 'atcident', FILTER_SANITIZE_STRING); |
|
10 | 10 | $atc_data = $ATC->getById($atcid); |
11 | 11 | if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident); |
12 | 12 | ?> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | print '</div>'; |
39 | 39 | |
40 | 40 | //print '<div><span>'._("Country").'</span>'.$spotter_item['country'].'</div>'; |
41 | -print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'],3).', '.round($spotter_item['longitude'],3).'</div>'; |
|
41 | +print '<div><span>'._("Coordinates").'</span>'.round($spotter_item['latitude'], 3).', '.round($spotter_item['longitude'], 3).'</div>'; |
|
42 | 42 | if ($spotter_item['atc_range'] > 0) { |
43 | 43 | print '<div><span>'._("Range").'</span>'; |
44 | 44 | print $spotter_item['atc_range']; |
@@ -8,7 +8,9 @@ |
||
8 | 8 | $atcid = filter_input(INPUT_GET,'atcid',FILTER_SANITIZE_NUMBER_INT); |
9 | 9 | $atcident = filter_input(INPUT_GET,'atcident',FILTER_SANITIZE_STRING); |
10 | 10 | $atc_data = $ATC->getById($atcid); |
11 | - if (!isset($atc_data[0])) $atc_data = $ATC->getByIdent($atcident); |
|
11 | + if (!isset($atc_data[0])) { |
|
12 | + $atc_data = $ATC->getByIdent($atcident); |
|
13 | + } |
|
12 | 14 | ?> |
13 | 15 | <div class="alldetails"> |
14 | 16 | <button type="button" class="close">×</button> |
@@ -89,6 +89,10 @@ discard block |
||
89 | 89 | 'y' => 'Yagi At QTH'); |
90 | 90 | |
91 | 91 | |
92 | + /** |
|
93 | + * @param integer $n |
|
94 | + * @param integer $s |
|
95 | + */ |
|
92 | 96 | private function urshift($n, $s) { |
93 | 97 | return ($n >= 0) ? ($n >> $s) : |
94 | 98 | (($n & 0x7fffffff) >> $s) | |
@@ -483,6 +487,9 @@ discard block |
||
483 | 487 | socket_close($this->socket); |
484 | 488 | } |
485 | 489 | |
490 | + /** |
|
491 | + * @param string $data |
|
492 | + */ |
|
486 | 493 | public function send($data) { |
487 | 494 | global $globalDebug; |
488 | 495 | if ($this->connected === false) $this->connect(); |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | require_once(dirname(__FILE__).'/class.Common.php'); |
4 | 4 | class aprs { |
5 | - private $socket; |
|
6 | - private $connected = false; |
|
5 | + private $socket; |
|
6 | + private $connected = false; |
|
7 | 7 | |
8 | - protected $symbols = array('!' => 'Police', |
|
8 | + protected $symbols = array('!' => 'Police', |
|
9 | 9 | '#' => 'DIGI', |
10 | 10 | '$' => 'Phone', |
11 | 11 | '%' => 'DX Cluster', |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | 'y' => 'Yagi At QTH'); |
90 | 90 | |
91 | 91 | |
92 | - private function urshift($n, $s) { |
|
92 | + private function urshift($n, $s) { |
|
93 | 93 | return ($n >= 0) ? ($n >> $s) : |
94 | - (($n & 0x7fffffff) >> $s) | |
|
94 | + (($n & 0x7fffffff) >> $s) | |
|
95 | 95 | (0x40000000 >> ($s - 1)); |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - public function parse($input) { |
|
98 | + public function parse($input) { |
|
99 | 99 | global $globalDebug; |
100 | 100 | $debug = false; |
101 | 101 | $result = array(); |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | /* Check that end was found and body has at least one byte. */ |
109 | 109 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
110 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
111 | - return false; |
|
110 | + if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
111 | + return false; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($debug) echo 'input : '.$input."\n"; |
@@ -122,34 +122,34 @@ discard block |
||
122 | 122 | /* Parse source, target and path. */ |
123 | 123 | //FLRDF0A52>APRS,qAS,LSTB |
124 | 124 | if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
125 | - $ident = $matches[1]; |
|
126 | - $all_elements = $matches[2]; |
|
127 | - if ($ident == 'AIRCRAFT') { |
|
125 | + $ident = $matches[1]; |
|
126 | + $all_elements = $matches[2]; |
|
127 | + if ($ident == 'AIRCRAFT') { |
|
128 | 128 | $result['format_source'] = 'famaprs'; |
129 | 129 | $result['source_type'] = 'modes'; |
130 | - } elseif ($ident == 'MARINE') { |
|
130 | + } elseif ($ident == 'MARINE') { |
|
131 | 131 | $result['format_source'] = 'famaprs'; |
132 | 132 | $result['source_type'] = 'ais'; |
133 | - } else { |
|
133 | + } else { |
|
134 | 134 | if ($debug) echo 'ident : '.$ident."\n"; |
135 | 135 | $result['ident'] = $ident; |
136 | - } |
|
136 | + } |
|
137 | 137 | } else { |
138 | - if ($debug) 'No ident'."\n"; |
|
139 | - return false; |
|
138 | + if ($debug) 'No ident'."\n"; |
|
139 | + return false; |
|
140 | 140 | } |
141 | 141 | $elements = explode(',',$all_elements); |
142 | 142 | $source = end($elements); |
143 | 143 | $result['source'] = $source; |
144 | 144 | foreach ($elements as $element) { |
145 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
146 | - //echo "ok"; |
|
147 | - //if ($element == 'TCPIP*') return false; |
|
148 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
145 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
146 | + //echo "ok"; |
|
147 | + //if ($element == 'TCPIP*') return false; |
|
148 | + } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
149 | 149 | if ($debug) echo 'element : '.$element."\n"; |
150 | 150 | return false; |
151 | - } |
|
152 | - /* |
|
151 | + } |
|
152 | + /* |
|
153 | 153 | } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) { |
154 | 154 | //echo "ok"; |
155 | 155 | } else { |
@@ -176,49 +176,49 @@ discard block |
||
176 | 176 | $body_parse = substr($body,1); |
177 | 177 | //echo 'Body : '.$body."\n"; |
178 | 178 | if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
179 | - $body_parse = substr($body_parse,10); |
|
180 | - $find = true; |
|
181 | - //echo $body_parse."\n"; |
|
179 | + $body_parse = substr($body_parse,10); |
|
180 | + $find = true; |
|
181 | + //echo $body_parse."\n"; |
|
182 | 182 | } |
183 | 183 | if (preg_match('/^`(.*)\//',$body,$matches)) { |
184 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
185 | - $find = true; |
|
186 | - //echo $body_parse."\n"; |
|
184 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
185 | + $find = true; |
|
186 | + //echo $body_parse."\n"; |
|
187 | 187 | } |
188 | 188 | if (preg_match("/^'(.*)\//",$body,$matches)) { |
189 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
190 | - $find = true; |
|
191 | - //echo $body_parse."\n"; |
|
189 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
190 | + $find = true; |
|
191 | + //echo $body_parse."\n"; |
|
192 | 192 | } |
193 | 193 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
194 | - $find = true; |
|
195 | - //print_r($matches); |
|
196 | - $timestamp = $matches[0]; |
|
197 | - if ($matches[4] == 'h') { |
|
194 | + $find = true; |
|
195 | + //print_r($matches); |
|
196 | + $timestamp = $matches[0]; |
|
197 | + if ($matches[4] == 'h') { |
|
198 | 198 | $timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]); |
199 | 199 | //echo 'timestamp : '.$timestamp.' - now : '.time()."\n"; |
200 | 200 | /* |
201 | 201 | if (time() + 3900 < $timestamp) $timestamp -= 86400; |
202 | 202 | elseif (time() - 82500 > $timestamp) $timestamp += 86400; |
203 | 203 | */ |
204 | - } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
204 | + } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
205 | 205 | // This work or not ? |
206 | 206 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
207 | - } |
|
208 | - $body_parse = substr($body_parse,7); |
|
209 | - $result['timestamp'] = $timestamp; |
|
210 | - //echo date('Ymd H:i:s',$timestamp); |
|
207 | + } |
|
208 | + $body_parse = substr($body_parse,7); |
|
209 | + $result['timestamp'] = $timestamp; |
|
210 | + //echo date('Ymd H:i:s',$timestamp); |
|
211 | 211 | } |
212 | 212 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
213 | - $find = true; |
|
214 | - $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
215 | - $body_parse = substr($body_parse,8); |
|
216 | - $result['timestamp'] = $timestamp; |
|
217 | - //echo date('Ymd H:i:s',$timestamp); |
|
213 | + $find = true; |
|
214 | + $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
215 | + $body_parse = substr($body_parse,8); |
|
216 | + $result['timestamp'] = $timestamp; |
|
217 | + //echo date('Ymd H:i:s',$timestamp); |
|
218 | 218 | } |
219 | 219 | //if (strlen($body_parse) > 19) { |
220 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
221 | - $find = true; |
|
220 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
221 | + $find = true; |
|
222 | 222 | // 4658.70N/00707.78Ez |
223 | 223 | //print_r(str_split($body_parse)); |
224 | 224 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | $lon = intval($lon_deg); |
236 | 236 | if ($lat > 89 || $lon > 179) return false; |
237 | 237 | |
238 | - /* |
|
238 | + /* |
|
239 | 239 | $tmp_5b = str_replace('.','',$lat_min); |
240 | 240 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
241 | 241 | print_r($matches); |
@@ -249,9 +249,9 @@ discard block |
||
249 | 249 | $result['longitude'] = $longitude; |
250 | 250 | $body_parse = substr($body_parse,18); |
251 | 251 | $body_parse_len = strlen($body_parse); |
252 | - } |
|
253 | - $body_parse_len = strlen($body_parse); |
|
254 | - if ($body_parse_len > 0) { |
|
252 | + } |
|
253 | + $body_parse_len = strlen($body_parse); |
|
254 | + if ($body_parse_len > 0) { |
|
255 | 255 | /* |
256 | 256 | if (!isset($result['timestamp']) && !isset($result['latitude'])) { |
257 | 257 | $body_split = str_split($body); |
@@ -281,95 +281,95 @@ discard block |
||
281 | 281 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
282 | 282 | if ($symbol_code != '_') { |
283 | 283 | } |
284 | - //$body_parse = substr($body_parse,1); |
|
285 | - //$body_parse = trim($body_parse); |
|
286 | - //$body_parse_len = strlen($body_parse); |
|
287 | - if ($body_parse_len >= 7) { |
|
284 | + //$body_parse = substr($body_parse,1); |
|
285 | + //$body_parse = trim($body_parse); |
|
286 | + //$body_parse_len = strlen($body_parse); |
|
287 | + if ($body_parse_len >= 7) { |
|
288 | 288 | |
289 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
290 | - $course = substr($body_parse,0,3); |
|
291 | - $tmp_s = intval($course); |
|
292 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
293 | - $speed = substr($body_parse,4,3); |
|
294 | - if ($speed != '...') { |
|
295 | - //$result['speed'] = round($speed*1.852); |
|
296 | - $result['speed'] = intval($speed); |
|
297 | - } |
|
298 | - $body_parse = substr($body_parse,7); |
|
299 | - } |
|
300 | - // Check PHGR, PHG, RNG |
|
301 | - } |
|
302 | - /* |
|
289 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
290 | + $course = substr($body_parse,0,3); |
|
291 | + $tmp_s = intval($course); |
|
292 | + if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
293 | + $speed = substr($body_parse,4,3); |
|
294 | + if ($speed != '...') { |
|
295 | + //$result['speed'] = round($speed*1.852); |
|
296 | + $result['speed'] = intval($speed); |
|
297 | + } |
|
298 | + $body_parse = substr($body_parse,7); |
|
299 | + } |
|
300 | + // Check PHGR, PHG, RNG |
|
301 | + } |
|
302 | + /* |
|
303 | 303 | else if ($body_parse_len > 0) { |
304 | 304 | $rest = $body_parse; |
305 | 305 | } |
306 | 306 | */ |
307 | - if (strlen($body_parse) > 0) { |
|
308 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
309 | - $altitude = intval($matches[1]); |
|
310 | - //$result['altitude'] = round($altitude*0.3048); |
|
311 | - $result['altitude'] = $altitude; |
|
312 | - //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
313 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
314 | - } |
|
315 | - } |
|
307 | + if (strlen($body_parse) > 0) { |
|
308 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
309 | + $altitude = intval($matches[1]); |
|
310 | + //$result['altitude'] = round($altitude*0.3048); |
|
311 | + $result['altitude'] = $altitude; |
|
312 | + //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
313 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
314 | + } |
|
315 | + } |
|
316 | 316 | |
317 | - // Telemetry |
|
318 | - /* |
|
317 | + // Telemetry |
|
318 | + /* |
|
319 | 319 | if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) { |
320 | 320 | // Nothing yet... |
321 | 321 | } |
322 | 322 | */ |
323 | - // DAO |
|
323 | + // DAO |
|
324 | 324 | |
325 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
325 | + if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
326 | 326 | |
327 | - $dao = $matches[1]; |
|
328 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
327 | + $dao = $matches[1]; |
|
328 | + if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
329 | 329 | $dao_split = str_split($dao); |
330 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
331 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
330 | + $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
331 | + $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
332 | 332 | |
333 | 333 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
334 | 334 | else $result['latitude'] += $lat_off; |
335 | 335 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
336 | 336 | else $result['longitude'] += $lon_off; |
337 | - } |
|
337 | + } |
|
338 | 338 | |
339 | - $body_parse = substr($body_parse,6); |
|
340 | - } |
|
339 | + $body_parse = substr($body_parse,6); |
|
340 | + } |
|
341 | 341 | |
342 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
342 | + if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
343 | 343 | $result['ident'] = str_replace('_',' ',$matches[1]); |
344 | - } |
|
345 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
344 | + } |
|
345 | + if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
346 | 346 | $result['squawk'] = $matches[1]; |
347 | - } |
|
348 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
347 | + } |
|
348 | + if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
349 | 349 | $result['aircraft_icao'] = $matches[1]; |
350 | - } |
|
351 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
350 | + } |
|
351 | + if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
352 | 352 | $result['verticalrate'] = $matches[1]; |
353 | - } |
|
354 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
353 | + } |
|
354 | + if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
355 | 355 | $result['typeid'] = $matches[1]; |
356 | - } |
|
357 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
356 | + } |
|
357 | + if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
358 | 358 | $result['statusid'] = $matches[1]; |
359 | - } |
|
360 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
359 | + } |
|
360 | + if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
361 | 361 | $result['imo'] = $matches[1]; |
362 | - } |
|
363 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
362 | + } |
|
363 | + if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
364 | 364 | $result['arrival_date'] = $matches[1]; |
365 | - } |
|
366 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
365 | + } |
|
366 | + if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
367 | 367 | $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
368 | - } |
|
369 | - // OGN comment |
|
368 | + } |
|
369 | + // OGN comment |
|
370 | 370 | // echo "Before OGN : ".$body_parse."\n"; |
371 | - //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
372 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
371 | + //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
372 | + if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
373 | 373 | $id = $matches[1]; |
374 | 374 | //$mode = substr($id,0,2); |
375 | 375 | $address = substr($id,2); |
@@ -399,53 +399,53 @@ discard block |
||
399 | 399 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
400 | 400 | $result['stealth'] = $stealth; |
401 | 401 | $result['address'] = $address; |
402 | - } |
|
402 | + } |
|
403 | 403 | |
404 | - //Comment |
|
405 | - $result['comment'] = trim($body_parse); |
|
404 | + //Comment |
|
405 | + $result['comment'] = trim($body_parse); |
|
406 | 406 | } else { |
407 | - // parse weather |
|
408 | - //$body_parse = substr($body_parse,1); |
|
409 | - //$body_parse_len = strlen($body_parse); |
|
407 | + // parse weather |
|
408 | + //$body_parse = substr($body_parse,1); |
|
409 | + //$body_parse_len = strlen($body_parse); |
|
410 | 410 | |
411 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
412 | - $result['wind_dir'] = intval($matches[1]); |
|
413 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
414 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
415 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
416 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
417 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
411 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
412 | + $result['wind_dir'] = intval($matches[1]); |
|
413 | + $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
414 | + $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
415 | + $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
416 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
417 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
418 | 418 | $result['wind_dir'] = intval($matches[1]); |
419 | 419 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
420 | 420 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
421 | 421 | $result['temp'] = round(5/9*(($matches[4])-32),1); |
422 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
423 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
422 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
423 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
424 | 424 | $result['wind_dir'] = intval($matches[1]); |
425 | 425 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
426 | 426 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
427 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
428 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
427 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
428 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
429 | 429 | $result['wind_dir'] = intval($matches[1]); |
430 | 430 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
431 | 431 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
432 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
433 | - } |
|
434 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
432 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
433 | + } |
|
434 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
435 | 435 | $result['temp'] = round(5/9*(($matches[1])-32),1); |
436 | - } |
|
436 | + } |
|
437 | 437 | } |
438 | 438 | } else $result['comment'] = trim($body_parse); |
439 | 439 | |
440 | - } |
|
440 | + } |
|
441 | 441 | //} |
442 | 442 | if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
443 | 443 | if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
444 | 444 | if ($debug) print_r($result); |
445 | 445 | return $result; |
446 | - } |
|
446 | + } |
|
447 | 447 | |
448 | - public function connect() { |
|
448 | + public function connect() { |
|
449 | 449 | global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
450 | 450 | $aprs_connect = 0; |
451 | 451 | $aprs_keep = 120; |
@@ -469,24 +469,24 @@ discard block |
||
469 | 469 | socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
470 | 470 | while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
471 | 471 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
472 | - echo 'APRS user verified !'."\n"; |
|
473 | - $this->connected = true; |
|
474 | - return true; |
|
475 | - break; |
|
472 | + echo 'APRS user verified !'."\n"; |
|
473 | + $this->connected = true; |
|
474 | + return true; |
|
475 | + break; |
|
476 | 476 | } |
477 | 477 | if (time()-$authstart > 5) { |
478 | - echo 'APRS timeout'."\n"; |
|
479 | - break; |
|
478 | + echo 'APRS timeout'."\n"; |
|
479 | + break; |
|
480 | 480 | } |
481 | 481 | } |
482 | 482 | } |
483 | - } |
|
483 | + } |
|
484 | 484 | |
485 | - public function disconnect() { |
|
485 | + public function disconnect() { |
|
486 | 486 | socket_close($this->socket); |
487 | - } |
|
487 | + } |
|
488 | 488 | |
489 | - public function send($data) { |
|
489 | + public function send($data) { |
|
490 | 490 | global $globalDebug; |
491 | 491 | if ($this->connected === false) $this->connect(); |
492 | 492 | $send = socket_send( $this->socket , $data , strlen($data),0); |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | socket_close($this->socket); |
496 | 496 | $this->connect(); |
497 | 497 | } |
498 | - } |
|
498 | + } |
|
499 | 499 | } |
500 | 500 | |
501 | 501 | class APRSSpotter extends APRS { |
@@ -90,8 +90,7 @@ discard block |
||
90 | 90 | |
91 | 91 | |
92 | 92 | private function urshift($n, $s) { |
93 | - return ($n >= 0) ? ($n >> $s) : |
|
94 | - (($n & 0x7fffffff) >> $s) | |
|
93 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
95 | 94 | (0x40000000 >> ($s - 1)); |
96 | 95 | } |
97 | 96 | |
@@ -103,7 +102,7 @@ discard block |
||
103 | 102 | //$split_input = str_split($input); |
104 | 103 | |
105 | 104 | /* Find the end of header checking for NULL bytes while doing it. */ |
106 | - $splitpos = strpos($input,':'); |
|
105 | + $splitpos = strpos($input, ':'); |
|
107 | 106 | |
108 | 107 | /* Check that end was found and body has at least one byte. */ |
109 | 108 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -113,15 +112,15 @@ discard block |
||
113 | 112 | |
114 | 113 | if ($debug) echo 'input : '.$input."\n"; |
115 | 114 | /* Save header and body. */ |
116 | - $body = substr($input,$splitpos+1,$input_len); |
|
115 | + $body = substr($input, $splitpos + 1, $input_len); |
|
117 | 116 | $body_len = strlen($body); |
118 | - $header = substr($input,0,$splitpos); |
|
117 | + $header = substr($input, 0, $splitpos); |
|
119 | 118 | //$header_len = strlen($header); |
120 | 119 | if ($debug) echo 'header : '.$header."\n"; |
121 | 120 | |
122 | 121 | /* Parse source, target and path. */ |
123 | 122 | //FLRDF0A52>APRS,qAS,LSTB |
124 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
123 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
125 | 124 | $ident = $matches[1]; |
126 | 125 | $all_elements = $matches[2]; |
127 | 126 | if ($ident == 'AIRCRAFT') { |
@@ -138,14 +137,14 @@ discard block |
||
138 | 137 | if ($debug) 'No ident'."\n"; |
139 | 138 | return false; |
140 | 139 | } |
141 | - $elements = explode(',',$all_elements); |
|
140 | + $elements = explode(',', $all_elements); |
|
142 | 141 | $source = end($elements); |
143 | 142 | $result['source'] = $source; |
144 | 143 | foreach ($elements as $element) { |
145 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
144 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
146 | 145 | //echo "ok"; |
147 | 146 | //if ($element == 'TCPIP*') return false; |
148 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
147 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
149 | 148 | if ($debug) echo 'element : '.$element."\n"; |
150 | 149 | return false; |
151 | 150 | } |
@@ -158,14 +157,14 @@ discard block |
||
158 | 157 | */ |
159 | 158 | } |
160 | 159 | |
161 | - $type = substr($body,0,1); |
|
160 | + $type = substr($body, 0, 1); |
|
162 | 161 | if ($debug) echo 'type : '.$type."\n"; |
163 | 162 | if ($type == ';') { |
164 | 163 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
165 | - $result['address'] = trim(substr($body,1,9)); |
|
164 | + $result['address'] = trim(substr($body, 1, 9)); |
|
166 | 165 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
167 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
168 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
166 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
167 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
169 | 168 | } elseif ($type == ',') { |
170 | 169 | // Invalid data or test data |
171 | 170 | return false; |
@@ -173,24 +172,24 @@ discard block |
||
173 | 172 | |
174 | 173 | // Check for Timestamp |
175 | 174 | $find = false; |
176 | - $body_parse = substr($body,1); |
|
175 | + $body_parse = substr($body, 1); |
|
177 | 176 | //echo 'Body : '.$body."\n"; |
178 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
179 | - $body_parse = substr($body_parse,10); |
|
177 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
178 | + $body_parse = substr($body_parse, 10); |
|
180 | 179 | $find = true; |
181 | 180 | //echo $body_parse."\n"; |
182 | 181 | } |
183 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
184 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
182 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
183 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
185 | 184 | $find = true; |
186 | 185 | //echo $body_parse."\n"; |
187 | 186 | } |
188 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
189 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
187 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
188 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
190 | 189 | $find = true; |
191 | 190 | //echo $body_parse."\n"; |
192 | 191 | } |
193 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
192 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
194 | 193 | $find = true; |
195 | 194 | //print_r($matches); |
196 | 195 | $timestamp = $matches[0]; |
@@ -205,19 +204,19 @@ discard block |
||
205 | 204 | // This work or not ? |
206 | 205 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
207 | 206 | } |
208 | - $body_parse = substr($body_parse,7); |
|
207 | + $body_parse = substr($body_parse, 7); |
|
209 | 208 | $result['timestamp'] = $timestamp; |
210 | 209 | //echo date('Ymd H:i:s',$timestamp); |
211 | 210 | } |
212 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
211 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
213 | 212 | $find = true; |
214 | 213 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
215 | - $body_parse = substr($body_parse,8); |
|
214 | + $body_parse = substr($body_parse, 8); |
|
216 | 215 | $result['timestamp'] = $timestamp; |
217 | 216 | //echo date('Ymd H:i:s',$timestamp); |
218 | 217 | } |
219 | 218 | //if (strlen($body_parse) > 19) { |
220 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
219 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) { |
|
221 | 220 | $find = true; |
222 | 221 | // 4658.70N/00707.78Ez |
223 | 222 | //print_r(str_split($body_parse)); |
@@ -243,11 +242,11 @@ discard block |
||
243 | 242 | */ |
244 | 243 | $latitude = $lat + floatval($lat_min)/60; |
245 | 244 | $longitude = $lon + floatval($lon_min)/60; |
246 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
247 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
245 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
246 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
248 | 247 | $result['latitude'] = $latitude; |
249 | 248 | $result['longitude'] = $longitude; |
250 | - $body_parse = substr($body_parse,18); |
|
249 | + $body_parse = substr($body_parse, 18); |
|
251 | 250 | $body_parse_len = strlen($body_parse); |
252 | 251 | } |
253 | 252 | $body_parse_len = strlen($body_parse); |
@@ -275,7 +274,7 @@ discard block |
||
275 | 274 | //echo $body_parse; |
276 | 275 | //if ($type != ';' && $type != '>') { |
277 | 276 | if ($type != '') { |
278 | - $body_parse = substr($body_parse,1); |
|
277 | + $body_parse = substr($body_parse, 1); |
|
279 | 278 | $body_parse_len = strlen($body_parse); |
280 | 279 | $result['symbol_code'] = $symbol_code; |
281 | 280 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
@@ -286,16 +285,16 @@ discard block |
||
286 | 285 | //$body_parse_len = strlen($body_parse); |
287 | 286 | if ($body_parse_len >= 7) { |
288 | 287 | |
289 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
290 | - $course = substr($body_parse,0,3); |
|
288 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
289 | + $course = substr($body_parse, 0, 3); |
|
291 | 290 | $tmp_s = intval($course); |
292 | 291 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
293 | - $speed = substr($body_parse,4,3); |
|
292 | + $speed = substr($body_parse, 4, 3); |
|
294 | 293 | if ($speed != '...') { |
295 | 294 | //$result['speed'] = round($speed*1.852); |
296 | 295 | $result['speed'] = intval($speed); |
297 | 296 | } |
298 | - $body_parse = substr($body_parse,7); |
|
297 | + $body_parse = substr($body_parse, 7); |
|
299 | 298 | } |
300 | 299 | // Check PHGR, PHG, RNG |
301 | 300 | } |
@@ -305,12 +304,12 @@ discard block |
||
305 | 304 | } |
306 | 305 | */ |
307 | 306 | if (strlen($body_parse) > 0) { |
308 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
307 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
309 | 308 | $altitude = intval($matches[1]); |
310 | 309 | //$result['altitude'] = round($altitude*0.3048); |
311 | 310 | $result['altitude'] = $altitude; |
312 | 311 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
313 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
312 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
314 | 313 | } |
315 | 314 | } |
316 | 315 | |
@@ -322,13 +321,13 @@ discard block |
||
322 | 321 | */ |
323 | 322 | // DAO |
324 | 323 | |
325 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
324 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
326 | 325 | |
327 | 326 | $dao = $matches[1]; |
328 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
327 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
329 | 328 | $dao_split = str_split($dao); |
330 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
331 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
329 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
330 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
332 | 331 | |
333 | 332 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
334 | 333 | else $result['latitude'] += $lat_off; |
@@ -336,50 +335,50 @@ discard block |
||
336 | 335 | else $result['longitude'] += $lon_off; |
337 | 336 | } |
338 | 337 | |
339 | - $body_parse = substr($body_parse,6); |
|
338 | + $body_parse = substr($body_parse, 6); |
|
340 | 339 | } |
341 | 340 | |
342 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
343 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
341 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
342 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
344 | 343 | } |
345 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
344 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
346 | 345 | $result['squawk'] = $matches[1]; |
347 | 346 | } |
348 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
347 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
349 | 348 | $result['aircraft_icao'] = $matches[1]; |
350 | 349 | } |
351 | - if (preg_match('/VR=([0-9]*)/',$body_parse,$matches)) { |
|
350 | + if (preg_match('/VR=([0-9]*)/', $body_parse, $matches)) { |
|
352 | 351 | $result['verticalrate'] = $matches[1]; |
353 | 352 | } |
354 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
353 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
355 | 354 | $result['typeid'] = $matches[1]; |
356 | 355 | } |
357 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
356 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
358 | 357 | $result['statusid'] = $matches[1]; |
359 | 358 | } |
360 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
359 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
361 | 360 | $result['imo'] = $matches[1]; |
362 | 361 | } |
363 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
362 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
364 | 363 | $result['arrival_date'] = $matches[1]; |
365 | 364 | } |
366 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
367 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
365 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
366 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
368 | 367 | } |
369 | 368 | // OGN comment |
370 | 369 | // echo "Before OGN : ".$body_parse."\n"; |
371 | 370 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
372 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
371 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
373 | 372 | $id = $matches[1]; |
374 | 373 | //$mode = substr($id,0,2); |
375 | - $address = substr($id,2); |
|
374 | + $address = substr($id, 2); |
|
376 | 375 | //print_r($matches); |
377 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
376 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
378 | 377 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
379 | 378 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
380 | 379 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
381 | 380 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
382 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
381 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
383 | 382 | $result['aircrafttype_code'] = $aircraftType; |
384 | 383 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
385 | 384 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -396,7 +395,7 @@ discard block |
||
396 | 395 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
397 | 396 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
398 | 397 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
399 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
398 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
400 | 399 | $result['stealth'] = $stealth; |
401 | 400 | $result['address'] = $address; |
402 | 401 | } |
@@ -408,73 +407,73 @@ discard block |
||
408 | 407 | //$body_parse = substr($body_parse,1); |
409 | 408 | //$body_parse_len = strlen($body_parse); |
410 | 409 | |
411 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
410 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
412 | 411 | $result['wind_dir'] = intval($matches[1]); |
413 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
414 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
415 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
416 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
417 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
412 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
413 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
414 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
415 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
416 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
418 | 417 | $result['wind_dir'] = intval($matches[1]); |
419 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
420 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
421 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
422 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
423 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
418 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
419 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
420 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
421 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
422 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
424 | 423 | $result['wind_dir'] = intval($matches[1]); |
425 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
426 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
427 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
428 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
424 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
425 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
426 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
427 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
429 | 428 | $result['wind_dir'] = intval($matches[1]); |
430 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
431 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
432 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
429 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
430 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
431 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
433 | 432 | } |
434 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
435 | - $result['temp'] = round(5/9*(($matches[1])-32),1); |
|
433 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/', $body_parse, $matches)) { |
|
434 | + $result['temp'] = round(5/9*(($matches[1]) - 32), 1); |
|
436 | 435 | } |
437 | 436 | } |
438 | 437 | } else $result['comment'] = trim($body_parse); |
439 | 438 | |
440 | 439 | } |
441 | 440 | //} |
442 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
443 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
441 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
442 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
444 | 443 | if ($debug) print_r($result); |
445 | 444 | return $result; |
446 | 445 | } |
447 | 446 | |
448 | 447 | public function connect() { |
449 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
448 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
450 | 449 | $aprs_connect = 0; |
451 | 450 | $aprs_keep = 120; |
452 | 451 | $aprs_last_tx = time(); |
453 | 452 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
454 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
453 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
455 | 454 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
456 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
455 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
457 | 456 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
458 | 457 | else $aprs_pass = '-1'; |
459 | 458 | |
460 | - $aprs_filter = ''; |
|
459 | + $aprs_filter = ''; |
|
461 | 460 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
462 | 461 | $Common = new Common(); |
463 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
462 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
464 | 463 | if ($s !== false) { |
465 | 464 | echo 'Connected to APRS server! '."\n"; |
466 | 465 | $authstart = time(); |
467 | 466 | $this->socket = $s; |
468 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
469 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
470 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
467 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
468 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
469 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
471 | 470 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
472 | 471 | echo 'APRS user verified !'."\n"; |
473 | 472 | $this->connected = true; |
474 | 473 | return true; |
475 | 474 | break; |
476 | 475 | } |
477 | - if (time()-$authstart > 5) { |
|
476 | + if (time() - $authstart > 5) { |
|
478 | 477 | echo 'APRS timeout'."\n"; |
479 | 478 | break; |
480 | 479 | } |
@@ -489,7 +488,7 @@ discard block |
||
489 | 488 | public function send($data) { |
490 | 489 | global $globalDebug; |
491 | 490 | if ($this->connected === false) $this->connect(); |
492 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
491 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
493 | 492 | if ($send === FALSE) { |
494 | 493 | if ($globalDebug) echo 'Reconnect...'; |
495 | 494 | socket_close($this->socket); |
@@ -499,14 +498,14 @@ discard block |
||
499 | 498 | } |
500 | 499 | |
501 | 500 | class APRSSpotter extends APRS { |
502 | - public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) { |
|
501 | + public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) { |
|
503 | 502 | $Common = new Common(); |
504 | 503 | if ($latitude != '' && $longitude != '') { |
505 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
506 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
507 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
508 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
509 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
504 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
505 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
506 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
507 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
508 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
510 | 509 | $w = $w1.$w2; |
511 | 510 | //$w = '00'; |
512 | 511 | $custom = ''; |
@@ -527,25 +526,25 @@ discard block |
||
527 | 526 | $custom .= 'AI='.$aircraft_icao; |
528 | 527 | } |
529 | 528 | if ($custom != '') $custom = ' '.$custom; |
530 | - $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
529 | + $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
531 | 530 | } |
532 | 531 | } |
533 | 532 | } |
534 | 533 | class APRSMarine extends APRS { |
535 | - public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) { |
|
534 | + public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) { |
|
536 | 535 | $Common = new Common(); |
537 | 536 | if ($latitude != '' && $longitude != '') { |
538 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
539 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
540 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
541 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
542 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
537 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
538 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
539 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
540 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
541 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
543 | 542 | $w = $w1.$w2; |
544 | 543 | //$w = '00'; |
545 | 544 | $custom = ''; |
546 | 545 | if ($ident != '') { |
547 | 546 | if ($custom != '') $custom .= '/'; |
548 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
547 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
549 | 548 | } |
550 | 549 | if ($typeid != '') { |
551 | 550 | if ($custom != '') $custom .= '/'; |
@@ -565,11 +564,11 @@ discard block |
||
565 | 564 | } |
566 | 565 | if ($arrival_code != '') { |
567 | 566 | if ($custom != '') $custom .= '/'; |
568 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
567 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
569 | 568 | } |
570 | 569 | if ($custom != '') $custom = ' '.$custom; |
571 | 570 | $altitude = 0; |
572 | - $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
571 | + $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
573 | 572 | } |
574 | 573 | } |
575 | 574 | } |
@@ -107,17 +107,23 @@ discard block |
||
107 | 107 | |
108 | 108 | /* Check that end was found and body has at least one byte. */ |
109 | 109 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
110 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
110 | + if ($globalDebug) { |
|
111 | + echo '!!! APRS invalid : '.$input."\n"; |
|
112 | + } |
|
111 | 113 | return false; |
112 | 114 | } |
113 | 115 | |
114 | - if ($debug) echo 'input : '.$input."\n"; |
|
116 | + if ($debug) { |
|
117 | + echo 'input : '.$input."\n"; |
|
118 | + } |
|
115 | 119 | /* Save header and body. */ |
116 | 120 | $body = substr($input,$splitpos+1,$input_len); |
117 | 121 | $body_len = strlen($body); |
118 | 122 | $header = substr($input,0,$splitpos); |
119 | 123 | //$header_len = strlen($header); |
120 | - if ($debug) echo 'header : '.$header."\n"; |
|
124 | + if ($debug) { |
|
125 | + echo 'header : '.$header."\n"; |
|
126 | + } |
|
121 | 127 | |
122 | 128 | /* Parse source, target and path. */ |
123 | 129 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -131,11 +137,15 @@ discard block |
||
131 | 137 | $result['format_source'] = 'famaprs'; |
132 | 138 | $result['source_type'] = 'ais'; |
133 | 139 | } else { |
134 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
140 | + if ($debug) { |
|
141 | + echo 'ident : '.$ident."\n"; |
|
142 | + } |
|
135 | 143 | $result['ident'] = $ident; |
136 | 144 | } |
137 | 145 | } else { |
138 | - if ($debug) 'No ident'."\n"; |
|
146 | + if ($debug) { |
|
147 | + 'No ident'."\n"; |
|
148 | + } |
|
139 | 149 | return false; |
140 | 150 | } |
141 | 151 | $elements = explode(',',$all_elements); |
@@ -146,7 +156,9 @@ discard block |
||
146 | 156 | //echo "ok"; |
147 | 157 | //if ($element == 'TCPIP*') return false; |
148 | 158 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
149 | - if ($debug) echo 'element : '.$element."\n"; |
|
159 | + if ($debug) { |
|
160 | + echo 'element : '.$element."\n"; |
|
161 | + } |
|
150 | 162 | return false; |
151 | 163 | } |
152 | 164 | /* |
@@ -159,13 +171,17 @@ discard block |
||
159 | 171 | } |
160 | 172 | |
161 | 173 | $type = substr($body,0,1); |
162 | - if ($debug) echo 'type : '.$type."\n"; |
|
174 | + if ($debug) { |
|
175 | + echo 'type : '.$type."\n"; |
|
176 | + } |
|
163 | 177 | if ($type == ';') { |
164 | 178 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
165 | 179 | $result['address'] = trim(substr($body,1,9)); |
166 | 180 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
167 | 181 | $result['mmsi'] = trim(substr($body,1,9)); |
168 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
182 | + } else { |
|
183 | + $result['ident'] = trim(substr($body,1,9)); |
|
184 | + } |
|
169 | 185 | } elseif ($type == ',') { |
170 | 186 | // Invalid data or test data |
171 | 187 | return false; |
@@ -233,7 +249,9 @@ discard block |
||
233 | 249 | //$symbol_table = $matches[4]; |
234 | 250 | $lat = intval($lat_deg); |
235 | 251 | $lon = intval($lon_deg); |
236 | - if ($lat > 89 || $lon > 179) return false; |
|
252 | + if ($lat > 89 || $lon > 179) { |
|
253 | + return false; |
|
254 | + } |
|
237 | 255 | |
238 | 256 | /* |
239 | 257 | $tmp_5b = str_replace('.','',$lat_min); |
@@ -243,8 +261,12 @@ discard block |
||
243 | 261 | */ |
244 | 262 | $latitude = $lat + floatval($lat_min)/60; |
245 | 263 | $longitude = $lon + floatval($lon_min)/60; |
246 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
247 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
264 | + if ($sind == 'S') { |
|
265 | + $latitude = 0-$latitude; |
|
266 | + } |
|
267 | + if ($wind == 'W') { |
|
268 | + $longitude = 0-$longitude; |
|
269 | + } |
|
248 | 270 | $result['latitude'] = $latitude; |
249 | 271 | $result['longitude'] = $longitude; |
250 | 272 | $body_parse = substr($body_parse,18); |
@@ -278,7 +300,9 @@ discard block |
||
278 | 300 | $body_parse = substr($body_parse,1); |
279 | 301 | $body_parse_len = strlen($body_parse); |
280 | 302 | $result['symbol_code'] = $symbol_code; |
281 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
303 | + if (isset($this->symbols[$symbol_code])) { |
|
304 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
305 | + } |
|
282 | 306 | if ($symbol_code != '_') { |
283 | 307 | } |
284 | 308 | //$body_parse = substr($body_parse,1); |
@@ -289,7 +313,9 @@ discard block |
||
289 | 313 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
290 | 314 | $course = substr($body_parse,0,3); |
291 | 315 | $tmp_s = intval($course); |
292 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
316 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
317 | + $result['heading'] = intval($course); |
|
318 | + } |
|
293 | 319 | $speed = substr($body_parse,4,3); |
294 | 320 | if ($speed != '...') { |
295 | 321 | //$result['speed'] = round($speed*1.852); |
@@ -330,10 +356,16 @@ discard block |
||
330 | 356 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
331 | 357 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
332 | 358 | |
333 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
334 | - else $result['latitude'] += $lat_off; |
|
335 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
336 | - else $result['longitude'] += $lon_off; |
|
359 | + if ($result['latitude'] < 0) { |
|
360 | + $result['latitude'] -= $lat_off; |
|
361 | + } else { |
|
362 | + $result['latitude'] += $lat_off; |
|
363 | + } |
|
364 | + if ($result['longitude'] < 0) { |
|
365 | + $result['longitude'] -= $lon_off; |
|
366 | + } else { |
|
367 | + $result['longitude'] += $lon_off; |
|
368 | + } |
|
337 | 369 | } |
338 | 370 | |
339 | 371 | $body_parse = substr($body_parse,6); |
@@ -375,27 +407,48 @@ discard block |
||
375 | 407 | $address = substr($id,2); |
376 | 408 | //print_r($matches); |
377 | 409 | $addressType = (intval(substr($id,0,2),16))&3; |
378 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
379 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
380 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
381 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
410 | + if ($addressType == 0) { |
|
411 | + $result['addresstype'] = "RANDOM"; |
|
412 | + } elseif ($addressType == 1) { |
|
413 | + $result['addresstype'] = "ICAO"; |
|
414 | + } elseif ($addressType == 2) { |
|
415 | + $result['addresstype'] = "FLARM"; |
|
416 | + } elseif ($addressType == 3) { |
|
417 | + $result['addresstype'] = "OGN"; |
|
418 | + } |
|
382 | 419 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
383 | 420 | $result['aircrafttype_code'] = $aircraftType; |
384 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
385 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
386 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
387 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
388 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
389 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
390 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
391 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
392 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
393 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
394 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
395 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
396 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
397 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
398 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
421 | + if ($aircraftType == 0) { |
|
422 | + $result['aircrafttype'] = "UNKNOWN"; |
|
423 | + } elseif ($aircraftType == 1) { |
|
424 | + $result['aircrafttype'] = "GLIDER"; |
|
425 | + } elseif ($aircraftType == 2) { |
|
426 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
427 | + } elseif ($aircraftType == 3) { |
|
428 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
429 | + } elseif ($aircraftType == 4) { |
|
430 | + $result['aircrafttype'] = "PARACHUTE"; |
|
431 | + } elseif ($aircraftType == 5) { |
|
432 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
433 | + } elseif ($aircraftType == 6) { |
|
434 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
435 | + } elseif ($aircraftType == 7) { |
|
436 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
437 | + } elseif ($aircraftType == 8) { |
|
438 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
439 | + } elseif ($aircraftType == 9) { |
|
440 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
441 | + } elseif ($aircraftType == 10) { |
|
442 | + $result['aircrafttype'] = "UFO"; |
|
443 | + } elseif ($aircraftType == 11) { |
|
444 | + $result['aircrafttype'] = "BALLOON"; |
|
445 | + } elseif ($aircraftType == 12) { |
|
446 | + $result['aircrafttype'] = "AIRSHIP"; |
|
447 | + } elseif ($aircraftType == 13) { |
|
448 | + $result['aircrafttype'] = "UAV"; |
|
449 | + } elseif ($aircraftType == 15) { |
|
450 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
451 | + } |
|
399 | 452 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
400 | 453 | $result['stealth'] = $stealth; |
401 | 454 | $result['address'] = $address; |
@@ -435,13 +488,21 @@ discard block |
||
435 | 488 | $result['temp'] = round(5/9*(($matches[1])-32),1); |
436 | 489 | } |
437 | 490 | } |
438 | - } else $result['comment'] = trim($body_parse); |
|
491 | + } else { |
|
492 | + $result['comment'] = trim($body_parse); |
|
493 | + } |
|
439 | 494 | |
440 | 495 | } |
441 | 496 | //} |
442 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
443 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
444 | - if ($debug) print_r($result); |
|
497 | + if (isset($result['latitude'])) { |
|
498 | + $result['latitude'] = round($result['latitude'],4); |
|
499 | + } |
|
500 | + if (isset($result['longitude'])) { |
|
501 | + $result['longitude'] = round($result['longitude'],4); |
|
502 | + } |
|
503 | + if ($debug) { |
|
504 | + print_r($result); |
|
505 | + } |
|
445 | 506 | return $result; |
446 | 507 | } |
447 | 508 | |
@@ -450,12 +511,21 @@ discard block |
||
450 | 511 | $aprs_connect = 0; |
451 | 512 | $aprs_keep = 120; |
452 | 513 | $aprs_last_tx = time(); |
453 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
454 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
455 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
456 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
457 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
458 | - else $aprs_pass = '-1'; |
|
514 | + if (isset($globalAPRSversion)) { |
|
515 | + $aprs_version = $globalAPRSversion; |
|
516 | + } else { |
|
517 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
518 | + } |
|
519 | + if (isset($globalServerAPRSssid)) { |
|
520 | + $aprs_ssid = $globalServerAPRSssid; |
|
521 | + } else { |
|
522 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
523 | + } |
|
524 | + if (isset($globalServerAPRSpass)) { |
|
525 | + $aprs_pass = $globalServerAPRSpass; |
|
526 | + } else { |
|
527 | + $aprs_pass = '-1'; |
|
528 | + } |
|
459 | 529 | |
460 | 530 | $aprs_filter = ''; |
461 | 531 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
@@ -488,10 +558,14 @@ discard block |
||
488 | 558 | |
489 | 559 | public function send($data) { |
490 | 560 | global $globalDebug; |
491 | - if ($this->connected === false) $this->connect(); |
|
561 | + if ($this->connected === false) { |
|
562 | + $this->connect(); |
|
563 | + } |
|
492 | 564 | $send = socket_send( $this->socket , $data , strlen($data),0); |
493 | 565 | if ($send === FALSE) { |
494 | - if ($globalDebug) echo 'Reconnect...'; |
|
566 | + if ($globalDebug) { |
|
567 | + echo 'Reconnect...'; |
|
568 | + } |
|
495 | 569 | socket_close($this->socket); |
496 | 570 | $this->connect(); |
497 | 571 | } |
@@ -511,22 +585,32 @@ discard block |
||
511 | 585 | //$w = '00'; |
512 | 586 | $custom = ''; |
513 | 587 | if ($ident != '') { |
514 | - if ($custom != '') $custom .= '/'; |
|
588 | + if ($custom != '') { |
|
589 | + $custom .= '/'; |
|
590 | + } |
|
515 | 591 | $custom .= 'CS='.$ident; |
516 | 592 | } |
517 | 593 | if ($squawk != '') { |
518 | - if ($custom != '') $custom .= '/'; |
|
594 | + if ($custom != '') { |
|
595 | + $custom .= '/'; |
|
596 | + } |
|
519 | 597 | $custom .= 'SQ='.$squawk; |
520 | 598 | } |
521 | 599 | if ($verticalrate != '') { |
522 | - if ($custom != '') $custom .= '/'; |
|
600 | + if ($custom != '') { |
|
601 | + $custom .= '/'; |
|
602 | + } |
|
523 | 603 | $custom .= 'VR='.$verticalrate; |
524 | 604 | } |
525 | 605 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
526 | - if ($custom != '') $custom .= '/'; |
|
606 | + if ($custom != '') { |
|
607 | + $custom .= '/'; |
|
608 | + } |
|
527 | 609 | $custom .= 'AI='.$aircraft_icao; |
528 | 610 | } |
529 | - if ($custom != '') $custom = ' '.$custom; |
|
611 | + if ($custom != '') { |
|
612 | + $custom = ' '.$custom; |
|
613 | + } |
|
530 | 614 | $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
531 | 615 | } |
532 | 616 | } |
@@ -544,30 +628,44 @@ discard block |
||
544 | 628 | //$w = '00'; |
545 | 629 | $custom = ''; |
546 | 630 | if ($ident != '') { |
547 | - if ($custom != '') $custom .= '/'; |
|
631 | + if ($custom != '') { |
|
632 | + $custom .= '/'; |
|
633 | + } |
|
548 | 634 | $custom .= 'CS='.str_replace(' ','_',$ident); |
549 | 635 | } |
550 | 636 | if ($typeid != '') { |
551 | - if ($custom != '') $custom .= '/'; |
|
637 | + if ($custom != '') { |
|
638 | + $custom .= '/'; |
|
639 | + } |
|
552 | 640 | $custom .= 'TI='.$typeid; |
553 | 641 | } |
554 | 642 | if ($statusid != '') { |
555 | - if ($custom != '') $custom .= '/'; |
|
643 | + if ($custom != '') { |
|
644 | + $custom .= '/'; |
|
645 | + } |
|
556 | 646 | $custom .= 'SI='.$statusid; |
557 | 647 | } |
558 | 648 | if ($imo != '') { |
559 | - if ($custom != '') $custom .= '/'; |
|
649 | + if ($custom != '') { |
|
650 | + $custom .= '/'; |
|
651 | + } |
|
560 | 652 | $custom .= 'IMO='.$imo; |
561 | 653 | } |
562 | 654 | if ($arrival_date != '') { |
563 | - if ($custom != '') $custom .= '/'; |
|
655 | + if ($custom != '') { |
|
656 | + $custom .= '/'; |
|
657 | + } |
|
564 | 658 | $custom .= 'AD='.strtotime($arrival_date); |
565 | 659 | } |
566 | 660 | if ($arrival_code != '') { |
567 | - if ($custom != '') $custom .= '/'; |
|
661 | + if ($custom != '') { |
|
662 | + $custom .= '/'; |
|
663 | + } |
|
568 | 664 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
569 | 665 | } |
570 | - if ($custom != '') $custom = ' '.$custom; |
|
666 | + if ($custom != '') { |
|
667 | + $custom = ' '.$custom; |
|
668 | + } |
|
571 | 669 | $altitude = 0; |
572 | 670 | $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
573 | 671 | } |
@@ -308,18 +308,18 @@ discard block |
||
308 | 308 | </tr> |
309 | 309 | <!-- |
310 | 310 | <?php |
311 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
312 | - $Connection = new Connection(); |
|
311 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
312 | + $Connection = new Connection(); |
|
313 | 313 | ?> |
314 | 314 | --> |
315 | 315 | <?php |
316 | - if ($Connection->db != NULL) { |
|
316 | + if ($Connection->db != NULL) { |
|
317 | 317 | if ($Connection->tableExists('source_location')) { |
318 | - require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
319 | - $Source = new Source(); |
|
320 | - //$alllocations = $Source->getAllLocationInfo(); |
|
321 | - $alllocations = $Source->getLocationInfobyType(''); |
|
322 | - foreach ($alllocations as $location) { |
|
318 | + require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
319 | + $Source = new Source(); |
|
320 | + //$alllocations = $Source->getAllLocationInfo(); |
|
321 | + $alllocations = $Source->getLocationInfobyType(''); |
|
322 | + foreach ($alllocations as $location) { |
|
323 | 323 | ?> |
324 | 324 | <tr> |
325 | 325 | <input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" /> |
@@ -333,9 +333,9 @@ discard block |
||
333 | 333 | </tr> |
334 | 334 | |
335 | 335 | <?php |
336 | - } |
|
336 | + } |
|
337 | + } |
|
337 | 338 | } |
338 | - } |
|
339 | 339 | ?> |
340 | 340 | |
341 | 341 | <tr> |
@@ -442,12 +442,12 @@ discard block |
||
442 | 442 | ?> |
443 | 443 | <tr> |
444 | 444 | <?php |
445 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
445 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
446 | 446 | ?> |
447 | 447 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
448 | 448 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
449 | 449 | <?php |
450 | - } else { |
|
450 | + } else { |
|
451 | 451 | $hostport = explode(':',$source['host']); |
452 | 452 | if (isset($hostport[1])) { |
453 | 453 | $host = $hostport[0]; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
461 | 461 | <td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td> |
462 | 462 | <?php |
463 | - } |
|
463 | + } |
|
464 | 464 | ?> |
465 | 465 | <td> |
466 | 466 | <select name="format[]" id="format"> |
@@ -812,7 +812,7 @@ discard block |
||
812 | 812 | <br /> |
813 | 813 | <p> |
814 | 814 | <?php |
815 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
815 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
816 | 816 | ?> |
817 | 817 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
818 | 818 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -822,11 +822,11 @@ discard block |
||
822 | 822 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
823 | 823 | <?php |
824 | 824 | } |
825 | - } else { |
|
825 | + } else { |
|
826 | 826 | ?> |
827 | 827 | <b>PHP GD is not installed, you can t change color of aircraft icon on map</b> |
828 | 828 | <?php |
829 | - } |
|
829 | + } |
|
830 | 830 | ?> |
831 | 831 | </p> |
832 | 832 | <br /> |
@@ -850,7 +850,7 @@ discard block |
||
850 | 850 | </p> |
851 | 851 | <?php |
852 | 852 | require('../footer.php'); |
853 | - exit; |
|
853 | + exit; |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | $settings = array(); |
@@ -940,8 +940,8 @@ discard block |
||
940 | 940 | |
941 | 941 | $sources = array(); |
942 | 942 | foreach ($source_name as $keys => $name) { |
943 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
944 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
943 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
944 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
945 | 945 | } |
946 | 946 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
947 | 947 | |
@@ -1296,14 +1296,14 @@ discard block |
||
1296 | 1296 | |
1297 | 1297 | // Set some defaults values... |
1298 | 1298 | if (!isset($globalAircraftImageSources)) { |
1299 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1300 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1299 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1300 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1301 | 1301 | } |
1302 | 1302 | |
1303 | 1303 | if (!isset($globalSchedulesSources)) { |
1304 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1305 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1306 | - } |
|
1304 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1305 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1306 | + } |
|
1307 | 1307 | |
1308 | 1308 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1309 | 1309 | |
@@ -1355,21 +1355,21 @@ discard block |
||
1355 | 1355 | $popi = false; |
1356 | 1356 | $popw = false; |
1357 | 1357 | foreach ($_SESSION['done'] as $done) { |
1358 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1359 | - if ($done == 'Create database') $pop = true; |
|
1360 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1361 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1362 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1358 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1359 | + if ($done == 'Create database') $pop = true; |
|
1360 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1361 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1362 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1363 | 1363 | } |
1364 | 1364 | if ($pop) { |
1365 | - sleep(5); |
|
1366 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1365 | + sleep(5); |
|
1366 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1367 | 1367 | } else if ($popi) { |
1368 | - sleep(5); |
|
1369 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1368 | + sleep(5); |
|
1369 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1370 | 1370 | } else if ($popw) { |
1371 | - sleep(5); |
|
1372 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1371 | + sleep(5); |
|
1372 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1373 | 1373 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1374 | 1374 | print '</div></ul>'; |
1375 | 1375 | print '<div id="error"></div>'; |
@@ -1432,7 +1432,7 @@ discard block |
||
1432 | 1432 | unset($_COOKIE['install']); |
1433 | 1433 | print '<div class="info column"><ul>'; |
1434 | 1434 | foreach ($_SESSION['done'] as $done) { |
1435 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1435 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1436 | 1436 | } |
1437 | 1437 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1438 | 1438 | print '</ul></div>'; |
@@ -131,45 +131,72 @@ discard block |
||
131 | 131 | </div> |
132 | 132 | <p> |
133 | 133 | <label for="dbhost">Database hostname</label> |
134 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
134 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
135 | + print $globalDBhost; |
|
136 | +} |
|
137 | +?>" /> |
|
135 | 138 | </p> |
136 | 139 | <p> |
137 | 140 | <label for="dbport">Database port</label> |
138 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
141 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
142 | + print $globalDBport; |
|
143 | +} |
|
144 | +?>" /> |
|
139 | 145 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
140 | 146 | </p> |
141 | 147 | <p> |
142 | 148 | <label for="dbname">Database name</label> |
143 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
149 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
150 | + print $globalDBname; |
|
151 | +} |
|
152 | +?>" /> |
|
144 | 153 | </p> |
145 | 154 | <p> |
146 | 155 | <label for="dbuser">Database user</label> |
147 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
156 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
157 | + print $globalDBuser; |
|
158 | +} |
|
159 | +?>" /> |
|
148 | 160 | </p> |
149 | 161 | <p> |
150 | 162 | <label for="dbuserpass">Database user password</label> |
151 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
163 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
164 | + print $globalDBpass; |
|
165 | +} |
|
166 | +?>" /> |
|
152 | 167 | </p> |
153 | 168 | </fieldset> |
154 | 169 | <fieldset id="site"> |
155 | 170 | <legend>Site configuration</legend> |
156 | 171 | <p> |
157 | 172 | <label for="sitename">Site name</label> |
158 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
173 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
174 | + print $globalName; |
|
175 | +} |
|
176 | +?>" /> |
|
159 | 177 | </p> |
160 | 178 | <p> |
161 | 179 | <label for="siteurl">Site directory</label> |
162 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
180 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
181 | + print $globalURL; |
|
182 | +} |
|
183 | +?>" /> |
|
163 | 184 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
164 | 185 | </p> |
165 | 186 | <p> |
166 | 187 | <label for="timezone">Timezone</label> |
167 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
188 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
189 | + print $globalTimezone; |
|
190 | +} |
|
191 | +?>" /> |
|
168 | 192 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
169 | 193 | </p> |
170 | 194 | <p> |
171 | 195 | <label for="language">Language</label> |
172 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
196 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
197 | + print $globalLanguage; |
|
198 | +} |
|
199 | +?>" /> |
|
173 | 200 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
174 | 201 | </p> |
175 | 202 | </fieldset> |
@@ -190,11 +217,17 @@ discard block |
||
190 | 217 | <div id="mapbox_data"> |
191 | 218 | <p> |
192 | 219 | <label for="mapboxid">Mapbox id</label> |
193 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
220 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
221 | + print $globalMapboxId; |
|
222 | +} |
|
223 | +?>" /> |
|
194 | 224 | </p> |
195 | 225 | <p> |
196 | 226 | <label for="mapboxtoken">Mapbox token</label> |
197 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
227 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
228 | + print $globalMapboxToken; |
|
229 | +} |
|
230 | +?>" /> |
|
198 | 231 | </p> |
199 | 232 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
200 | 233 | </div> |
@@ -202,7 +235,10 @@ discard block |
||
202 | 235 | <div id="google_data"> |
203 | 236 | <p> |
204 | 237 | <label for="googlekey">Google API key</label> |
205 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
238 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
239 | + print $globalGoogleAPIKey; |
|
240 | +} |
|
241 | +?>" /> |
|
206 | 242 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
207 | 243 | </p> |
208 | 244 | </div> |
@@ -210,7 +246,10 @@ discard block |
||
210 | 246 | <div id="bing_data"> |
211 | 247 | <p> |
212 | 248 | <label for="bingkey">Bing Map key</label> |
213 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
249 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
250 | + print $globalBingMapKey; |
|
251 | +} |
|
252 | +?>" /> |
|
214 | 253 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
215 | 254 | </p> |
216 | 255 | </div> |
@@ -218,7 +257,10 @@ discard block |
||
218 | 257 | <div id="mapquest_data"> |
219 | 258 | <p> |
220 | 259 | <label for="mapquestkey">MapQuest key</label> |
221 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
260 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
261 | + print $globalMapQuestKey; |
|
262 | +} |
|
263 | +?>" /> |
|
222 | 264 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
223 | 265 | </p> |
224 | 266 | </div> |
@@ -226,11 +268,17 @@ discard block |
||
226 | 268 | <div id="here_data"> |
227 | 269 | <p> |
228 | 270 | <label for="hereappid">Here App_Id</label> |
229 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
271 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
272 | + print $globalHereappId; |
|
273 | +} |
|
274 | +?>" /> |
|
230 | 275 | </p> |
231 | 276 | <p> |
232 | 277 | <label for="hereappcode">Here App_Code</label> |
233 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
278 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
279 | + print $globalHereappCode; |
|
280 | +} |
|
281 | +?>" /> |
|
234 | 282 | </p> |
235 | 283 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
236 | 284 | </div> |
@@ -238,7 +286,10 @@ discard block |
||
238 | 286 | <div id="openweathermap_data"> |
239 | 287 | <p> |
240 | 288 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
241 | - <input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
289 | + <input type="text" name="oepnweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
290 | + print $globalOpenWeatherMapKey; |
|
291 | +} |
|
292 | +?>" /> |
|
242 | 293 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
243 | 294 | </p> |
244 | 295 | </div> |
@@ -248,42 +299,86 @@ discard block |
||
248 | 299 | <legend>Coverage area</legend> |
249 | 300 | <p> |
250 | 301 | <label for="latitudemax">The maximum latitude (north)</label> |
251 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
302 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
303 | + print $globalLatitudeMax; |
|
304 | +} |
|
305 | +?>" /> |
|
252 | 306 | </p> |
253 | 307 | <p> |
254 | 308 | <label for="latitudemin">The minimum latitude (south)</label> |
255 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
309 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
310 | + print $globalLatitudeMin; |
|
311 | +} |
|
312 | +?>" /> |
|
256 | 313 | </p> |
257 | 314 | <p> |
258 | 315 | <label for="longitudemax">The maximum longitude (west)</label> |
259 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
316 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
317 | + print $globalLongitudeMax; |
|
318 | +} |
|
319 | +?>" /> |
|
260 | 320 | </p> |
261 | 321 | <p> |
262 | 322 | <label for="longitudemin">The minimum longitude (east)</label> |
263 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
323 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
324 | + print $globalLongitudeMin; |
|
325 | +} |
|
326 | +?>" /> |
|
264 | 327 | </p> |
265 | 328 | <p> |
266 | 329 | <label for="latitudecenter">The latitude center</label> |
267 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
330 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
331 | + print $globalCenterLatitude; |
|
332 | +} |
|
333 | +?>" /> |
|
268 | 334 | </p> |
269 | 335 | <p> |
270 | 336 | <label for="longitudecenter">The longitude center</label> |
271 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
337 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
338 | + print $globalCenterLongitude; |
|
339 | +} |
|
340 | +?>" /> |
|
272 | 341 | </p> |
273 | 342 | <p> |
274 | 343 | <label for="livezoom">Default Zoom on live map</label> |
275 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
344 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
345 | + print $globalLiveZoom; |
|
346 | +} else { |
|
347 | + print '9'; |
|
348 | +} |
|
349 | +?>" /> |
|
276 | 350 | </p> |
277 | 351 | <p> |
278 | 352 | <label for="squawk_country">Country for squawk usage</label> |
279 | 353 | <select name="squawk_country" id="squawk_country"> |
280 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
281 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
282 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
283 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
284 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
285 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
286 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
354 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
355 | + print ' selected '; |
|
356 | +} |
|
357 | +?>>UK</option> |
|
358 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
359 | + print ' selected '; |
|
360 | +} |
|
361 | +?>>NZ</option> |
|
362 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
363 | + print ' selected '; |
|
364 | +} |
|
365 | +?>>US</option> |
|
366 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
367 | + print ' selected '; |
|
368 | +} |
|
369 | +?>>AU</option> |
|
370 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
371 | + print ' selected '; |
|
372 | +} |
|
373 | +?>>NL</option> |
|
374 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
375 | + print ' selected '; |
|
376 | +} |
|
377 | +?>>FR</option> |
|
378 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
379 | + print ' selected '; |
|
380 | +} |
|
381 | +?>>TR</option> |
|
287 | 382 | </select> |
288 | 383 | </p> |
289 | 384 | </fieldset> |
@@ -292,15 +387,24 @@ discard block |
||
292 | 387 | <p><i>Only put in DB flights that are inside a circle</i></p> |
293 | 388 | <p> |
294 | 389 | <label for="latitude">Center latitude</label> |
295 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
390 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
391 | + echo $globalDistanceIgnore['latitude']; |
|
392 | +} |
|
393 | +?>" /> |
|
296 | 394 | </p> |
297 | 395 | <p> |
298 | 396 | <label for="longitude">Center longitude</label> |
299 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
397 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
398 | + echo $globalDistanceIgnore['longitude']; |
|
399 | +} |
|
400 | +?>" /> |
|
300 | 401 | </p> |
301 | 402 | <p> |
302 | 403 | <label for="Distance">Distance (in km)</label> |
303 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
404 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
405 | + echo $globalDistanceIgnore['distance']; |
|
406 | +} |
|
407 | +?>" /> |
|
304 | 408 | </p> |
305 | 409 | </fieldset> |
306 | 410 | <fieldset id="sourceloc"> |
@@ -409,11 +513,17 @@ discard block |
||
409 | 513 | <div id="flightaware_data"> |
410 | 514 | <p> |
411 | 515 | <label for="flightawareusername">FlightAware username</label> |
412 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
516 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
517 | + print $globalFlightAwareUsername; |
|
518 | +} |
|
519 | +?>" /> |
|
413 | 520 | </p> |
414 | 521 | <p> |
415 | 522 | <label for="flightawarepassword">FlightAware password/API key</label> |
416 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
523 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
524 | + print $globalFlightAwarePassword; |
|
525 | +} |
|
526 | +?>" /> |
|
417 | 527 | </p> |
418 | 528 | </div> |
419 | 529 | --> |
@@ -473,29 +583,92 @@ discard block |
||
473 | 583 | ?> |
474 | 584 | <td> |
475 | 585 | <select name="format[]" id="format"> |
476 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
477 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
478 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
479 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
480 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
481 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
482 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
483 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
484 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
485 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
486 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
487 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
488 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
489 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
490 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
491 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
492 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
493 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
586 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
587 | + print 'selected'; |
|
588 | +} |
|
589 | +?>>Auto</option> |
|
590 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
591 | + print 'selected'; |
|
592 | +} |
|
593 | +?>>SBS</option> |
|
594 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
595 | + print 'selected'; |
|
596 | +} |
|
597 | +?>>TSV</option> |
|
598 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
599 | + print 'selected'; |
|
600 | +} |
|
601 | +?>>Raw</option> |
|
602 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
603 | + print 'selected'; |
|
604 | +} |
|
605 | +?>>APRS</option> |
|
606 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
607 | + print 'selected'; |
|
608 | +} |
|
609 | +?>>Radarcape deltadb.txt</option> |
|
610 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
611 | + print 'selected'; |
|
612 | +} |
|
613 | +?>>Vatsim</option> |
|
614 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
615 | + print 'selected'; |
|
616 | +} |
|
617 | +?>>Virtual Radar Server AircraftList.json</option> |
|
618 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
619 | + print 'selected'; |
|
620 | +} |
|
621 | +?>>Virtual Radar Server TCP</option> |
|
622 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
623 | + print 'selected'; |
|
624 | +} |
|
625 | +?>>phpVMS</option> |
|
626 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
627 | + print 'selected'; |
|
628 | +} |
|
629 | +?>>Virtual Airlines Manager</option> |
|
630 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
631 | + print 'selected'; |
|
632 | +} |
|
633 | +?>>IVAO</option> |
|
634 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
635 | + print 'selected'; |
|
636 | +} |
|
637 | +?>>FlightGear Multiplayer</option> |
|
638 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
639 | + print 'selected'; |
|
640 | +} |
|
641 | +?>>FlightGear Singleplayer</option> |
|
642 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
643 | + print 'selected'; |
|
644 | +} |
|
645 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
646 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
647 | + print 'selected'; |
|
648 | +} |
|
649 | +?>>ACARS SBS-3 over TCP</option> |
|
650 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
651 | + print 'selected'; |
|
652 | +} |
|
653 | +?>>NMEA AIS over TCP</option> |
|
654 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
655 | + print 'selected'; |
|
656 | +} |
|
657 | +?>>AirWhere website</option> |
|
494 | 658 | </select> |
495 | 659 | </td> |
496 | - <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td> |
|
497 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
498 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
660 | + <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
661 | + print $source['name']; |
|
662 | +} |
|
663 | +?>" /></td> |
|
664 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
665 | + print 'checked'; |
|
666 | +} |
|
667 | +?> /></td> |
|
668 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
669 | + print 'checked'; |
|
670 | +} |
|
671 | +?> /></td> |
|
499 | 672 | <td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td> |
500 | 673 | </tr> |
501 | 674 | <?php |
@@ -545,11 +718,17 @@ discard block |
||
545 | 718 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
546 | 719 | <p> |
547 | 720 | <label for="acarshost">ACARS UDP host</label> |
548 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
721 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
722 | + print $globalACARSHost; |
|
723 | +} |
|
724 | +?>" /> |
|
549 | 725 | </p> |
550 | 726 | <p> |
551 | 727 | <label for="acarsport">ACARS UDP port</label> |
552 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
728 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
729 | + print $globalACARSPort; |
|
730 | +} |
|
731 | +?>" /> |
|
553 | 732 | </p> |
554 | 733 | </fieldset> |
555 | 734 | </div> |
@@ -629,13 +808,19 @@ discard block |
||
629 | 808 | <div id="schedules_options"> |
630 | 809 | <p> |
631 | 810 | <label for="britishairways">British Airways API Key</label> |
632 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
811 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
812 | + print $globalBritishAirwaysKey; |
|
813 | +} |
|
814 | +?>" /> |
|
633 | 815 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
634 | 816 | </p> |
635 | 817 | <!-- |
636 | 818 | <p> |
637 | 819 | <label for="transavia">Transavia Test API Consumer Key</label> |
638 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
820 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
821 | + print $globalTransaviaKey; |
|
822 | +} |
|
823 | +?>" /> |
|
639 | 824 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
640 | 825 | </p> |
641 | 826 | --> |
@@ -644,10 +829,16 @@ discard block |
||
644 | 829 | <b>Lufthansa API Key</b> |
645 | 830 | <p> |
646 | 831 | <label for="lufthansakey">Key</label> |
647 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
832 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
833 | + print $globalLufthansaKey['key']; |
|
834 | +} |
|
835 | +?>" /> |
|
648 | 836 | </p><p> |
649 | 837 | <label for="lufthansasecret">Secret</label> |
650 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
838 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
839 | + print $globalLufthansaKey['secret']; |
|
840 | +} |
|
841 | +?>" /> |
|
651 | 842 | </p> |
652 | 843 | </div> |
653 | 844 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -667,7 +858,10 @@ discard block |
||
667 | 858 | </p> |
668 | 859 | <p> |
669 | 860 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
670 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
861 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
862 | + print $globalNOTAMSource; |
|
863 | +} |
|
864 | +?>" /> |
|
671 | 865 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
672 | 866 | </p> |
673 | 867 | <br /> |
@@ -683,14 +877,20 @@ discard block |
||
683 | 877 | <div id="metarsrc"> |
684 | 878 | <p> |
685 | 879 | <label for="metarsource">URL of your METAR source</label> |
686 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
880 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
881 | + print $globalMETARurl; |
|
882 | +} |
|
883 | +?>" /> |
|
687 | 884 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
688 | 885 | </p> |
689 | 886 | </div> |
690 | 887 | <br /> |
691 | 888 | <p> |
692 | 889 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
693 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
890 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
891 | + print $globalBitlyAccessToken; |
|
892 | +} |
|
893 | +?>" /> |
|
694 | 894 | </p> |
695 | 895 | <br /> |
696 | 896 | <p> |
@@ -710,7 +910,12 @@ discard block |
||
710 | 910 | </p> |
711 | 911 | <p> |
712 | 912 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
713 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
913 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
914 | + print $globalArchiveMonths; |
|
915 | +} else { |
|
916 | + echo '0'; |
|
917 | +} |
|
918 | +?>" /> |
|
714 | 919 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
715 | 920 | </p> |
716 | 921 | <p> |
@@ -720,12 +925,22 @@ discard block |
||
720 | 925 | </p> |
721 | 926 | <p> |
722 | 927 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
723 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
928 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
929 | + print $globalArchiveKeepMonths; |
|
930 | +} else { |
|
931 | + echo '0'; |
|
932 | +} |
|
933 | +?>" /> |
|
724 | 934 | <p class="help-block">0 to disable</p> |
725 | 935 | </p> |
726 | 936 | <p> |
727 | 937 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
728 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
938 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
939 | + print $globalArchiveKeepTrackMonths; |
|
940 | +} else { |
|
941 | + echo '0'; |
|
942 | +} |
|
943 | +?>" /> |
|
729 | 944 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
730 | 945 | </p> |
731 | 946 | <br /> |
@@ -735,7 +950,12 @@ discard block |
||
735 | 950 | <p class="help-block">Uncheck if the script is running as cron job</p> |
736 | 951 | <div id="cronends"> |
737 | 952 | <label for="cronend">Run script for xx seconds</label> |
738 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
953 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
954 | + print $globalCronEnd; |
|
955 | +} else { |
|
956 | + print '0'; |
|
957 | +} |
|
958 | +?>" /> |
|
739 | 959 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
740 | 960 | </div> |
741 | 961 | </p> |
@@ -788,15 +1008,30 @@ discard block |
||
788 | 1008 | <br /> |
789 | 1009 | <p> |
790 | 1010 | <label for="refresh">Show flights detected since xxx seconds</label> |
791 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1011 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1012 | + echo $globalLiveInterval; |
|
1013 | +} else { |
|
1014 | + echo '200'; |
|
1015 | +} |
|
1016 | +?>" /> |
|
792 | 1017 | </p> |
793 | 1018 | <p> |
794 | 1019 | <label for="maprefresh">Live map refresh (in seconds)</label> |
795 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1020 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1021 | + echo $globalMapRefresh; |
|
1022 | +} else { |
|
1023 | + echo '30'; |
|
1024 | +} |
|
1025 | +?>" /> |
|
796 | 1026 | </p> |
797 | 1027 | <p> |
798 | 1028 | <label for="mapidle">Map idle timeout (in minutes)</label> |
799 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1029 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1030 | + echo $globalMapIdleTimeout; |
|
1031 | +} else { |
|
1032 | + echo '30'; |
|
1033 | +} |
|
1034 | +?>" /> |
|
800 | 1035 | <p class="help-block">0 to disable</p> |
801 | 1036 | </p> |
802 | 1037 | <p> |
@@ -806,12 +1041,20 @@ discard block |
||
806 | 1041 | <br /> |
807 | 1042 | <p> |
808 | 1043 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
809 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1044 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1045 | + echo $globalClosestMinDist; |
|
1046 | +} else { |
|
1047 | + echo '50'; |
|
1048 | +} |
|
1049 | +?>" /> |
|
810 | 1050 | </p> |
811 | 1051 | <br /> |
812 | 1052 | <p> |
813 | 1053 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
814 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1054 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1055 | + echo $globalAircraftSize; |
|
1056 | +} |
|
1057 | +?>" /> |
|
815 | 1058 | </p> |
816 | 1059 | <br /> |
817 | 1060 | <p> |
@@ -824,7 +1067,12 @@ discard block |
||
824 | 1067 | if (extension_loaded('gd') && function_exists('gd_info')) { |
825 | 1068 | ?> |
826 | 1069 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
827 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1070 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1071 | + echo $globalAircraftIconColor; |
|
1072 | +} else { |
|
1073 | + echo '1a3151'; |
|
1074 | +} |
|
1075 | +?>" /> |
|
828 | 1076 | <?php |
829 | 1077 | if (!is_writable('../cache')) { |
830 | 1078 | ?> |
@@ -842,14 +1090,27 @@ discard block |
||
842 | 1090 | <p> |
843 | 1091 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
844 | 1092 | <div class="range"> |
845 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
846 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1093 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1094 | + echo $globalAirportZoom; |
|
1095 | +} else { |
|
1096 | + echo '7'; |
|
1097 | +} |
|
1098 | +?>" /> |
|
1099 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1100 | + echo $globalAirportZoom; |
|
1101 | +} else { |
|
1102 | + echo '7'; |
|
1103 | +} |
|
1104 | +?></output> |
|
847 | 1105 | </div> |
848 | 1106 | </p> |
849 | 1107 | <br /> |
850 | 1108 | <p> |
851 | 1109 | <label for="customcss">Custom CSS web path</label> |
852 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1110 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1111 | + echo $globalCustomCSS; |
|
1112 | +} |
|
1113 | +?>" /> |
|
853 | 1114 | </p> |
854 | 1115 | </fieldset> |
855 | 1116 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -876,8 +1137,12 @@ discard block |
||
876 | 1137 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
877 | 1138 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
878 | 1139 | |
879 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
880 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1140 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1141 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1142 | + } |
|
1143 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1144 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1145 | + } |
|
881 | 1146 | |
882 | 1147 | $_SESSION['database_root'] = $dbroot; |
883 | 1148 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -945,15 +1210,23 @@ discard block |
||
945 | 1210 | $source_city = $_POST['source_city']; |
946 | 1211 | $source_country = $_POST['source_country']; |
947 | 1212 | $source_ref = $_POST['source_ref']; |
948 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
949 | - else $source_id = array(); |
|
1213 | + if (isset($source_id)) { |
|
1214 | + $source_id = $_POST['source_id']; |
|
1215 | + } else { |
|
1216 | + $source_id = array(); |
|
1217 | + } |
|
950 | 1218 | |
951 | 1219 | $sources = array(); |
952 | 1220 | foreach ($source_name as $keys => $name) { |
953 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
954 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1221 | + if (isset($source_id[$keys])) { |
|
1222 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
1223 | + } else { |
|
1224 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
1225 | + } |
|
1226 | + } |
|
1227 | + if (count($sources) > 0) { |
|
1228 | + $_SESSION['sources'] = $sources; |
|
955 | 1229 | } |
956 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
957 | 1230 | |
958 | 1231 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
959 | 1232 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -974,14 +1247,23 @@ discard block |
||
974 | 1247 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
975 | 1248 | |
976 | 1249 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
977 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
978 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1250 | + if ($globalaircraft == 'aircraft') { |
|
1251 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1252 | + } else { |
|
1253 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1254 | + } |
|
979 | 1255 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
980 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
981 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1256 | + if ($globaltracker == 'tracker') { |
|
1257 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1258 | + } else { |
|
1259 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1260 | + } |
|
982 | 1261 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
983 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
984 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1262 | + if ($globalmarine == 'marine') { |
|
1263 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1264 | + } else { |
|
1265 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1266 | + } |
|
985 | 1267 | |
986 | 1268 | /* |
987 | 1269 | $globalSBS1Hosts = array(); |
@@ -1002,19 +1284,35 @@ discard block |
||
1002 | 1284 | $port = $_POST['port']; |
1003 | 1285 | $name = $_POST['name']; |
1004 | 1286 | $format = $_POST['format']; |
1005 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1006 | - else $sourcestats = array(); |
|
1007 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1008 | - else $noarchive = array(); |
|
1287 | + if (isset($_POST['sourcestats'])) { |
|
1288 | + $sourcestats = $_POST['sourcestats']; |
|
1289 | + } else { |
|
1290 | + $sourcestats = array(); |
|
1291 | + } |
|
1292 | + if (isset($_POST['noarchive'])) { |
|
1293 | + $noarchive = $_POST['noarchive']; |
|
1294 | + } else { |
|
1295 | + $noarchive = array(); |
|
1296 | + } |
|
1009 | 1297 | $gSources = array(); |
1010 | 1298 | $forcepilots = false; |
1011 | 1299 | foreach ($host as $key => $h) { |
1012 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1013 | - else $cov = 'FALSE'; |
|
1014 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1015 | - else $arch = 'FALSE'; |
|
1016 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1017 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1300 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1301 | + $cov = 'TRUE'; |
|
1302 | + } else { |
|
1303 | + $cov = 'FALSE'; |
|
1304 | + } |
|
1305 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1306 | + $arch = 'TRUE'; |
|
1307 | + } else { |
|
1308 | + $arch = 'FALSE'; |
|
1309 | + } |
|
1310 | + if ($h != '') { |
|
1311 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1312 | + } |
|
1313 | + if ($format[$key] == 'airwhere') { |
|
1314 | + $forcepilots = true; |
|
1315 | + } |
|
1018 | 1316 | } |
1019 | 1317 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1020 | 1318 | |
@@ -1042,7 +1340,9 @@ discard block |
||
1042 | 1340 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1043 | 1341 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1044 | 1342 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1045 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1343 | + } else { |
|
1344 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1345 | + } |
|
1046 | 1346 | |
1047 | 1347 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1048 | 1348 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1081,7 +1381,9 @@ discard block |
||
1081 | 1381 | |
1082 | 1382 | // Create in settings.php keys not yet configurable if not already here |
1083 | 1383 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1084 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1384 | + if (!isset($globalDebug)) { |
|
1385 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1386 | + } |
|
1085 | 1387 | |
1086 | 1388 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1087 | 1389 | if ($resetyearstats == 'resetyearstats') { |
@@ -1118,37 +1420,56 @@ discard block |
||
1118 | 1420 | } |
1119 | 1421 | */ |
1120 | 1422 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1121 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1122 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1123 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1124 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1423 | + if ($globalsbs == 'sbs') { |
|
1424 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1425 | + } else { |
|
1426 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1427 | + } |
|
1428 | + if ($globalaprs == 'aprs') { |
|
1429 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1430 | + } else { |
|
1431 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1432 | + } |
|
1125 | 1433 | $va = false; |
1126 | 1434 | if ($globalivao == 'ivao') { |
1127 | 1435 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1128 | 1436 | $va = true; |
1129 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1437 | + } else { |
|
1438 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1439 | + } |
|
1130 | 1440 | if ($globalvatsim == 'vatsim') { |
1131 | 1441 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1132 | 1442 | $va = true; |
1133 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1443 | + } else { |
|
1444 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1445 | + } |
|
1134 | 1446 | if ($globalphpvms == 'phpvms') { |
1135 | 1447 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1136 | 1448 | $va = true; |
1137 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1449 | + } else { |
|
1450 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1451 | + } |
|
1138 | 1452 | if ($globalvam == 'vam') { |
1139 | 1453 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1140 | 1454 | $va = true; |
1141 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1455 | + } else { |
|
1456 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1457 | + } |
|
1142 | 1458 | if ($va) { |
1143 | 1459 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1144 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1460 | + } else { |
|
1461 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1462 | + } |
|
1145 | 1463 | if ($globalva == 'va' || $va) { |
1146 | 1464 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1147 | 1465 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1148 | 1466 | } else { |
1149 | 1467 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1150 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1151 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1468 | + if ($forcepilots) { |
|
1469 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1470 | + } else { |
|
1471 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1472 | + } |
|
1152 | 1473 | } |
1153 | 1474 | |
1154 | 1475 | |
@@ -1309,7 +1630,9 @@ discard block |
||
1309 | 1630 | $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
1310 | 1631 | } |
1311 | 1632 | |
1312 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1633 | + if (!isset($globalTransaction)) { |
|
1634 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1635 | + } |
|
1313 | 1636 | |
1314 | 1637 | // Set some defaults values... |
1315 | 1638 | if (!isset($globalAircraftImageSources)) { |
@@ -1324,15 +1647,23 @@ discard block |
||
1324 | 1647 | |
1325 | 1648 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1326 | 1649 | |
1327 | - if ($error == '') settings::modify_settings($settings); |
|
1328 | - if ($error == '') settings::comment_settings($settings_comment); |
|
1650 | + if ($error == '') { |
|
1651 | + settings::modify_settings($settings); |
|
1652 | + } |
|
1653 | + if ($error == '') { |
|
1654 | + settings::comment_settings($settings_comment); |
|
1655 | + } |
|
1329 | 1656 | if ($error != '') { |
1330 | 1657 | print '<div class="info column">'.$error.'</div>'; |
1331 | 1658 | require('../footer.php'); |
1332 | 1659 | exit; |
1333 | 1660 | } else { |
1334 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1335 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
1661 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
1662 | + $_SESSION['waypoints'] = 1; |
|
1663 | + } |
|
1664 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
1665 | + $_SESSION['owner'] = 1; |
|
1666 | + } |
|
1336 | 1667 | if (isset($_POST['createdb'])) { |
1337 | 1668 | $_SESSION['install'] = 'database_create'; |
1338 | 1669 | } else { |
@@ -1373,10 +1704,18 @@ discard block |
||
1373 | 1704 | $popw = false; |
1374 | 1705 | foreach ($_SESSION['done'] as $done) { |
1375 | 1706 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1376 | - if ($done == 'Create database') $pop = true; |
|
1377 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1378 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1379 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1707 | + if ($done == 'Create database') { |
|
1708 | + $pop = true; |
|
1709 | + } |
|
1710 | + if ($_SESSION['install'] == 'database_create') { |
|
1711 | + $pop = true; |
|
1712 | + } |
|
1713 | + if ($_SESSION['install'] == 'database_import') { |
|
1714 | + $popi = true; |
|
1715 | + } |
|
1716 | + if ($_SESSION['install'] == 'waypoints') { |
|
1717 | + $popw = true; |
|
1718 | + } |
|
1380 | 1719 | } |
1381 | 1720 | if ($pop) { |
1382 | 1721 | sleep(5); |
@@ -1387,7 +1726,9 @@ discard block |
||
1387 | 1726 | } else if ($popw) { |
1388 | 1727 | sleep(5); |
1389 | 1728 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1390 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1729 | + } else { |
|
1730 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
1731 | + } |
|
1391 | 1732 | print '</div></ul>'; |
1392 | 1733 | print '<div id="error"></div>'; |
1393 | 1734 | /* foreach ($_SESSION['done'] as $done) { |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | require_once(dirname(__FILE__).'/class.create_db.php'); |
11 | 11 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
12 | 12 | require_once(dirname(__FILE__).'/class.settings.php'); |
13 | -$title="Install"; |
|
13 | +$title = "Install"; |
|
14 | 14 | require(dirname(__FILE__).'/../require/settings.php'); |
15 | 15 | require(dirname(__FILE__).'/header.php'); |
16 | 16 | |
@@ -69,8 +69,8 @@ discard block |
||
69 | 69 | if (!extension_loaded('curl')) { |
70 | 70 | $error[] = "Curl is not loaded."; |
71 | 71 | } |
72 | -if(function_exists('apache_get_modules') ){ |
|
73 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
72 | +if (function_exists('apache_get_modules')) { |
|
73 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
74 | 74 | $error[] = "mod_rewrite is not available."; |
75 | 75 | } |
76 | 76 | /* |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | print '<div class="info column"><p><strong>If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some table can fail.</strong></p></div>'; |
87 | 87 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
88 | 88 | if (function_exists('get_headers')) { |
89 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/','search',str_replace('index.php',$_SERVER["REQUEST_URI"]))); |
|
90 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
89 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace('install/', 'search', str_replace('index.php', $_SERVER["REQUEST_URI"]))); |
|
90 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
91 | 91 | print '<div class="info column"><p><strong>Check your configuration, rewrite don\'t seems to work.</strong></p></div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -451,13 +451,13 @@ discard block |
||
451 | 451 | ?> |
452 | 452 | <tr> |
453 | 453 | <?php |
454 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
454 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
455 | 455 | ?> |
456 | 456 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
457 | 457 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
458 | 458 | <?php |
459 | 459 | } else { |
460 | - $hostport = explode(':',$source['host']); |
|
460 | + $hostport = explode(':', $source['host']); |
|
461 | 461 | if (isset($hostport[1])) { |
462 | 462 | $host = $hostport[0]; |
463 | 463 | $port = $hostport[1]; |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | <br /> |
817 | 817 | <p> |
818 | 818 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
819 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
819 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
820 | 820 | </p> |
821 | 821 | <br /> |
822 | 822 | <p> |
@@ -872,14 +872,14 @@ discard block |
||
872 | 872 | $error = ''; |
873 | 873 | |
874 | 874 | if (isset($_POST['dbtype'])) { |
875 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
876 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
877 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
878 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
879 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
880 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
881 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
882 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
875 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
876 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
877 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
878 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
879 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
880 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
881 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
882 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
883 | 883 | |
884 | 884 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
885 | 885 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -899,49 +899,49 @@ discard block |
||
899 | 899 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
900 | 900 | */ |
901 | 901 | |
902 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
902 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
903 | 903 | |
904 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
905 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
906 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
907 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
908 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
904 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
905 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
906 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
907 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
908 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
909 | 909 | |
910 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
911 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
912 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
913 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
914 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
915 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
916 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
917 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
918 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
919 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
910 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
911 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
912 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
913 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
914 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
915 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
916 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
917 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
918 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
919 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
920 | 920 | |
921 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
922 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
923 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
924 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
925 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
926 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
921 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
922 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
923 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
924 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
925 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
926 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
927 | 927 | |
928 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
929 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
928 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
929 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
930 | 930 | |
931 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
932 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
933 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
931 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
932 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
933 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
934 | 934 | |
935 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
935 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
936 | 936 | if ($acars == 'acars') { |
937 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
937 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
938 | 938 | } else { |
939 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
939 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
940 | 940 | } |
941 | 941 | |
942 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
943 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
944 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
942 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
943 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
944 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
945 | 945 | |
946 | 946 | $source_name = $_POST['source_name']; |
947 | 947 | $source_latitude = $_POST['source_latitude']; |
@@ -955,8 +955,8 @@ discard block |
||
955 | 955 | |
956 | 956 | $sources = array(); |
957 | 957 | foreach ($source_name as $keys => $name) { |
958 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
959 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
958 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'id' => $source_id[$keys], 'source' => $source_ref[$keys]); |
|
959 | + else $sources[] = array('name' => $name, 'latitude' => $source_latitude[$keys], 'longitude' => $source_longitude[$keys], 'altitude' => $source_altitude[$keys], 'city' => $source_city[$keys], 'country' => $source_country[$keys], 'source' => $source_ref[$keys]); |
|
960 | 960 | } |
961 | 961 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
962 | 962 | |
@@ -969,24 +969,24 @@ discard block |
||
969 | 969 | $sbsurl = $_POST['sbsurl']; |
970 | 970 | */ |
971 | 971 | |
972 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
973 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
974 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
975 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
976 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
977 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
978 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
979 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
972 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
973 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
974 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
975 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
976 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
977 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
978 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
979 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
980 | 980 | |
981 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
982 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
983 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
984 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
985 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
986 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
987 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
988 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
989 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
981 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
982 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
983 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
984 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
985 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
986 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
987 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
988 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
989 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
990 | 990 | |
991 | 991 | /* |
992 | 992 | $globalSBS1Hosts = array(); |
@@ -1002,7 +1002,7 @@ discard block |
||
1002 | 1002 | } |
1003 | 1003 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1004 | 1004 | */ |
1005 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1005 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1006 | 1006 | $host = $_POST['host']; |
1007 | 1007 | $port = $_POST['port']; |
1008 | 1008 | $name = $_POST['name']; |
@@ -1018,100 +1018,100 @@ discard block |
||
1018 | 1018 | else $cov = 'FALSE'; |
1019 | 1019 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1020 | 1020 | else $arch = 'FALSE'; |
1021 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch); |
|
1021 | + if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch); |
|
1022 | 1022 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1023 | 1023 | } |
1024 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1024 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1025 | 1025 | |
1026 | 1026 | /* |
1027 | 1027 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1028 | 1028 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1029 | 1029 | */ |
1030 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1031 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1032 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1030 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1031 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1032 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1033 | 1033 | |
1034 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1035 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1034 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1035 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1036 | 1036 | |
1037 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1038 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1037 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1038 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1039 | 1039 | |
1040 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1041 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1042 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1043 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1040 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1041 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1042 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1043 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1044 | 1044 | |
1045 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1046 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1047 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1045 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1046 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1047 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1048 | 1048 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1049 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1050 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1049 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1050 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1051 | 1051 | |
1052 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1053 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1054 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1055 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1056 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1057 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1058 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1059 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1052 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1053 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1054 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1055 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1056 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1057 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1058 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1059 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1060 | 1060 | |
1061 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1062 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1061 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1062 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1063 | 1063 | |
1064 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1065 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1064 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1065 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1066 | 1066 | |
1067 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1067 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1068 | 1068 | if ($archiveyear == "archiveyear") { |
1069 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1069 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1070 | 1070 | } else { |
1071 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1071 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1072 | 1072 | } |
1073 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1074 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1075 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1076 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1073 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1074 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1075 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1076 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1077 | 1077 | |
1078 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1079 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1080 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1081 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1078 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1079 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1080 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1081 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1082 | 1082 | |
1083 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1084 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1085 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1083 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1084 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1085 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1086 | 1086 | |
1087 | 1087 | // Create in settings.php keys not yet configurable if not already here |
1088 | 1088 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1089 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1089 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1090 | 1090 | |
1091 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1091 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1092 | 1092 | if ($resetyearstats == 'resetyearstats') { |
1093 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1093 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1094 | 1094 | } else { |
1095 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1095 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1098 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1099 | 1099 | if ($archive == 'archive') { |
1100 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1100 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1101 | 1101 | } else { |
1102 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1102 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1103 | 1103 | } |
1104 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1104 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1105 | 1105 | if ($daemon == 'daemon') { |
1106 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1106 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1107 | 1107 | } else { |
1108 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1108 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1109 | 1109 | } |
1110 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1110 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1111 | 1111 | if ($schedules == 'schedules') { |
1112 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1112 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1113 | 1113 | } else { |
1114 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1114 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1115 | 1115 | } |
1116 | 1116 | |
1117 | 1117 | /* |
@@ -1122,218 +1122,218 @@ discard block |
||
1122 | 1122 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1123 | 1123 | } |
1124 | 1124 | */ |
1125 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1126 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1127 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1128 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1129 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1125 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1126 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1127 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1128 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1129 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1130 | 1130 | $va = false; |
1131 | 1131 | if ($globalivao == 'ivao') { |
1132 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1132 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1133 | 1133 | $va = true; |
1134 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1134 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1135 | 1135 | if ($globalvatsim == 'vatsim') { |
1136 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1136 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1137 | 1137 | $va = true; |
1138 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1138 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1139 | 1139 | if ($globalphpvms == 'phpvms') { |
1140 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1140 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1141 | 1141 | $va = true; |
1142 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1142 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1143 | 1143 | if ($globalvam == 'vam') { |
1144 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1144 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1145 | 1145 | $va = true; |
1146 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1146 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1147 | 1147 | if ($va) { |
1148 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1149 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1148 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1149 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1150 | 1150 | if ($globalva == 'va' || $va) { |
1151 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1152 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1151 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1152 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1153 | 1153 | } else { |
1154 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1155 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1156 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1154 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1155 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1156 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1157 | 1157 | } |
1158 | 1158 | |
1159 | 1159 | |
1160 | 1160 | |
1161 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1161 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1162 | 1162 | if ($notam == 'notam') { |
1163 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1163 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1164 | 1164 | } else { |
1165 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1165 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1166 | 1166 | } |
1167 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1167 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1168 | 1168 | if ($owner == 'owner') { |
1169 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1169 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1170 | 1170 | } else { |
1171 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1171 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1172 | 1172 | } |
1173 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1173 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1174 | 1174 | if ($map3d == 'map3d') { |
1175 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1175 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1176 | 1176 | } else { |
1177 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1177 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1178 | 1178 | } |
1179 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1179 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1180 | 1180 | if ($crash == 'crash') { |
1181 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1181 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1182 | 1182 | } else { |
1183 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1183 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1184 | 1184 | } |
1185 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1185 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1186 | 1186 | if ($mapsatellites == 'mapsatellites') { |
1187 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1187 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1188 | 1188 | } else { |
1189 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1189 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1190 | 1190 | } |
1191 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1191 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1192 | 1192 | if ($map3ddefault == 'map3ddefault') { |
1193 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1193 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1194 | 1194 | } else { |
1195 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1195 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1196 | 1196 | } |
1197 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1197 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1198 | 1198 | if ($translate == 'translate') { |
1199 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1199 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1200 | 1200 | } else { |
1201 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1201 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1202 | 1202 | } |
1203 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1203 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1204 | 1204 | if ($realairlines == 'realairlines') { |
1205 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1205 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1206 | 1206 | } else { |
1207 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1207 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1208 | 1208 | } |
1209 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1209 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1210 | 1210 | if ($estimation == 'estimation') { |
1211 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1211 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1212 | 1212 | } else { |
1213 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1213 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1214 | 1214 | } |
1215 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1215 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1216 | 1216 | if ($metar == 'metar') { |
1217 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1217 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1218 | 1218 | } else { |
1219 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1219 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1220 | 1220 | } |
1221 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1221 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1222 | 1222 | if ($metarcycle == 'metarcycle') { |
1223 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1223 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1224 | 1224 | } else { |
1225 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1225 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1226 | 1226 | } |
1227 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1227 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1228 | 1228 | if ($fork == 'fork') { |
1229 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1229 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1230 | 1230 | } else { |
1231 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1231 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1232 | 1232 | } |
1233 | 1233 | |
1234 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1234 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1235 | 1235 | if ($colormap == 'colormap') { |
1236 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1236 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1237 | 1237 | } else { |
1238 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1238 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1239 | 1239 | } |
1240 | 1240 | |
1241 | 1241 | if (isset($_POST['aircrafticoncolor'])) { |
1242 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1243 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1242 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1243 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1244 | 1244 | } |
1245 | 1245 | |
1246 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1247 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1246 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1247 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1248 | 1248 | |
1249 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1250 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1251 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1252 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1253 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1254 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1249 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1250 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1251 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1252 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1253 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1254 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1255 | 1255 | |
1256 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1256 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1257 | 1257 | if ($mappopup == 'mappopup') { |
1258 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1258 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1259 | 1259 | } else { |
1260 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1260 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1261 | 1261 | } |
1262 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1262 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1263 | 1263 | if ($airportpopup == 'airportpopup') { |
1264 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1264 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1265 | 1265 | } else { |
1266 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1266 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1267 | 1267 | } |
1268 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1268 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1269 | 1269 | if ($maphistory == 'maphistory') { |
1270 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1270 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1271 | 1271 | } else { |
1272 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1272 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1273 | 1273 | } |
1274 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1274 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1275 | 1275 | if ($maptooltip == 'maptooltip') { |
1276 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1276 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1277 | 1277 | } else { |
1278 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1278 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1279 | 1279 | } |
1280 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1280 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1281 | 1281 | if ($flightroute == 'flightroute') { |
1282 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1282 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1283 | 1283 | } else { |
1284 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1284 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1285 | 1285 | } |
1286 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1286 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1287 | 1287 | if ($flightremainingroute == 'flightremainingroute') { |
1288 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1288 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1289 | 1289 | } else { |
1290 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1290 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1291 | 1291 | } |
1292 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1292 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1293 | 1293 | if ($allflights == 'allflights') { |
1294 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1294 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1295 | 1295 | } else { |
1296 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1296 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1297 | 1297 | } |
1298 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1298 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1299 | 1299 | if ($bbox == 'bbox') { |
1300 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1300 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1301 | 1301 | } else { |
1302 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1302 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1303 | 1303 | } |
1304 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1304 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1305 | 1305 | if ($groundaltitude == 'groundaltitude') { |
1306 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1306 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1307 | 1307 | } else { |
1308 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1308 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1309 | 1309 | } |
1310 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1310 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1311 | 1311 | if ($waypoints == 'waypoints') { |
1312 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1312 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1313 | 1313 | } else { |
1314 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1314 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1315 | 1315 | } |
1316 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1316 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1317 | 1317 | if ($noairlines == 'noairlines') { |
1318 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1318 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1319 | 1319 | } else { |
1320 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1320 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1321 | 1321 | } |
1322 | 1322 | |
1323 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1323 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1324 | 1324 | |
1325 | 1325 | // Set some defaults values... |
1326 | 1326 | if (!isset($globalAircraftImageSources)) { |
1327 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1328 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1327 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1328 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1329 | 1329 | } |
1330 | 1330 | |
1331 | 1331 | if (!isset($globalSchedulesSources)) { |
1332 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1333 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1332 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1333 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1334 | 1334 | } |
1335 | 1335 | |
1336 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1336 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1337 | 1337 | |
1338 | 1338 | if ($error == '') settings::modify_settings($settings); |
1339 | 1339 | if ($error == '') settings::comment_settings($settings_comment); |