@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($registration != '') { |
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | -} else $spotter_array=array(); |
|
11 | +} else $spotter_array = array(); |
|
12 | 12 | |
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"),$registration); |
|
16 | + $title = sprintf(_("Most Common Arrival Airports by Country of aircraft with registration %s"), $registration); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$_GET['registration'].' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>'; |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | include('registration-sub-menu.php'); |
26 | 26 | print '<div class="column">'; |
27 | 27 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
28 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
28 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
29 | 29 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByRegistration($registration); |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
31 | 31 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
34 | 34 | print 'var series = ['; |
35 | 35 | $country_data = ''; |
36 | - foreach($airport_country_array as $airport_item) |
|
36 | + foreach ($airport_country_array as $airport_item) |
|
37 | 37 | { |
38 | 38 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
39 | 39 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | print '</thead>'; |
82 | 82 | print '<tbody>'; |
83 | 83 | $i = 1; |
84 | - foreach($airport_country_array as $airport_item) |
|
84 | + foreach ($airport_country_array as $airport_item) |
|
85 | 85 | { |
86 | 86 | print '<tr>'; |
87 | 87 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -9,13 +9,13 @@ discard block |
||
9 | 9 | } |
10 | 10 | |
11 | 11 | $Spotter = new Spotter(); |
12 | -$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
13 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
14 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
12 | +$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
13 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
14 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
15 | 15 | |
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | - $title = sprintf(_("Most Common Arrival Airports by Country from %s"),$manufacturer); |
|
18 | + $title = sprintf(_("Most Common Arrival Airports by Country from %s"), $manufacturer); |
|
19 | 19 | |
20 | 20 | require_once('header.php'); |
21 | 21 | print '<div class="select-item">'; |
@@ -24,9 +24,9 @@ discard block |
||
24 | 24 | $Stats = new Stats(); |
25 | 25 | $all_manufacturers = $Stats->getAllManufacturers(); |
26 | 26 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
27 | - foreach($all_manufacturers as $all_manufacturer) |
|
27 | + foreach ($all_manufacturers as $all_manufacturer) |
|
28 | 28 | { |
29 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
29 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
30 | 30 | { |
31 | 31 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
32 | 32 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | include('manufacturer-sub-menu.php'); |
46 | 46 | print '<div class="column">'; |
47 | 47 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
48 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
48 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
49 | 49 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByManufacturer($manufacturer); |
50 | 50 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
51 | 51 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
54 | 54 | print 'var series = ['; |
55 | 55 | $country_data = ''; |
56 | - foreach($airport_country_array as $airport_item) |
|
56 | + foreach ($airport_country_array as $airport_item) |
|
57 | 57 | { |
58 | 58 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
59 | 59 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | print '</thead>'; |
102 | 102 | print '<tbody>'; |
103 | 103 | $i = 1; |
104 | - foreach($airport_country_array as $airport_item) |
|
104 | + foreach ($airport_country_array as $airport_item) |
|
105 | 105 | { |
106 | 106 | print '<tr>'; |
107 | 107 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | die; |
46 | 46 | } |
47 | 47 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
48 | - $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
|
48 | + $globalSources[] = array('host' => $globalSBS1Host, 'port' => $globalSBS1Port); |
|
49 | 49 | } |
50 | 50 | } |
51 | 51 | |
52 | -$options = getopt('s::',array('source::','server','nodaemon','idsource::','aprsserverssid::','aprsserverpass::')); |
|
52 | +$options = getopt('s::', array('source::', 'server', 'nodaemon', 'idsource::', 'aprsserverssid::', 'aprsserverpass::')); |
|
53 | 53 | //if (isset($options['s'])) $hosts = array($options['s']); |
54 | 54 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
55 | 55 | if (isset($options['s'])) { |
@@ -67,27 +67,27 @@ discard block |
||
67 | 67 | else $id_source = 1; |
68 | 68 | if (isset($globalServer) && $globalServer) { |
69 | 69 | if ($globalDebug) echo "Using Server Mode\n"; |
70 | - $SI=new SpotterServer(); |
|
70 | + $SI = new SpotterServer(); |
|
71 | 71 | /* |
72 | 72 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
73 | 73 | $SI = new adsb2aprs(); |
74 | 74 | $SI->connect(); |
75 | 75 | */ |
76 | -} else $SI=new SpotterImport($Connection->db); |
|
76 | +} else $SI = new SpotterImport($Connection->db); |
|
77 | 77 | if (isset($globalTracker) && $globalTracker) $TI = new TrackerImport($Connection->db); |
78 | 78 | if (isset($globalMarine) && $globalMarine) { |
79 | 79 | $AIS = new AIS(); |
80 | 80 | $MI = new MarineImport($Connection->db); |
81 | 81 | } |
82 | 82 | //$APRS=new APRS($Connection->db); |
83 | -$SBS=new SBS(); |
|
84 | -$ACARS=new ACARS($Connection->db); |
|
85 | -$Common=new Common(); |
|
83 | +$SBS = new SBS(); |
|
84 | +$ACARS = new ACARS($Connection->db); |
|
85 | +$Common = new Common(); |
|
86 | 86 | date_default_timezone_set('UTC'); |
87 | 87 | //$servertz = system('date +%Z'); |
88 | 88 | // signal handler - playing nice with sockets and dump1090 |
89 | 89 | if (function_exists('pcntl_fork')) { |
90 | - pcntl_signal(SIGINT, function() { |
|
90 | + pcntl_signal(SIGINT, function() { |
|
91 | 91 | global $sockets; |
92 | 92 | echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
93 | 93 | die("Bye!\n"); |
@@ -103,35 +103,35 @@ discard block |
||
103 | 103 | |
104 | 104 | function connect_all($hosts) { |
105 | 105 | //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
106 | - global $sockets,$httpfeeds, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset,$context; |
|
106 | + global $sockets, $httpfeeds, $globalSources, $globalDebug, $aprs_connect, $last_exec, $globalSourcesRights, $use_aprs, $reset, $context; |
|
107 | 107 | $reset++; |
108 | 108 | if ($globalDebug) echo 'Connect to all...'."\n"; |
109 | 109 | foreach ($hosts as $id => $value) { |
110 | 110 | $host = $value['host']; |
111 | 111 | $globalSources[$id]['last_exec'] = 0; |
112 | 112 | // Here we check type of source(s) |
113 | - if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
114 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
113 | + if (filter_var($host, FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
|
114 | + if (preg_match('/deltadb.txt$/i', $host)) { |
|
115 | 115 | //$formats[$id] = 'deltadbtxt'; |
116 | 116 | $globalSources[$id]['format'] = 'deltadbtxt'; |
117 | 117 | //$last_exec['deltadbtxt'] = 0; |
118 | 118 | if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
119 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
119 | + } else if (preg_match('/vatsim-data.txt$/i', $host)) { |
|
120 | 120 | //$formats[$id] = 'vatsimtxt'; |
121 | 121 | $globalSources[$id]['format'] = 'vatsimtxt'; |
122 | 122 | //$last_exec['vatsimtxt'] = 0; |
123 | 123 | if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
124 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
124 | + } else if (preg_match('/aircraftlist.json$/i', $host)) { |
|
125 | 125 | //$formats[$id] = 'aircraftlistjson'; |
126 | 126 | $globalSources[$id]['format'] = 'aircraftlistjson'; |
127 | 127 | //$last_exec['aircraftlistjson'] = 0; |
128 | 128 | if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
129 | - } else if (preg_match('/opensky/i',$host)) { |
|
129 | + } else if (preg_match('/opensky/i', $host)) { |
|
130 | 130 | //$formats[$id] = 'aircraftlistjson'; |
131 | 131 | $globalSources[$id]['format'] = 'opensky'; |
132 | 132 | //$last_exec['aircraftlistjson'] = 0; |
133 | 133 | if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
134 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
134 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i', $host)) { |
|
135 | 135 | //$formats[$id] = 'radarvirtueljson'; |
136 | 136 | $globalSources[$id]['format'] = 'radarvirtueljson'; |
137 | 137 | //$last_exec['radarvirtueljson'] = 0; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
141 | 141 | exit(0); |
142 | 142 | } |
143 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
143 | + } else if (preg_match('/planeUpdateFAA.php$/i', $host)) { |
|
144 | 144 | //$formats[$id] = 'planeupdatefaa'; |
145 | 145 | $globalSources[$id]['format'] = 'planeupdatefaa'; |
146 | 146 | //$last_exec['planeupdatefaa'] = 0; |
@@ -149,26 +149,26 @@ discard block |
||
149 | 149 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
150 | 150 | exit(0); |
151 | 151 | } |
152 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
152 | + } else if (preg_match('/\/action.php\/acars\/data$/i', $host)) { |
|
153 | 153 | //$formats[$id] = 'phpvmacars'; |
154 | 154 | $globalSources[$id]['format'] = 'phpvmacars'; |
155 | 155 | //$last_exec['phpvmacars'] = 0; |
156 | 156 | if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
157 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
157 | + } else if (preg_match('/VAM-json.php$/i', $host)) { |
|
158 | 158 | //$formats[$id] = 'phpvmacars'; |
159 | 159 | $globalSources[$id]['format'] = 'vam'; |
160 | 160 | if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
161 | - } else if (preg_match('/whazzup/i',$host)) { |
|
161 | + } else if (preg_match('/whazzup/i', $host)) { |
|
162 | 162 | //$formats[$id] = 'whazzup'; |
163 | 163 | $globalSources[$id]['format'] = 'whazzup'; |
164 | 164 | //$last_exec['whazzup'] = 0; |
165 | 165 | if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
166 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
166 | + } else if (preg_match('/recentpireps/i', $host)) { |
|
167 | 167 | //$formats[$id] = 'pirepsjson'; |
168 | 168 | $globalSources[$id]['format'] = 'pirepsjson'; |
169 | 169 | //$last_exec['pirepsjson'] = 0; |
170 | 170 | if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
171 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
171 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i', $host)) { |
|
172 | 172 | //$formats[$id] = 'fr24json'; |
173 | 173 | $globalSources[$id]['format'] = 'fr24json'; |
174 | 174 | //$last_exec['fr24json'] = 0; |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
178 | 178 | exit(0); |
179 | 179 | } |
180 | - } else if (preg_match(':myshiptracking.com/:i',$host)) { |
|
180 | + } else if (preg_match(':myshiptracking.com/:i', $host)) { |
|
181 | 181 | //$formats[$id] = 'fr24json'; |
182 | 182 | $globalSources[$id]['format'] = 'myshiptracking'; |
183 | 183 | //$last_exec['fr24json'] = 0; |
@@ -187,22 +187,22 @@ discard block |
||
187 | 187 | exit(0); |
188 | 188 | } |
189 | 189 | //} else if (preg_match('/10001/',$host)) { |
190 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
190 | + } else if (preg_match('/10001/', $host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
191 | 191 | //$formats[$id] = 'tsv'; |
192 | 192 | $globalSources[$id]['format'] = 'tsv'; |
193 | 193 | if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
194 | 194 | } |
195 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
195 | + } elseif (filter_var($host, FILTER_VALIDATE_URL)) { |
|
196 | 196 | if ($globalSources[$id]['format'] == 'aisnmeahttp') { |
197 | - $idf = fopen($globalSources[$id]['host'],'r',false,$context); |
|
197 | + $idf = fopen($globalSources[$id]['host'], 'r', false, $context); |
|
198 | 198 | if ($idf !== false) { |
199 | 199 | $httpfeeds[$id] = $idf; |
200 | 200 | if ($globalDebug) echo "Connected to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
201 | 201 | } |
202 | 202 | elseif ($globalDebug) echo "Can't connect to ".$globalSources[$id]['host']."\n"; |
203 | 203 | } elseif ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
204 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
205 | - $hostport = explode(':',$host); |
|
204 | + } elseif (!filter_var($host, FILTER_VALIDATE_URL)) { |
|
205 | + $hostport = explode(':', $host); |
|
206 | 206 | if (isset($hostport[1])) { |
207 | 207 | $port = $hostport[1]; |
208 | 208 | $hostn = $hostport[0]; |
@@ -212,19 +212,19 @@ discard block |
||
212 | 212 | } |
213 | 213 | $Common = new Common(); |
214 | 214 | if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
215 | - $s = $Common->create_socket($hostn,$port, $errno, $errstr); |
|
215 | + $s = $Common->create_socket($hostn, $port, $errno, $errstr); |
|
216 | 216 | } else { |
217 | - $s = $Common->create_socket_udp($hostn,$port, $errno, $errstr); |
|
217 | + $s = $Common->create_socket_udp($hostn, $port, $errno, $errstr); |
|
218 | 218 | } |
219 | 219 | if ($s) { |
220 | 220 | $sockets[$id] = $s; |
221 | 221 | if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
222 | - if (preg_match('/aprs/',$hostn) || $port == '10152' || $port == '14580') { |
|
222 | + if (preg_match('/aprs/', $hostn) || $port == '10152' || $port == '14580') { |
|
223 | 223 | //$formats[$id] = 'aprs'; |
224 | 224 | $globalSources[$id]['format'] = 'aprs'; |
225 | 225 | //$aprs_connect = 0; |
226 | 226 | //$use_aprs = true; |
227 | - } elseif (preg_match('/pub-vrs/',$hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
227 | + } elseif (preg_match('/pub-vrs/', $hostn) || $port == '32001' || $port == '32005' || $port == '32010' || $port == '32015' || $port == '32030') { |
|
228 | 228 | $globalSources[$id]['format'] = 'vrstcp'; |
229 | 229 | } elseif ($port == '10001') { |
230 | 230 | //$formats[$id] = 'tsv'; |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | else if (isset($globalSBS1TimeOut)) $timeout = $globalSBS1TimeOut; |
264 | 264 | else $timeout = 20; |
265 | 265 | $errno = ''; |
266 | -$errstr=''; |
|
266 | +$errstr = ''; |
|
267 | 267 | |
268 | 268 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
269 | 269 | /* Initiate connections to all the hosts simultaneously */ |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | //connect_all($globalSources); |
272 | 272 | |
273 | 273 | if (isset($globalProxy) && $globalProxy) { |
274 | - $context = stream_context_create(array('http' => array('timeout' => $timeout,'proxy' => $globalProxy,'request_fulluri' => true))); |
|
274 | + $context = stream_context_create(array('http' => array('timeout' => $timeout, 'proxy' => $globalProxy, 'request_fulluri' => true))); |
|
275 | 275 | } else { |
276 | 276 | $context = stream_context_create(array('http' => array('timeout' => $timeout))); |
277 | 277 | } |
@@ -298,16 +298,16 @@ discard block |
||
298 | 298 | |
299 | 299 | if ($use_aprs) { |
300 | 300 | require_once(dirname(__FILE__).'/../require/class.APRS.php'); |
301 | - $APRS=new APRS(); |
|
301 | + $APRS = new APRS(); |
|
302 | 302 | $aprs_connect = 0; |
303 | 303 | $aprs_keep = 120; |
304 | 304 | $aprs_last_tx = time(); |
305 | 305 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
306 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
306 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
307 | 307 | if (isset($globalAPRSssid)) $aprs_ssid = $globalAPRSssid; |
308 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
308 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
309 | 309 | if (isset($globalAPRSfilter)) $aprs_filter = $globalAPRSfilter; |
310 | - else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
310 | + else $aprs_filter = 'r/'.$globalCenterLatitude.'/'.$globalCenterLongitude.'/250.0'; |
|
311 | 311 | if ($aprs_full) $aprs_filter = ''; |
312 | 312 | if (isset($globalAPRSpass)) $aprs_pass = $globalAPRSpass; |
313 | 313 | else $aprs_pass = '-1'; |
@@ -321,12 +321,12 @@ discard block |
||
321 | 321 | sleep(1); |
322 | 322 | if ($globalDebug) echo "SCAN MODE \n\n"; |
323 | 323 | if (!isset($globalCronEnd)) $globalCronEnd = 60; |
324 | -$endtime = time()+$globalCronEnd; |
|
324 | +$endtime = time() + $globalCronEnd; |
|
325 | 325 | $i = 1; |
326 | 326 | $tt = array(); |
327 | 327 | // Delete all ATC |
328 | 328 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
329 | - $ATC=new ATC($Connection->db); |
|
329 | + $ATC = new ATC($Connection->db); |
|
330 | 330 | } |
331 | 331 | if (!$globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
332 | 332 | $ATC->deleteAll(); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
336 | 336 | while ($i > 0) { |
337 | - if (!$globalDaemon) $i = $endtime-time(); |
|
337 | + if (!$globalDaemon) $i = $endtime - time(); |
|
338 | 338 | // Delete old ATC |
339 | 339 | if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
340 | 340 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | } |
350 | 350 | if ($max != $globalMinFetch) { |
351 | 351 | if ($globalDebug) echo 'Sleeping...'."\n"; |
352 | - sleep($globalMinFetch-$max+2); |
|
352 | + sleep($globalMinFetch - $max + 2); |
|
353 | 353 | } |
354 | 354 | } |
355 | 355 | |
@@ -362,8 +362,8 @@ discard block |
||
362 | 362 | //$buffer = $Common->getData($hosts[$id]); |
363 | 363 | $buffer = $Common->getData($value['host']); |
364 | 364 | if ($buffer != '') $reset = 0; |
365 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
366 | - $buffer = explode('\n',$buffer); |
|
365 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
366 | + $buffer = explode('\n', $buffer); |
|
367 | 367 | foreach ($buffer as $line) { |
368 | 368 | if ($line != '' && count($line) > 7) { |
369 | 369 | $line = explode(',', $line); |
@@ -390,11 +390,11 @@ discard block |
||
390 | 390 | $last_exec[$id]['last'] = time(); |
391 | 391 | } elseif ($value['format'] == 'aisnmeatxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
392 | 392 | date_default_timezone_set('CET'); |
393 | - $buffer = $Common->getData(str_replace('{date}',date('Ymd'),$value['host'])); |
|
393 | + $buffer = $Common->getData(str_replace('{date}', date('Ymd'), $value['host'])); |
|
394 | 394 | date_default_timezone_set('UTC'); |
395 | 395 | if ($buffer != '') $reset = 0; |
396 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
397 | - $buffer = explode('\n',$buffer); |
|
396 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
397 | + $buffer = explode('\n', $buffer); |
|
398 | 398 | foreach ($buffer as $line) { |
399 | 399 | if ($line != '') { |
400 | 400 | echo "'".$line."'\n"; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
413 | 413 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
414 | 414 | if (isset($ais_data['timestamp'])) { |
415 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
415 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
416 | 416 | if (!isset($last_exec[$id]['timestamp']) || $ais_data['timestamp'] >= $last_exec[$id]['timestamp']) { |
417 | 417 | $last_exec[$id]['timestamp'] = $ais_data['timestamp']; |
418 | 418 | $add = true; |
@@ -435,12 +435,12 @@ discard block |
||
435 | 435 | $w = $e = null; |
436 | 436 | |
437 | 437 | if (isset($arr[$id])) { |
438 | - $nn = stream_select($arr,$w,$e,$timeout); |
|
438 | + $nn = stream_select($arr, $w, $e, $timeout); |
|
439 | 439 | if ($nn > 0) { |
440 | 440 | foreach ($httpfeeds as $feed) { |
441 | - $buffer = stream_get_line($feed,2000,"\n"); |
|
442 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
443 | - $buffer = explode('\n',$buffer); |
|
441 | + $buffer = stream_get_line($feed, 2000, "\n"); |
|
442 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
443 | + $buffer = explode('\n', $buffer); |
|
444 | 444 | foreach ($buffer as $line) { |
445 | 445 | if ($line != '') { |
446 | 446 | $ais_data = $AIS->parse_line(trim($line)); |
@@ -456,9 +456,9 @@ discard block |
||
456 | 456 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
457 | 457 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
458 | 458 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
459 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
459 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
460 | 460 | if (isset($ais_data['timestamp'])) { |
461 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
461 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
462 | 462 | } else { |
463 | 463 | $data['datetime'] = date('Y-m-d H:i:s'); |
464 | 464 | } |
@@ -472,10 +472,10 @@ discard block |
||
472 | 472 | } |
473 | 473 | } |
474 | 474 | } elseif ($value['format'] == 'myshiptracking' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
475 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
475 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
476 | 476 | if ($buffer != '') { |
477 | 477 | //echo $buffer; |
478 | - $all_data = json_decode($buffer,true); |
|
478 | + $all_data = json_decode($buffer, true); |
|
479 | 479 | //print_r($all_data); |
480 | 480 | if (isset($all_data[0]['DATA'])) { |
481 | 481 | foreach ($all_data[0]['DATA'] as $line) { |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | // if (isset($ais_data['type'])) $data['type'] = $ais_data['type']; |
491 | 491 | $data['imo'] = $line['IMO']; |
492 | 492 | //$data['arrival_code'] = $ais_data['destination']; |
493 | - $data['datetime'] = date('Y-m-d H:i:s',$line['T']); |
|
493 | + $data['datetime'] = date('Y-m-d H:i:s', $line['T']); |
|
494 | 494 | $data['format_source'] = 'myshiptracking'; |
495 | 495 | $data['id_source'] = $id_source; |
496 | 496 | $MI->add($data); |
@@ -502,9 +502,9 @@ discard block |
||
502 | 502 | } |
503 | 503 | $last_exec[$id]['last'] = time(); |
504 | 504 | } elseif ($value['format'] == 'boatbeaconapp' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
505 | - $buffer = $Common->getData(str_replace('{timestamp}',time(),$value['host'])); |
|
505 | + $buffer = $Common->getData(str_replace('{timestamp}', time(), $value['host'])); |
|
506 | 506 | if ($buffer != '') { |
507 | - $all_data = json_decode($buffer,true); |
|
507 | + $all_data = json_decode($buffer, true); |
|
508 | 508 | if (isset($all_data[0]['mmsi'])) { |
509 | 509 | foreach ($all_data as $line) { |
510 | 510 | if ($line != '') { |
@@ -531,27 +531,27 @@ discard block |
||
531 | 531 | $last_exec[$id]['last'] = time(); |
532 | 532 | } elseif ($value['format'] == 'shipplotter' && (time() - $last_exec[$id]['last'] > $globalMinFetch*3)) { |
533 | 533 | echo 'download...'; |
534 | - $buffer = $Common->getData($value['host'],'post',$value['post'],'','','','','ShipPlotter'); |
|
534 | + $buffer = $Common->getData($value['host'], 'post', $value['post'], '', '', '', '', 'ShipPlotter'); |
|
535 | 535 | echo 'done !'."\n"; |
536 | 536 | if ($buffer != '') $reset = 0; |
537 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
538 | - $buffer = explode('\n',$buffer); |
|
537 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
538 | + $buffer = explode('\n', $buffer); |
|
539 | 539 | foreach ($buffer as $line) { |
540 | 540 | if ($line != '') { |
541 | 541 | $data = array(); |
542 | - $data['mmsi'] = (int)substr($line,0,9); |
|
543 | - $data['datetime'] = date('Y-m-d H:i:s',substr($line,10,10)); |
|
542 | + $data['mmsi'] = (int) substr($line, 0, 9); |
|
543 | + $data['datetime'] = date('Y-m-d H:i:s', substr($line, 10, 10)); |
|
544 | 544 | //$data['status'] = substr($line,21,2); |
545 | 545 | //$data['type'] = substr($line,24,3); |
546 | - $data['latitude'] = substr($line,29,9); |
|
547 | - $data['longitude'] = substr($line,41,9); |
|
548 | - $data['speed'] = round(substr($line,51,5)); |
|
546 | + $data['latitude'] = substr($line, 29, 9); |
|
547 | + $data['longitude'] = substr($line, 41, 9); |
|
548 | + $data['speed'] = round(substr($line, 51, 5)); |
|
549 | 549 | //$data['course'] = substr($line,57,5); |
550 | - $data['heading'] = round(substr($line,63,3)); |
|
550 | + $data['heading'] = round(substr($line, 63, 3)); |
|
551 | 551 | //$data['draft'] = substr($line,67,4); |
552 | 552 | //$data['length'] = substr($line,72,3); |
553 | 553 | //$data['beam'] = substr($line,76,2); |
554 | - $data['ident'] = trim(utf8_encode(substr($line,79,20))); |
|
554 | + $data['ident'] = trim(utf8_encode(substr($line, 79, 20))); |
|
555 | 555 | //$data['callsign'] = trim(substr($line,100,7); |
556 | 556 | //$data['dest'] = substr($line,108,20); |
557 | 557 | //$data['etaDate'] = substr($line,129,5); |
@@ -569,8 +569,8 @@ discard block |
||
569 | 569 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
570 | 570 | //$buffer = $Common->getData($hosts[$id]); |
571 | 571 | $buffer = $Common->getData($value['host']); |
572 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
573 | - $buffer = explode('\n',$buffer); |
|
572 | + $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '\n', $buffer)); |
|
573 | + $buffer = explode('\n', $buffer); |
|
574 | 574 | $reset = 0; |
575 | 575 | foreach ($buffer as $line) { |
576 | 576 | if ($line != '') { |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
582 | 582 | $data['pilot_id'] = $line[1]; |
583 | 583 | $data['pilot_name'] = $line[2]; |
584 | - $data['hex'] = str_pad(dechex($Common->str2int($line[1])),6,'000000',STR_PAD_LEFT); |
|
584 | + $data['hex'] = str_pad(dechex($Common->str2int($line[1])), 6, '000000', STR_PAD_LEFT); |
|
585 | 585 | $data['ident'] = $line[0]; // ident |
586 | 586 | if ($line[7] != '' && $line[7] != 0) $data['altitude'] = $line[7]; // altitude |
587 | 587 | $data['speed'] = $line[8]; // speed |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
598 | 598 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
599 | 599 | $data['departure_airport_icao'] = $line[11]; |
600 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
600 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22], 2, ':'), ':'); |
|
601 | 601 | $data['arrival_airport_icao'] = $line[13]; |
602 | 602 | $data['frequency'] = $line[4]; |
603 | 603 | $data['type'] = $line[18]; |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | $data['id_source'] = $id_source; |
607 | 607 | //$data['arrival_airport_time'] = ; |
608 | 608 | if ($line[9] != '') { |
609 | - $aircraft_data = explode('/',$line[9]); |
|
609 | + $aircraft_data = explode('/', $line[9]); |
|
610 | 610 | if (isset($aircraft_data[1])) { |
611 | 611 | $data['aircraft_icao'] = $aircraft_data[1]; |
612 | 612 | } |
@@ -620,9 +620,9 @@ discard block |
||
620 | 620 | if ($line[3] == 'PILOT') $SI->add($data); |
621 | 621 | elseif ($line[3] == 'ATC') { |
622 | 622 | //print_r($data); |
623 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
624 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
625 | - $typec = substr($data['ident'],-3); |
|
623 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
624 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
625 | + $typec = substr($data['ident'], -3); |
|
626 | 626 | if ($typec == 'APP') $data['type'] = 'Approach'; |
627 | 627 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
628 | 628 | elseif ($typec == 'OBS') $data['type'] = 'Observer'; |
@@ -633,7 +633,7 @@ discard block |
||
633 | 633 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
634 | 634 | elseif ($data['type'] == '') $data['type'] = 'Observer'; |
635 | 635 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
636 | - if (isset($ATC)) echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
|
636 | + if (isset($ATC)) echo $ATC->add($data['ident'], $data['frequency'], $data['latitude'], $data['longitude'], $data['range'], $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source'], $data['source_name']); |
|
637 | 637 | } |
638 | 638 | unset($data); |
639 | 639 | } |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | $last_exec[$id]['last'] = time(); |
645 | 645 | //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
646 | 646 | } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
647 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
647 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '20'); |
|
648 | 648 | if ($buffer != '') { |
649 | - $all_data = json_decode($buffer,true); |
|
649 | + $all_data = json_decode($buffer, true); |
|
650 | 650 | if (isset($all_data['acList'])) { |
651 | 651 | $reset = 0; |
652 | 652 | foreach ($all_data['acList'] as $line) { |
@@ -702,7 +702,7 @@ discard block |
||
702 | 702 | //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
703 | 703 | } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
704 | 704 | $buffer = $Common->getData($value['host']); |
705 | - $all_data = json_decode($buffer,true); |
|
705 | + $all_data = json_decode($buffer, true); |
|
706 | 706 | if (isset($all_data['planes'])) { |
707 | 707 | $reset = 0; |
708 | 708 | foreach ($all_data['planes'] as $key => $line) { |
@@ -719,12 +719,12 @@ discard block |
||
719 | 719 | $data['emergency'] = ''; // emergency |
720 | 720 | $data['registration'] = $line[2]; |
721 | 721 | $data['aircraft_icao'] = $line[0]; |
722 | - $deparr = explode('-',$line[1]); |
|
722 | + $deparr = explode('-', $line[1]); |
|
723 | 723 | if (count($deparr) == 2) { |
724 | 724 | $data['departure_airport_icao'] = $deparr[0]; |
725 | 725 | $data['arrival_airport_icao'] = $deparr[1]; |
726 | 726 | } |
727 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
727 | + $data['datetime'] = date('Y-m-d H:i:s', $line[9]); |
|
728 | 728 | $data['format_source'] = 'planeupdatefaa'; |
729 | 729 | $data['id_source'] = $id_source; |
730 | 730 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | $last_exec[$id]['last'] = time(); |
737 | 737 | } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
738 | 738 | $buffer = $Common->getData($value['host']); |
739 | - $all_data = json_decode($buffer,true); |
|
739 | + $all_data = json_decode($buffer, true); |
|
740 | 740 | if (isset($all_data['states'])) { |
741 | 741 | $reset = 0; |
742 | 742 | foreach ($all_data['states'] as $key => $line) { |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | //$data['emergency'] = ''; // emergency |
754 | 754 | //$data['registration'] = $line[2]; |
755 | 755 | //$data['aircraft_icao'] = $line[0]; |
756 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
756 | + $data['datetime'] = date('Y-m-d H:i:s', $line[3]); |
|
757 | 757 | $data['format_source'] = 'opensky'; |
758 | 758 | $data['id_source'] = $id_source; |
759 | 759 | $SI->add($data); |
@@ -766,7 +766,7 @@ discard block |
||
766 | 766 | } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
767 | 767 | //$buffer = $Common->getData($hosts[$id]); |
768 | 768 | $buffer = $Common->getData($value['host']); |
769 | - $all_data = json_decode($buffer,true); |
|
769 | + $all_data = json_decode($buffer, true); |
|
770 | 770 | if (!empty($all_data)) $reset = 0; |
771 | 771 | foreach ($all_data as $key => $line) { |
772 | 772 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
@@ -798,11 +798,11 @@ discard block |
||
798 | 798 | //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
799 | 799 | } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
800 | 800 | //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
801 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
801 | + $buffer = $Common->getData($value['host'], 'get', '', '', '', '', '150'); |
|
802 | 802 | //echo $buffer; |
803 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
804 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
805 | - $all_data = json_decode($buffer,true); |
|
803 | + $buffer = str_replace(array("\n", "\r"), "", $buffer); |
|
804 | + $buffer = preg_replace('/,"num":(.+)/', '}', $buffer); |
|
805 | + $all_data = json_decode($buffer, true); |
|
806 | 806 | if (json_last_error() != JSON_ERROR_NONE) { |
807 | 807 | die(json_last_error_msg()); |
808 | 808 | } |
@@ -825,7 +825,7 @@ discard block |
||
825 | 825 | //$data['departure_airport_iata'] = $line[11]; |
826 | 826 | //$data['arrival_airport_iata'] = $line[12]; |
827 | 827 | //$data['emergency'] = ''; // emergency |
828 | - $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
|
828 | + $data['datetime'] = date('Y-m-d H:i:s', $line['inf']['dt']); //$line[10] |
|
829 | 829 | $data['format_source'] = 'radarvirtueljson'; |
830 | 830 | $data['id_source'] = $id_source; |
831 | 831 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
@@ -840,14 +840,14 @@ discard block |
||
840 | 840 | } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
841 | 841 | //$buffer = $Common->getData($hosts[$id]); |
842 | 842 | $buffer = $Common->getData($value['host'].'?'.time()); |
843 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
843 | + $all_data = json_decode(utf8_encode($buffer), true); |
|
844 | 844 | |
845 | 845 | if (isset($all_data['pireps'])) { |
846 | 846 | $reset = 0; |
847 | 847 | foreach ($all_data['pireps'] as $line) { |
848 | 848 | $data = array(); |
849 | 849 | $data['id'] = $line['id']; |
850 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
850 | + $data['hex'] = substr(str_pad(dechex($line['id']), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
851 | 851 | $data['ident'] = $line['callsign']; // ident |
852 | 852 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
853 | 853 | if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
@@ -876,9 +876,9 @@ discard block |
||
876 | 876 | $SI->add($data); |
877 | 877 | // print_r($data); |
878 | 878 | } elseif ($line['icon'] == 'ct') { |
879 | - $data['info'] = str_replace('^§','<br />',$data['info']); |
|
880 | - $data['info'] = str_replace('&sect;','',$data['info']); |
|
881 | - $typec = substr($data['ident'],-3); |
|
879 | + $data['info'] = str_replace('^§', '<br />', $data['info']); |
|
880 | + $data['info'] = str_replace('&sect;', '', $data['info']); |
|
881 | + $typec = substr($data['ident'], -3); |
|
882 | 882 | $data['type'] = ''; |
883 | 883 | if ($typec == 'APP') $data['type'] = 'Approach'; |
884 | 884 | elseif ($typec == 'TWR') $data['type'] = 'Tower'; |
@@ -889,7 +889,7 @@ discard block |
||
889 | 889 | elseif ($typec == 'FSS') $data['type'] = 'Flight Service Station'; |
890 | 890 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
891 | 891 | else $data['type'] = 'Observer'; |
892 | - if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
|
892 | + if (isset($ATC)) echo $ATC->add($data['ident'], '', $data['latitude'], $data['longitude'], '0', $data['info'], $data['datetime'], $data['type'], $data['pilot_id'], $data['pilot_name'], $data['format_source']); |
|
893 | 893 | } |
894 | 894 | unset($data); |
895 | 895 | } |
@@ -901,14 +901,14 @@ discard block |
||
901 | 901 | //$buffer = $Common->getData($hosts[$id]); |
902 | 902 | if ($globalDebug) echo 'Get Data...'."\n"; |
903 | 903 | $buffer = $Common->getData($value['host']); |
904 | - $all_data = json_decode($buffer,true); |
|
904 | + $all_data = json_decode($buffer, true); |
|
905 | 905 | if ($buffer != '' && is_array($all_data)) { |
906 | 906 | $reset = 0; |
907 | 907 | foreach ($all_data as $line) { |
908 | 908 | $data = array(); |
909 | 909 | //$data['id'] = $line['id']; // id not usable |
910 | 910 | if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
911 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
911 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
912 | 912 | if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
913 | 913 | if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
914 | 914 | $data['ident'] = $line['flightnum']; // ident |
@@ -931,14 +931,14 @@ discard block |
||
931 | 931 | if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
932 | 932 | if (isset($line['aircraftname'])) { |
933 | 933 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
934 | - $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
|
935 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
934 | + $line['aircraftname'] = str_replace('BOEING ', 'B', $line['aircraftname']); |
|
935 | + $aircraft_data = explode('-', $line['aircraftname']); |
|
936 | 936 | if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) >= 3 && strlen($aircraft_data[0]) <= 4) $data['aircraft_icao'] = $aircraft_data[0]; |
937 | 937 | elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) >= 3 && strlen($aircraft_data[1]) <= 4) $data['aircraft_icao'] = $aircraft_data[1]; |
938 | 938 | else { |
939 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
940 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-','',$aircraft_data[1]); |
|
941 | - else $data['aircraft_icao'] = str_replace('-','',$line['aircraftname']); |
|
939 | + $aircraft_data = explode(' ', $line['aircraftname']); |
|
940 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = str_replace('-', '', $aircraft_data[1]); |
|
941 | + else $data['aircraft_icao'] = str_replace('-', '', $line['aircraftname']); |
|
942 | 942 | } |
943 | 943 | } |
944 | 944 | if (isset($line['route'])) $data['waypoints'] = $line['route']; |
@@ -958,14 +958,14 @@ discard block |
||
958 | 958 | //$buffer = $Common->getData($hosts[$id]); |
959 | 959 | if ($globalDebug) echo 'Get Data...'."\n"; |
960 | 960 | $buffer = $Common->getData($value['host']); |
961 | - $all_data = json_decode($buffer,true); |
|
961 | + $all_data = json_decode($buffer, true); |
|
962 | 962 | if ($buffer != '' && is_array($all_data)) { |
963 | 963 | $reset = 0; |
964 | 964 | foreach ($all_data as $line) { |
965 | 965 | $data = array(); |
966 | 966 | //$data['id'] = $line['id']; // id not usable |
967 | 967 | $data['id'] = trim($line['flight_id']); |
968 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
968 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']), 6, '000000', STR_PAD_LEFT), -6); // hex |
|
969 | 969 | $data['pilot_name'] = $line['pilot_name']; |
970 | 970 | $data['pilot_id'] = $line['pilot_id']; |
971 | 971 | $data['ident'] = trim($line['callsign']); // ident |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | //$value = $formats[$nb]; |
1017 | 1017 | $format = $globalSources[$nb]['format']; |
1018 | 1018 | if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
1019 | - $buffer = @socket_read($r, 6000,PHP_NORMAL_READ); |
|
1019 | + $buffer = @socket_read($r, 6000, PHP_NORMAL_READ); |
|
1020 | 1020 | } elseif ($format == 'vrstcp') { |
1021 | 1021 | $buffer = @socket_read($r, 6000); |
1022 | 1022 | } else { |
1023 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
1023 | + $az = socket_recvfrom($r, $buffer, 6000, 0, $remote_ip, $remote_port); |
|
1024 | 1024 | } |
1025 | 1025 | //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
1026 | 1026 | //echo $buffer."\n"; |
@@ -1029,8 +1029,8 @@ discard block |
||
1029 | 1029 | $error = false; |
1030 | 1030 | //$SI::del(); |
1031 | 1031 | if ($format == 'vrstcp') { |
1032 | - $buffer = explode('},{',$buffer); |
|
1033 | - } else $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
1032 | + $buffer = explode('},{', $buffer); |
|
1033 | + } else $buffer = trim(str_replace(array("\r\n", "\r", "\n", "\\r", "\\n", "\\r\\n"), '', $buffer)); |
|
1034 | 1034 | // SBS format is CSV format |
1035 | 1035 | if ($buffer !== FALSE && $buffer != '') { |
1036 | 1036 | $tt[$format] = 0; |
@@ -1062,10 +1062,10 @@ discard block |
||
1062 | 1062 | if (isset($ais_data['imo'])) $data['imo'] = $ais_data['imo']; |
1063 | 1063 | if (isset($ais_data['callsign'])) $data['callsign'] = $ais_data['callsign']; |
1064 | 1064 | if (isset($ais_data['destination'])) $data['arrival_code'] = $ais_data['destination']; |
1065 | - if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s',$ais_data['eta_ts']); |
|
1065 | + if (isset($ais_data['eta_ts'])) $data['arrival_date'] = date('Y-m-d H:i:s', $ais_data['eta_ts']); |
|
1066 | 1066 | |
1067 | 1067 | if (isset($ais_data['timestamp'])) { |
1068 | - $data['datetime'] = date('Y-m-d H:i:s',$ais_data['timestamp']); |
|
1068 | + $data['datetime'] = date('Y-m-d H:i:s', $ais_data['timestamp']); |
|
1069 | 1069 | } else { |
1070 | 1070 | $data['datetime'] = date('Y-m-d H:i:s'); |
1071 | 1071 | } |
@@ -1076,10 +1076,10 @@ discard block |
||
1076 | 1076 | } elseif ($format == 'flightgearsp') { |
1077 | 1077 | //echo $buffer."\n"; |
1078 | 1078 | if (strlen($buffer) > 5) { |
1079 | - $line = explode(',',$buffer); |
|
1079 | + $line = explode(',', $buffer); |
|
1080 | 1080 | $data = array(); |
1081 | 1081 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
1082 | - $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]),6,'000000',STR_PAD_LEFT),0,6); |
|
1082 | + $data['hex'] = substr(str_pad(bin2hex($line[6].$line[7]), 6, '000000', STR_PAD_LEFT), 0, 6); |
|
1083 | 1083 | $data['ident'] = $line[6]; |
1084 | 1084 | $data['aircraft_name'] = $line[7]; |
1085 | 1085 | $data['longitude'] = $line[1]; |
@@ -1090,21 +1090,21 @@ discard block |
||
1090 | 1090 | $data['datetime'] = date('Y-m-d H:i:s'); |
1091 | 1091 | $data['format_source'] = 'flightgearsp'; |
1092 | 1092 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1093 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1093 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1094 | 1094 | } |
1095 | 1095 | } elseif ($format == 'acars') { |
1096 | 1096 | if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
1097 | 1097 | $ACARS->add(trim($buffer)); |
1098 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
1098 | + socket_sendto($r, "OK ".$buffer, 100, 0, $remote_ip, $remote_port); |
|
1099 | 1099 | $ACARS->deleteLiveAcarsData(); |
1100 | 1100 | } elseif ($format == 'flightgearmp') { |
1101 | - if (substr($buffer,0,1) != '#') { |
|
1101 | + if (substr($buffer, 0, 1) != '#') { |
|
1102 | 1102 | $data = array(); |
1103 | 1103 | //echo $buffer."\n"; |
1104 | - $line = explode(' ',$buffer); |
|
1104 | + $line = explode(' ', $buffer); |
|
1105 | 1105 | if (count($line) == 11) { |
1106 | - $userserver = explode('@',$line[0]); |
|
1107 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
1106 | + $userserver = explode('@', $line[0]); |
|
1107 | + $data['hex'] = substr(str_pad(bin2hex($line[0]), 6, '000000', STR_PAD_LEFT), 0, 6); // hex |
|
1108 | 1108 | $data['ident'] = $userserver[0]; |
1109 | 1109 | $data['registration'] = $userserver[0]; |
1110 | 1110 | $data['latitude'] = $line[4]; |
@@ -1112,8 +1112,8 @@ discard block |
||
1112 | 1112 | $data['altitude'] = $line[6]; |
1113 | 1113 | $data['datetime'] = date('Y-m-d H:i:s'); |
1114 | 1114 | $aircraft_type = $line[10]; |
1115 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
1116 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
1115 | + $aircraft_type = preg_split(':/:', $aircraft_type); |
|
1116 | + $data['aircraft_name'] = substr(end($aircraft_type), 0, -4); |
|
1117 | 1117 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1121,8 +1121,8 @@ discard block |
||
1121 | 1121 | echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
1122 | 1122 | die; |
1123 | 1123 | } elseif ($format == 'vrstcp') { |
1124 | - foreach($buffer as $all_data) { |
|
1125 | - $line = json_decode('{'.$all_data.'}',true); |
|
1124 | + foreach ($buffer as $all_data) { |
|
1125 | + $line = json_decode('{'.$all_data.'}', true); |
|
1126 | 1126 | $data = array(); |
1127 | 1127 | if (isset($line['Icao'])) $data['hex'] = $line['Icao']; // hex |
1128 | 1128 | if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
@@ -1147,16 +1147,16 @@ discard block |
||
1147 | 1147 | if (isset($data['latitude']) && isset($data['hex'])) $SI->add($data); |
1148 | 1148 | unset($data); |
1149 | 1149 | } |
1150 | - } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
|
1150 | + } elseif ($format == 'tsv' || substr($buffer, 0, 4) == 'clock') { |
|
1151 | 1151 | $line = explode("\t", $buffer); |
1152 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
1152 | + for ($k = 0; $k < count($line); $k = $k + 2) { |
|
1153 | 1153 | $key = $line[$k]; |
1154 | - $lined[$key] = $line[$k+1]; |
|
1154 | + $lined[$key] = $line[$k + 1]; |
|
1155 | 1155 | } |
1156 | 1156 | if (count($lined) > 3) { |
1157 | 1157 | $data['hex'] = $lined['hexid']; |
1158 | 1158 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
1159 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
1159 | + $data['datetime'] = date('Y-m-d H:i:s'); ; |
|
1160 | 1160 | if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
1161 | 1161 | if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
1162 | 1162 | if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
@@ -1174,22 +1174,22 @@ discard block |
||
1174 | 1174 | } else $error = true; |
1175 | 1175 | } elseif ($format == 'aprs' && $use_aprs) { |
1176 | 1176 | if ($aprs_connect == 0) { |
1177 | - $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
|
1177 | + $send = @ socket_send($r, $aprs_login, strlen($aprs_login), 0); |
|
1178 | 1178 | $aprs_connect = 1; |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
1181 | + if ($aprs_keep > 60 && time() - $aprs_last_tx > $aprs_keep) { |
|
1182 | 1182 | $aprs_last_tx = time(); |
1183 | 1183 | $data_aprs = "# Keep alive"; |
1184 | - $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
|
1184 | + $send = @ socket_send($r, $data_aprs, strlen($data_aprs), 0); |
|
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
1188 | 1188 | //echo 'APRS data : '.$buffer."\n"; |
1189 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
1190 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
1189 | + $buffer = str_replace('APRS <- ', '', $buffer); |
|
1190 | + $buffer = str_replace('APRS -> ', '', $buffer); |
|
1191 | 1191 | //echo $buffer."\n"; |
1192 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
1192 | + if (substr($buffer, 0, 1) != '#' && substr($buffer, 0, 1) != '@' && substr($buffer, 0, 5) != 'APRS ') { |
|
1193 | 1193 | $line = $APRS->parse($buffer); |
1194 | 1194 | //print_r($line); |
1195 | 1195 | //if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
@@ -1198,7 +1198,7 @@ discard block |
||
1198 | 1198 | $data = array(); |
1199 | 1199 | //print_r($line); |
1200 | 1200 | if (isset($line['address'])) $data['hex'] = $line['address']; |
1201 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
1201 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s', $line['timestamp']); |
|
1202 | 1202 | else $data['datetime'] = date('Y-m-d H:i:s'); |
1203 | 1203 | //$data['datetime'] = date('Y-m-d H:i:s'); |
1204 | 1204 | if (isset($line['ident'])) $data['ident'] = $line['ident']; |
@@ -1224,7 +1224,7 @@ discard block |
||
1224 | 1224 | $currentdate = date('Y-m-d H:i:s'); |
1225 | 1225 | $aprsdate = strtotime($data['datetime']); |
1226 | 1226 | // Accept data if time <= system time + 20s |
1227 | - if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1227 | + if (($data['source_type'] == 'modes') || isset($line['stealth']) && ($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate) + 20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
1228 | 1228 | $send = $SI->add($data); |
1229 | 1229 | } elseif (isset($line['stealth'])) { |
1230 | 1230 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | connect_all($sourceee); |
1322 | 1322 | $sourceee = array(); |
1323 | 1323 | //connect_all($globalSources); |
1324 | - $tt[$format]=0; |
|
1324 | + $tt[$format] = 0; |
|
1325 | 1325 | break; |
1326 | 1326 | } |
1327 | 1327 | } |
@@ -1330,14 +1330,14 @@ discard block |
||
1330 | 1330 | } else { |
1331 | 1331 | $error = socket_strerror(socket_last_error()); |
1332 | 1332 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || (time() - $time >= $timeout && $error != 'Success')) { |
1333 | - if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
|
1333 | + if ($globalDebug) echo "ERROR : socket_select give this error ".$error."\n"; |
|
1334 | 1334 | if (isset($globalDebug)) echo "Restarting...\n"; |
1335 | 1335 | // Restart the script if possible |
1336 | 1336 | if (is_array($sockets)) { |
1337 | 1337 | if ($globalDebug) echo "Shutdown all sockets..."; |
1338 | 1338 | |
1339 | 1339 | foreach ($sockets as $sock) { |
1340 | - @socket_shutdown($sock,2); |
|
1340 | + @socket_shutdown($sock, 2); |
|
1341 | 1341 | @socket_close($sock); |
1342 | 1342 | } |
1343 | 1343 |
@@ -4,16 +4,16 @@ discard block |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | $Spotter = new Spotter(); |
7 | -if (!isset($_GET['aircraft_manufacturer'])){ |
|
7 | +if (!isset($_GET['aircraft_manufacturer'])) { |
|
8 | 8 | header('Location: '.$globalURL.''); |
9 | 9 | } else { |
10 | 10 | //calculuation for the pagination |
11 | - if(!isset($_GET['limit'])) |
|
11 | + if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
15 | 15 | $absolute_difference = 25; |
16 | - } else { |
|
16 | + } else { |
|
17 | 17 | $limit_explode = explode(",", $_GET['limit']); |
18 | 18 | $limit_start = $limit_explode[0]; |
19 | 19 | $limit_end = $limit_explode[1]; |
@@ -27,19 +27,19 @@ discard block |
||
27 | 27 | $limit_previous_1 = $limit_start - $absolute_difference; |
28 | 28 | $limit_previous_2 = $limit_end - $absolute_difference; |
29 | 29 | |
30 | - $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
31 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
30 | + $manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
31 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
32 | 32 | $page_url = $globalURL.'/manufacturer/'.$manufacturer; |
33 | 33 | |
34 | 34 | if ($sort != '') { |
35 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, $sort); |
|
35 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, $sort); |
|
36 | 36 | } else { |
37 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, ''); |
|
37 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, ''); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | if (!empty($spotter_array)) |
41 | 41 | { |
42 | - $title = sprintf(_("Detailed View for %s"),$manufacturer); |
|
42 | + $title = sprintf(_("Detailed View for %s"), $manufacturer); |
|
43 | 43 | |
44 | 44 | require_once('header.php'); |
45 | 45 | print '<div class="select-item">'; |
@@ -48,9 +48,9 @@ discard block |
||
48 | 48 | $Stats = new Stats(); |
49 | 49 | $all_manufacturers = $Stats->getAllManufacturers(); |
50 | 50 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
51 | - foreach($all_manufacturers as $all_manufacturer) |
|
51 | + foreach ($all_manufacturers as $all_manufacturer) |
|
52 | 52 | { |
53 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
53 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
54 | 54 | { |
55 | 55 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
56 | 56 | } else { |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | print '</div>'; |
68 | 68 | |
69 | 69 | print '<div class="table column">'; |
70 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong."),$manufacturer).'</p>'; |
|
70 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong."), $manufacturer).'</p>'; |
|
71 | 71 | |
72 | 72 | include('manufacturer-sub-menu.php'); |
73 | 73 | include('table-output.php'); |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | 7 | if (isset($_GET['registration'])) { |
8 | - $registration = filter_input(INPUT_GET,'registration',FILTER_SANITIZE_STRING); |
|
8 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
9 | 9 | $spotter_array = $Spotter->getSpotterDataByRegistration($registration, "0,1", $sort); |
10 | 10 | $aircraft_array = $Spotter->getAircraftInfoByRegistration($registration); |
11 | 11 | } else $spotter_array = array(); |
12 | 12 | |
13 | 13 | if (!empty($spotter_array)) |
14 | 14 | { |
15 | - $title = sprintf(_("Most Common Departure Airports by Country of aircraft with registration %s"),$registration); |
|
15 | + $title = sprintf(_("Most Common Departure Airports by Country of aircraft with registration %s"), $registration); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | print '<div class="info column">'; |
18 | 18 | print '<h1>'.$registration.' - '.$aircraft_array[0]['aircraft_name'].' ('.$aircraft_array[0]['aircraft_icao'].')</h1>'; |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | include('registration-sub-menu.php'); |
25 | 25 | print '<div class="column">'; |
26 | 26 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
27 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with aircraft registration <strong>%s</strong>."),$registration).'</p>'; |
|
27 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with aircraft registration <strong>%s</strong>."), $registration).'</p>'; |
|
28 | 28 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByRegistration($registration); |
29 | 29 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
30 | 30 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
33 | 33 | print 'var series = ['; |
34 | 34 | $country_data = ''; |
35 | - foreach($airport_country_array as $airport_item) |
|
35 | + foreach ($airport_country_array as $airport_item) |
|
36 | 36 | { |
37 | 37 | $country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
38 | 38 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | print '</thead>'; |
81 | 81 | print '<tbody>'; |
82 | 82 | $i = 1; |
83 | - foreach($airport_country_array as $airport_item) |
|
83 | + foreach ($airport_country_array as $airport_item) |
|
84 | 84 | { |
85 | 85 | print '<tr>'; |
86 | 86 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,9 +3,9 @@ discard block |
||
3 | 3 | </span> |
4 | 4 | <div class="sub-menu sub-menu-container"> |
5 | 5 | <ul class="nav nav-pills"> |
6 | - <li><a href="<?php print $globalURL; ?>/manufacturer/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-detailed"){ print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
6 | + <li><a href="<?php print $globalURL; ?>/manufacturer/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-detailed") { print 'class="active"'; } ?>><?php echo _("Detailed"); ?></a></li> |
|
7 | 7 | <li class="dropdown"> |
8 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "manufacturer-statistics-aircraft" || strtolower($current_page) == "manufacturer-statistics-registration"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
8 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "manufacturer-statistics-aircraft" || strtolower($current_page) == "manufacturer-statistics-registration") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
9 | 9 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
10 | 10 | </a> |
11 | 11 | <ul class="dropdown-menu" role="menu"> |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | </ul> |
15 | 15 | </li> |
16 | 16 | <li class="dropdown"> |
17 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "manufacturer-statistics-airline" || strtolower($current_page) == "manufacturer-statistics-airline-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
17 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "manufacturer-statistics-airline" || strtolower($current_page) == "manufacturer-statistics-airline-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
18 | 18 | <?php echo _("Airline"); ?> <span class="caret"></span> |
19 | 19 | </a> |
20 | 20 | <ul class="dropdown-menu" role="menu"> |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | </ul> |
24 | 24 | </li> |
25 | 25 | <li class="dropdown"> |
26 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "manufacturer-statistics-departure-airport" || strtolower($current_page) == "manufacturer-statistics-departure-airport-country" || strtolower($current_page) == "manufacturer-statistics-arrival-airport" || strtolower($current_page) == "manufacturer-statistics-arrival-airport-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
26 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "manufacturer-statistics-departure-airport" || strtolower($current_page) == "manufacturer-statistics-departure-airport-country" || strtolower($current_page) == "manufacturer-statistics-arrival-airport" || strtolower($current_page) == "manufacturer-statistics-arrival-airport-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
27 | 27 | <?php echo _("Airport"); ?> <span class="caret"></span> |
28 | 28 | </a> |
29 | 29 | <ul class="dropdown-menu" role="menu"> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | <li><a href="<?php print $globalURL; ?>/manufacturer/statistics/arrival-airport-country/<?php print $manufacturer; ?>"><?php echo _("Arrival Airport by Country"); ?></a></li> |
34 | 34 | </ul> |
35 | 35 | </li> |
36 | - <li><a href="<?php print $globalURL; ?>/manufacturer/statistics/route/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-statistics-route"){ print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
37 | - <li><a href="<?php print $globalURL; ?>/manufacturer/statistics/time/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-statistics-time"){ print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
36 | + <li><a href="<?php print $globalURL; ?>/manufacturer/statistics/route/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-statistics-route") { print 'class="active"'; } ?>><?php echo _("Route"); ?></a></li> |
|
37 | + <li><a href="<?php print $globalURL; ?>/manufacturer/statistics/time/<?php print $manufacturer; ?>" <?php if (strtolower($current_page) == "manufacturer-statistics-time") { print 'class="active"'; } ?>><?php echo _("Time"); ?></a></li> |
|
38 | 38 | </ul> |
39 | 39 | </div> |
40 | 40 | \ No newline at end of file |
@@ -8,13 +8,13 @@ discard block |
||
8 | 8 | die(); |
9 | 9 | } |
10 | 10 | $Spotter = new Spotter(); |
11 | -$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING))); |
|
12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
13 | -$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,"0,1", $sort); |
|
11 | +$manufacturer = ucwords(str_replace("-", " ", filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING))); |
|
12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
13 | +$spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, "0,1", $sort); |
|
14 | 14 | |
15 | 15 | if (!empty($spotter_array)) |
16 | 16 | { |
17 | - $title = sprintf(_("'Most Common Departure Airports by Country from %s"),$manufacturer); |
|
17 | + $title = sprintf(_("'Most Common Departure Airports by Country from %s"), $manufacturer); |
|
18 | 18 | |
19 | 19 | require_once('header.php'); |
20 | 20 | print '<div class="select-item">'; |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | $Stats = new Stats(); |
24 | 24 | $all_manufacturers = $Stats->getAllManufacturers(); |
25 | 25 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
26 | - foreach($all_manufacturers as $all_manufacturer) |
|
26 | + foreach ($all_manufacturers as $all_manufacturer) |
|
27 | 27 | { |
28 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
28 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
29 | 29 | { |
30 | 30 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
31 | 31 | } else { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | include('manufacturer-sub-menu.php'); |
45 | 45 | print '<div class="column">'; |
46 | 46 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
47 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
47 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
48 | 48 | |
49 | 49 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByManufacturer($manufacturer); |
50 | 50 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
54 | 54 | print 'var series = ['; |
55 | 55 | $country_data = ''; |
56 | - foreach($airport_country_array as $airport_item) |
|
56 | + foreach ($airport_country_array as $airport_item) |
|
57 | 57 | { |
58 | 58 | $country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
59 | 59 | } |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | print '</thead>'; |
102 | 102 | print '<tbody>'; |
103 | 103 | $i = 1; |
104 | - foreach($airport_country_array as $airport_item) |
|
104 | + foreach ($airport_country_array as $airport_item) |
|
105 | 105 | { |
106 | 106 | print '<tr>'; |
107 | 107 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | die(); |
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
12 | -$spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
12 | +$spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
13 | 13 | |
14 | 14 | if (!empty($spotter_array)) |
15 | 15 | { |
16 | - $title = sprintf(_("Most Common Departure Airports by Country of %s"),$spotter_array[0]['ident']); |
|
16 | + $title = sprintf(_("Most Common Departure Airports by Country of %s"), $spotter_array[0]['ident']); |
|
17 | 17 | require_once('header.php'); |
18 | 18 | print '<div class="info column">'; |
19 | 19 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | include('ident-sub-menu.php'); |
24 | 24 | print '<div class="column">'; |
25 | 25 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
26 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
26 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights with the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
27 | 27 | |
28 | 28 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByIdent($ident); |
29 | 29 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
33 | 33 | print 'var series = ['; |
34 | 34 | $country_data = ''; |
35 | - foreach($airport_country_array as $airport_item) |
|
35 | + foreach ($airport_country_array as $airport_item) |
|
36 | 36 | { |
37 | 37 | $country_data .= '[ "'.$airport_item['departure_airport_country_iso3'].'",'.$airport_item['airport_departure_country_count'].'],'; |
38 | 38 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | print '</thead>'; |
81 | 81 | print '<tbody>'; |
82 | 82 | $i = 1; |
83 | - foreach($airport_country_array as $airport_item) |
|
83 | + foreach ($airport_country_array as $airport_item) |
|
84 | 84 | { |
85 | 85 | print '<tr>'; |
86 | 86 | print '<td><strong>'.$i.'</strong></td>'; |