@@ -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 | if (isset($limit_explode[1])) { |
19 | 19 | $limit_start = $limit_explode[0]; |
@@ -32,19 +32,19 @@ discard block |
||
32 | 32 | $limit_previous_1 = $limit_start - $absolute_difference; |
33 | 33 | $limit_previous_2 = $limit_end - $absolute_difference; |
34 | 34 | |
35 | - $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'aircraft_manufacturer',FILTER_SANITIZE_STRING)))); |
|
36 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
35 | + $manufacturer = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'aircraft_manufacturer', FILTER_SANITIZE_STRING)))); |
|
36 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
37 | 37 | $page_url = $globalURL.'/manufacturer/'.$manufacturer; |
38 | 38 | |
39 | 39 | if ($sort != '') { |
40 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, $sort); |
|
40 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, $sort); |
|
41 | 41 | } else { |
42 | - $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer,$limit_start.",".$absolute_difference, ''); |
|
42 | + $spotter_array = $Spotter->getSpotterDataByManufacturer($manufacturer, $limit_start.",".$absolute_difference, ''); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | if (!empty($spotter_array)) |
46 | 46 | { |
47 | - $title = sprintf(_("Detailed View for %s"),$manufacturer); |
|
47 | + $title = sprintf(_("Detailed View for %s"), $manufacturer); |
|
48 | 48 | |
49 | 49 | require_once('header.php'); |
50 | 50 | print '<div class="select-item">'; |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | $Stats = new Stats(); |
54 | 54 | $all_manufacturers = $Stats->getAllManufacturers(); |
55 | 55 | if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
56 | - foreach($all_manufacturers as $all_manufacturer) |
|
56 | + foreach ($all_manufacturers as $all_manufacturer) |
|
57 | 57 | { |
58 | - if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
58 | + if ($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
|
59 | 59 | { |
60 | 60 | print '<option value="'.strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer'])).'" selected="selected">'.$all_manufacturer['aircraft_manufacturer'].'</option>'; |
61 | 61 | } else { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | print '</div>'; |
73 | 73 | |
74 | 74 | print '<div class="table column">'; |
75 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$manufacturer).'</p>'; |
|
75 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $manufacturer).'</p>'; |
|
76 | 76 | |
77 | 77 | include('manufacturer-sub-menu.php'); |
78 | 78 | include('table-output.php'); |
@@ -13,7 +13,7 @@ discard block |
||
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 | if (isset($limit_explode[1])) { |
19 | 19 | $limit_start = $limit_explode[0]; |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | print '<select name="aircraft_manufacturer" class="selectpicker" data-live-search="true">'; |
53 | 53 | $Stats = new Stats(); |
54 | 54 | $all_manufacturers = $Stats->getAllManufacturers(); |
55 | - if (empty($all_manufacturers)) $all_manufacturers = $Spotter->getAllManufacturers(); |
|
55 | + if (empty($all_manufacturers)) { |
|
56 | + $all_manufacturers = $Spotter->getAllManufacturers(); |
|
57 | + } |
|
56 | 58 | foreach($all_manufacturers as $all_manufacturer) |
57 | 59 | { |
58 | 60 | if($_GET['aircraft_manufacturer'] == strtolower(str_replace(" ", "-", $all_manufacturer['aircraft_manufacturer']))) |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | $id = $spotter_item['Waypoint']['@attributes']['id']; |
24 | 24 | if ($id == 0 || !is_numeric($id)) $id = $j; |
25 | 25 | $output .= '{"type": "Feature",'; |
26 | - $output .= '"id": '.$id.','; |
|
27 | - $output .= '"properties": {'; |
|
26 | + $output .= '"id": '.$id.','; |
|
27 | + $output .= '"properties": {'; |
|
28 | 28 | $output .= '"type": "'.$spotter_item['@attributes']['type'].'",'; |
29 | 29 | //$output .= '"id": "'.$spotter_item['Waypoint']['@attributes']['id'].'",'; |
30 | 30 | $output .= '"name": "'.$spotter_item['Waypoint']['@attributes']['name'].'",'; |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | } elseif ($spotter_item['@attributes']['type'] == 'Finish') { |
36 | 36 | $output .= '"icon": "/images/tsk/tsk-finish.png"'; |
37 | 37 | } else $output .= '"icon": "/images/tsk/number_'.$id.'.png"'; |
38 | - $output .= '},'; |
|
39 | - $output .= '"geometry": {'; |
|
38 | + $output .= '},'; |
|
39 | + $output .= '"geometry": {'; |
|
40 | 40 | $output .= '"type": "Point",'; |
41 | 41 | $output .= '"coordinates": ['; |
42 | - $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
42 | + $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
43 | 43 | $output .= ']'; |
44 | - $output .= '}'; |
|
44 | + $output .= '}'; |
|
45 | 45 | $output .= '},'; |
46 | 46 | $j++; |
47 | 47 | } |
48 | 48 | // Lines |
49 | 49 | $output .= '{"type": "Feature",'; |
50 | - $output .= '"properties": {'; |
|
50 | + $output .= '"properties": {'; |
|
51 | 51 | $output .= '"type": "'.$spotter_array['@attributes']['type'].'"'; |
52 | - $output .= '},'; |
|
53 | - $output .= '"geometry": {'; |
|
52 | + $output .= '},'; |
|
53 | + $output .= '"geometry": {'; |
|
54 | 54 | $output .= '"type": "LineString",'; |
55 | 55 | $output .= '"coordinates": ['; |
56 | 56 | foreach($spotter_array['Point'] as $spotter_item) |
57 | 57 | { |
58 | - $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
58 | + $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
59 | 59 | } |
60 | 60 | $output = substr($output, 0, -1); |
61 | 61 | $output .= ']'; |
62 | - $output .= '}'; |
|
62 | + $output .= '}'; |
|
63 | 63 | $output .= '},'; |
64 | 64 | $output = substr($output, 0, -1); |
65 | 65 | } |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | } |
9 | 9 | header('Content-Type: text/javascript'); |
10 | 10 | |
11 | -$tskfile = filter_input(INPUT_GET,'tsk',FILTER_SANITIZE_URL); |
|
11 | +$tskfile = filter_input(INPUT_GET, 'tsk', FILTER_SANITIZE_URL); |
|
12 | 12 | |
13 | 13 | $spotter_array = $TSK->parse_xml($tskfile); |
14 | 14 | |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | if (!empty($spotter_array)) |
17 | 17 | { |
18 | 18 | $j = 0; |
19 | - foreach($spotter_array['Point'] as $spotter_item) |
|
19 | + foreach ($spotter_array['Point'] as $spotter_item) |
|
20 | 20 | { |
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | //waypoint plotting |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $output .= '"geometry": {'; |
54 | 54 | $output .= '"type": "LineString",'; |
55 | 55 | $output .= '"coordinates": ['; |
56 | - foreach($spotter_array['Point'] as $spotter_item) |
|
56 | + foreach ($spotter_array['Point'] as $spotter_item) |
|
57 | 57 | { |
58 | 58 | $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
59 | 59 | } |
@@ -21,7 +21,9 @@ discard block |
||
21 | 21 | date_default_timezone_set('UTC'); |
22 | 22 | //waypoint plotting |
23 | 23 | $id = $spotter_item['Waypoint']['@attributes']['id']; |
24 | - if ($id == 0 || !is_numeric($id)) $id = $j; |
|
24 | + if ($id == 0 || !is_numeric($id)) { |
|
25 | + $id = $j; |
|
26 | + } |
|
25 | 27 | $output .= '{"type": "Feature",'; |
26 | 28 | $output .= '"id": '.$id.','; |
27 | 29 | $output .= '"properties": {'; |
@@ -34,7 +36,9 @@ discard block |
||
34 | 36 | $output .= '"icon": "/images/tsk/tsk-start.png"'; |
35 | 37 | } elseif ($spotter_item['@attributes']['type'] == 'Finish') { |
36 | 38 | $output .= '"icon": "/images/tsk/tsk-finish.png"'; |
37 | - } else $output .= '"icon": "/images/tsk/number_'.$id.'.png"'; |
|
39 | + } else { |
|
40 | + $output .= '"icon": "/images/tsk/number_'.$id.'.png"'; |
|
41 | + } |
|
38 | 42 | $output .= '},'; |
39 | 43 | $output .= '"geometry": {'; |
40 | 44 | $output .= '"type": "Point",'; |
@@ -97,6 +97,10 @@ discard block |
||
97 | 97 | return strlen($headerLine); // Needed by curl |
98 | 98 | } |
99 | 99 | |
100 | + /** |
|
101 | + * @param string $url |
|
102 | + * @param string $file |
|
103 | + */ |
|
100 | 104 | public static function download($url, $file, $referer = '') { |
101 | 105 | global $globalDebug, $globalProxy, $globalForceIPv4; |
102 | 106 | $fp = fopen($file, 'w'); |
@@ -121,6 +125,9 @@ discard block |
||
121 | 125 | fclose($fp); |
122 | 126 | } |
123 | 127 | |
128 | + /** |
|
129 | + * @param string $in_file |
|
130 | + */ |
|
124 | 131 | public static function gunzip($in_file,$out_file_name = '') { |
125 | 132 | //echo $in_file.' -> '.$out_file_name."\n"; |
126 | 133 | $buffer_size = 4096; // read 4kb at a time |
@@ -272,7 +279,7 @@ discard block |
||
272 | 279 | * Check is distance realistic |
273 | 280 | * @param int $timeDifference the time between the reception of both messages |
274 | 281 | * @param float $distance distance covered |
275 | - * @return whether distance is realistic |
|
282 | + * @return boolean distance is realistic |
|
276 | 283 | */ |
277 | 284 | public function withinThreshold ($timeDifference, $distance) { |
278 | 285 | $x = abs($timeDifference); |
@@ -295,6 +302,9 @@ discard block |
||
295 | 302 | } |
296 | 303 | |
297 | 304 | |
305 | + /** |
|
306 | + * @param string $latlong |
|
307 | + */ |
|
298 | 308 | public function convertDec($dms,$latlong) { |
299 | 309 | if ($latlong == 'latitude') { |
300 | 310 | $deg = substr($dms, 0, 2); |
@@ -306,6 +316,9 @@ discard block |
||
306 | 316 | return $deg+(($min*60)/3600); |
307 | 317 | } |
308 | 318 | |
319 | + /** |
|
320 | + * @param string $latlong |
|
321 | + */ |
|
309 | 322 | public function convertDM($coord,$latlong) { |
310 | 323 | if ($latlong == 'latitude') { |
311 | 324 | if ($coord < 0) $NSEW = 'S'; |
@@ -443,7 +456,7 @@ discard block |
||
443 | 456 | /** |
444 | 457 | * Returns list of available locales |
445 | 458 | * |
446 | - * @return array |
|
459 | + * @return string[] |
|
447 | 460 | */ |
448 | 461 | public function listLocaleDir() |
449 | 462 | { |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | //protected $cookies = array(); |
8 | 8 | |
9 | 9 | /** |
10 | - * Get data from form result |
|
11 | - * @param String $url form URL |
|
12 | - * @param String $type type of submit form method (get or post) |
|
13 | - * @param String|Array $data values form post method |
|
14 | - * @param Array $headers header to submit with the form |
|
15 | - * @return String the result |
|
16 | - */ |
|
10 | + * Get data from form result |
|
11 | + * @param String $url form URL |
|
12 | + * @param String $type type of submit form method (get or post) |
|
13 | + * @param String|Array $data values form post method |
|
14 | + * @param Array $headers header to submit with the form |
|
15 | + * @return String the result |
|
16 | + */ |
|
17 | 17 | public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false) { |
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
@@ -166,10 +166,10 @@ discard block |
||
166 | 166 | } |
167 | 167 | |
168 | 168 | /** |
169 | - * Convert a HTML table to an array |
|
170 | - * @param String $data HTML page |
|
171 | - * @return Array array of the tables in HTML page |
|
172 | - */ |
|
169 | + * Convert a HTML table to an array |
|
170 | + * @param String $data HTML page |
|
171 | + * @return Array array of the tables in HTML page |
|
172 | + */ |
|
173 | 173 | public function table2array($data) { |
174 | 174 | if (!is_string($data)) return array(); |
175 | 175 | if ($data == '') return array(); |
@@ -203,10 +203,10 @@ discard block |
||
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
206 | - * Convert <p> part of a HTML page to an array |
|
207 | - * @param String $data HTML page |
|
208 | - * @return Array array of the <p> in HTML page |
|
209 | - */ |
|
206 | + * Convert <p> part of a HTML page to an array |
|
207 | + * @param String $data HTML page |
|
208 | + * @return Array array of the <p> in HTML page |
|
209 | + */ |
|
210 | 210 | public function text2array($data) { |
211 | 211 | $html = str_get_html($data); |
212 | 212 | if ($html === false) return array(); |
@@ -221,14 +221,14 @@ discard block |
||
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
224 | - * Give distance between 2 coordonnates |
|
225 | - * @param Float $lat latitude of first point |
|
226 | - * @param Float $lon longitude of first point |
|
227 | - * @param Float $latc latitude of second point |
|
228 | - * @param Float $lonc longitude of second point |
|
229 | - * @param String $unit km else no unit used |
|
230 | - * @return Float Distance in $unit |
|
231 | - */ |
|
224 | + * Give distance between 2 coordonnates |
|
225 | + * @param Float $lat latitude of first point |
|
226 | + * @param Float $lon longitude of first point |
|
227 | + * @param Float $latc latitude of second point |
|
228 | + * @param Float $lonc longitude of second point |
|
229 | + * @param String $unit km else no unit used |
|
230 | + * @return Float Distance in $unit |
|
231 | + */ |
|
232 | 232 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | 233 | if ($lat == $latc && $lon == $lonc) return 0; |
234 | 234 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
@@ -246,12 +246,12 @@ discard block |
||
246 | 246 | } |
247 | 247 | |
248 | 248 | /** |
249 | - * Give plunge between 2 altitudes and distance |
|
250 | - * @param Float $initial_altitude altitude of first point in m |
|
251 | - * @param Float $final_altitude altitude of second point in m |
|
252 | - * @param String $distance distance between two points in m |
|
253 | - * @return Float plunge |
|
254 | - */ |
|
249 | + * Give plunge between 2 altitudes and distance |
|
250 | + * @param Float $initial_altitude altitude of first point in m |
|
251 | + * @param Float $final_altitude altitude of second point in m |
|
252 | + * @param String $distance distance between two points in m |
|
253 | + * @return Float plunge |
|
254 | + */ |
|
255 | 255 | public function plunge($initial_altitude,$final_altitude,$distance) { |
256 | 256 | $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
257 | 257 | /* |
@@ -265,13 +265,13 @@ discard block |
||
265 | 265 | } |
266 | 266 | |
267 | 267 | /** |
268 | - * Give azimuth between 2 coordonnates |
|
269 | - * @param Float $lat latitude of first point |
|
270 | - * @param Float $lon longitude of first point |
|
271 | - * @param Float $latc latitude of second point |
|
272 | - * @param Float $lonc longitude of second point |
|
273 | - * @return Float Azimuth |
|
274 | - */ |
|
268 | + * Give azimuth between 2 coordonnates |
|
269 | + * @param Float $lat latitude of first point |
|
270 | + * @param Float $lon longitude of first point |
|
271 | + * @param Float $latc latitude of second point |
|
272 | + * @param Float $lonc longitude of second point |
|
273 | + * @return Float Azimuth |
|
274 | + */ |
|
275 | 275 | public function azimuth($lat, $lon, $latc, $lonc) { |
276 | 276 | $dX = $latc - $lat; |
277 | 277 | $dY = $lonc - $lon; |
@@ -282,11 +282,11 @@ discard block |
||
282 | 282 | |
283 | 283 | |
284 | 284 | /** |
285 | - * Check is distance realistic |
|
286 | - * @param int $timeDifference the time between the reception of both messages |
|
287 | - * @param float $distance distance covered |
|
288 | - * @return whether distance is realistic |
|
289 | - */ |
|
285 | + * Check is distance realistic |
|
286 | + * @param int $timeDifference the time between the reception of both messages |
|
287 | + * @param float $distance distance covered |
|
288 | + * @return whether distance is realistic |
|
289 | + */ |
|
290 | 290 | public function withinThreshold ($timeDifference, $distance) { |
291 | 291 | $x = abs($timeDifference); |
292 | 292 | $d = abs($distance); |
@@ -336,11 +336,11 @@ discard block |
||
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
339 | - * Copy folder contents |
|
340 | - * @param string $source Source path |
|
341 | - * @param string $dest Destination path |
|
342 | - * @return bool Returns true on success, false on failure |
|
343 | - */ |
|
339 | + * Copy folder contents |
|
340 | + * @param string $source Source path |
|
341 | + * @param string $dest Destination path |
|
342 | + * @return bool Returns true on success, false on failure |
|
343 | + */ |
|
344 | 344 | public function xcopy($source, $dest) |
345 | 345 | { |
346 | 346 | $files = glob($source.'*.*'); |
@@ -352,20 +352,20 @@ discard block |
||
352 | 352 | } |
353 | 353 | |
354 | 354 | /** |
355 | - * Check if an url exist |
|
356 | - * @param String $url url to check |
|
357 | - * @return bool Return true on succes false on failure |
|
358 | - */ |
|
355 | + * Check if an url exist |
|
356 | + * @param String $url url to check |
|
357 | + * @return bool Return true on succes false on failure |
|
358 | + */ |
|
359 | 359 | public function urlexist($url){ |
360 | 360 | $headers=get_headers($url); |
361 | 361 | return stripos($headers[0],"200 OK")?true:false; |
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
365 | - * Convert hexa to string |
|
366 | - * @param String $hex data in hexa |
|
367 | - * @return String Return result |
|
368 | - */ |
|
365 | + * Convert hexa to string |
|
366 | + * @param String $hex data in hexa |
|
367 | + * @return String Return result |
|
368 | + */ |
|
369 | 369 | public function hex2str($hex) { |
370 | 370 | $str = ''; |
371 | 371 | $hexln = strlen($hex); |
@@ -374,10 +374,10 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
377 | - * Convert hexa color to rgb |
|
378 | - * @param String $hex data in hexa |
|
379 | - * @return String Return result |
|
380 | - */ |
|
377 | + * Convert hexa color to rgb |
|
378 | + * @param String $hex data in hexa |
|
379 | + * @return String Return result |
|
380 | + */ |
|
381 | 381 | public function hex2rgb($hex) { |
382 | 382 | $hex = str_replace('#','',$hex); |
383 | 383 | return sscanf($hex, "%02x%02x%02x"); |
@@ -455,9 +455,9 @@ discard block |
||
455 | 455 | } |
456 | 456 | |
457 | 457 | /** |
458 | - * Returns list of available locales |
|
459 | - * |
|
460 | - * @return array |
|
458 | + * Returns list of available locales |
|
459 | + * |
|
460 | + * @return array |
|
461 | 461 | */ |
462 | 462 | public function listLocaleDir() |
463 | 463 | { |
@@ -556,100 +556,100 @@ discard block |
||
556 | 556 | public function remove_accents($string) { |
557 | 557 | if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
558 | 558 | $chars = array( |
559 | - // Decompositions for Latin-1 Supplement |
|
560 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
561 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
562 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
563 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
564 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
565 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
566 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
567 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
568 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
569 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
570 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
571 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
572 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
573 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
574 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
575 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
576 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
577 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
578 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
579 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
580 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
581 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
582 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
583 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
584 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
585 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
586 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
587 | - chr(195).chr(191) => 'y', |
|
588 | - // Decompositions for Latin Extended-A |
|
589 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
590 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
591 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
592 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
593 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
594 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
595 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
596 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
597 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
598 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
599 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
600 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
601 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
602 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
603 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
604 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
605 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
606 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
607 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
608 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
609 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
610 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
611 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
612 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
613 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
614 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
615 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
616 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
617 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
618 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
619 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
620 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
621 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
622 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
623 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
624 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
625 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
626 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
627 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
628 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
629 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
630 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
631 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
632 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
633 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
634 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
635 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
636 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
637 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
638 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
639 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
640 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
641 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
642 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
643 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
644 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
645 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
646 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
647 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
648 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
649 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
650 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
651 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
652 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
559 | + // Decompositions for Latin-1 Supplement |
|
560 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
561 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
562 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
563 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
564 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
565 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
566 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
567 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
568 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
569 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
570 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
571 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
572 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
573 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
574 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
575 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
576 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
577 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
578 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
579 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
580 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
581 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
582 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
583 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
584 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
585 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
586 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
587 | + chr(195).chr(191) => 'y', |
|
588 | + // Decompositions for Latin Extended-A |
|
589 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
590 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
591 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
592 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
593 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
594 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
595 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
596 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
597 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
598 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
599 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
600 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
601 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
602 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
603 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
604 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
605 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
606 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
607 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
608 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
609 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
610 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
611 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
612 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
613 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
614 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
615 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
616 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
617 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
618 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
619 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
620 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
621 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
622 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
623 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
624 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
625 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
626 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
627 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
628 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
629 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
630 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
631 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
632 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
633 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
634 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
635 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
636 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
637 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
638 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
639 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
640 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
641 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
642 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
643 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
644 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
645 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
646 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
647 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
648 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
649 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
650 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
651 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
652 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
653 | 653 | ); |
654 | 654 | $string = strtr($string, $chars); |
655 | 655 | return $string; |
@@ -790,7 +790,7 @@ discard block |
||
790 | 790 | $dfX = $first_pass[$j][0]; |
791 | 791 | $dfDiffLong = abs($dfX - $dfPrevX); |
792 | 792 | if ($dfDiffLong > $dfDiffSpace && |
793 | - (($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) |
|
793 | + (($dfX > $dfLeftBorderX && $dfPrevX < $dfRightBorderX) || ($dfPrevX > $dfLeftBorderX && $dfX < $dfRightBorderX))) |
|
794 | 794 | { |
795 | 795 | $bHasBigDiff = true; |
796 | 796 | } else if ($dfDiffLong > $dfMaxSmallDiffLong) { |
@@ -810,8 +810,8 @@ discard block |
||
810 | 810 | $dfX2 = floatval($first_pass[$k][0]); |
811 | 811 | $dfY2 = floatval($first_pass[$k][1]); |
812 | 812 | if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 && |
813 | - $k+1 < count($first_pass) && |
|
814 | - $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX) |
|
813 | + $k+1 < count($first_pass) && |
|
814 | + $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX) |
|
815 | 815 | { |
816 | 816 | $poNewLS[] = array(-180, $first_pass[$k][1]); |
817 | 817 | $k++; |
@@ -819,8 +819,8 @@ discard block |
||
819 | 819 | $poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]); |
820 | 820 | continue; |
821 | 821 | } else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 && |
822 | - $k+1 < $first_pass_ln && |
|
823 | - $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180) |
|
822 | + $k+1 < $first_pass_ln && |
|
823 | + $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180) |
|
824 | 824 | { |
825 | 825 | $poNewLS[] = array(180, $first_pass[$k][1]); |
826 | 826 | $k++; |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * @param Array $headers header to submit with the form |
15 | 15 | * @return String the result |
16 | 16 | */ |
17 | - public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '', $sizelimit = false, $async = false) { |
|
17 | + public function getData($url, $type = 'get', $data = '', $headers = '', $cookie = '', $referer = '', $timeout = '', $useragent = '', $sizelimit = false, $async = false) { |
|
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
20 | 20 | curl_setopt($ch, CURLOPT_URL, $url); |
21 | 21 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
22 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
22 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
23 | 23 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
24 | 24 | } |
25 | 25 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
30 | 30 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
31 | 31 | curl_setopt($ch, CURLINFO_HEADER_OUT, true); |
32 | - curl_setopt($ch,CURLOPT_ENCODING , "gzip"); |
|
32 | + curl_setopt($ch, CURLOPT_ENCODING, "gzip"); |
|
33 | 33 | //curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
34 | 34 | // curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (X11; Linux x86_64; rv:42.0) Gecko/20100101 Firefox/42.0'); |
35 | 35 | if ($useragent == '') { |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | } |
40 | 40 | if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
41 | 41 | else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
42 | - curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
|
42 | + curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common', "curlResponseHeaderCallback")); |
|
43 | 43 | if ($type == 'post') { |
44 | 44 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
45 | 45 | if (is_array($data)) { |
46 | 46 | curl_setopt($ch, CURLOPT_POST, count($data)); |
47 | 47 | $data_string = ''; |
48 | - foreach($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
48 | + foreach ($data as $key=>$value) { $data_string .= $key.'='.$value.'&'; } |
|
49 | 49 | rtrim($data_string, '&'); |
50 | 50 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string); |
51 | 51 | } else { |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | if ($cookie != '') { |
59 | 59 | if (is_array($cookie)) { |
60 | - curl_setopt($ch, CURLOPT_COOKIE, implode($cookie,';')); |
|
60 | + curl_setopt($ch, CURLOPT_COOKIE, implode($cookie, ';')); |
|
61 | 61 | } else { |
62 | 62 | curl_setopt($ch, CURLOPT_COOKIE, $cookie); |
63 | 63 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | if ($sizelimit === true) { |
69 | 69 | curl_setopt($ch, CURLOPT_BUFFERSIZE, 128); |
70 | 70 | curl_setopt($ch, CURLOPT_NOPROGRESS, false); |
71 | - curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr,$downloadsize, $downloaded, $uploadsize, $uploaded){ |
|
71 | + curl_setopt($ch, CURLOPT_PROGRESSFUNCTION, function($curlr, $downloadsize, $downloaded, $uploadsize, $uploaded) { |
|
72 | 72 | return ($downloaded > (3*1024)) ? 1 : 0; |
73 | 73 | }); |
74 | 74 | } |
@@ -79,13 +79,13 @@ discard block |
||
79 | 79 | $result = curl_exec($ch); |
80 | 80 | $info = curl_getinfo($ch); |
81 | 81 | curl_close($ch); |
82 | - if ($info['http_code'] == '503' && strstr($result,'DDoS protection by CloudFlare')) { |
|
82 | + if ($info['http_code'] == '503' && strstr($result, 'DDoS protection by CloudFlare')) { |
|
83 | 83 | echo "Cloudflare Detected\n"; |
84 | 84 | require_once(dirname(__FILE__).'/libs/cloudflare-bypass/libraries/cloudflareClass.php'); |
85 | 85 | $useragent = UAgent::random(); |
86 | 86 | cloudflare::useUserAgent($useragent); |
87 | 87 | if ($clearanceCookie = cloudflare::bypass($url)) { |
88 | - return $this->getData($url,'get',$data,$headers,$clearanceCookie,$referer,$timeout,$useragent); |
|
88 | + return $this->getData($url, 'get', $data, $headers, $clearanceCookie, $referer, $timeout, $useragent); |
|
89 | 89 | } |
90 | 90 | } else { |
91 | 91 | return $result; |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
110 | 110 | if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
111 | 111 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
112 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
112 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
113 | 113 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
114 | 114 | } |
115 | 115 | } |
@@ -124,20 +124,20 @@ discard block |
||
124 | 124 | fclose($fp); |
125 | 125 | } |
126 | 126 | |
127 | - public static function gunzip($in_file,$out_file_name = '') { |
|
127 | + public static function gunzip($in_file, $out_file_name = '') { |
|
128 | 128 | //echo $in_file.' -> '.$out_file_name."\n"; |
129 | 129 | $buffer_size = 4096; // read 4kb at a time |
130 | 130 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
131 | 131 | if ($in_file != '' && file_exists($in_file)) { |
132 | 132 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
133 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
134 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
133 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
134 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
135 | 135 | else { |
136 | 136 | echo 'gzopen not available'; |
137 | 137 | die; |
138 | 138 | } |
139 | 139 | $out_file = fopen($out_file_name, 'wb'); |
140 | - while(!gzeof($file)) { |
|
140 | + while (!gzeof($file)) { |
|
141 | 141 | fwrite($out_file, gzread($file, $buffer_size)); |
142 | 142 | } |
143 | 143 | fclose($out_file); |
@@ -145,19 +145,19 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | - public static function bunzip2($in_file,$out_file_name = '') { |
|
148 | + public static function bunzip2($in_file, $out_file_name = '') { |
|
149 | 149 | //echo $in_file.' -> '.$out_file_name."\n"; |
150 | 150 | $buffer_size = 4096; // read 4kb at a time |
151 | 151 | if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
152 | 152 | if ($in_file != '' && file_exists($in_file)) { |
153 | 153 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
154 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
154 | + if (function_exists('bzopen')) $file = bzopen($in_file, 'rb'); |
|
155 | 155 | else { |
156 | 156 | echo 'bzopen not available'; |
157 | 157 | die; |
158 | 158 | } |
159 | 159 | $out_file = fopen($out_file_name, 'wb'); |
160 | - while(!feof($file)) { |
|
160 | + while (!feof($file)) { |
|
161 | 161 | fwrite($out_file, bzread($file, $buffer_size)); |
162 | 162 | } |
163 | 163 | fclose($out_file); |
@@ -175,27 +175,27 @@ discard block |
||
175 | 175 | if ($data == '') return array(); |
176 | 176 | $html = str_get_html($data); |
177 | 177 | if ($html === false) return array(); |
178 | - $tabledata=array(); |
|
179 | - foreach($html->find('tr') as $element) |
|
178 | + $tabledata = array(); |
|
179 | + foreach ($html->find('tr') as $element) |
|
180 | 180 | { |
181 | 181 | $td = array(); |
182 | - foreach( $element->find('th') as $row) |
|
182 | + foreach ($element->find('th') as $row) |
|
183 | 183 | { |
184 | 184 | $td [] = trim($row->plaintext); |
185 | 185 | } |
186 | - $td=array_filter($td); |
|
186 | + $td = array_filter($td); |
|
187 | 187 | $tabledata[] = $td; |
188 | 188 | |
189 | 189 | $td = array(); |
190 | 190 | $tdi = array(); |
191 | - foreach( $element->find('td') as $row) |
|
191 | + foreach ($element->find('td') as $row) |
|
192 | 192 | { |
193 | 193 | $td [] = trim($row->plaintext); |
194 | 194 | $tdi [] = trim($row->innertext); |
195 | 195 | } |
196 | - $td=array_filter($td); |
|
197 | - $tdi=array_filter($tdi); |
|
198 | - $tabledata[]=array_merge($td,$tdi); |
|
196 | + $td = array_filter($td); |
|
197 | + $tdi = array_filter($tdi); |
|
198 | + $tabledata[] = array_merge($td, $tdi); |
|
199 | 199 | } |
200 | 200 | $html->clear(); |
201 | 201 | unset($html); |
@@ -210,8 +210,8 @@ discard block |
||
210 | 210 | public function text2array($data) { |
211 | 211 | $html = str_get_html($data); |
212 | 212 | if ($html === false) return array(); |
213 | - $tabledata=array(); |
|
214 | - foreach($html->find('p') as $element) |
|
213 | + $tabledata = array(); |
|
214 | + foreach ($html->find('p') as $element) |
|
215 | 215 | { |
216 | 216 | $tabledata [] = trim($element->plaintext); |
217 | 217 | } |
@@ -231,11 +231,11 @@ discard block |
||
231 | 231 | */ |
232 | 232 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | 233 | if ($lat == $latc && $lon == $lonc) return 0; |
234 | - $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
|
234 | + $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc))) + cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon) - floatval($lonc)))))*60*1.1515; |
|
235 | 235 | if ($unit == "km") { |
236 | - return round($dist * 1.609344); |
|
236 | + return round($dist*1.609344); |
|
237 | 237 | } elseif ($unit == "m") { |
238 | - return round($dist * 1.609344 * 1000); |
|
238 | + return round($dist*1.609344*1000); |
|
239 | 239 | } elseif ($unit == "mile" || $unit == "mi") { |
240 | 240 | return round($dist); |
241 | 241 | } elseif ($unit == "nm") { |
@@ -252,8 +252,8 @@ discard block |
||
252 | 252 | * @param String $distance distance between two points in m |
253 | 253 | * @return Float plunge |
254 | 254 | */ |
255 | - public function plunge($initial_altitude,$final_altitude,$distance) { |
|
256 | - $plunge = rad2deg(asin(($final_altitude-$initial_altitude)/$distance)); |
|
255 | + public function plunge($initial_altitude, $final_altitude, $distance) { |
|
256 | + $plunge = rad2deg(asin(($final_altitude - $initial_altitude)/$distance)); |
|
257 | 257 | /* |
258 | 258 | $siter = 6378137.0 + $initial_altitude; |
259 | 259 | $planer = 6378137.0 + $final_altitude; |
@@ -275,8 +275,8 @@ discard block |
||
275 | 275 | public function azimuth($lat, $lon, $latc, $lonc) { |
276 | 276 | $dX = $latc - $lat; |
277 | 277 | $dY = $lonc - $lon; |
278 | - $azimuth = rad2deg(atan2($dY,$dX)); |
|
279 | - if ($azimuth < 0) return $azimuth+360; |
|
278 | + $azimuth = rad2deg(atan2($dY, $dX)); |
|
279 | + if ($azimuth < 0) return $azimuth + 360; |
|
280 | 280 | return $azimuth; |
281 | 281 | } |
282 | 282 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | * @param float $distance distance covered |
288 | 288 | * @return whether distance is realistic |
289 | 289 | */ |
290 | - public function withinThreshold ($timeDifference, $distance) { |
|
290 | + public function withinThreshold($timeDifference, $distance) { |
|
291 | 291 | $x = abs($timeDifference); |
292 | 292 | $d = abs($distance); |
293 | 293 | if ($x == 0 || $d == 0) return true; |
@@ -303,13 +303,13 @@ discard block |
||
303 | 303 | return ($array !== array_values($array)); |
304 | 304 | } |
305 | 305 | |
306 | - public function isInteger($input){ |
|
306 | + public function isInteger($input) { |
|
307 | 307 | //return(ctype_digit(strval($input))); |
308 | - return preg_match('/^-?[0-9]+$/', (string)$input) ? true : false; |
|
308 | + return preg_match('/^-?[0-9]+$/', (string) $input) ? true : false; |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | |
312 | - public function convertDec($dms,$latlong) { |
|
312 | + public function convertDec($dms, $latlong) { |
|
313 | 313 | if ($latlong == 'latitude') { |
314 | 314 | $deg = substr($dms, 0, 2); |
315 | 315 | $min = substr($dms, 2, 4); |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | $deg = substr($dms, 0, 3); |
318 | 318 | $min = substr($dms, 3, 5); |
319 | 319 | } |
320 | - return $deg+(($min*60)/3600); |
|
320 | + return $deg + (($min*60)/3600); |
|
321 | 321 | } |
322 | 322 | |
323 | - public function convertDM($coord,$latlong) { |
|
323 | + public function convertDM($coord, $latlong) { |
|
324 | 324 | if ($latlong == 'latitude') { |
325 | 325 | if ($coord < 0) $NSEW = 'S'; |
326 | 326 | else $NSEW = 'N'; |
@@ -330,9 +330,9 @@ discard block |
||
330 | 330 | } |
331 | 331 | $coord = abs($coord); |
332 | 332 | $deg = floor($coord); |
333 | - $coord = ($coord-$deg)*60; |
|
333 | + $coord = ($coord - $deg)*60; |
|
334 | 334 | $min = $coord; |
335 | - return array('deg' => $deg,'min' => $min,'NSEW' => $NSEW); |
|
335 | + return array('deg' => $deg, 'min' => $min, 'NSEW' => $NSEW); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | /** |
@@ -344,8 +344,8 @@ discard block |
||
344 | 344 | public function xcopy($source, $dest) |
345 | 345 | { |
346 | 346 | $files = glob($source.'*.*'); |
347 | - foreach($files as $file){ |
|
348 | - $file_to_go = str_replace($source,$dest,$file); |
|
347 | + foreach ($files as $file) { |
|
348 | + $file_to_go = str_replace($source, $dest, $file); |
|
349 | 349 | copy($file, $file_to_go); |
350 | 350 | } |
351 | 351 | return true; |
@@ -356,9 +356,9 @@ discard block |
||
356 | 356 | * @param String $url url to check |
357 | 357 | * @return bool Return true on succes false on failure |
358 | 358 | */ |
359 | - public function urlexist($url){ |
|
360 | - $headers=get_headers($url); |
|
361 | - return stripos($headers[0],"200 OK")?true:false; |
|
359 | + public function urlexist($url) { |
|
360 | + $headers = get_headers($url); |
|
361 | + return stripos($headers[0], "200 OK") ?true:false; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | public function hex2str($hex) { |
370 | 370 | $str = ''; |
371 | 371 | $hexln = strlen($hex); |
372 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
372 | + for ($i = 0; $i < $hexln; $i += 2) $str .= chr(hexdec(substr($hex, $i, 2))); |
|
373 | 373 | return $str; |
374 | 374 | } |
375 | 375 | |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * @return String Return result |
380 | 380 | */ |
381 | 381 | public function hex2rgb($hex) { |
382 | - $hex = str_replace('#','',$hex); |
|
382 | + $hex = str_replace('#', '', $hex); |
|
383 | 383 | return sscanf($hex, "%02x%02x%02x"); |
384 | 384 | } |
385 | 385 | |
@@ -387,33 +387,33 @@ discard block |
||
387 | 387 | //difference in longitudinal coordinates |
388 | 388 | $dLon = deg2rad($lon2) - deg2rad($lon1); |
389 | 389 | //difference in the phi of latitudinal coordinates |
390 | - $dPhi = log(tan(deg2rad($lat2) / 2 + M_PI / 4) / tan(deg2rad($lat1) / 2 + M_PI / 4)); |
|
390 | + $dPhi = log(tan(deg2rad($lat2)/2 + M_PI/4)/tan(deg2rad($lat1)/2 + M_PI/4)); |
|
391 | 391 | //we need to recalculate $dLon if it is greater than pi |
392 | - if(abs($dLon) > M_PI) { |
|
393 | - if($dLon > 0) { |
|
394 | - $dLon = (2 * M_PI - $dLon) * -1; |
|
392 | + if (abs($dLon) > M_PI) { |
|
393 | + if ($dLon > 0) { |
|
394 | + $dLon = (2*M_PI - $dLon)*-1; |
|
395 | 395 | } else { |
396 | - $dLon = 2 * M_PI + $dLon; |
|
396 | + $dLon = 2*M_PI + $dLon; |
|
397 | 397 | } |
398 | 398 | } |
399 | 399 | //return the angle, normalized |
400 | - return (rad2deg(atan2($dLon, $dPhi)) + 360) % 360; |
|
400 | + return (rad2deg(atan2($dLon, $dPhi)) + 360)%360; |
|
401 | 401 | } |
402 | 402 | |
403 | - public function checkLine($lat1,$lon1,$lat2,$lon2,$lat3,$lon3,$approx = 0.15) { |
|
403 | + public function checkLine($lat1, $lon1, $lat2, $lon2, $lat3, $lon3, $approx = 0.15) { |
|
404 | 404 | //$a = ($lon2-$lon1)*$lat3+($lat2-$lat1)*$lon3+($lat1*$lon2+$lat2*$lon1); |
405 | - $a = -($lon2-$lon1); |
|
405 | + $a = -($lon2 - $lon1); |
|
406 | 406 | $b = $lat2 - $lat1; |
407 | - $c = -($a*$lat1+$b*$lon1); |
|
408 | - $d = $a*$lat3+$b*$lon3+$c; |
|
407 | + $c = -($a*$lat1 + $b*$lon1); |
|
408 | + $d = $a*$lat3 + $b*$lon3 + $c; |
|
409 | 409 | if ($d > -$approx && $d < $approx) return true; |
410 | 410 | else return false; |
411 | 411 | } |
412 | 412 | |
413 | 413 | public function array_merge_noappend() { |
414 | 414 | $output = array(); |
415 | - foreach(func_get_args() as $array) { |
|
416 | - foreach($array as $key => $value) { |
|
415 | + foreach (func_get_args() as $array) { |
|
416 | + foreach ($array as $key => $value) { |
|
417 | 417 | $output[$key] = isset($output[$key]) ? |
418 | 418 | array_merge($output[$key], $value) : $value; |
419 | 419 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | return $result; |
478 | 478 | } |
479 | 479 | |
480 | - public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = ''){ |
|
480 | + public function nextcoord($latitude, $longitude, $speed, $heading, $archivespeed = 1, $seconds = '') { |
|
481 | 481 | global $globalMapRefresh; |
482 | 482 | if ($seconds == '') { |
483 | 483 | $distance = ($speed*0.514444*$globalMapRefresh*$archivespeed)/1000; |
@@ -488,27 +488,27 @@ discard block |
||
488 | 488 | $latitude = deg2rad($latitude); |
489 | 489 | $longitude = deg2rad($longitude); |
490 | 490 | $bearing = deg2rad($heading); |
491 | - $latitude2 = asin( (sin($latitude) * cos($distance/$r)) + (cos($latitude) * sin($distance/$r) * cos($bearing)) ); |
|
492 | - $longitude2 = $longitude + atan2( sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r)-(sin($latitude)*sin($latitude2)) ); |
|
493 | - return array('latitude' => number_format(rad2deg($latitude2),5,'.',''),'longitude' => number_format(rad2deg($longitude2),5,'.','')); |
|
491 | + $latitude2 = asin((sin($latitude)*cos($distance/$r)) + (cos($latitude)*sin($distance/$r)*cos($bearing))); |
|
492 | + $longitude2 = $longitude + atan2(sin($bearing)*sin($distance/$r)*cos($latitude), cos($distance/$r) - (sin($latitude)*sin($latitude2))); |
|
493 | + return array('latitude' => number_format(rad2deg($latitude2), 5, '.', ''), 'longitude' => number_format(rad2deg($longitude2), 5, '.', '')); |
|
494 | 494 | } |
495 | 495 | |
496 | - public function getCoordfromDistanceBearing($latitude,$longitude,$bearing,$distance) { |
|
496 | + public function getCoordfromDistanceBearing($latitude, $longitude, $bearing, $distance) { |
|
497 | 497 | // distance in meter |
498 | 498 | $R = 6378.14; |
499 | - $latitude1 = $latitude * (M_PI/180); |
|
500 | - $longitude1 = $longitude * (M_PI/180); |
|
501 | - $brng = $bearing * (M_PI/180); |
|
499 | + $latitude1 = $latitude*(M_PI/180); |
|
500 | + $longitude1 = $longitude*(M_PI/180); |
|
501 | + $brng = $bearing*(M_PI/180); |
|
502 | 502 | $d = $distance; |
503 | 503 | |
504 | 504 | $latitude2 = asin(sin($latitude1)*cos($d/$R) + cos($latitude1)*sin($d/$R)*cos($brng)); |
505 | - $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1),cos($d/$R)-sin($latitude1)*sin($latitude2)); |
|
505 | + $longitude2 = $longitude1 + atan2(sin($brng)*sin($d/$R)*cos($latitude1), cos($d/$R) - sin($latitude1)*sin($latitude2)); |
|
506 | 506 | |
507 | - $latitude2 = $latitude2 * (180/M_PI); |
|
508 | - $longitude2 = $longitude2 * (180/M_PI); |
|
507 | + $latitude2 = $latitude2*(180/M_PI); |
|
508 | + $longitude2 = $longitude2*(180/M_PI); |
|
509 | 509 | |
510 | - $flat = round ($latitude2,6); |
|
511 | - $flong = round ($longitude2,6); |
|
510 | + $flat = round($latitude2, 6); |
|
511 | + $flong = round($longitude2, 6); |
|
512 | 512 | /* |
513 | 513 | $dx = $distance*cos($bearing); |
514 | 514 | $dy = $distance*sin($bearing); |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | $flong = $longitude + $dlong; |
518 | 518 | $flat = $latitude + $dlat; |
519 | 519 | */ |
520 | - return array('latitude' => $flat,'longitude' => $flong); |
|
520 | + return array('latitude' => $flat, 'longitude' => $flong); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -531,14 +531,14 @@ discard block |
||
531 | 531 | * @param integer $level GZIP compression level (default: 9) |
532 | 532 | * @return string New filename (with .gz appended) if success, or false if operation fails |
533 | 533 | */ |
534 | - public function gzCompressFile($source, $level = 9){ |
|
535 | - $dest = $source . '.gz'; |
|
536 | - $mode = 'wb' . $level; |
|
534 | + public function gzCompressFile($source, $level = 9) { |
|
535 | + $dest = $source.'.gz'; |
|
536 | + $mode = 'wb'.$level; |
|
537 | 537 | $error = false; |
538 | 538 | if ($fp_out = gzopen($dest, $mode)) { |
539 | - if ($fp_in = fopen($source,'rb')) { |
|
539 | + if ($fp_in = fopen($source, 'rb')) { |
|
540 | 540 | while (!feof($fp_in)) |
541 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
541 | + gzwrite($fp_out, fread($fp_in, 1024*512)); |
|
542 | 542 | fclose($fp_in); |
543 | 543 | } else { |
544 | 544 | $error = true; |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | } |
555 | 555 | |
556 | 556 | public function remove_accents($string) { |
557 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
557 | + if (!preg_match('/[\x80-\xff]/', $string)) return $string; |
|
558 | 558 | $chars = array( |
559 | 559 | // Decompositions for Latin-1 Supplement |
560 | 560 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
612 | 612 | chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
613 | 613 | chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
614 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
614 | + chr(196).chr(178) => 'IJ', chr(196).chr(179) => 'ij', |
|
615 | 615 | chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
616 | 616 | chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
617 | 617 | chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
@@ -627,13 +627,13 @@ discard block |
||
627 | 627 | chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
628 | 628 | chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
629 | 629 | chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
630 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
631 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
632 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
633 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
634 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
635 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
636 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
630 | + chr(197).chr(146) => 'OE', chr(197).chr(147) => 'oe', |
|
631 | + chr(197).chr(148) => 'R', chr(197).chr(149) => 'r', |
|
632 | + chr(197).chr(150) => 'R', chr(197).chr(151) => 'r', |
|
633 | + chr(197).chr(152) => 'R', chr(197).chr(153) => 'r', |
|
634 | + chr(197).chr(154) => 'S', chr(197).chr(155) => 's', |
|
635 | + chr(197).chr(156) => 'S', chr(197).chr(157) => 's', |
|
636 | + chr(197).chr(158) => 'S', chr(197).chr(159) => 's', |
|
637 | 637 | chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
638 | 638 | chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
639 | 639 | chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
@@ -667,7 +667,7 @@ discard block |
||
667 | 667 | for ($i = 0, $int = '', $concat_flag = true; $i < $length; $i++) { |
668 | 668 | if (is_numeric($string[$i]) && $concat_flag) { |
669 | 669 | $int .= $string[$i]; |
670 | - } elseif(!$concat && $concat_flag && strlen($int) > 0) { |
|
670 | + } elseif (!$concat && $concat_flag && strlen($int) > 0) { |
|
671 | 671 | $concat_flag = false; |
672 | 672 | } |
673 | 673 | } |
@@ -713,7 +713,7 @@ discard block |
||
713 | 713 | $slice = array_slice($arr, $offset + 1, $length); |
714 | 714 | return implode("", $slice); |
715 | 715 | } else { |
716 | - return mb_substr($string,$offset,$length,'UTF-8'); |
|
716 | + return mb_substr($string, $offset, $length, 'UTF-8'); |
|
717 | 717 | } |
718 | 718 | } |
719 | 719 | |
@@ -723,14 +723,14 @@ discard block |
||
723 | 723 | //NOTE: use a trailing slash for folders!!! |
724 | 724 | //see http://bugs.php.net/bug.php?id=27609 |
725 | 725 | //see http://bugs.php.net/bug.php?id=30931 |
726 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
726 | + if ($path{strlen($path) - 1} == '/') // recursively return a temporary file path |
|
727 | 727 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
728 | 728 | else if (is_dir($path)) |
729 | 729 | return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
730 | 730 | // check tmp file for read/write capabilities |
731 | 731 | $rm = file_exists($path); |
732 | 732 | $f = @fopen($path, 'a'); |
733 | - if ($f===false) |
|
733 | + if ($f === false) |
|
734 | 734 | return false; |
735 | 735 | fclose($f); |
736 | 736 | if (!$rm) |
@@ -749,29 +749,29 @@ discard block |
||
749 | 749 | * @param Integer $offset Controls the likelyhood that lines will be split which cross the dateline |
750 | 750 | * @return Array Coordinate of the route |
751 | 751 | */ |
752 | - public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
|
753 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
752 | + public function greatcircle($begin_lat, $begin_lon, $end_lat, $end_lon, $nbpts = 20, $offset = 10) { |
|
753 | + if ($nbpts <= 2) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat)); |
|
754 | 754 | $sx = deg2rad($begin_lon); |
755 | 755 | $sy = deg2rad($begin_lat); |
756 | 756 | $ex = deg2rad($end_lon); |
757 | 757 | $ey = deg2rad($end_lat); |
758 | 758 | $w = $sx - $ex; |
759 | 759 | $h = $sy - $ey; |
760 | - $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
|
760 | + $z = pow(sin($h/2.0), 2) + cos($sy)*cos($ey)*pow(sin($w/2.0), 2); |
|
761 | 761 | $g = 2.0*asin(sqrt($z)); |
762 | - if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
762 | + if ($g == M_PI || is_nan($g)) return array(array($begin_lon, $begin_lat), array($end_lon, $end_lat)); |
|
763 | 763 | $first_pass = array(); |
764 | - $delta = 1.0/($nbpts-1); |
|
765 | - for ($i =0; $i < $nbpts; ++$i) { |
|
764 | + $delta = 1.0/($nbpts - 1); |
|
765 | + for ($i = 0; $i < $nbpts; ++$i) { |
|
766 | 766 | $step = $delta*$i; |
767 | - $A = sin((1 - $step) * $g) / sin($g); |
|
768 | - $B = sin($step * $g) / sin($g); |
|
769 | - $x = $A * cos($sy) * cos($sx) + $B * cos($ey) * cos($ex); |
|
770 | - $y = $A * cos($sy) * sin($sx) + $B * cos($ey) * sin($ex); |
|
771 | - $z = $A * sin($sy) + $B * sin($ey); |
|
767 | + $A = sin((1 - $step)*$g)/sin($g); |
|
768 | + $B = sin($step*$g)/sin($g); |
|
769 | + $x = $A*cos($sy)*cos($sx) + $B*cos($ey)*cos($ex); |
|
770 | + $y = $A*cos($sy)*sin($sx) + $B*cos($ey)*sin($ex); |
|
771 | + $z = $A*sin($sy) + $B*sin($ey); |
|
772 | 772 | $lat = rad2deg(atan2($z, sqrt(pow($x, 2) + pow($y, 2)))); |
773 | 773 | $lon = rad2deg(atan2($y, $x)); |
774 | - $first_pass[] = array($lon,$lat); |
|
774 | + $first_pass[] = array($lon, $lat); |
|
775 | 775 | } |
776 | 776 | $bHasBigDiff = false; |
777 | 777 | $dfMaxSmallDiffLong = 0; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | // https://github.com/OSGeo/gdal/blob/7bfb9c452a59aac958bff0c8386b891edf8154ca/gdal/ogr/ogrgeometryfactory.cpp#L2342 |
787 | 787 | $first_pass_ln = count($first_pass); |
788 | 788 | for ($j = 1; $j < $first_pass_ln; ++$j) { |
789 | - $dfPrevX = $first_pass[$j-1][0]; |
|
789 | + $dfPrevX = $first_pass[$j - 1][0]; |
|
790 | 790 | $dfX = $first_pass[$j][0]; |
791 | 791 | $dfDiffLong = abs($dfX - $dfPrevX); |
792 | 792 | if ($dfDiffLong > $dfDiffSpace && |
@@ -804,14 +804,14 @@ discard block |
||
804 | 804 | //$poMulti[] = $poNewLS; |
805 | 805 | for ($k = 0; $k < $first_pass_ln; ++$k) { |
806 | 806 | $dfX0 = floatval($first_pass[$k][0]); |
807 | - if ($k > 0 && abs($dfX0 - $first_pass[$k-1][0]) > $dfDiffSpace) { |
|
808 | - $dfX1 = floatval($first_pass[$k-1][0]); |
|
809 | - $dfY1 = floatval($first_pass[$k-1][1]); |
|
807 | + if ($k > 0 && abs($dfX0 - $first_pass[$k - 1][0]) > $dfDiffSpace) { |
|
808 | + $dfX1 = floatval($first_pass[$k - 1][0]); |
|
809 | + $dfY1 = floatval($first_pass[$k - 1][1]); |
|
810 | 810 | $dfX2 = floatval($first_pass[$k][0]); |
811 | 811 | $dfY2 = floatval($first_pass[$k][1]); |
812 | 812 | if ($dfX1 > -180 && $dfX1 < $dfRightBorderX && $dfX2 == 180 && |
813 | - $k+1 < count($first_pass) && |
|
814 | - $first_pass[$k-1][0] > -180 && $first_pass[$k-1][0] < $dfRightBorderX) |
|
813 | + $k + 1 < count($first_pass) && |
|
814 | + $first_pass[$k - 1][0] > -180 && $first_pass[$k - 1][0] < $dfRightBorderX) |
|
815 | 815 | { |
816 | 816 | $poNewLS[] = array(-180, $first_pass[$k][1]); |
817 | 817 | $k++; |
@@ -819,8 +819,8 @@ discard block |
||
819 | 819 | $poNewLS[] = array($first_pass[$k][0], $first_pass[$k][1]); |
820 | 820 | continue; |
821 | 821 | } else if ($dfX1 > $dfLeftBorderX && $dfX1 < 180 && $dfX2 == -180 && |
822 | - $k+1 < $first_pass_ln && |
|
823 | - $first_pass[$k-1][0] > $dfLeftBorderX && $first_pass[$k-1][0] < 180) |
|
822 | + $k + 1 < $first_pass_ln && |
|
823 | + $first_pass[$k - 1][0] > $dfLeftBorderX && $first_pass[$k - 1][0] < 180) |
|
824 | 824 | { |
825 | 825 | $poNewLS[] = array(180, $first_pass[$k][1]); |
826 | 826 | $k++; |
@@ -843,12 +843,12 @@ discard block |
||
843 | 843 | } |
844 | 844 | if ($dfX1 <= 180 && $dfX2 >= 180 && $dfX1 < $dfX2) |
845 | 845 | { |
846 | - $dfRatio = (180 - $dfX1) / ($dfX2 - $dfX1); |
|
847 | - $dfY = $dfRatio * $dfY2 + (1 - $dfRatio) * $dfY1; |
|
848 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
846 | + $dfRatio = (180 - $dfX1)/($dfX2 - $dfX1); |
|
847 | + $dfY = $dfRatio*$dfY2 + (1 - $dfRatio)*$dfY1; |
|
848 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? 180 : -180, $dfY); |
|
849 | 849 | $poMulti[] = $poNewLS; |
850 | 850 | $poNewLS = array(); |
851 | - $poNewLS[] = array($first_pass[$k-1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
851 | + $poNewLS[] = array($first_pass[$k - 1][0] > $dfLeftBorderX ? -180 : 180, $dfY); |
|
852 | 852 | //$poMulti[] = $poNewLS; |
853 | 853 | } else { |
854 | 854 | //$poNewLS[] = array(); |
@@ -866,7 +866,7 @@ discard block |
||
866 | 866 | $poNewLS0 = array(); |
867 | 867 | //$poMulti[] = $poNewLS0; |
868 | 868 | for ($l = 0; $l < $first_pass_ln; ++$l) { |
869 | - $poNewLS0[] = array($first_pass[$l][0],$first_pass[$l][1]); |
|
869 | + $poNewLS0[] = array($first_pass[$l][0], $first_pass[$l][1]); |
|
870 | 870 | } |
871 | 871 | $poMulti[] = $poNewLS0; |
872 | 872 | } |
@@ -37,8 +37,11 @@ discard block |
||
37 | 37 | } else { |
38 | 38 | curl_setopt($ch, CURLOPT_USERAGENT, $useragent); |
39 | 39 | } |
40 | - if ($timeout == '') curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
41 | - else curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
40 | + if ($timeout == '') { |
|
41 | + curl_setopt($ch, CURLOPT_TIMEOUT, 10); |
|
42 | + } else { |
|
43 | + curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); |
|
44 | + } |
|
42 | 45 | curl_setopt($ch, CURLOPT_HEADERFUNCTION, array('Common',"curlResponseHeaderCallback")); |
43 | 46 | if ($type == 'post') { |
44 | 47 | curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); |
@@ -51,7 +54,9 @@ discard block |
||
51 | 54 | } else { |
52 | 55 | curl_setopt($ch, CURLOPT_POSTFIELDS, $data); |
53 | 56 | } |
54 | - } elseif ($type != 'get' && $type != '') curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
57 | + } elseif ($type != 'get' && $type != '') { |
|
58 | + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, $type); |
|
59 | + } |
|
55 | 60 | if ($headers != '') { |
56 | 61 | curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); |
57 | 62 | } |
@@ -95,8 +100,9 @@ discard block |
||
95 | 100 | private function curlResponseHeaderCallback($ch, $headerLine) { |
96 | 101 | //global $cookies; |
97 | 102 | $cookies = array(); |
98 | - if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) |
|
99 | - $cookies[] = $cookie; |
|
103 | + if (preg_match('/^Set-Cookie:\s*([^;]*)/mi', $headerLine, $cookie) == 1) { |
|
104 | + $cookies[] = $cookie; |
|
105 | + } |
|
100 | 106 | return strlen($headerLine); // Needed by curl |
101 | 107 | } |
102 | 108 | |
@@ -107,7 +113,9 @@ discard block |
||
107 | 113 | curl_setopt($ch, CURLOPT_URL, $url); |
108 | 114 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); |
109 | 115 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
110 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
116 | + if ($referer != '') { |
|
117 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
118 | + } |
|
111 | 119 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
112 | 120 | if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
113 | 121 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
@@ -119,7 +127,9 @@ discard block |
||
119 | 127 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
120 | 128 | curl_setopt($ch, CURLOPT_FILE, $fp); |
121 | 129 | curl_exec($ch); |
122 | - if (curl_errno($ch) && $globalDebug) echo 'Download error: '.curl_error($ch); |
|
130 | + if (curl_errno($ch) && $globalDebug) { |
|
131 | + echo 'Download error: '.curl_error($ch); |
|
132 | + } |
|
123 | 133 | curl_close($ch); |
124 | 134 | fclose($fp); |
125 | 135 | } |
@@ -127,12 +137,16 @@ discard block |
||
127 | 137 | public static function gunzip($in_file,$out_file_name = '') { |
128 | 138 | //echo $in_file.' -> '.$out_file_name."\n"; |
129 | 139 | $buffer_size = 4096; // read 4kb at a time |
130 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
140 | + if ($out_file_name == '') { |
|
141 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
142 | + } |
|
131 | 143 | if ($in_file != '' && file_exists($in_file)) { |
132 | 144 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
133 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
134 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
135 | - else { |
|
145 | + if (function_exists('gzopen')) { |
|
146 | + $file = gzopen($in_file,'rb'); |
|
147 | + } elseif (function_exists('gzopen64')) { |
|
148 | + $file = gzopen64($in_file,'rb'); |
|
149 | + } else { |
|
136 | 150 | echo 'gzopen not available'; |
137 | 151 | die; |
138 | 152 | } |
@@ -148,11 +162,14 @@ discard block |
||
148 | 162 | public static function bunzip2($in_file,$out_file_name = '') { |
149 | 163 | //echo $in_file.' -> '.$out_file_name."\n"; |
150 | 164 | $buffer_size = 4096; // read 4kb at a time |
151 | - if ($out_file_name == '') $out_file_name = str_replace('.bz2', '', $in_file); |
|
165 | + if ($out_file_name == '') { |
|
166 | + $out_file_name = str_replace('.bz2', '', $in_file); |
|
167 | + } |
|
152 | 168 | if ($in_file != '' && file_exists($in_file)) { |
153 | 169 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
154 | - if (function_exists('bzopen')) $file = bzopen($in_file,'rb'); |
|
155 | - else { |
|
170 | + if (function_exists('bzopen')) { |
|
171 | + $file = bzopen($in_file,'rb'); |
|
172 | + } else { |
|
156 | 173 | echo 'bzopen not available'; |
157 | 174 | die; |
158 | 175 | } |
@@ -171,10 +188,16 @@ discard block |
||
171 | 188 | * @return Array array of the tables in HTML page |
172 | 189 | */ |
173 | 190 | public function table2array($data) { |
174 | - if (!is_string($data)) return array(); |
|
175 | - if ($data == '') return array(); |
|
191 | + if (!is_string($data)) { |
|
192 | + return array(); |
|
193 | + } |
|
194 | + if ($data == '') { |
|
195 | + return array(); |
|
196 | + } |
|
176 | 197 | $html = str_get_html($data); |
177 | - if ($html === false) return array(); |
|
198 | + if ($html === false) { |
|
199 | + return array(); |
|
200 | + } |
|
178 | 201 | $tabledata=array(); |
179 | 202 | foreach($html->find('tr') as $element) |
180 | 203 | { |
@@ -209,7 +232,9 @@ discard block |
||
209 | 232 | */ |
210 | 233 | public function text2array($data) { |
211 | 234 | $html = str_get_html($data); |
212 | - if ($html === false) return array(); |
|
235 | + if ($html === false) { |
|
236 | + return array(); |
|
237 | + } |
|
213 | 238 | $tabledata=array(); |
214 | 239 | foreach($html->find('p') as $element) |
215 | 240 | { |
@@ -230,7 +255,9 @@ discard block |
||
230 | 255 | * @return Float Distance in $unit |
231 | 256 | */ |
232 | 257 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
233 | - if ($lat == $latc && $lon == $lonc) return 0; |
|
258 | + if ($lat == $latc && $lon == $lonc) { |
|
259 | + return 0; |
|
260 | + } |
|
234 | 261 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
235 | 262 | if ($unit == "km") { |
236 | 263 | return round($dist * 1.609344); |
@@ -276,7 +303,9 @@ discard block |
||
276 | 303 | $dX = $latc - $lat; |
277 | 304 | $dY = $lonc - $lon; |
278 | 305 | $azimuth = rad2deg(atan2($dY,$dX)); |
279 | - if ($azimuth < 0) return $azimuth+360; |
|
306 | + if ($azimuth < 0) { |
|
307 | + return $azimuth+360; |
|
308 | + } |
|
280 | 309 | return $azimuth; |
281 | 310 | } |
282 | 311 | |
@@ -290,10 +319,16 @@ discard block |
||
290 | 319 | public function withinThreshold ($timeDifference, $distance) { |
291 | 320 | $x = abs($timeDifference); |
292 | 321 | $d = abs($distance); |
293 | - if ($x == 0 || $d == 0) return true; |
|
322 | + if ($x == 0 || $d == 0) { |
|
323 | + return true; |
|
324 | + } |
|
294 | 325 | // may be due to Internet jitter; distance is realistic |
295 | - if ($x < 0.7 && $d < 2000) return true; |
|
296 | - else return $d/$x < 1500*0.27778; // 1500 km/h max |
|
326 | + if ($x < 0.7 && $d < 2000) { |
|
327 | + return true; |
|
328 | + } else { |
|
329 | + return $d/$x < 1500*0.27778; |
|
330 | + } |
|
331 | + // 1500 km/h max |
|
297 | 332 | } |
298 | 333 | |
299 | 334 | |
@@ -322,11 +357,17 @@ discard block |
||
322 | 357 | |
323 | 358 | public function convertDM($coord,$latlong) { |
324 | 359 | if ($latlong == 'latitude') { |
325 | - if ($coord < 0) $NSEW = 'S'; |
|
326 | - else $NSEW = 'N'; |
|
360 | + if ($coord < 0) { |
|
361 | + $NSEW = 'S'; |
|
362 | + } else { |
|
363 | + $NSEW = 'N'; |
|
364 | + } |
|
327 | 365 | } else { |
328 | - if ($coord < 0) $NSEW = 'W'; |
|
329 | - else $NSEW = 'E'; |
|
366 | + if ($coord < 0) { |
|
367 | + $NSEW = 'W'; |
|
368 | + } else { |
|
369 | + $NSEW = 'E'; |
|
370 | + } |
|
330 | 371 | } |
331 | 372 | $coord = abs($coord); |
332 | 373 | $deg = floor($coord); |
@@ -369,7 +410,9 @@ discard block |
||
369 | 410 | public function hex2str($hex) { |
370 | 411 | $str = ''; |
371 | 412 | $hexln = strlen($hex); |
372 | - for($i=0;$i<$hexln;$i+=2) $str .= chr(hexdec(substr($hex,$i,2))); |
|
413 | + for($i=0;$i<$hexln;$i+=2) { |
|
414 | + $str .= chr(hexdec(substr($hex,$i,2))); |
|
415 | + } |
|
373 | 416 | return $str; |
374 | 417 | } |
375 | 418 | |
@@ -406,8 +449,11 @@ discard block |
||
406 | 449 | $b = $lat2 - $lat1; |
407 | 450 | $c = -($a*$lat1+$b*$lon1); |
408 | 451 | $d = $a*$lat3+$b*$lon3+$c; |
409 | - if ($d > -$approx && $d < $approx) return true; |
|
410 | - else return false; |
|
452 | + if ($d > -$approx && $d < $approx) { |
|
453 | + return true; |
|
454 | + } else { |
|
455 | + return false; |
|
456 | + } |
|
411 | 457 | } |
412 | 458 | |
413 | 459 | public function array_merge_noappend() { |
@@ -466,7 +512,9 @@ discard block |
||
466 | 512 | return $result; |
467 | 513 | } |
468 | 514 | $handle = @opendir('./locale'); |
469 | - if ($handle === false) return $result; |
|
515 | + if ($handle === false) { |
|
516 | + return $result; |
|
517 | + } |
|
470 | 518 | while (false !== ($file = readdir($handle))) { |
471 | 519 | $path = './locale'.'/'.$file.'/LC_MESSAGES/fam.mo'; |
472 | 520 | if ($file != "." && $file != ".." && @file_exists($path)) { |
@@ -537,8 +585,9 @@ discard block |
||
537 | 585 | $error = false; |
538 | 586 | if ($fp_out = gzopen($dest, $mode)) { |
539 | 587 | if ($fp_in = fopen($source,'rb')) { |
540 | - while (!feof($fp_in)) |
|
541 | - gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
588 | + while (!feof($fp_in)) { |
|
589 | + gzwrite($fp_out, fread($fp_in, 1024 * 512)); |
|
590 | + } |
|
542 | 591 | fclose($fp_in); |
543 | 592 | } else { |
544 | 593 | $error = true; |
@@ -547,14 +596,17 @@ discard block |
||
547 | 596 | } else { |
548 | 597 | $error = true; |
549 | 598 | } |
550 | - if ($error) |
|
551 | - return false; |
|
552 | - else |
|
553 | - return $dest; |
|
599 | + if ($error) { |
|
600 | + return false; |
|
601 | + } else { |
|
602 | + return $dest; |
|
603 | + } |
|
554 | 604 | } |
555 | 605 | |
556 | 606 | public function remove_accents($string) { |
557 | - if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
|
607 | + if ( !preg_match('/[\x80-\xff]/', $string) ) { |
|
608 | + return $string; |
|
609 | + } |
|
558 | 610 | $chars = array( |
559 | 611 | // Decompositions for Latin-1 Supplement |
560 | 612 | chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
@@ -678,7 +730,9 @@ discard block |
||
678 | 730 | $ip = gethostbyname($host); |
679 | 731 | $s = socket_create(AF_INET, SOCK_STREAM, 0); |
680 | 732 | $r = @socket_connect($s, $ip, $port); |
681 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
733 | + if (!socket_set_nonblock($s)) { |
|
734 | + echo "Unable to set nonblock on socket\n"; |
|
735 | + } |
|
682 | 736 | if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
683 | 737 | return $s; |
684 | 738 | } |
@@ -723,18 +777,22 @@ discard block |
||
723 | 777 | //NOTE: use a trailing slash for folders!!! |
724 | 778 | //see http://bugs.php.net/bug.php?id=27609 |
725 | 779 | //see http://bugs.php.net/bug.php?id=30931 |
726 | - if ($path{strlen($path)-1}=='/') // recursively return a temporary file path |
|
780 | + if ($path{strlen($path)-1}=='/') { |
|
781 | + // recursively return a temporary file path |
|
727 | 782 | return $this->is__writable($path.uniqid(mt_rand()).'.tmp'); |
728 | - else if (is_dir($path)) |
|
729 | - return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
783 | + } else if (is_dir($path)) { |
|
784 | + return $this->is__writable($path.'/'.uniqid(mt_rand()).'.tmp'); |
|
785 | + } |
|
730 | 786 | // check tmp file for read/write capabilities |
731 | 787 | $rm = file_exists($path); |
732 | 788 | $f = @fopen($path, 'a'); |
733 | - if ($f===false) |
|
734 | - return false; |
|
789 | + if ($f===false) { |
|
790 | + return false; |
|
791 | + } |
|
735 | 792 | fclose($f); |
736 | - if (!$rm) |
|
737 | - unlink($path); |
|
793 | + if (!$rm) { |
|
794 | + unlink($path); |
|
795 | + } |
|
738 | 796 | return true; |
739 | 797 | } |
740 | 798 | |
@@ -750,7 +808,9 @@ discard block |
||
750 | 808 | * @return Array Coordinate of the route |
751 | 809 | */ |
752 | 810 | public function greatcircle($begin_lat,$begin_lon,$end_lat,$end_lon,$nbpts = 20, $offset = 10) { |
753 | - if ($nbpts <= 2) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
811 | + if ($nbpts <= 2) { |
|
812 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
813 | + } |
|
754 | 814 | $sx = deg2rad($begin_lon); |
755 | 815 | $sy = deg2rad($begin_lat); |
756 | 816 | $ex = deg2rad($end_lon); |
@@ -759,7 +819,9 @@ discard block |
||
759 | 819 | $h = $sy - $ey; |
760 | 820 | $z = pow(sin($h/2.0),2) + cos($sy)*cos($ey)*pow(sin($w/2.0),2); |
761 | 821 | $g = 2.0*asin(sqrt($z)); |
762 | - if ($g == M_PI || is_nan($g)) return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
822 | + if ($g == M_PI || is_nan($g)) { |
|
823 | + return array(array($begin_lon,$begin_lat),array($end_lon,$end_lat)); |
|
824 | + } |
|
763 | 825 | $first_pass = array(); |
764 | 826 | $delta = 1.0/($nbpts-1); |
765 | 827 | for ($i =0; $i < $nbpts; ++$i) { |
@@ -174,6 +174,10 @@ |
||
174 | 174 | '\|' => 'TNC Stream SW', |
175 | 175 | '\~' => 'TNC Stream SW'); |
176 | 176 | |
177 | + /** |
|
178 | + * @param integer $n |
|
179 | + * @param integer $s |
|
180 | + */ |
|
177 | 181 | private function urshift($n, $s) { |
178 | 182 | return ($n >= 0) ? ($n >> $s) : |
179 | 183 | (($n & 0x7fffffff) >> $s) | |
@@ -176,8 +176,8 @@ |
||
176 | 176 | |
177 | 177 | private function urshift($n, $s) { |
178 | 178 | return ($n >= 0) ? ($n >> $s) : |
179 | - (($n & 0x7fffffff) >> $s) | |
|
180 | - (0x40000000 >> ($s - 1)); |
|
179 | + (($n & 0x7fffffff) >> $s) | |
|
180 | + (0x40000000 >> ($s - 1)); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /* |
@@ -196,16 +196,22 @@ discard block |
||
196 | 196 | |
197 | 197 | /* Check that end was found and body has at least one byte. */ |
198 | 198 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
199 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
199 | + if ($globalDebug) { |
|
200 | + echo '!!! APRS invalid : '.$input."\n"; |
|
201 | + } |
|
200 | 202 | return false; |
201 | 203 | } |
202 | 204 | |
203 | - if ($debug) echo 'input : '.$input."\n"; |
|
205 | + if ($debug) { |
|
206 | + echo 'input : '.$input."\n"; |
|
207 | + } |
|
204 | 208 | /* Save header and body. */ |
205 | 209 | $body = substr($input,$splitpos+1,$input_len); |
206 | 210 | $body_len = strlen($body); |
207 | 211 | $header = substr($input,0,$splitpos); |
208 | - if ($debug) echo 'header : '.$header."\n"; |
|
212 | + if ($debug) { |
|
213 | + echo 'header : '.$header."\n"; |
|
214 | + } |
|
209 | 215 | |
210 | 216 | /* Parse source, target and path. */ |
211 | 217 | //FLRDF0A52>APRS,qAS,LSTB |
@@ -219,11 +225,15 @@ discard block |
||
219 | 225 | $result['format_source'] = 'famaprs'; |
220 | 226 | $result['source_type'] = 'ais'; |
221 | 227 | } else { |
222 | - if ($debug) echo 'ident : '.$ident."\n"; |
|
228 | + if ($debug) { |
|
229 | + echo 'ident : '.$ident."\n"; |
|
230 | + } |
|
223 | 231 | $result['ident'] = $ident; |
224 | 232 | } |
225 | 233 | } else { |
226 | - if ($debug) 'No ident'."\n"; |
|
234 | + if ($debug) { |
|
235 | + 'No ident'."\n"; |
|
236 | + } |
|
227 | 237 | return false; |
228 | 238 | } |
229 | 239 | $elements = explode(',',$all_elements); |
@@ -233,7 +243,9 @@ discard block |
||
233 | 243 | if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
234 | 244 | //if ($element == 'TCPIP*') return false; |
235 | 245 | } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
236 | - if ($debug) echo 'element : '.$element."\n"; |
|
246 | + if ($debug) { |
|
247 | + echo 'element : '.$element."\n"; |
|
248 | + } |
|
237 | 249 | return false; |
238 | 250 | } |
239 | 251 | /* |
@@ -246,13 +258,17 @@ discard block |
||
246 | 258 | } |
247 | 259 | |
248 | 260 | $type = substr($body,0,1); |
249 | - if ($debug) echo 'type : '.$type."\n"; |
|
261 | + if ($debug) { |
|
262 | + echo 'type : '.$type."\n"; |
|
263 | + } |
|
250 | 264 | if ($type == ';') { |
251 | 265 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
252 | 266 | $result['address'] = trim(substr($body,1,9)); |
253 | 267 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
254 | 268 | $result['mmsi'] = trim(substr($body,1,9)); |
255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
269 | + } else { |
|
270 | + $result['ident'] = trim(substr($body,1,9)); |
|
271 | + } |
|
256 | 272 | } elseif ($type == ',') { |
257 | 273 | // Invalid data or test data |
258 | 274 | return false; |
@@ -309,7 +325,9 @@ discard block |
||
309 | 325 | //$symbol_table = $matches[4]; |
310 | 326 | $lat = intval($lat_deg); |
311 | 327 | $lon = intval($lon_deg); |
312 | - if ($lat > 89 || $lon > 179) return false; |
|
328 | + if ($lat > 89 || $lon > 179) { |
|
329 | + return false; |
|
330 | + } |
|
313 | 331 | /* |
314 | 332 | $tmp_5b = str_replace('.','',$lat_min); |
315 | 333 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
@@ -318,8 +336,12 @@ discard block |
||
318 | 336 | */ |
319 | 337 | $latitude = $lat + floatval($lat_min)/60; |
320 | 338 | $longitude = $lon + floatval($lon_min)/60; |
321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
339 | + if ($sind == 'S') { |
|
340 | + $latitude = 0-$latitude; |
|
341 | + } |
|
342 | + if ($wind == 'W') { |
|
343 | + $longitude = 0-$longitude; |
|
344 | + } |
|
323 | 345 | $result['latitude'] = $latitude; |
324 | 346 | $result['longitude'] = $longitude; |
325 | 347 | $body_parse = substr($body_parse,18); |
@@ -344,22 +366,29 @@ discard block |
||
344 | 366 | if ($find) { |
345 | 367 | $body_split = str_split($body_parse); |
346 | 368 | $symbol_code = $body_split[0]; |
347 | - if (!isset($symbolll) || $symbolll == '/') $symbol_code = '/'.$symbol_code; |
|
348 | - else $symbol_code = '\\'.$symbol_code; |
|
369 | + if (!isset($symbolll) || $symbolll == '/') { |
|
370 | + $symbol_code = '/'.$symbol_code; |
|
371 | + } else { |
|
372 | + $symbol_code = '\\'.$symbol_code; |
|
373 | + } |
|
349 | 374 | //' |
350 | 375 | //if ($type != ';' && $type != '>') { |
351 | 376 | if ($type != '') { |
352 | 377 | $body_parse = substr($body_parse,1); |
353 | 378 | $body_parse_len = strlen($body_parse); |
354 | 379 | $result['symbol_code'] = $symbol_code; |
355 | - if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
|
380 | + if (isset($this->symbols[$symbol_code])) { |
|
381 | + $result['symbol'] = $this->symbols[$symbol_code]; |
|
382 | + } |
|
356 | 383 | if ($symbol_code != '_') { |
357 | 384 | } |
358 | 385 | if ($body_parse_len >= 7) { |
359 | 386 | if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
360 | 387 | $course = substr($body_parse,0,3); |
361 | 388 | $tmp_s = intval($course); |
362 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
389 | + if ($tmp_s >= 1 && $tmp_s <= 360) { |
|
390 | + $result['heading'] = intval($course); |
|
391 | + } |
|
363 | 392 | $speed = substr($body_parse,4,3); |
364 | 393 | if ($speed != '...') { |
365 | 394 | $result['speed'] = intval($speed); |
@@ -394,10 +423,16 @@ discard block |
||
394 | 423 | $dao_split = str_split($dao); |
395 | 424 | $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
396 | 425 | $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
397 | - if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
|
398 | - else $result['latitude'] += $lat_off; |
|
399 | - if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
|
400 | - else $result['longitude'] += $lon_off; |
|
426 | + if ($result['latitude'] < 0) { |
|
427 | + $result['latitude'] -= $lat_off; |
|
428 | + } else { |
|
429 | + $result['latitude'] += $lat_off; |
|
430 | + } |
|
431 | + if ($result['longitude'] < 0) { |
|
432 | + $result['longitude'] -= $lon_off; |
|
433 | + } else { |
|
434 | + $result['longitude'] += $lon_off; |
|
435 | + } |
|
401 | 436 | } |
402 | 437 | $body_parse = substr($body_parse,6); |
403 | 438 | } |
@@ -435,27 +470,48 @@ discard block |
||
435 | 470 | //$mode = substr($id,0,2); |
436 | 471 | $address = substr($id,2); |
437 | 472 | $addressType = (intval(substr($id,0,2),16))&3; |
438 | - if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
|
439 | - elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
|
440 | - elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
|
441 | - elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
|
473 | + if ($addressType == 0) { |
|
474 | + $result['addresstype'] = "RANDOM"; |
|
475 | + } elseif ($addressType == 1) { |
|
476 | + $result['addresstype'] = "ICAO"; |
|
477 | + } elseif ($addressType == 2) { |
|
478 | + $result['addresstype'] = "FLARM"; |
|
479 | + } elseif ($addressType == 3) { |
|
480 | + $result['addresstype'] = "OGN"; |
|
481 | + } |
|
442 | 482 | $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
443 | 483 | $result['aircrafttype_code'] = $aircraftType; |
444 | - if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
|
445 | - elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
|
446 | - elseif ($aircraftType == 2) $result['aircrafttype'] = "TOW_PLANE"; |
|
447 | - elseif ($aircraftType == 3) $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
448 | - elseif ($aircraftType == 4) $result['aircrafttype'] = "PARACHUTE"; |
|
449 | - elseif ($aircraftType == 5) $result['aircrafttype'] = "DROP_PLANE"; |
|
450 | - elseif ($aircraftType == 6) $result['aircrafttype'] = "HANG_GLIDER"; |
|
451 | - elseif ($aircraftType == 7) $result['aircrafttype'] = "PARA_GLIDER"; |
|
452 | - elseif ($aircraftType == 8) $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
453 | - elseif ($aircraftType == 9) $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
454 | - elseif ($aircraftType == 10) $result['aircrafttype'] = "UFO"; |
|
455 | - elseif ($aircraftType == 11) $result['aircrafttype'] = "BALLOON"; |
|
456 | - elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
|
457 | - elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
|
458 | - elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
|
484 | + if ($aircraftType == 0) { |
|
485 | + $result['aircrafttype'] = "UNKNOWN"; |
|
486 | + } elseif ($aircraftType == 1) { |
|
487 | + $result['aircrafttype'] = "GLIDER"; |
|
488 | + } elseif ($aircraftType == 2) { |
|
489 | + $result['aircrafttype'] = "TOW_PLANE"; |
|
490 | + } elseif ($aircraftType == 3) { |
|
491 | + $result['aircrafttype'] = "HELICOPTER_ROTORCRAFT"; |
|
492 | + } elseif ($aircraftType == 4) { |
|
493 | + $result['aircrafttype'] = "PARACHUTE"; |
|
494 | + } elseif ($aircraftType == 5) { |
|
495 | + $result['aircrafttype'] = "DROP_PLANE"; |
|
496 | + } elseif ($aircraftType == 6) { |
|
497 | + $result['aircrafttype'] = "HANG_GLIDER"; |
|
498 | + } elseif ($aircraftType == 7) { |
|
499 | + $result['aircrafttype'] = "PARA_GLIDER"; |
|
500 | + } elseif ($aircraftType == 8) { |
|
501 | + $result['aircrafttype'] = "POWERED_AIRCRAFT"; |
|
502 | + } elseif ($aircraftType == 9) { |
|
503 | + $result['aircrafttype'] = "JET_AIRCRAFT"; |
|
504 | + } elseif ($aircraftType == 10) { |
|
505 | + $result['aircrafttype'] = "UFO"; |
|
506 | + } elseif ($aircraftType == 11) { |
|
507 | + $result['aircrafttype'] = "BALLOON"; |
|
508 | + } elseif ($aircraftType == 12) { |
|
509 | + $result['aircrafttype'] = "AIRSHIP"; |
|
510 | + } elseif ($aircraftType == 13) { |
|
511 | + $result['aircrafttype'] = "UAV"; |
|
512 | + } elseif ($aircraftType == 15) { |
|
513 | + $result['aircrafttype'] = "STATIC_OBJECT"; |
|
514 | + } |
|
459 | 515 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
460 | 516 | $result['stealth'] = $stealth; |
461 | 517 | $result['address'] = $address; |
@@ -490,77 +546,181 @@ discard block |
||
490 | 546 | //g012t088r000p000P000h38b10110 |
491 | 547 | //g011t086r000p000P000h29b10198 |
492 | 548 | if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
498 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
549 | + if ($matches[1] != '...') { |
|
550 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | + } |
|
552 | + if ($matches[2] != '...') { |
|
553 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
554 | + } |
|
555 | + if ($matches[3] != '...') { |
|
556 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
557 | + } |
|
558 | + if ($matches[4] != '...') { |
|
559 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
560 | + } |
|
561 | + if ($matches[5] != '...') { |
|
562 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
563 | + } |
|
564 | + if ($matches[6] != '...') { |
|
565 | + $result['humidity'] = intval($matches[6]); |
|
566 | + } |
|
567 | + if ($matches[7] != '...') { |
|
568 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
569 | + } |
|
500 | 570 | $body_parse = substr($body_parse,strlen($matches[0])); |
501 | 571 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
507 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
572 | + if ($matches[1] != '...') { |
|
573 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
574 | + } |
|
575 | + if ($matches[2] != '...') { |
|
576 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
577 | + } |
|
578 | + if ($matches[3] != '...') { |
|
579 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
580 | + } |
|
581 | + if ($matches[5] != '...') { |
|
582 | + $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
583 | + } |
|
584 | + if ($matches[4] != '...') { |
|
585 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
586 | + } |
|
587 | + if ($matches[6] != '...') { |
|
588 | + $result['humidity'] = intval($matches[6]); |
|
589 | + } |
|
590 | + if ($matches[7] != '...') { |
|
591 | + $result['pressure'] = round((intval($matches[7])/10),1); |
|
592 | + } |
|
509 | 593 | $body_parse = substr($body_parse,strlen($matches[0])); |
510 | 594 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
516 | - if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
|
517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
595 | + if ($matches[1] != '...') { |
|
596 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
597 | + } |
|
598 | + if ($matches[2] != '...') { |
|
599 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
600 | + } |
|
601 | + if ($matches[3] != '...') { |
|
602 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
603 | + } |
|
604 | + if ($matches[4] != '...') { |
|
605 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
606 | + } |
|
607 | + if ($matches[5] != '...') { |
|
608 | + $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
609 | + } |
|
610 | + if ($matches[7] != '...') { |
|
611 | + $result['humidity'] = intval($matches[7]); |
|
612 | + } |
|
613 | + if ($matches[6] != '...') { |
|
614 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
615 | + } |
|
518 | 616 | $body_parse = substr($body_parse,strlen($matches[0])); |
519 | 617 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
618 | + if ($matches[1] != '...') { |
|
619 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
620 | + } |
|
621 | + if ($matches[2] != '...') { |
|
622 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
623 | + } |
|
624 | + if ($matches[3] != '...') { |
|
625 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
626 | + } |
|
627 | + if ($matches[4] != '...') { |
|
628 | + $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
629 | + } |
|
630 | + if ($matches[6] != '...') { |
|
631 | + $result['humidity'] = intval($matches[6]); |
|
632 | + } |
|
633 | + if ($matches[5] != '...') { |
|
634 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
635 | + } |
|
526 | 636 | $body_parse = substr($body_parse,strlen($matches[0])); |
527 | 637 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
532 | - if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
|
533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
638 | + if ($matches[1] != '...') { |
|
639 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
640 | + } |
|
641 | + if ($matches[2] != '...') { |
|
642 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
643 | + } |
|
644 | + if ($matches[3] != '...') { |
|
645 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
646 | + } |
|
647 | + if ($matches[4] != '...') { |
|
648 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
649 | + } |
|
650 | + if ($matches[6] != '...') { |
|
651 | + $result['humidity'] = intval($matches[6]); |
|
652 | + } |
|
653 | + if ($matches[5] != '...') { |
|
654 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
655 | + } |
|
534 | 656 | $body_parse = substr($body_parse,strlen($matches[0])); |
535 | 657 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
540 | - if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
|
541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
658 | + if ($matches[1] != '...') { |
|
659 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
660 | + } |
|
661 | + if ($matches[2] != '...') { |
|
662 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
663 | + } |
|
664 | + if ($matches[3] != '...') { |
|
665 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
666 | + } |
|
667 | + if ($matches[4] != '...') { |
|
668 | + $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
669 | + } |
|
670 | + if ($matches[5] != '...') { |
|
671 | + $result['humidity'] = intval($matches[5]); |
|
672 | + } |
|
673 | + if ($matches[6] != '...') { |
|
674 | + $result['pressure'] = round((intval($matches[6])/10),1); |
|
675 | + } |
|
542 | 676 | $body_parse = substr($body_parse,strlen($matches[0])); |
543 | 677 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
546 | - if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
|
547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
678 | + if ($matches[1] != '...') { |
|
679 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
680 | + } |
|
681 | + if ($matches[2] != '...') { |
|
682 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
683 | + } |
|
684 | + if ($matches[2] != '...') { |
|
685 | + $result['humidity'] = intval($matches[3]); |
|
686 | + } |
|
687 | + if ($matches[4] != '...') { |
|
688 | + $result['pressure'] = round((intval($matches[4])/10),1); |
|
689 | + } |
|
548 | 690 | $body_parse = substr($body_parse,strlen($matches[0])); |
549 | 691 | } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
553 | - if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
|
554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
692 | + if ($matches[1] != '...') { |
|
693 | + $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
694 | + } |
|
695 | + if ($matches[2] != '...') { |
|
696 | + $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
697 | + } |
|
698 | + if ($matches[3] != '...') { |
|
699 | + $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
700 | + } |
|
701 | + if ($matches[4] != '...') { |
|
702 | + $result['humidity'] = intval($matches[4]); |
|
703 | + } |
|
704 | + if ($matches[5] != '...') { |
|
705 | + $result['pressure'] = round((intval($matches[5])/10),1); |
|
706 | + } |
|
555 | 707 | $body_parse = substr($body_parse,strlen($matches[0])); |
556 | 708 | } |
557 | 709 | $result['comment'] = trim($body_parse); |
558 | 710 | } |
559 | - } else $result['comment'] = trim($body_parse); |
|
711 | + } else { |
|
712 | + $result['comment'] = trim($body_parse); |
|
713 | + } |
|
714 | + } |
|
715 | + if (isset($result['latitude'])) { |
|
716 | + $result['latitude'] = round($result['latitude'],4); |
|
717 | + } |
|
718 | + if (isset($result['longitude'])) { |
|
719 | + $result['longitude'] = round($result['longitude'],4); |
|
720 | + } |
|
721 | + if ($debug) { |
|
722 | + print_r($result); |
|
560 | 723 | } |
561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
563 | - if ($debug) print_r($result); |
|
564 | 724 | return $result; |
565 | 725 | } |
566 | 726 | |
@@ -572,12 +732,21 @@ discard block |
||
572 | 732 | $aprs_connect = 0; |
573 | 733 | $aprs_keep = 120; |
574 | 734 | $aprs_last_tx = time(); |
575 | - if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
|
576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
577 | - if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
|
578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
579 | - if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
|
580 | - else $aprs_pass = '-1'; |
|
735 | + if (isset($globalAPRSversion)) { |
|
736 | + $aprs_version = $globalAPRSversion; |
|
737 | + } else { |
|
738 | + $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
739 | + } |
|
740 | + if (isset($globalServerAPRSssid)) { |
|
741 | + $aprs_ssid = $globalServerAPRSssid; |
|
742 | + } else { |
|
743 | + $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
744 | + } |
|
745 | + if (isset($globalServerAPRSpass)) { |
|
746 | + $aprs_pass = $globalServerAPRSpass; |
|
747 | + } else { |
|
748 | + $aprs_pass = '-1'; |
|
749 | + } |
|
581 | 750 | $aprs_filter = ''; |
582 | 751 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
583 | 752 | $Common = new Common(); |
@@ -616,10 +785,14 @@ discard block |
||
616 | 785 | */ |
617 | 786 | public function send($data) { |
618 | 787 | global $globalDebug; |
619 | - if ($this->connected === false) $this->connect(); |
|
788 | + if ($this->connected === false) { |
|
789 | + $this->connect(); |
|
790 | + } |
|
620 | 791 | $send = socket_send( $this->socket , $data , strlen($data),0); |
621 | 792 | if ($send === FALSE) { |
622 | - if ($globalDebug) echo 'Reconnect...'; |
|
793 | + if ($globalDebug) { |
|
794 | + echo 'Reconnect...'; |
|
795 | + } |
|
623 | 796 | socket_close($this->socket); |
624 | 797 | $this->connect(); |
625 | 798 | } |
@@ -642,22 +815,32 @@ discard block |
||
642 | 815 | //$w = '00'; |
643 | 816 | $custom = ''; |
644 | 817 | if ($ident != '') { |
645 | - if ($custom != '') $custom .= '/'; |
|
818 | + if ($custom != '') { |
|
819 | + $custom .= '/'; |
|
820 | + } |
|
646 | 821 | $custom .= 'CS='.$ident; |
647 | 822 | } |
648 | 823 | if ($squawk != '') { |
649 | - if ($custom != '') $custom .= '/'; |
|
824 | + if ($custom != '') { |
|
825 | + $custom .= '/'; |
|
826 | + } |
|
650 | 827 | $custom .= 'SQ='.$squawk; |
651 | 828 | } |
652 | 829 | if ($verticalrate != '') { |
653 | - if ($custom != '') $custom .= '/'; |
|
830 | + if ($custom != '') { |
|
831 | + $custom .= '/'; |
|
832 | + } |
|
654 | 833 | $custom .= 'VR='.$verticalrate; |
655 | 834 | } |
656 | 835 | if ($aircraft_icao != '' && $aircraft_icao != 'NA') { |
657 | - if ($custom != '') $custom .= '/'; |
|
836 | + if ($custom != '') { |
|
837 | + $custom .= '/'; |
|
838 | + } |
|
658 | 839 | $custom .= 'AI='.$aircraft_icao; |
659 | 840 | } |
660 | - if ($custom != '') $custom = ' '.$custom; |
|
841 | + if ($custom != '') { |
|
842 | + $custom = ' '.$custom; |
|
843 | + } |
|
661 | 844 | /* |
662 | 845 | // Use AMSL altitude |
663 | 846 | $GeoidClass = new GeoidHeight(); |
@@ -682,30 +865,44 @@ discard block |
||
682 | 865 | //$w = '00'; |
683 | 866 | $custom = ''; |
684 | 867 | if ($ident != '') { |
685 | - if ($custom != '') $custom .= '/'; |
|
868 | + if ($custom != '') { |
|
869 | + $custom .= '/'; |
|
870 | + } |
|
686 | 871 | $custom .= 'CS='.str_replace(' ','_',$ident); |
687 | 872 | } |
688 | 873 | if ($typeid != '') { |
689 | - if ($custom != '') $custom .= '/'; |
|
874 | + if ($custom != '') { |
|
875 | + $custom .= '/'; |
|
876 | + } |
|
690 | 877 | $custom .= 'TI='.$typeid; |
691 | 878 | } |
692 | 879 | if ($statusid != '') { |
693 | - if ($custom != '') $custom .= '/'; |
|
880 | + if ($custom != '') { |
|
881 | + $custom .= '/'; |
|
882 | + } |
|
694 | 883 | $custom .= 'SI='.$statusid; |
695 | 884 | } |
696 | 885 | if ($imo != '') { |
697 | - if ($custom != '') $custom .= '/'; |
|
886 | + if ($custom != '') { |
|
887 | + $custom .= '/'; |
|
888 | + } |
|
698 | 889 | $custom .= 'IMO='.$imo; |
699 | 890 | } |
700 | 891 | if ($arrival_date != '') { |
701 | - if ($custom != '') $custom .= '/'; |
|
892 | + if ($custom != '') { |
|
893 | + $custom .= '/'; |
|
894 | + } |
|
702 | 895 | $custom .= 'AD='.strtotime($arrival_date); |
703 | 896 | } |
704 | 897 | if ($arrival_code != '') { |
705 | - if ($custom != '') $custom .= '/'; |
|
898 | + if ($custom != '') { |
|
899 | + $custom .= '/'; |
|
900 | + } |
|
706 | 901 | $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
707 | 902 | } |
708 | - if ($custom != '') $custom = ' '.$custom; |
|
903 | + if ($custom != '') { |
|
904 | + $custom = ' '.$custom; |
|
905 | + } |
|
709 | 906 | $altitude = 0; |
710 | 907 | $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"); |
711 | 908 | } |
@@ -175,8 +175,7 @@ discard block |
||
175 | 175 | '\~' => 'TNC Stream SW'); |
176 | 176 | |
177 | 177 | private function urshift($n, $s) { |
178 | - return ($n >= 0) ? ($n >> $s) : |
|
179 | - (($n & 0x7fffffff) >> $s) | |
|
178 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
180 | 179 | (0x40000000 >> ($s - 1)); |
181 | 180 | } |
182 | 181 | |
@@ -192,7 +191,7 @@ discard block |
||
192 | 191 | $input_len = strlen($input); |
193 | 192 | |
194 | 193 | /* Find the end of header checking for NULL bytes while doing it. */ |
195 | - $splitpos = strpos($input,':'); |
|
194 | + $splitpos = strpos($input, ':'); |
|
196 | 195 | |
197 | 196 | /* Check that end was found and body has at least one byte. */ |
198 | 197 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -202,14 +201,14 @@ discard block |
||
202 | 201 | |
203 | 202 | if ($debug) echo 'input : '.$input."\n"; |
204 | 203 | /* Save header and body. */ |
205 | - $body = substr($input,$splitpos+1,$input_len); |
|
204 | + $body = substr($input, $splitpos + 1, $input_len); |
|
206 | 205 | $body_len = strlen($body); |
207 | - $header = substr($input,0,$splitpos); |
|
206 | + $header = substr($input, 0, $splitpos); |
|
208 | 207 | if ($debug) echo 'header : '.$header."\n"; |
209 | 208 | |
210 | 209 | /* Parse source, target and path. */ |
211 | 210 | //FLRDF0A52>APRS,qAS,LSTB |
212 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
211 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
213 | 212 | $ident = $matches[1]; |
214 | 213 | $all_elements = $matches[2]; |
215 | 214 | if ($ident == 'AIRCRAFT') { |
@@ -226,13 +225,13 @@ discard block |
||
226 | 225 | if ($debug) 'No ident'."\n"; |
227 | 226 | return false; |
228 | 227 | } |
229 | - $elements = explode(',',$all_elements); |
|
228 | + $elements = explode(',', $all_elements); |
|
230 | 229 | $source = end($elements); |
231 | 230 | $result['source'] = $source; |
232 | 231 | foreach ($elements as $element) { |
233 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
232 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
234 | 233 | //if ($element == 'TCPIP*') return false; |
235 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
234 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
236 | 235 | if ($debug) echo 'element : '.$element."\n"; |
237 | 236 | return false; |
238 | 237 | } |
@@ -245,14 +244,14 @@ discard block |
||
245 | 244 | */ |
246 | 245 | } |
247 | 246 | |
248 | - $type = substr($body,0,1); |
|
247 | + $type = substr($body, 0, 1); |
|
249 | 248 | if ($debug) echo 'type : '.$type."\n"; |
250 | 249 | if ($type == ';') { |
251 | 250 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
252 | - $result['address'] = trim(substr($body,1,9)); |
|
251 | + $result['address'] = trim(substr($body, 1, 9)); |
|
253 | 252 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
254 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
253 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
254 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
256 | 255 | } elseif ($type == ',') { |
257 | 256 | // Invalid data or test data |
258 | 257 | return false; |
@@ -260,20 +259,20 @@ discard block |
||
260 | 259 | |
261 | 260 | // Check for Timestamp |
262 | 261 | $find = false; |
263 | - $body_parse = substr($body,1); |
|
264 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
265 | - $body_parse = substr($body_parse,10); |
|
262 | + $body_parse = substr($body, 1); |
|
263 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
264 | + $body_parse = substr($body_parse, 10); |
|
266 | 265 | $find = true; |
267 | 266 | } |
268 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
269 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
267 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
268 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
270 | 269 | $find = true; |
271 | 270 | } |
272 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
273 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
271 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
272 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
274 | 273 | $find = true; |
275 | 274 | } |
276 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
275 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
277 | 276 | $find = true; |
278 | 277 | $timestamp = $matches[0]; |
279 | 278 | if ($matches[4] == 'h') { |
@@ -286,17 +285,17 @@ discard block |
||
286 | 285 | // This work or not ? |
287 | 286 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
288 | 287 | } |
289 | - $body_parse = substr($body_parse,7); |
|
288 | + $body_parse = substr($body_parse, 7); |
|
290 | 289 | $result['timestamp'] = $timestamp; |
291 | 290 | } |
292 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
291 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
293 | 292 | $find = true; |
294 | 293 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
295 | - $body_parse = substr($body_parse,8); |
|
294 | + $body_parse = substr($body_parse, 8); |
|
296 | 295 | $result['timestamp'] = $timestamp; |
297 | 296 | } |
298 | 297 | //if (strlen($body_parse) > 19) { |
299 | - 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)) { |
|
298 | + 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)) { |
|
300 | 299 | $find = true; |
301 | 300 | // 4658.70N/00707.78Ez |
302 | 301 | $sind = strtoupper($matches[3]); |
@@ -318,11 +317,11 @@ discard block |
||
318 | 317 | */ |
319 | 318 | $latitude = $lat + floatval($lat_min)/60; |
320 | 319 | $longitude = $lon + floatval($lon_min)/60; |
321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
320 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
321 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
323 | 322 | $result['latitude'] = $latitude; |
324 | 323 | $result['longitude'] = $longitude; |
325 | - $body_parse = substr($body_parse,18); |
|
324 | + $body_parse = substr($body_parse, 18); |
|
326 | 325 | $body_parse_len = strlen($body_parse); |
327 | 326 | } |
328 | 327 | $body_parse_len = strlen($body_parse); |
@@ -349,22 +348,22 @@ discard block |
||
349 | 348 | //' |
350 | 349 | //if ($type != ';' && $type != '>') { |
351 | 350 | if ($type != '') { |
352 | - $body_parse = substr($body_parse,1); |
|
351 | + $body_parse = substr($body_parse, 1); |
|
353 | 352 | $body_parse_len = strlen($body_parse); |
354 | 353 | $result['symbol_code'] = $symbol_code; |
355 | 354 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
356 | 355 | if ($symbol_code != '_') { |
357 | 356 | } |
358 | 357 | if ($body_parse_len >= 7) { |
359 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
360 | - $course = substr($body_parse,0,3); |
|
358 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
359 | + $course = substr($body_parse, 0, 3); |
|
361 | 360 | $tmp_s = intval($course); |
362 | 361 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
363 | - $speed = substr($body_parse,4,3); |
|
362 | + $speed = substr($body_parse, 4, 3); |
|
364 | 363 | if ($speed != '...') { |
365 | 364 | $result['speed'] = intval($speed); |
366 | 365 | } |
367 | - $body_parse = substr($body_parse,7); |
|
366 | + $body_parse = substr($body_parse, 7); |
|
368 | 367 | } |
369 | 368 | // Check PHGR, PHG, RNG |
370 | 369 | } |
@@ -374,11 +373,11 @@ discard block |
||
374 | 373 | } |
375 | 374 | */ |
376 | 375 | if (strlen($body_parse) > 0) { |
377 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
376 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
378 | 377 | $altitude = intval($matches[1]); |
379 | 378 | $result['altitude'] = $altitude; |
380 | 379 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
381 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
380 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
382 | 381 | } |
383 | 382 | } |
384 | 383 | // Telemetry |
@@ -388,58 +387,58 @@ discard block |
||
388 | 387 | } |
389 | 388 | */ |
390 | 389 | // DAO |
391 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
390 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
392 | 391 | $dao = $matches[1]; |
393 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
392 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
394 | 393 | $dao_split = str_split($dao); |
395 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
396 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
394 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
395 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
397 | 396 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
398 | 397 | else $result['latitude'] += $lat_off; |
399 | 398 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
400 | 399 | else $result['longitude'] += $lon_off; |
401 | 400 | } |
402 | - $body_parse = substr($body_parse,6); |
|
401 | + $body_parse = substr($body_parse, 6); |
|
403 | 402 | } |
404 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
405 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
403 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
404 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
406 | 405 | } |
407 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
406 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
408 | 407 | $result['squawk'] = $matches[1]; |
409 | 408 | } |
410 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
409 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
411 | 410 | $result['aircraft_icao'] = $matches[1]; |
412 | 411 | } |
413 | - if (preg_match('/VR=([-0-9]*)/',$body_parse,$matches)) { |
|
412 | + if (preg_match('/VR=([-0-9]*)/', $body_parse, $matches)) { |
|
414 | 413 | $result['verticalrate'] = $matches[1]; |
415 | 414 | } |
416 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
415 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
417 | 416 | $result['typeid'] = $matches[1]; |
418 | 417 | } |
419 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
418 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
420 | 419 | $result['statusid'] = $matches[1]; |
421 | 420 | } |
422 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
421 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
423 | 422 | $result['imo'] = $matches[1]; |
424 | 423 | } |
425 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
424 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
426 | 425 | $result['arrival_date'] = $matches[1]; |
427 | 426 | } |
428 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
429 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
427 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
428 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
430 | 429 | } |
431 | 430 | // OGN comment |
432 | 431 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
433 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
432 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
434 | 433 | $id = $matches[1]; |
435 | 434 | //$mode = substr($id,0,2); |
436 | - $address = substr($id,2); |
|
437 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
435 | + $address = substr($id, 2); |
|
436 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
438 | 437 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
439 | 438 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
440 | 439 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
441 | 440 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
442 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
441 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
443 | 442 | $result['aircrafttype_code'] = $aircraftType; |
444 | 443 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
445 | 444 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -456,110 +455,110 @@ discard block |
||
456 | 455 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
457 | 456 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
458 | 457 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
459 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
458 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
460 | 459 | $result['stealth'] = $stealth; |
461 | 460 | $result['address'] = $address; |
462 | 461 | } |
463 | 462 | //Comment |
464 | 463 | $result['comment'] = trim($body_parse); |
465 | 464 | // parse weather |
466 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
465 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
467 | 466 | $result['wind_dir'] = intval($matches[1]); |
468 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
469 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
470 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
471 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
472 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
467 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
468 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
469 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
470 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
471 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
473 | 472 | $result['wind_dir'] = intval($matches[1]); |
474 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
475 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
476 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
477 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
478 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
473 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
474 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
475 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
476 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
477 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
479 | 478 | $result['wind_dir'] = intval($matches[1]); |
480 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
481 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
482 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
483 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
479 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
480 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
481 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
482 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
484 | 483 | $result['wind_dir'] = intval($matches[1]); |
485 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
486 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
487 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
484 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
485 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
486 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
488 | 487 | } |
489 | 488 | // temperature |
490 | 489 | //g012t088r000p000P000h38b10110 |
491 | 490 | //g011t086r000p000P000h29b10198 |
492 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
491 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
492 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
493 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
494 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
495 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
496 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
498 | 497 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
500 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
501 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
498 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
499 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
500 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
501 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
502 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
503 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
504 | + if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1); |
|
505 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
507 | 506 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
509 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
510 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
507 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
508 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
509 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
510 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
511 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
512 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
513 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
514 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
516 | 515 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
518 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
519 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
516 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
517 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
518 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
519 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
520 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
521 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
522 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
524 | 523 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
526 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
527 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
524 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
525 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
526 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
527 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
528 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
529 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
530 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
532 | 531 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
534 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
535 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
532 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
533 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
534 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
535 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
536 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
537 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
538 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
540 | 539 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
542 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
543 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
540 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
541 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
542 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
543 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
544 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
546 | 545 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
548 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
549 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
546 | + if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1); |
|
547 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
548 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
549 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
550 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
551 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
553 | 552 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
555 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
553 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
554 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
556 | 555 | } |
557 | 556 | $result['comment'] = trim($body_parse); |
558 | 557 | } |
559 | 558 | } else $result['comment'] = trim($body_parse); |
560 | 559 | } |
561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
560 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
561 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
563 | 562 | if ($debug) print_r($result); |
564 | 563 | return $result; |
565 | 564 | } |
@@ -568,34 +567,34 @@ discard block |
||
568 | 567 | * Connect to APRS server |
569 | 568 | */ |
570 | 569 | public function connect() { |
571 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
570 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
572 | 571 | $aprs_connect = 0; |
573 | 572 | $aprs_keep = 120; |
574 | 573 | $aprs_last_tx = time(); |
575 | 574 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
575 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
577 | 576 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
577 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
579 | 578 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
580 | 579 | else $aprs_pass = '-1'; |
581 | - $aprs_filter = ''; |
|
580 | + $aprs_filter = ''; |
|
582 | 581 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
583 | 582 | $Common = new Common(); |
584 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
583 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
585 | 584 | if ($s !== false) { |
586 | 585 | echo 'Connected to APRS server! '."\n"; |
587 | 586 | $authstart = time(); |
588 | 587 | $this->socket = $s; |
589 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
590 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
591 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
588 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
589 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
590 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
592 | 591 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
593 | 592 | echo 'APRS user verified !'."\n"; |
594 | 593 | $this->connected = true; |
595 | 594 | return true; |
596 | 595 | break; |
597 | 596 | } |
598 | - if (time()-$authstart > 5) { |
|
597 | + if (time() - $authstart > 5) { |
|
599 | 598 | echo 'APRS timeout'."\n"; |
600 | 599 | break; |
601 | 600 | } |
@@ -617,7 +616,7 @@ discard block |
||
617 | 616 | public function send($data) { |
618 | 617 | global $globalDebug; |
619 | 618 | if ($this->connected === false) $this->connect(); |
620 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
619 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
621 | 620 | if ($send === FALSE) { |
622 | 621 | if ($globalDebug) echo 'Reconnect...'; |
623 | 622 | socket_close($this->socket); |
@@ -627,17 +626,17 @@ discard block |
||
627 | 626 | } |
628 | 627 | |
629 | 628 | class APRSSpotter extends APRS { |
630 | - 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) { |
|
629 | + 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) { |
|
631 | 630 | $Common = new Common(); |
632 | 631 | date_default_timezone_set('UTC'); |
633 | 632 | if ($latitude != '' && $longitude != '') { |
634 | 633 | $lat = $latitude; |
635 | 634 | $long = $longitude; |
636 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
637 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
638 | - $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']; |
|
639 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
640 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
635 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
636 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
637 | + $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']; |
|
638 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
639 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
641 | 640 | $w = $w1.$w2; |
642 | 641 | //$w = '00'; |
643 | 642 | $custom = ''; |
@@ -664,26 +663,26 @@ discard block |
||
664 | 663 | $geoid= round($GeoidClass->get($lat,$long)*3.28084,2); |
665 | 664 | $altitude_real = round($altitude_real + $geoid); |
666 | 665 | */ |
667 | - $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"); |
|
666 | + $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"); |
|
668 | 667 | } |
669 | 668 | } |
670 | 669 | } |
671 | 670 | class APRSMarine extends APRS { |
672 | - 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) { |
|
671 | + 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) { |
|
673 | 672 | $Common = new Common(); |
674 | 673 | date_default_timezone_set('UTC'); |
675 | 674 | if ($latitude != '' && $longitude != '') { |
676 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
677 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
678 | - $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']; |
|
679 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
680 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
675 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
676 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
677 | + $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']; |
|
678 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
679 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
681 | 680 | $w = $w1.$w2; |
682 | 681 | //$w = '00'; |
683 | 682 | $custom = ''; |
684 | 683 | if ($ident != '') { |
685 | 684 | if ($custom != '') $custom .= '/'; |
686 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
685 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
687 | 686 | } |
688 | 687 | if ($typeid != '') { |
689 | 688 | if ($custom != '') $custom .= '/'; |
@@ -703,11 +702,11 @@ discard block |
||
703 | 702 | } |
704 | 703 | if ($arrival_code != '') { |
705 | 704 | if ($custom != '') $custom .= '/'; |
706 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
705 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
707 | 706 | } |
708 | 707 | if ($custom != '') $custom = ' '.$custom; |
709 | 708 | $altitude = 0; |
710 | - $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"); |
|
709 | + $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"); |
|
711 | 710 | } |
712 | 711 | } |
713 | 712 | } |
@@ -190,12 +190,20 @@ |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | + /** |
|
194 | + * @param double $lat |
|
195 | + * @param integer $isodd |
|
196 | + */ |
|
193 | 197 | private function cprN($lat,$isodd) { |
194 | 198 | $nl = $this->cprNL($lat) - $isodd; |
195 | 199 | if ($nl > 1) return $nl; |
196 | 200 | else return 1; |
197 | 201 | } |
198 | 202 | |
203 | + /** |
|
204 | + * @param string $msg |
|
205 | + * @param string $bin |
|
206 | + */ |
|
199 | 207 | private function parityCheck($msg, $bin) { |
200 | 208 | $modes_checksum_table = array( |
201 | 209 | 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
@@ -198,20 +198,20 @@ |
||
198 | 198 | |
199 | 199 | private function parityCheck($msg, $bin) { |
200 | 200 | $modes_checksum_table = array( |
201 | - 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | - 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | - 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | - 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | - 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | - 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | - 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | - 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | - 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | - 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | - 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
201 | + 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | + 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | + 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | + 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | + 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | + 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | + 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | + 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | + 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | + 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | + 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | 217 | $checksum = intval(substr($msg,22,6),16); |
@@ -18,82 +18,82 @@ discard block |
||
18 | 18 | public function parse($buffer) { |
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | - $typehex = substr($buffer,0,1); |
|
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
25 | - $bin = gmp_strval( gmp_init($hex,16), 2); |
|
21 | + $typehex = substr($buffer, 0, 1); |
|
22 | + if ($typehex == '*' || $typehex == ':') $hex = substr($buffer, 1, -1); |
|
23 | + elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer, 13, -13); |
|
24 | + else $hex = substr($buffer, 1, -1); |
|
25 | + $bin = gmp_strval(gmp_init($hex, 16), 2); |
|
26 | 26 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 27 | if (strlen($hex) == 28) { |
28 | - $df = intval(substr($bin,0,5),2); |
|
28 | + $df = intval(substr($bin, 0, 5), 2); |
|
29 | 29 | //$ca = intval(substr($bin,5,3),2); |
30 | 30 | // Only support DF17 for now |
31 | 31 | //if ($df == 17 || ($df == 18 && ($ca == 0 || $ca == 1 || $ca == 6))) { |
32 | - if (($df == 17 || $df == 18) && ($this->parityCheck($hex,$bin) || $typehex == '@')) { |
|
33 | - $icao = substr($hex,2,6); |
|
32 | + if (($df == 17 || $df == 18) && ($this->parityCheck($hex, $bin) || $typehex == '@')) { |
|
33 | + $icao = substr($hex, 2, 6); |
|
34 | 34 | $data['hex'] = $icao; |
35 | - $tc = intval(substr($bin,32,5),2); |
|
35 | + $tc = intval(substr($bin, 32, 5), 2); |
|
36 | 36 | if ($tc >= 1 && $tc <= 4) { |
37 | 37 | //callsign |
38 | - $csbin = substr($bin,40,56); |
|
38 | + $csbin = substr($bin, 40, 56); |
|
39 | 39 | $charset = str_split('#ABCDEFGHIJKLMNOPQRSTUVWXYZ#####_###############0123456789######'); |
40 | 40 | $cs = ''; |
41 | - $cs .= $charset[intval(substr($csbin,0,6),2)]; |
|
42 | - $cs .= $charset[intval(substr($csbin,6,6),2)]; |
|
43 | - $cs .= $charset[intval(substr($csbin,12,6),2)]; |
|
44 | - $cs .= $charset[intval(substr($csbin,18,6),2)]; |
|
45 | - $cs .= $charset[intval(substr($csbin,24,6),2)]; |
|
46 | - $cs .= $charset[intval(substr($csbin,30,6),2)]; |
|
47 | - $cs .= $charset[intval(substr($csbin,36,6),2)]; |
|
48 | - $cs .= $charset[intval(substr($csbin,42,6),2)]; |
|
49 | - $cs = str_replace('_','',$cs); |
|
50 | - $cs = str_replace('#','',$cs); |
|
41 | + $cs .= $charset[intval(substr($csbin, 0, 6), 2)]; |
|
42 | + $cs .= $charset[intval(substr($csbin, 6, 6), 2)]; |
|
43 | + $cs .= $charset[intval(substr($csbin, 12, 6), 2)]; |
|
44 | + $cs .= $charset[intval(substr($csbin, 18, 6), 2)]; |
|
45 | + $cs .= $charset[intval(substr($csbin, 24, 6), 2)]; |
|
46 | + $cs .= $charset[intval(substr($csbin, 30, 6), 2)]; |
|
47 | + $cs .= $charset[intval(substr($csbin, 36, 6), 2)]; |
|
48 | + $cs .= $charset[intval(substr($csbin, 42, 6), 2)]; |
|
49 | + $cs = str_replace('_', '', $cs); |
|
50 | + $cs = str_replace('#', '', $cs); |
|
51 | 51 | $callsign = $cs; |
52 | 52 | $data['ident'] = $callsign; |
53 | 53 | } elseif ($tc >= 9 && $tc <= 18) { |
54 | 54 | // Check Q-bit |
55 | - $q = substr($bin,47,1); |
|
55 | + $q = substr($bin, 47, 1); |
|
56 | 56 | if ($q) { |
57 | - $n = intval(substr($bin,40,7).substr($bin,48,4),2); |
|
58 | - $alt = $n*25-1000; |
|
57 | + $n = intval(substr($bin, 40, 7).substr($bin, 48, 4), 2); |
|
58 | + $alt = $n*25 - 1000; |
|
59 | 59 | $data['altitude'] = $alt; |
60 | 60 | } |
61 | 61 | // Check odd/even flag |
62 | - $oe = substr($bin,53,1); |
|
62 | + $oe = substr($bin, 53, 1); |
|
63 | 63 | //if ($oe) => odd else even |
64 | 64 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | - $cprlat = intval(substr($bin,54,17),2)/131072.0; |
|
66 | - $cprlon = intval(substr($bin,71,17),2)/131072.0; |
|
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
65 | + $cprlat = intval(substr($bin, 54, 17), 2)/131072.0; |
|
66 | + $cprlon = intval(substr($bin, 71, 17), 2)/131072.0; |
|
67 | + if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat, 'longitude' => $cprlon, 'created' => time()); |
|
68 | 68 | elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
69 | 69 | $cprlat_odd = $cprlat; |
70 | 70 | $cprlon_odd = $cprlon; |
71 | 71 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
72 | 72 | $cprlon_even = $this::$latlon[$icao]['longitude']; |
73 | - $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
|
74 | - $lat_even = (360.0/60)*($j%60+$cprlat_even); |
|
75 | - $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
|
73 | + $j = 59*$cprlat_even - 60*$cprlat_odd + 0.5; |
|
74 | + $lat_even = (360.0/60)*($j%60 + $cprlat_even); |
|
75 | + $lat_odd = (360.0/59)*($j%59 + $cprlat_odd); |
|
76 | 76 | if ($lat_even >= 270) $lat_even = $lat_even - 360; |
77 | 77 | if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
78 | 78 | // check latitude zone |
79 | 79 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 80 | if ($this::$latlon[$icao]['created'] > time()) { |
81 | - $ni = $this->cprN($lat_even,0); |
|
82 | - $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
|
83 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
|
81 | + $ni = $this->cprN($lat_even, 0); |
|
82 | + $m = floor($cprlon_even*($this->cprNL($lat_even) - 1) - $cprlon_odd*$this->cprNL($lat_even) + 0.5); |
|
83 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_even); |
|
84 | 84 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
85 | + if ($lon > 180) $lon = $lon - 360; |
|
86 | 86 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 87 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 88 | $data['latitude'] = $lat; |
89 | 89 | $data['longitude'] = $lon; |
90 | 90 | } |
91 | 91 | } else { |
92 | - $ni = $this->cprN($lat_odd,1); |
|
93 | - $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
|
94 | - $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
|
92 | + $ni = $this->cprN($lat_odd, 1); |
|
93 | + $m = floor($cprlon_even*($this->cprNL($lat_odd) - 1) - $cprlon_odd*$this->cprNL($lat_odd) + 0.5); |
|
94 | + $lon = (360.0/$ni)*($m%$ni + $cprlon_odd); |
|
95 | 95 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
96 | + if ($lon > 180) $lon = $lon - 360; |
|
97 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 98 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 99 | $data['latitude'] = $lat; |
@@ -105,15 +105,15 @@ discard block |
||
105 | 105 | } |
106 | 106 | } elseif ($tc == 19) { |
107 | 107 | // speed & heading |
108 | - $v_ew_dir = intval(substr($bin,45,1)); |
|
109 | - $v_ew = intval(substr($bin,46,10),2); |
|
110 | - $v_ns_dir = intval(substr($bin,56,1)); |
|
111 | - $v_ns = intval(substr($bin,57,10),2); |
|
108 | + $v_ew_dir = intval(substr($bin, 45, 1)); |
|
109 | + $v_ew = intval(substr($bin, 46, 10), 2); |
|
110 | + $v_ns_dir = intval(substr($bin, 56, 1)); |
|
111 | + $v_ns = intval(substr($bin, 57, 10), 2); |
|
112 | 112 | if ($v_ew_dir) $v_ew = -1*$v_ew; |
113 | 113 | if ($v_ns_dir) $v_ns = -1*$v_ns; |
114 | - $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
|
115 | - $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
|
116 | - if ($heading <0) $heading = $heading+360; |
|
114 | + $speed = sqrt($v_ns*$v_ns + $v_ew*$v_ew); |
|
115 | + $heading = atan2($v_ew, $v_ns)*360.0/(2*pi()); |
|
116 | + if ($heading < 0) $heading = $heading + 360; |
|
117 | 117 | $data['speed'] = $speed; |
118 | 118 | $data['heading'] = $heading; |
119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * Lookup table to convert the latitude to index. |
129 | 129 | */ |
130 | 130 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
131 | + if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | 132 | if ($lat < 10.47047130) return 59; |
133 | 133 | if ($lat < 14.82817437) return 58; |
134 | 134 | if ($lat < 18.18626357) return 57; |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | return 1; |
191 | 191 | } |
192 | 192 | |
193 | - private function cprN($lat,$isodd) { |
|
193 | + private function cprN($lat, $isodd) { |
|
194 | 194 | $nl = $this->cprNL($lat) - $isodd; |
195 | 195 | if ($nl > 1) return $nl; |
196 | 196 | else return 1; |
@@ -214,9 +214,9 @@ discard block |
||
214 | 214 | 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | - $checksum = intval(substr($msg,22,6),16); |
|
217 | + $checksum = intval(substr($msg, 22, 6), 16); |
|
218 | 218 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
219 | + if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j], 0); |
|
220 | 220 | } |
221 | 221 | if ($crc == $checksum) return true; |
222 | 222 | else { |
@@ -238,10 +238,10 @@ discard block |
||
238 | 238 | $msg['aircraftid'] = hexdec($data['address']); |
239 | 239 | $msg['hex'] = $data['address']; |
240 | 240 | $msg['flightid'] = hexdec($data['address']); |
241 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
242 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
243 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
244 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
241 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
242 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
243 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
244 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
245 | 245 | $msg['callsign'] = $data['ident']; |
246 | 246 | $msg['altitude'] = ''; |
247 | 247 | $msg['speed'] = ''; |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | $msg['emergency'] = ''; |
255 | 255 | $msg['SPI'] = ''; |
256 | 256 | $msg['ground'] = ''; |
257 | - $result[] = implode(',',$msg); |
|
257 | + $result[] = implode(',', $msg); |
|
258 | 258 | } |
259 | 259 | if (isset($data['latitude']) && $data['latitude'] != 0) { |
260 | 260 | $msg = array(); |
@@ -264,10 +264,10 @@ discard block |
||
264 | 264 | $msg['aircraftid'] = hexdec($data['address']); |
265 | 265 | $msg['hex'] = $data['address']; |
266 | 266 | $msg['flightid'] = hexdec($data['address']); |
267 | - $msg['date_gen'] = date('Y/m/d',$data['timestamp']); |
|
268 | - $msg['time_gen'] = date('H:i:s',$data['timestamp']).'.180'; |
|
269 | - $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
|
270 | - $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
|
267 | + $msg['date_gen'] = date('Y/m/d', $data['timestamp']); |
|
268 | + $msg['time_gen'] = date('H:i:s', $data['timestamp']).'.180'; |
|
269 | + $msg['date_log'] = date('Y/m/d', $data['timestamp']); |
|
270 | + $msg['time_log'] = date('H:i:s', $data['timestamp']).'.180'; |
|
271 | 271 | $msg['callsign'] = ''; |
272 | 272 | if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
273 | 273 | else $msg['altitude'] = ''; |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | $msg['SPI'] = 0; |
286 | 286 | if (isset($data['ground'])) $msg['ground'] = 1; |
287 | 287 | else $msg['ground'] = 0; |
288 | - $result[] = implode(',',$msg); |
|
288 | + $result[] = implode(',', $msg); |
|
289 | 289 | } |
290 | 290 | return $result; |
291 | 291 | } |
@@ -19,9 +19,13 @@ discard block |
||
19 | 19 | // Not yet finished, no CRC checks |
20 | 20 | $data = array(); |
21 | 21 | $typehex = substr($buffer,0,1); |
22 | - if ($typehex == '*' || $typehex == ':') $hex = substr($buffer,1,-1); |
|
23 | - elseif ($typehex == '@' || $typehex == '%') $hex = substr($buffer,13,-13); |
|
24 | - else $hex = substr($buffer,1,-1); |
|
22 | + if ($typehex == '*' || $typehex == ':') { |
|
23 | + $hex = substr($buffer,1,-1); |
|
24 | + } elseif ($typehex == '@' || $typehex == '%') { |
|
25 | + $hex = substr($buffer,13,-13); |
|
26 | + } else { |
|
27 | + $hex = substr($buffer,1,-1); |
|
28 | + } |
|
25 | 29 | $bin = gmp_strval( gmp_init($hex,16), 2); |
26 | 30 | //if (strlen($hex) == 28 && $this->parityCheck($hex,$bin)) { |
27 | 31 | if (strlen($hex) == 28) { |
@@ -64,8 +68,9 @@ discard block |
||
64 | 68 | // 131072 is 2^17 since CPR latitude and longitude are encoded in 17 bits. |
65 | 69 | $cprlat = intval(substr($bin,54,17),2)/131072.0; |
66 | 70 | $cprlon = intval(substr($bin,71,17),2)/131072.0; |
67 | - if ($oe == 0) $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
68 | - elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
71 | + if ($oe == 0) { |
|
72 | + $this::$latlon[$icao] = array('latitude' => $cprlat,'longitude' => $cprlon,'created' => time()); |
|
73 | + } elseif (isset($this::$latlon[$icao]) && (time() - $this::$latlon[$icao]['created']) < 10) { |
|
69 | 74 | $cprlat_odd = $cprlat; |
70 | 75 | $cprlon_odd = $cprlon; |
71 | 76 | $cprlat_even = $this::$latlon[$icao]['latitude']; |
@@ -73,8 +78,12 @@ discard block |
||
73 | 78 | $j = 59*$cprlat_even-60*$cprlat_odd+0.5; |
74 | 79 | $lat_even = (360.0/60)*($j%60+$cprlat_even); |
75 | 80 | $lat_odd = (360.0/59)*($j%59+$cprlat_odd); |
76 | - if ($lat_even >= 270) $lat_even = $lat_even - 360; |
|
77 | - if ($lat_odd >= 270) $lat_odd = $lat_odd - 360; |
|
81 | + if ($lat_even >= 270) { |
|
82 | + $lat_even = $lat_even - 360; |
|
83 | + } |
|
84 | + if ($lat_odd >= 270) { |
|
85 | + $lat_odd = $lat_odd - 360; |
|
86 | + } |
|
78 | 87 | // check latitude zone |
79 | 88 | if ($this->cprNL($lat_even) == $this->cprNL($lat_odd)) { |
80 | 89 | if ($this::$latlon[$icao]['created'] > time()) { |
@@ -82,7 +91,9 @@ discard block |
||
82 | 91 | $m = floor($cprlon_even*($this->cprNL($lat_even)-1) - $cprlon_odd * $this->cprNL($lat_even)+0.5); |
83 | 92 | $lon = (360.0/$ni)*($m%$ni+$cprlon_even); |
84 | 93 | $lat = $lat_even; |
85 | - if ($lon > 180) $lon = $lon -360; |
|
94 | + if ($lon > 180) { |
|
95 | + $lon = $lon -360; |
|
96 | + } |
|
86 | 97 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
87 | 98 | //if ($globalDebug) echo 'cs : '.$cs.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon; |
88 | 99 | $data['latitude'] = $lat; |
@@ -93,14 +104,18 @@ discard block |
||
93 | 104 | $m = floor($cprlon_even*($this->cprNL($lat_odd)-1) - $cprlon_odd * $this->cprNL($lat_odd)+0.5); |
94 | 105 | $lon = (360.0/$ni)*($m%$ni+$cprlon_odd); |
95 | 106 | $lat = $lat_odd; |
96 | - if ($lon > 180) $lon = $lon -360; |
|
107 | + if ($lon > 180) { |
|
108 | + $lon = $lon -360; |
|
109 | + } |
|
97 | 110 | if ($lat > -91 && $lat < 91 && $lon > -181 && $lon < 181) { |
98 | 111 | //if ($globalDebug) echo 'icao : '.$icao.' - hex : '.$hex.' - lat : '.$lat.' - lon : '.$lon.' second'."\n"; |
99 | 112 | $data['latitude'] = $lat; |
100 | 113 | $data['longitude'] = $lon; |
101 | 114 | } |
102 | 115 | } |
103 | - } else echo "Not cprNL"; |
|
116 | + } else { |
|
117 | + echo "Not cprNL"; |
|
118 | + } |
|
104 | 119 | unset($this::$latlon[$icao]); |
105 | 120 | } |
106 | 121 | } elseif ($tc == 19) { |
@@ -109,11 +124,17 @@ discard block |
||
109 | 124 | $v_ew = intval(substr($bin,46,10),2); |
110 | 125 | $v_ns_dir = intval(substr($bin,56,1)); |
111 | 126 | $v_ns = intval(substr($bin,57,10),2); |
112 | - if ($v_ew_dir) $v_ew = -1*$v_ew; |
|
113 | - if ($v_ns_dir) $v_ns = -1*$v_ns; |
|
127 | + if ($v_ew_dir) { |
|
128 | + $v_ew = -1*$v_ew; |
|
129 | + } |
|
130 | + if ($v_ns_dir) { |
|
131 | + $v_ns = -1*$v_ns; |
|
132 | + } |
|
114 | 133 | $speed = sqrt($v_ns*$v_ns+$v_ew*$v_ew); |
115 | 134 | $heading = atan2($v_ew,$v_ns)*360.0/(2*pi()); |
116 | - if ($heading <0) $heading = $heading+360; |
|
135 | + if ($heading <0) { |
|
136 | + $heading = $heading+360; |
|
137 | + } |
|
117 | 138 | $data['speed'] = $speed; |
118 | 139 | $data['heading'] = $heading; |
119 | 140 | } |
@@ -128,72 +149,194 @@ discard block |
||
128 | 149 | * Lookup table to convert the latitude to index. |
129 | 150 | */ |
130 | 151 | private function cprNL($lat) { |
131 | - if ($lat < 0) $lat = -$lat; // Table is simmetric about the equator. |
|
132 | - if ($lat < 10.47047130) return 59; |
|
133 | - if ($lat < 14.82817437) return 58; |
|
134 | - if ($lat < 18.18626357) return 57; |
|
135 | - if ($lat < 21.02939493) return 56; |
|
136 | - if ($lat < 23.54504487) return 55; |
|
137 | - if ($lat < 25.82924707) return 54; |
|
138 | - if ($lat < 27.93898710) return 53; |
|
139 | - if ($lat < 29.91135686) return 52; |
|
140 | - if ($lat < 31.77209708) return 51; |
|
141 | - if ($lat < 33.53993436) return 50; |
|
142 | - if ($lat < 35.22899598) return 49; |
|
143 | - if ($lat < 36.85025108) return 48; |
|
144 | - if ($lat < 38.41241892) return 47; |
|
145 | - if ($lat < 39.92256684) return 46; |
|
146 | - if ($lat < 41.38651832) return 45; |
|
147 | - if ($lat < 42.80914012) return 44; |
|
148 | - if ($lat < 44.19454951) return 43; |
|
149 | - if ($lat < 45.54626723) return 42; |
|
150 | - if ($lat < 46.86733252) return 41; |
|
151 | - if ($lat < 48.16039128) return 40; |
|
152 | - if ($lat < 49.42776439) return 39; |
|
153 | - if ($lat < 50.67150166) return 38; |
|
154 | - if ($lat < 51.89342469) return 37; |
|
155 | - if ($lat < 53.09516153) return 36; |
|
156 | - if ($lat < 54.27817472) return 35; |
|
157 | - if ($lat < 55.44378444) return 34; |
|
158 | - if ($lat < 56.59318756) return 33; |
|
159 | - if ($lat < 57.72747354) return 32; |
|
160 | - if ($lat < 58.84763776) return 31; |
|
161 | - if ($lat < 59.95459277) return 30; |
|
162 | - if ($lat < 61.04917774) return 29; |
|
163 | - if ($lat < 62.13216659) return 28; |
|
164 | - if ($lat < 63.20427479) return 27; |
|
165 | - if ($lat < 64.26616523) return 26; |
|
166 | - if ($lat < 65.31845310) return 25; |
|
167 | - if ($lat < 66.36171008) return 24; |
|
168 | - if ($lat < 67.39646774) return 23; |
|
169 | - if ($lat < 68.42322022) return 22; |
|
170 | - if ($lat < 69.44242631) return 21; |
|
171 | - if ($lat < 70.45451075) return 20; |
|
172 | - if ($lat < 71.45986473) return 19; |
|
173 | - if ($lat < 72.45884545) return 18; |
|
174 | - if ($lat < 73.45177442) return 17; |
|
175 | - if ($lat < 74.43893416) return 16; |
|
176 | - if ($lat < 75.42056257) return 15; |
|
177 | - if ($lat < 76.39684391) return 14; |
|
178 | - if ($lat < 77.36789461) return 13; |
|
179 | - if ($lat < 78.33374083) return 12; |
|
180 | - if ($lat < 79.29428225) return 11; |
|
181 | - if ($lat < 80.24923213) return 10; |
|
182 | - if ($lat < 81.19801349) return 9; |
|
183 | - if ($lat < 82.13956981) return 8; |
|
184 | - if ($lat < 83.07199445) return 7; |
|
185 | - if ($lat < 83.99173563) return 6; |
|
186 | - if ($lat < 84.89166191) return 5; |
|
187 | - if ($lat < 85.75541621) return 4; |
|
188 | - if ($lat < 86.53536998) return 3; |
|
189 | - if ($lat < 87.00000000) return 2; |
|
152 | + if ($lat < 0) { |
|
153 | + $lat = -$lat; |
|
154 | + } |
|
155 | + // Table is simmetric about the equator. |
|
156 | + if ($lat < 10.47047130) { |
|
157 | + return 59; |
|
158 | + } |
|
159 | + if ($lat < 14.82817437) { |
|
160 | + return 58; |
|
161 | + } |
|
162 | + if ($lat < 18.18626357) { |
|
163 | + return 57; |
|
164 | + } |
|
165 | + if ($lat < 21.02939493) { |
|
166 | + return 56; |
|
167 | + } |
|
168 | + if ($lat < 23.54504487) { |
|
169 | + return 55; |
|
170 | + } |
|
171 | + if ($lat < 25.82924707) { |
|
172 | + return 54; |
|
173 | + } |
|
174 | + if ($lat < 27.93898710) { |
|
175 | + return 53; |
|
176 | + } |
|
177 | + if ($lat < 29.91135686) { |
|
178 | + return 52; |
|
179 | + } |
|
180 | + if ($lat < 31.77209708) { |
|
181 | + return 51; |
|
182 | + } |
|
183 | + if ($lat < 33.53993436) { |
|
184 | + return 50; |
|
185 | + } |
|
186 | + if ($lat < 35.22899598) { |
|
187 | + return 49; |
|
188 | + } |
|
189 | + if ($lat < 36.85025108) { |
|
190 | + return 48; |
|
191 | + } |
|
192 | + if ($lat < 38.41241892) { |
|
193 | + return 47; |
|
194 | + } |
|
195 | + if ($lat < 39.92256684) { |
|
196 | + return 46; |
|
197 | + } |
|
198 | + if ($lat < 41.38651832) { |
|
199 | + return 45; |
|
200 | + } |
|
201 | + if ($lat < 42.80914012) { |
|
202 | + return 44; |
|
203 | + } |
|
204 | + if ($lat < 44.19454951) { |
|
205 | + return 43; |
|
206 | + } |
|
207 | + if ($lat < 45.54626723) { |
|
208 | + return 42; |
|
209 | + } |
|
210 | + if ($lat < 46.86733252) { |
|
211 | + return 41; |
|
212 | + } |
|
213 | + if ($lat < 48.16039128) { |
|
214 | + return 40; |
|
215 | + } |
|
216 | + if ($lat < 49.42776439) { |
|
217 | + return 39; |
|
218 | + } |
|
219 | + if ($lat < 50.67150166) { |
|
220 | + return 38; |
|
221 | + } |
|
222 | + if ($lat < 51.89342469) { |
|
223 | + return 37; |
|
224 | + } |
|
225 | + if ($lat < 53.09516153) { |
|
226 | + return 36; |
|
227 | + } |
|
228 | + if ($lat < 54.27817472) { |
|
229 | + return 35; |
|
230 | + } |
|
231 | + if ($lat < 55.44378444) { |
|
232 | + return 34; |
|
233 | + } |
|
234 | + if ($lat < 56.59318756) { |
|
235 | + return 33; |
|
236 | + } |
|
237 | + if ($lat < 57.72747354) { |
|
238 | + return 32; |
|
239 | + } |
|
240 | + if ($lat < 58.84763776) { |
|
241 | + return 31; |
|
242 | + } |
|
243 | + if ($lat < 59.95459277) { |
|
244 | + return 30; |
|
245 | + } |
|
246 | + if ($lat < 61.04917774) { |
|
247 | + return 29; |
|
248 | + } |
|
249 | + if ($lat < 62.13216659) { |
|
250 | + return 28; |
|
251 | + } |
|
252 | + if ($lat < 63.20427479) { |
|
253 | + return 27; |
|
254 | + } |
|
255 | + if ($lat < 64.26616523) { |
|
256 | + return 26; |
|
257 | + } |
|
258 | + if ($lat < 65.31845310) { |
|
259 | + return 25; |
|
260 | + } |
|
261 | + if ($lat < 66.36171008) { |
|
262 | + return 24; |
|
263 | + } |
|
264 | + if ($lat < 67.39646774) { |
|
265 | + return 23; |
|
266 | + } |
|
267 | + if ($lat < 68.42322022) { |
|
268 | + return 22; |
|
269 | + } |
|
270 | + if ($lat < 69.44242631) { |
|
271 | + return 21; |
|
272 | + } |
|
273 | + if ($lat < 70.45451075) { |
|
274 | + return 20; |
|
275 | + } |
|
276 | + if ($lat < 71.45986473) { |
|
277 | + return 19; |
|
278 | + } |
|
279 | + if ($lat < 72.45884545) { |
|
280 | + return 18; |
|
281 | + } |
|
282 | + if ($lat < 73.45177442) { |
|
283 | + return 17; |
|
284 | + } |
|
285 | + if ($lat < 74.43893416) { |
|
286 | + return 16; |
|
287 | + } |
|
288 | + if ($lat < 75.42056257) { |
|
289 | + return 15; |
|
290 | + } |
|
291 | + if ($lat < 76.39684391) { |
|
292 | + return 14; |
|
293 | + } |
|
294 | + if ($lat < 77.36789461) { |
|
295 | + return 13; |
|
296 | + } |
|
297 | + if ($lat < 78.33374083) { |
|
298 | + return 12; |
|
299 | + } |
|
300 | + if ($lat < 79.29428225) { |
|
301 | + return 11; |
|
302 | + } |
|
303 | + if ($lat < 80.24923213) { |
|
304 | + return 10; |
|
305 | + } |
|
306 | + if ($lat < 81.19801349) { |
|
307 | + return 9; |
|
308 | + } |
|
309 | + if ($lat < 82.13956981) { |
|
310 | + return 8; |
|
311 | + } |
|
312 | + if ($lat < 83.07199445) { |
|
313 | + return 7; |
|
314 | + } |
|
315 | + if ($lat < 83.99173563) { |
|
316 | + return 6; |
|
317 | + } |
|
318 | + if ($lat < 84.89166191) { |
|
319 | + return 5; |
|
320 | + } |
|
321 | + if ($lat < 85.75541621) { |
|
322 | + return 4; |
|
323 | + } |
|
324 | + if ($lat < 86.53536998) { |
|
325 | + return 3; |
|
326 | + } |
|
327 | + if ($lat < 87.00000000) { |
|
328 | + return 2; |
|
329 | + } |
|
190 | 330 | return 1; |
191 | 331 | } |
192 | 332 | |
193 | 333 | private function cprN($lat,$isodd) { |
194 | 334 | $nl = $this->cprNL($lat) - $isodd; |
195 | - if ($nl > 1) return $nl; |
|
196 | - else return 1; |
|
335 | + if ($nl > 1) { |
|
336 | + return $nl; |
|
337 | + } else { |
|
338 | + return 1; |
|
339 | + } |
|
197 | 340 | } |
198 | 341 | |
199 | 342 | private function parityCheck($msg, $bin) { |
@@ -216,10 +359,13 @@ discard block |
||
216 | 359 | $crc = 0; |
217 | 360 | $checksum = intval(substr($msg,22,6),16); |
218 | 361 | for ($j = 0; $j < strlen($bin); $j++) { |
219 | - if ($bin[$j]) $crc = $crc^intval($modes_checksum_table[$j],0); |
|
362 | + if ($bin[$j]) { |
|
363 | + $crc = $crc^intval($modes_checksum_table[$j],0); |
|
364 | + } |
|
220 | 365 | } |
221 | - if ($crc == $checksum) return true; |
|
222 | - else { |
|
366 | + if ($crc == $checksum) { |
|
367 | + return true; |
|
368 | + } else { |
|
223 | 369 | //echo "**** CRC ERROR ****\n"; |
224 | 370 | return false; |
225 | 371 | } |
@@ -269,22 +415,37 @@ discard block |
||
269 | 415 | $msg['date_log'] = date('Y/m/d',$data['timestamp']); |
270 | 416 | $msg['time_log'] = date('H:i:s',$data['timestamp']).'.180'; |
271 | 417 | $msg['callsign'] = ''; |
272 | - if (isset($data['altitude'])) $msg['altitude'] = $data['altitude']; |
|
273 | - else $msg['altitude'] = ''; |
|
418 | + if (isset($data['altitude'])) { |
|
419 | + $msg['altitude'] = $data['altitude']; |
|
420 | + } else { |
|
421 | + $msg['altitude'] = ''; |
|
422 | + } |
|
274 | 423 | $msg['speed'] = $data['speed']; |
275 | - if (isset($data['heading'])) $msg['track'] = $data['heading']; |
|
276 | - else $msg['track'] = ''; |
|
424 | + if (isset($data['heading'])) { |
|
425 | + $msg['track'] = $data['heading']; |
|
426 | + } else { |
|
427 | + $msg['track'] = ''; |
|
428 | + } |
|
277 | 429 | $msg['latitude'] = $data['latitude']; |
278 | 430 | $msg['longitude'] = $data['longitude']; |
279 | - if (isset($data['verticalrate'])) $msg['verticalrate'] = $data['verticalrate']; |
|
280 | - else $msg['verticalrate'] = ''; |
|
281 | - if (isset($data['squawk'])) $msg['squawk'] = $data['squawk']; |
|
282 | - else $msg['squawk'] = 0; |
|
431 | + if (isset($data['verticalrate'])) { |
|
432 | + $msg['verticalrate'] = $data['verticalrate']; |
|
433 | + } else { |
|
434 | + $msg['verticalrate'] = ''; |
|
435 | + } |
|
436 | + if (isset($data['squawk'])) { |
|
437 | + $msg['squawk'] = $data['squawk']; |
|
438 | + } else { |
|
439 | + $msg['squawk'] = 0; |
|
440 | + } |
|
283 | 441 | $msg['alert'] = 0; |
284 | 442 | $msg['emergency'] = 0; |
285 | 443 | $msg['SPI'] = 0; |
286 | - if (isset($data['ground'])) $msg['ground'] = 1; |
|
287 | - else $msg['ground'] = 0; |
|
444 | + if (isset($data['ground'])) { |
|
445 | + $msg['ground'] = 1; |
|
446 | + } else { |
|
447 | + $msg['ground'] = 0; |
|
448 | + } |
|
288 | 449 | $result[] = implode(',',$msg); |
289 | 450 | } |
290 | 451 | return $result; |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | public $db; |
15 | 15 | |
16 | 16 | protected $texts = Array( |
17 | - 'MI' => 'Shallow', |
|
18 | - 'PR' => 'Partial', |
|
19 | - 'BC' => 'Low drifting', |
|
20 | - 'BL' => 'Blowing', |
|
21 | - 'SH' => 'Showers', |
|
22 | - 'TS' => 'Thunderstorm', |
|
23 | - 'FZ' => 'Freezing', |
|
24 | - 'DZ' => 'Drizzle', |
|
25 | - 'RA' => 'Rain', |
|
26 | - 'SN' => 'Snow', |
|
27 | - 'SG' => 'Snow Grains', |
|
28 | - 'IC' => 'Ice crystals', |
|
29 | - 'PL' => 'Ice pellets', |
|
30 | - 'GR' => 'Hail', |
|
31 | - 'GS' => 'Small hail', |
|
32 | - 'UP' => 'Unknown', |
|
33 | - 'BR' => 'Mist', |
|
34 | - 'FG' => 'Fog', |
|
35 | - 'FU' => 'Smoke', |
|
36 | - 'VA' => 'Volcanic ash', |
|
37 | - 'DU' => 'Widespread dust', |
|
38 | - 'SA' => 'Sand', |
|
39 | - 'HZ' => 'Haze', |
|
40 | - 'PY' => 'Spray', |
|
41 | - 'PO' => 'Well developed dust / sand whirls', |
|
42 | - 'SQ' => 'Squalls', |
|
43 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | - 'SS' => 'Sandstorm', |
|
45 | - 'DS' => 'Duststorm' |
|
17 | + 'MI' => 'Shallow', |
|
18 | + 'PR' => 'Partial', |
|
19 | + 'BC' => 'Low drifting', |
|
20 | + 'BL' => 'Blowing', |
|
21 | + 'SH' => 'Showers', |
|
22 | + 'TS' => 'Thunderstorm', |
|
23 | + 'FZ' => 'Freezing', |
|
24 | + 'DZ' => 'Drizzle', |
|
25 | + 'RA' => 'Rain', |
|
26 | + 'SN' => 'Snow', |
|
27 | + 'SG' => 'Snow Grains', |
|
28 | + 'IC' => 'Ice crystals', |
|
29 | + 'PL' => 'Ice pellets', |
|
30 | + 'GR' => 'Hail', |
|
31 | + 'GS' => 'Small hail', |
|
32 | + 'UP' => 'Unknown', |
|
33 | + 'BR' => 'Mist', |
|
34 | + 'FG' => 'Fog', |
|
35 | + 'FU' => 'Smoke', |
|
36 | + 'VA' => 'Volcanic ash', |
|
37 | + 'DU' => 'Widespread dust', |
|
38 | + 'SA' => 'Sand', |
|
39 | + 'HZ' => 'Haze', |
|
40 | + 'PY' => 'Spray', |
|
41 | + 'PO' => 'Well developed dust / sand whirls', |
|
42 | + 'SQ' => 'Squalls', |
|
43 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | + 'SS' => 'Sandstorm', |
|
45 | + 'DS' => 'Duststorm' |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /* |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
178 | 178 | */ |
179 | 179 | } |
180 | - /* |
|
180 | + /* |
|
181 | 181 | // Wind Direction |
182 | 182 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
183 | 183 | $result['wind_direction'] = $matches[1]; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $result['speed_variable'] = $matches[1]; |
189 | 189 | } |
190 | 190 | */ |
191 | - // Visibility |
|
191 | + // Visibility |
|
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | 194 | $result['visibility'] = (float)$matches[3] * 1609.34; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
251 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
249 | + 'from' => (float)$matches[2], |
|
250 | + 'to' => (float)$matches[4], |
|
251 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | $result['RVR'] = $matches[1]; |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $Connection = new Connection(); |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $Connection = new Connection(); |
88 | 88 | $sth = $Connection->db->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | public function parse($data) { |
101 | 101 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
102 | 102 | $codes = implode('|', array_keys($this->texts)); |
103 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
103 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
104 | 104 | //$pieces = explode(' ',$data); |
105 | - $pieces = preg_split('/\s/',$data); |
|
105 | + $pieces = preg_split('/\s/', $data); |
|
106 | 106 | $pos = 0; |
107 | 107 | if ($pieces[0] == 'METAR') $pos++; |
108 | 108 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | $result['location'] = $pieces[$pos]; |
113 | 113 | $pos++; |
114 | 114 | if (!isset($pieces[$pos])) return $result; |
115 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
116 | - $result['time'] = substr($pieces[$pos],2,4); |
|
115 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
116 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
117 | 117 | $c = count($pieces); |
118 | - for($pos++; $pos < $c; $pos++) { |
|
118 | + for ($pos++; $pos < $c; $pos++) { |
|
119 | 119 | $piece = $pieces[$pos]; |
120 | 120 | if ($piece == 'RMK') break; |
121 | 121 | if ($piece == 'AUTO') $result['auto'] = true; |
122 | 122 | if ($piece == 'COR') $result['correction'] = true; |
123 | 123 | // Wind Speed |
124 | 124 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | - $result['wind']['direction'] = (float)$matches[1]; |
|
125 | + $result['wind']['direction'] = (float) $matches[1]; |
|
126 | 126 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
130 | - $result['wind']['gust'] = (float)$matches[3]; |
|
127 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
128 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
129 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
130 | + $result['wind']['gust'] = (float) $matches[3]; |
|
131 | 131 | $result['wind']['unit'] = $matches[4]; |
132 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
133 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
132 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
133 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | |
152 | 152 | // Temperature |
153 | 153 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
154 | - $temp = (float)$matches[1]; |
|
154 | + $temp = (float) $matches[1]; |
|
155 | 155 | if ($matches[1]{0} == 'M') { |
156 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
156 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
157 | 157 | } |
158 | 158 | $result['temperature'] = $temp; |
159 | - $dew = (float)$matches[2]; |
|
159 | + $dew = (float) $matches[2]; |
|
160 | 160 | if ($matches[2]{0} == 'M') { |
161 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
161 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
162 | 162 | } |
163 | 163 | $result['dew'] = $dew; |
164 | - $result['rh'] = round(100*(exp((17.625*$dew)/(243.04+$dew))/exp((17.625*$temp)/(243.04+$temp)))); |
|
164 | + $result['rh'] = round(100*(exp((17.625*$dew)/(243.04 + $dew))/exp((17.625*$temp)/(243.04 + $temp)))); |
|
165 | 165 | } |
166 | 166 | // QNH |
167 | 167 | if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $result['QNH'] = $matches[2]; |
172 | 172 | } else { |
173 | 173 | // inHg |
174 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
174 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
175 | 175 | } |
176 | 176 | /* |
177 | 177 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | // Visibility |
193 | 193 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
194 | 194 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
195 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
195 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
196 | 196 | } else { |
197 | 197 | if ($matches[1] == '9999') { |
198 | 198 | $result['visibility'] = '> 10000'; |
199 | 199 | } else { |
200 | - $result['visibility'] = (float)$matches[1]; |
|
200 | + $result['visibility'] = (float) $matches[1]; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | if (preg_match('#^CAVOK$#', $piece, $matches)) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
220 | 220 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
221 | 221 | $cloud['type_code'] = $type; |
222 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
222 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
223 | 223 | if (isset($matches[3])) $significant = $matches[3]; |
224 | 224 | else $significant = ''; |
225 | 225 | if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | $rvr['runway'] = $matches[1]; |
241 | 241 | $rvr['assessment'] = $matches[2]; |
242 | 242 | $rvr['rvr'] = $matches[3]; |
243 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
244 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
243 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
244 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
245 | 245 | $result['RVR'] = $rvr; |
246 | 246 | } |
247 | 247 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $result['RVR']['friction'] = $matches[5]; |
255 | 255 | } |
256 | 256 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
257 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
259 | 259 | if (isset($matches[3])) { |
260 | 260 | $range = Array( |
261 | - 'from' => (float)$matches[2], |
|
262 | - 'to' => (float)$matches[4], |
|
261 | + 'from' => (float) $matches[2], |
|
262 | + 'to' => (float) $matches[4], |
|
263 | 263 | 'unit' => $matches[5] ? 'FT' : 'M' |
264 | 264 | ); |
265 | 265 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | try { |
313 | 313 | $sth = $this->db->prepare($query); |
314 | 314 | $sth->execute($query_values); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -328,19 +328,19 @@ discard block |
||
328 | 328 | * @param String $metar METAR text |
329 | 329 | * @param String $date date of the METAR |
330 | 330 | */ |
331 | - public function addMETAR($location,$metar,$date) { |
|
331 | + public function addMETAR($location, $metar, $date) { |
|
332 | 332 | global $globalDBdriver; |
333 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
333 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
334 | 334 | if ($globalDBdriver == 'mysql') { |
335 | 335 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
336 | 336 | } else { |
337 | 337 | $query = "UPDATE metar SET metar_date = :date, metar = :metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
338 | 338 | } |
339 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
339 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
340 | 340 | try { |
341 | 341 | $sth = $this->db->prepare($query); |
342 | 342 | $sth->execute($query_values); |
343 | - } catch(PDOException $e) { |
|
343 | + } catch (PDOException $e) { |
|
344 | 344 | return "error : ".$e->getMessage(); |
345 | 345 | } |
346 | 346 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | try { |
356 | 356 | $sth = $this->db->prepare($query); |
357 | 357 | $sth->execute($query_values); |
358 | - } catch(PDOException $e) { |
|
358 | + } catch (PDOException $e) { |
|
359 | 359 | return "error : ".$e->getMessage(); |
360 | 360 | } |
361 | 361 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | try { |
369 | 369 | $sth = $this->db->prepare($query); |
370 | 370 | $sth->execute(); |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | } |
@@ -382,29 +382,29 @@ discard block |
||
382 | 382 | date_default_timezone_set("UTC"); |
383 | 383 | $Common = new Common(); |
384 | 384 | if (isset($globalIVAO) && $globalIVAO) { |
385 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
386 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
385 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
386 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
387 | 387 | } else { |
388 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
389 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
388 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
389 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
390 | 390 | } |
391 | 391 | if ($handle) { |
392 | 392 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
393 | 393 | $date = ''; |
394 | 394 | if ($globalTransaction) $this->db->beginTransaction(); |
395 | - while(($line = fgets($handle,4096)) !== false) { |
|
396 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
397 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
395 | + while (($line = fgets($handle, 4096)) !== false) { |
|
396 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
397 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
398 | 398 | $date = $line; |
399 | 399 | } elseif (trim($line) != '') { |
400 | 400 | if ($date == '') $date = date('Y/m/d H:m'); |
401 | 401 | $pos = 0; |
402 | - $pieces = preg_split('/\s/',$line); |
|
402 | + $pieces = preg_split('/\s/', $line); |
|
403 | 403 | if ($pieces[0] == 'METAR') $pos++; |
404 | 404 | if (strlen($pieces[$pos]) != 4) $pos++; |
405 | 405 | $location = $pieces[$pos]; |
406 | 406 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | - echo $this->addMETAR($location,$line,$date); |
|
407 | + echo $this->addMETAR($location, $line, $date); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | fclose($handle); |
@@ -423,23 +423,23 @@ discard block |
||
423 | 423 | if ($globalMETARurl == '') return array(); |
424 | 424 | date_default_timezone_set("UTC"); |
425 | 425 | $Common = new Common(); |
426 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
426 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
427 | 427 | $cycle = $Common->getData($url); |
428 | 428 | $date = ''; |
429 | - foreach(explode("\n",$cycle) as $line) { |
|
430 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
431 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
429 | + foreach (explode("\n", $cycle) as $line) { |
|
430 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
431 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
432 | 432 | $date = $line; |
433 | 433 | } |
434 | 434 | if (trim($line) != '') { |
435 | 435 | if ($date == '') $date = date('Y/m/d H:m'); |
436 | 436 | $pos = 0; |
437 | - $pieces = preg_split('/\s/',$line); |
|
437 | + $pieces = preg_split('/\s/', $line); |
|
438 | 438 | if ($pieces[0] == 'METAR') $pos++; |
439 | 439 | if (strlen($pieces[$pos]) != 4) $pos++; |
440 | 440 | $location = $pieces[$pos]; |
441 | 441 | if (strlen($location == 4)) { |
442 | - $this->addMETAR($location,$line,$date); |
|
442 | + $this->addMETAR($location, $line, $date); |
|
443 | 443 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | 444 | } else return array(); |
445 | 445 | } |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -210,27 +232,49 @@ discard block |
||
210 | 232 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
211 | 233 | $type = $matches[1]; |
212 | 234 | $cloud = array(); |
213 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
214 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
215 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
216 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
217 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
218 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
219 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
220 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
235 | + if ($type == 'SKC') { |
|
236 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
237 | + } elseif ($type == 'CLR') { |
|
238 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
239 | + } elseif ($type == 'NSC') { |
|
240 | + $cloud['type'] = 'No significant cloud'; |
|
241 | + } elseif ($type == 'FEW') { |
|
242 | + $cloud['type'] = 'Few'; |
|
243 | + } elseif ($type == 'SCT') { |
|
244 | + $cloud['type'] = 'Scattered'; |
|
245 | + } elseif ($type == 'BKN') { |
|
246 | + $cloud['type'] = 'Broken'; |
|
247 | + } elseif ($type == 'OVC') { |
|
248 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
249 | + } elseif ($type == 'VV') { |
|
250 | + $cloud['type'] = 'Vertical visibility'; |
|
251 | + } |
|
221 | 252 | $cloud['type_code'] = $type; |
222 | 253 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
223 | - if (isset($matches[3])) $significant = $matches[3]; |
|
224 | - else $significant = ''; |
|
225 | - if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
|
226 | - elseif ($significant == 'AC') $cloud['significant'] = 'Altocumulus'; |
|
227 | - elseif ($significant == 'CBS') $cloud['significant'] = 'Cumulonimbus'; |
|
228 | - elseif ($significant == 'CC') $cloud['significant'] = 'Cirrocumulus'; |
|
229 | - elseif ($significant == 'CU') $cloud['significant'] = 'Cumulus'; |
|
230 | - elseif ($significant == 'CI') $cloud['significant'] = 'Cirrus'; |
|
231 | - elseif ($significant == 'CS') $cloud['significant'] = 'Cirrostratus'; |
|
232 | - elseif ($significant == 'TCU') $cloud['significant'] = 'Towering Cumulus'; |
|
233 | - else $cloud['significant'] = $significant; |
|
254 | + if (isset($matches[3])) { |
|
255 | + $significant = $matches[3]; |
|
256 | + } else { |
|
257 | + $significant = ''; |
|
258 | + } |
|
259 | + if ($significant == 'CB') { |
|
260 | + $cloud['significant'] = 'Cumulonimbus'; |
|
261 | + } elseif ($significant == 'AC') { |
|
262 | + $cloud['significant'] = 'Altocumulus'; |
|
263 | + } elseif ($significant == 'CBS') { |
|
264 | + $cloud['significant'] = 'Cumulonimbus'; |
|
265 | + } elseif ($significant == 'CC') { |
|
266 | + $cloud['significant'] = 'Cirrocumulus'; |
|
267 | + } elseif ($significant == 'CU') { |
|
268 | + $cloud['significant'] = 'Cumulus'; |
|
269 | + } elseif ($significant == 'CI') { |
|
270 | + $cloud['significant'] = 'Cirrus'; |
|
271 | + } elseif ($significant == 'CS') { |
|
272 | + $cloud['significant'] = 'Cirrostratus'; |
|
273 | + } elseif ($significant == 'TCU') { |
|
274 | + $cloud['significant'] = 'Towering Cumulus'; |
|
275 | + } else { |
|
276 | + $cloud['significant'] = $significant; |
|
277 | + } |
|
234 | 278 | //$cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
235 | 279 | $result['cloud'][] = $cloud; |
236 | 280 | } |
@@ -254,8 +298,11 @@ discard block |
||
254 | 298 | $result['RVR']['friction'] = $matches[5]; |
255 | 299 | } |
256 | 300 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
301 | + if (isset($matches[5])) { |
|
302 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
303 | + } else { |
|
304 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
305 | + } |
|
259 | 306 | if (isset($matches[3])) { |
260 | 307 | $range = Array( |
261 | 308 | 'from' => (float)$matches[2], |
@@ -288,8 +335,11 @@ discard block |
||
288 | 335 | if (isset($matches[3])) { |
289 | 336 | $text[] = $this->texts[$matches[3]]; |
290 | 337 | } |
291 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
292 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
338 | + if (!isset($result['weather'])) { |
|
339 | + $result['weather'] = implode(' ', $text); |
|
340 | + } else { |
|
341 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
342 | + } |
|
293 | 343 | } |
294 | 344 | } |
295 | 345 | return $result; |
@@ -305,8 +355,11 @@ discard block |
||
305 | 355 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
306 | 356 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
307 | 357 | } else { |
308 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
309 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
358 | + if ($globalDBdriver == 'mysql') { |
|
359 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
360 | + } else { |
|
361 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
362 | + } |
|
310 | 363 | } |
311 | 364 | $query_values = array(':icao' => $icao); |
312 | 365 | try { |
@@ -378,7 +431,9 @@ discard block |
||
378 | 431 | */ |
379 | 432 | public function addMETARCycle() { |
380 | 433 | global $globalDebug, $globalIVAO, $globalTransaction; |
381 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
434 | + if (isset($globalDebug) && $globalDebug) { |
|
435 | + echo "Downloading METAR cycle..."; |
|
436 | + } |
|
382 | 437 | date_default_timezone_set("UTC"); |
383 | 438 | $Common = new Common(); |
384 | 439 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -389,28 +444,42 @@ discard block |
||
389 | 444 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
390 | 445 | } |
391 | 446 | if ($handle) { |
392 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
447 | + if (isset($globalDebug) && $globalDebug) { |
|
448 | + echo "Done - Updating DB..."; |
|
449 | + } |
|
393 | 450 | $date = ''; |
394 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
451 | + if ($globalTransaction) { |
|
452 | + $this->db->beginTransaction(); |
|
453 | + } |
|
395 | 454 | while(($line = fgets($handle,4096)) !== false) { |
396 | 455 | $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
397 | 456 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
398 | 457 | $date = $line; |
399 | 458 | } elseif (trim($line) != '') { |
400 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
459 | + if ($date == '') { |
|
460 | + $date = date('Y/m/d H:m'); |
|
461 | + } |
|
401 | 462 | $pos = 0; |
402 | 463 | $pieces = preg_split('/\s/',$line); |
403 | - if ($pieces[0] == 'METAR') $pos++; |
|
404 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
464 | + if ($pieces[0] == 'METAR') { |
|
465 | + $pos++; |
|
466 | + } |
|
467 | + if (strlen($pieces[$pos]) != 4) { |
|
468 | + $pos++; |
|
469 | + } |
|
405 | 470 | $location = $pieces[$pos]; |
406 | 471 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | 472 | echo $this->addMETAR($location,$line,$date); |
408 | 473 | } |
409 | 474 | } |
410 | 475 | fclose($handle); |
411 | - if ($globalTransaction) $this->db->commit(); |
|
476 | + if ($globalTransaction) { |
|
477 | + $this->db->commit(); |
|
478 | + } |
|
479 | + } |
|
480 | + if (isset($globalDebug) && $globalDebug) { |
|
481 | + echo "Done\n"; |
|
412 | 482 | } |
413 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
414 | 483 | } |
415 | 484 | |
416 | 485 | /* |
@@ -420,7 +489,9 @@ discard block |
||
420 | 489 | */ |
421 | 490 | public function downloadMETAR($icao) { |
422 | 491 | global $globalMETARurl; |
423 | - if ($globalMETARurl == '') return array(); |
|
492 | + if ($globalMETARurl == '') { |
|
493 | + return array(); |
|
494 | + } |
|
424 | 495 | date_default_timezone_set("UTC"); |
425 | 496 | $Common = new Common(); |
426 | 497 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -432,16 +503,24 @@ discard block |
||
432 | 503 | $date = $line; |
433 | 504 | } |
434 | 505 | if (trim($line) != '') { |
435 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
506 | + if ($date == '') { |
|
507 | + $date = date('Y/m/d H:m'); |
|
508 | + } |
|
436 | 509 | $pos = 0; |
437 | 510 | $pieces = preg_split('/\s/',$line); |
438 | - if ($pieces[0] == 'METAR') $pos++; |
|
439 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
511 | + if ($pieces[0] == 'METAR') { |
|
512 | + $pos++; |
|
513 | + } |
|
514 | + if (strlen($pieces[$pos]) != 4) { |
|
515 | + $pos++; |
|
516 | + } |
|
440 | 517 | $location = $pieces[$pos]; |
441 | 518 | if (strlen($location == 4)) { |
442 | 519 | $this->addMETAR($location,$line,$date); |
443 | 520 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | - } else return array(); |
|
521 | + } else { |
|
522 | + return array(); |
|
523 | + } |
|
445 | 524 | } |
446 | 525 | } |
447 | 526 | return array(); |
@@ -15,7 +15,7 @@ |
||
15 | 15 | */ |
16 | 16 | public function parse_xml($url) { |
17 | 17 | $Common = new Common(); |
18 | - $filedata = $Common->getData($url,'get','','','','','','',true); |
|
18 | + $filedata = $Common->getData($url, 'get', '', '', '', '', '', '', true); |
|
19 | 19 | if ($filedata != '' && $filedata !== false) { |
20 | 20 | $xml = simplexml_load_string($filedata); |
21 | 21 | if ($xml !== false) { |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | if ($check_version == '0') { |
87 | 87 | |
88 | 88 | if ($globalDBdriver == 'mysql') { |
89 | - $error .= create_db::import_all_db('../db/'); |
|
89 | + $error .= create_db::import_all_db('../db/'); |
|
90 | 90 | } elseif ($globalDBdriver == 'pgsql') { |
91 | - $error .= create_db::import_all_db('../db/pgsql/'); |
|
91 | + $error .= create_db::import_all_db('../db/pgsql/'); |
|
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
100 | 100 | } else { |
101 | - $_SESSION['install'] = 'sources'; |
|
102 | - $_SESSION['next'] = 'Insert data in source table'; |
|
101 | + $_SESSION['install'] = 'sources'; |
|
102 | + $_SESSION['next'] = 'Insert data in source table'; |
|
103 | 103 | } |
104 | 104 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
105 | 105 | print json_encode($result); |
@@ -156,10 +156,10 @@ discard block |
||
156 | 156 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
157 | 157 | } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | - $_SESSION['install'] = 'notam'; |
|
160 | - $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
162 | - print json_encode($result); |
|
159 | + $_SESSION['install'] = 'notam'; |
|
160 | + $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
161 | + $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
162 | + print json_encode($result); |
|
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
165 | 165 | $_SESSION['install'] = 'owner'; |
@@ -169,10 +169,10 @@ discard block |
||
169 | 169 | print json_encode($result); |
170 | 170 | */ |
171 | 171 | } else { |
172 | - $_SESSION['install'] = 'sources'; |
|
173 | - $_SESSION['next'] = 'Insert data in source table'; |
|
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
175 | - print json_encode($result); |
|
172 | + $_SESSION['install'] = 'sources'; |
|
173 | + $_SESSION['next'] = 'Insert data in source table'; |
|
174 | + $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
175 | + print json_encode($result); |
|
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
@@ -70,15 +70,15 @@ discard block |
||
70 | 70 | $globalDebug = FALSE; |
71 | 71 | $dbroot = $_SESSION['database_root']; |
72 | 72 | $dbrootpass = $_SESSION['database_rootpass']; |
73 | - $error .= create_db::create_database($dbroot,$dbrootpass,$globalDBuser,$globalDBpass,$globalDBname,$globalDBdriver,$globalDBhost); |
|
73 | + $error .= create_db::create_database($dbroot, $dbrootpass, $globalDBuser, $globalDBpass, $globalDBname, $globalDBdriver, $globalDBhost); |
|
74 | 74 | sleep(5); |
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
|
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
77 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create database')); |
|
78 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create database')); |
|
79 | 79 | $_SESSION['install'] = 'database_import'; |
80 | 80 | $_SESSION['next'] = 'Create and import tables'; |
81 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
81 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
82 | 82 | print json_encode($result); |
83 | 83 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
84 | 84 | $globalDebug = FALSE; |
@@ -92,8 +92,8 @@ discard block |
||
92 | 92 | } |
93 | 93 | if ($error != '') { |
94 | 94 | $_SESSION['error'] = $error; |
95 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
95 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
96 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Create and import tables')); |
|
97 | 97 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
98 | 98 | $_SESSION['install'] = 'populate'; |
99 | 99 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -101,24 +101,24 @@ discard block |
||
101 | 101 | $_SESSION['install'] = 'sources'; |
102 | 102 | $_SESSION['next'] = 'Insert data in source table'; |
103 | 103 | } |
104 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
104 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
105 | 105 | print json_encode($result); |
106 | 106 | } elseif (!is_numeric($check_version)) { |
107 | 107 | $error .= $check_version; |
108 | 108 | $_SESSION['error'] = $error; |
109 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
|
109 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Create and import tables')); |
|
110 | 110 | if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
111 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
111 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
112 | 112 | print json_encode($result); |
113 | 113 | } else { |
114 | 114 | $error .= update_schema::check_version(true); |
115 | 115 | if ($error != '') { |
116 | 116 | $_SESSION['error'] = $error; |
117 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
|
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
117 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Update schema if needed')); |
|
118 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Update schema if needed')); |
|
119 | 119 | $_SESSION['install'] = 'sources'; |
120 | 120 | $_SESSION['next'] = 'Insert data in source table'; |
121 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
121 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
122 | 122 | print json_encode($result); |
123 | 123 | } |
124 | 124 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'waypoints') { |
@@ -127,8 +127,8 @@ discard block |
||
127 | 127 | $error .= update_db::update_waypoints(); |
128 | 128 | if ($error != '') { |
129 | 129 | $_SESSION['error'] = $error; |
130 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
|
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
130 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate waypoints database')); |
|
131 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate waypoints database')); |
|
132 | 132 | /* |
133 | 133 | $_SESSION['install'] = 'airspace'; |
134 | 134 | $_SESSION['next'] = 'Populate airspace table'; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | */ |
146 | 146 | $_SESSION['install'] = 'countries'; |
147 | 147 | $_SESSION['next'] = 'Populate countries table'; |
148 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
148 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
149 | 149 | print json_encode($result); |
150 | 150 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'countries') { |
151 | 151 | include_once('class.update_db.php'); |
@@ -153,12 +153,12 @@ discard block |
||
153 | 153 | $error .= update_db::update_countries(); |
154 | 154 | if ($error != '') { |
155 | 155 | $_SESSION['error'] = $error; |
156 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
|
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
156 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate countries database')); |
|
157 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate countries database')); |
|
158 | 158 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 159 | $_SESSION['install'] = 'notam'; |
160 | 160 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
161 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
161 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
162 | 162 | print json_encode($result); |
163 | 163 | /* |
164 | 164 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -171,15 +171,15 @@ discard block |
||
171 | 171 | } else { |
172 | 172 | $_SESSION['install'] = 'sources'; |
173 | 173 | $_SESSION['next'] = 'Insert data in source table'; |
174 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
174 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
175 | 175 | print json_encode($result); |
176 | 176 | } |
177 | 177 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
178 | 178 | if (!is_writable('tmp')) { |
179 | 179 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
180 | 180 | $_SESSION['error'] = $error; |
181 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
181 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
182 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
183 | 183 | print json_encode($result); |
184 | 184 | } else { |
185 | 185 | include_once('class.update_db.php'); |
@@ -187,19 +187,19 @@ discard block |
||
187 | 187 | $error .= update_db::update_ModeS_fam(); |
188 | 188 | if ($error != '') { |
189 | 189 | $_SESSION['error'] = $error; |
190 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
190 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
191 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
192 | 192 | $_SESSION['install'] = 'populate_flarm'; |
193 | 193 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
194 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
195 | 195 | print json_encode($result); |
196 | 196 | } |
197 | 197 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
198 | 198 | if (!is_writable('tmp')) { |
199 | 199 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
200 | 200 | $_SESSION['error'] = $error; |
201 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
201 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
202 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
203 | 203 | print json_encode($result); |
204 | 204 | } else { |
205 | 205 | include_once('class.update_db.php'); |
@@ -208,8 +208,8 @@ discard block |
||
208 | 208 | $error .= update_db::update_ModeS_ogn(); |
209 | 209 | if ($error != '') { |
210 | 210 | $_SESSION['error'] = $error; |
211 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
211 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
212 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate aircraft_modes table with externals data for FLARM')); |
|
213 | 213 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 214 | $_SESSION['install'] = 'vatsim'; |
215 | 215 | if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
@@ -228,15 +228,15 @@ discard block |
||
228 | 228 | $_SESSION['install'] = 'routes'; |
229 | 229 | $_SESSION['next'] = 'Populate routes table with externals data'; |
230 | 230 | } |
231 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
231 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
232 | 232 | print json_encode($result); |
233 | 233 | } |
234 | 234 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
235 | 235 | if (!is_writable('tmp')) { |
236 | 236 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
237 | 237 | $_SESSION['error'] = $error; |
238 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
238 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate aircraft_modes table with externals data for ADS-B')); |
|
239 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
240 | 240 | print json_encode($result); |
241 | 241 | } else { |
242 | 242 | include_once('class.update_db.php'); |
@@ -244,19 +244,19 @@ discard block |
||
244 | 244 | $error .= update_db::update_routes_fam(); |
245 | 245 | if ($error != '') { |
246 | 246 | $_SESSION['error'] = $error; |
247 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
|
248 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
247 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate routes table with externals data')); |
|
248 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate routes table with externals data')); |
|
249 | 249 | $_SESSION['install'] = 'translation'; |
250 | 250 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
251 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
252 | 252 | print json_encode($result); |
253 | 253 | } |
254 | 254 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
255 | 255 | if (!is_writable('tmp')) { |
256 | 256 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
257 | 257 | $_SESSION['error'] = $error; |
258 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
259 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
258 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
259 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
260 | 260 | print json_encode($result); |
261 | 261 | } else { |
262 | 262 | include_once('class.update_db.php'); |
@@ -264,8 +264,8 @@ discard block |
||
264 | 264 | $error .= update_db::update_translation_fam(); |
265 | 265 | if ($error != '') { |
266 | 266 | $_SESSION['error'] = $error; |
267 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
|
268 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
267 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate translation table with externals data')); |
|
268 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate translation table with externals data')); |
|
269 | 269 | if ($_SESSION['waypoints'] == 1) { |
270 | 270 | $_SESSION['install'] = 'waypoints'; |
271 | 271 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -283,15 +283,15 @@ discard block |
||
283 | 283 | $_SESSION['install'] = 'sources'; |
284 | 284 | $_SESSION['next'] = 'Insert data in source table'; |
285 | 285 | } |
286 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
286 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
287 | 287 | print json_encode($result); |
288 | 288 | } |
289 | 289 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
290 | 290 | if (!is_writable('tmp')) { |
291 | 291 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
292 | 292 | $_SESSION['error'] = $error; |
293 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
294 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
293 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
294 | + $result = array('error' => $error, 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
295 | 295 | print json_encode($result); |
296 | 296 | } else { |
297 | 297 | include_once('class.update_db.php'); |
@@ -299,19 +299,19 @@ discard block |
||
299 | 299 | $error = update_db::update_owner_fam(); |
300 | 300 | if ($error != '') { |
301 | 301 | $_SESSION['error'] = $error; |
302 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
|
303 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
302 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate owner table with externals data')); |
|
303 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate owner table with externals data')); |
|
304 | 304 | $_SESSION['install'] = 'sources'; |
305 | 305 | $_SESSION['next'] = 'Insert data in source table'; |
306 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
306 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
307 | 307 | print json_encode($result); |
308 | 308 | } |
309 | 309 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
310 | 310 | if (!is_writable('tmp')) { |
311 | 311 | $error = 'The directory <i>install/tmp</i> must be writable.'; |
312 | 312 | $_SESSION['error'] = $error; |
313 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
314 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
313 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
314 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
315 | 315 | print json_encode($result); |
316 | 316 | } else { |
317 | 317 | include_once('class.update_db.php'); |
@@ -320,13 +320,13 @@ discard block |
||
320 | 320 | $error .= update_db::update_notam(); |
321 | 321 | if ($error != '') { |
322 | 322 | $_SESSION['error'] = $error; |
323 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
|
324 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
323 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data')); |
|
324 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data')); |
|
325 | 325 | } else { |
326 | 326 | if ($error != '') { |
327 | 327 | $_SESSION['error'] = $error; |
328 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
|
329 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
328 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Populate notam table with externals data (no source defined)')); |
|
329 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Populate notam table with externals data (no source defined)')); |
|
330 | 330 | } |
331 | 331 | /* |
332 | 332 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -339,7 +339,7 @@ discard block |
||
339 | 339 | */ |
340 | 340 | $_SESSION['install'] = 'sources'; |
341 | 341 | $_SESSION['next'] = 'Insert data in source table'; |
342 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
342 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
343 | 343 | print json_encode($result); |
344 | 344 | //} |
345 | 345 | } |
@@ -376,9 +376,9 @@ discard block |
||
376 | 376 | $Source = new Source(); |
377 | 377 | $Source->deleteAllLocation(); |
378 | 378 | foreach ($sources as $src) { |
379 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
379 | + if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'], $src['latitude'], $src['longitude'], $src['altitude'], $src['city'], $src['country'], $src['source'], 'antenna.png'); |
|
380 | 380 | } |
381 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
381 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert data in source table')); |
|
382 | 382 | unset($_SESSION['sources']); |
383 | 383 | } |
384 | 384 | /* |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | $_SESSION['install'] = 'finish'; |
404 | 404 | $_SESSION['next'] = 'finish'; |
405 | 405 | } |
406 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
406 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
407 | 407 | print json_encode($result); |
408 | 408 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'vatsim') { |
409 | 409 | include_once('../install/class.create_db.php'); |
@@ -415,48 +415,48 @@ discard block |
||
415 | 415 | $error .= update_db::update_IVAO(); |
416 | 416 | if ($error != '') { |
417 | 417 | $_SESSION['error'] = $error; |
418 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
418 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
419 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
420 | 420 | } else { |
421 | 421 | $error .= update_db::update_vatsim(); |
422 | 422 | if ($error != '') { |
423 | 423 | $_SESSION['error'] = $error; |
424 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
424 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
425 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
426 | 426 | } |
427 | 427 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 428 | $error .= update_db::update_vatsim(); |
429 | 429 | if ($error != '') { |
430 | 430 | $_SESSION['error'] = $error; |
431 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
|
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
431 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data')); |
|
432 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data')); |
|
433 | 433 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 434 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 435 | $error .= update_db::update_IVAO(); |
436 | 436 | if ($error != '') { |
437 | 437 | $_SESSION['error'] = $error; |
438 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
|
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
438 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert IVAO data')); |
|
439 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert IVAO data')); |
|
440 | 440 | } else { |
441 | 441 | $error .= update_db::update_vatsim(); |
442 | 442 | if ($error != '') { |
443 | 443 | $_SESSION['error'] = $error; |
444 | - $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
|
445 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
444 | + $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'], array('Insert VATSIM data (IVAO not found)')); |
|
445 | + } else $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert VATSIM data (IVAO not found)')); |
|
446 | 446 | } |
447 | 447 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
|
448 | + $_SESSION['done'] = array_merge($_SESSION['done'], array('Insert phpVMS data')); |
|
449 | 449 | } |
450 | 450 | //$_SESSION['install'] = 'routes'; |
451 | 451 | //$_SESSION['next'] = 'Populate routes table with externals data'; |
452 | 452 | $_SESSION['install'] = 'finish'; |
453 | 453 | $_SESSION['next'] = 'finish'; |
454 | - $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
454 | + $result = array('error' => $error, 'errorlst' => $_SESSION['errorlst'], 'done' => $_SESSION['done'], 'next' => $_SESSION['next'], 'install' => $_SESSION['install']); |
|
455 | 455 | print json_encode($result); |
456 | 456 | } else { |
457 | 457 | //unset($_SESSION['install']); |
458 | 458 | $_SESSION['error'] = 'Unknwon task : '.$_SESSION['install']; |
459 | - $result = array('error' => 'Unknwon task : '.$_SESSION['install'],'done' => $_SESSION['done'],'next' => 'finish','install' => 'finish'); |
|
459 | + $result = array('error' => 'Unknwon task : '.$_SESSION['install'], 'done' => $_SESSION['done'], 'next' => 'finish', 'install' => 'finish'); |
|
460 | 460 | print json_encode($result); |
461 | 461 | } |
462 | 462 | ?> |
463 | 463 | \ No newline at end of file |
@@ -75,7 +75,9 @@ discard block |
||
75 | 75 | if ($error != '') { |
76 | 76 | $_SESSION['error'] = $error; |
77 | 77 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create database')); |
78 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
78 | + } else { |
|
79 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Create database')); |
|
80 | + } |
|
79 | 81 | $_SESSION['install'] = 'database_import'; |
80 | 82 | $_SESSION['next'] = 'Create and import tables'; |
81 | 83 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -93,7 +95,9 @@ discard block |
||
93 | 95 | if ($error != '') { |
94 | 96 | $_SESSION['error'] = $error; |
95 | 97 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
96 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
98 | + } else { |
|
99 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
|
100 | + } |
|
97 | 101 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
98 | 102 | $_SESSION['install'] = 'populate'; |
99 | 103 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
@@ -107,7 +111,9 @@ discard block |
||
107 | 111 | $error .= $check_version; |
108 | 112 | $_SESSION['error'] = $error; |
109 | 113 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Create and import tables')); |
110 | - if (!isset($_SESSION['next'])) $_SESSION['next'] = ''; |
|
114 | + if (!isset($_SESSION['next'])) { |
|
115 | + $_SESSION['next'] = ''; |
|
116 | + } |
|
111 | 117 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
112 | 118 | print json_encode($result); |
113 | 119 | } else { |
@@ -115,7 +121,9 @@ discard block |
||
115 | 121 | if ($error != '') { |
116 | 122 | $_SESSION['error'] = $error; |
117 | 123 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Update schema if needed')); |
118 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
124 | + } else { |
|
125 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
|
126 | + } |
|
119 | 127 | $_SESSION['install'] = 'sources'; |
120 | 128 | $_SESSION['next'] = 'Insert data in source table'; |
121 | 129 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -128,8 +136,10 @@ discard block |
||
128 | 136 | if ($error != '') { |
129 | 137 | $_SESSION['error'] = $error; |
130 | 138 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate waypoints database')); |
131 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
132 | -/* |
|
139 | + } else { |
|
140 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate waypoints database')); |
|
141 | + } |
|
142 | + /* |
|
133 | 143 | $_SESSION['install'] = 'airspace'; |
134 | 144 | $_SESSION['next'] = 'Populate airspace table'; |
135 | 145 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -154,7 +164,9 @@ discard block |
||
154 | 164 | if ($error != '') { |
155 | 165 | $_SESSION['error'] = $error; |
156 | 166 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate countries database')); |
157 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
167 | + } else { |
|
168 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
|
169 | + } |
|
158 | 170 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
159 | 171 | $_SESSION['install'] = 'notam'; |
160 | 172 | $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
@@ -188,7 +200,9 @@ discard block |
||
188 | 200 | if ($error != '') { |
189 | 201 | $_SESSION['error'] = $error; |
190 | 202 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for ADS-B')); |
191 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
203 | + } else { |
|
204 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for ADS-B')); |
|
205 | + } |
|
192 | 206 | $_SESSION['install'] = 'populate_flarm'; |
193 | 207 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for FLARM'; |
194 | 208 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -209,18 +223,26 @@ discard block |
||
209 | 223 | if ($error != '') { |
210 | 224 | $_SESSION['error'] = $error; |
211 | 225 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate aircraft_modes table with externals data for FLARM')); |
212 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
226 | + } else { |
|
227 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate aircraft_modes table with externals data for FLARM')); |
|
228 | + } |
|
213 | 229 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
214 | 230 | $_SESSION['install'] = 'vatsim'; |
215 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
216 | - else $_SESSION['next'] = 'Insert VATSIM data'; |
|
231 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
232 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
233 | + } else { |
|
234 | + $_SESSION['next'] = 'Insert VATSIM data'; |
|
235 | + } |
|
217 | 236 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
218 | 237 | $_SESSION['install'] = 'vatsim'; |
219 | 238 | $_SESSION['next'] = 'Insert VATSIM data'; |
220 | 239 | } elseif (isset($globalIVAO) && $globalIVAO) { |
221 | 240 | $_SESSION['install'] = 'vatsim'; |
222 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
223 | - else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
241 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
242 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
243 | + } else { |
|
244 | + $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
245 | + } |
|
224 | 246 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
225 | 247 | $_SESSION['install'] = 'vatsim'; |
226 | 248 | $_SESSION['next'] = 'Insert phpVMS data'; |
@@ -245,7 +267,9 @@ discard block |
||
245 | 267 | if ($error != '') { |
246 | 268 | $_SESSION['error'] = $error; |
247 | 269 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate routes table with externals data')); |
248 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
270 | + } else { |
|
271 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate routes table with externals data')); |
|
272 | + } |
|
249 | 273 | $_SESSION['install'] = 'translation'; |
250 | 274 | $_SESSION['next'] = 'Populate translation table with externals data'; |
251 | 275 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -265,7 +289,9 @@ discard block |
||
265 | 289 | if ($error != '') { |
266 | 290 | $_SESSION['error'] = $error; |
267 | 291 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate translation table with externals data')); |
268 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
292 | + } else { |
|
293 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate translation table with externals data')); |
|
294 | + } |
|
269 | 295 | if ($_SESSION['waypoints'] == 1) { |
270 | 296 | $_SESSION['install'] = 'waypoints'; |
271 | 297 | $_SESSION['next'] = 'Populate waypoints table'; |
@@ -300,7 +326,9 @@ discard block |
||
300 | 326 | if ($error != '') { |
301 | 327 | $_SESSION['error'] = $error; |
302 | 328 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate owner table with externals data')); |
303 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
329 | + } else { |
|
330 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate owner table with externals data')); |
|
331 | + } |
|
304 | 332 | $_SESSION['install'] = 'sources'; |
305 | 333 | $_SESSION['next'] = 'Insert data in source table'; |
306 | 334 | $result = array('error' => $error,'errorlst' => $_SESSION['errorlst'],'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
@@ -321,12 +349,16 @@ discard block |
||
321 | 349 | if ($error != '') { |
322 | 350 | $_SESSION['error'] = $error; |
323 | 351 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data')); |
324 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
352 | + } else { |
|
353 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data')); |
|
354 | + } |
|
325 | 355 | } else { |
326 | 356 | if ($error != '') { |
327 | 357 | $_SESSION['error'] = $error; |
328 | 358 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Populate notam table with externals data (no source defined)')); |
329 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
359 | + } else { |
|
360 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate notam table with externals data (no source defined)')); |
|
361 | + } |
|
330 | 362 | } |
331 | 363 | /* |
332 | 364 | if (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
@@ -376,7 +408,9 @@ discard block |
||
376 | 408 | $Source = new Source(); |
377 | 409 | $Source->deleteAllLocation(); |
378 | 410 | foreach ($sources as $src) { |
379 | - if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
411 | + if (isset($src['latitude']) && $src['latitude'] != '') { |
|
412 | + $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
|
413 | + } |
|
380 | 414 | } |
381 | 415 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
382 | 416 | unset($_SESSION['sources']); |
@@ -387,15 +421,21 @@ discard block |
||
387 | 421 | */ |
388 | 422 | if ((isset($globalVATSIM) && $globalVATSIM) && (isset($globalIVAO) && $globalIVAO)) { |
389 | 423 | $_SESSION['install'] = 'vatsim'; |
390 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
391 | - else $_SESSION['next'] = 'Insert VATSIM data'; |
|
424 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
425 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
426 | + } else { |
|
427 | + $_SESSION['next'] = 'Insert VATSIM data'; |
|
428 | + } |
|
392 | 429 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
393 | 430 | $_SESSION['install'] = 'vatsim'; |
394 | 431 | $_SESSION['next'] = 'Insert VATSIM data'; |
395 | 432 | } elseif (isset($globalIVAO) && $globalIVAO) { |
396 | 433 | $_SESSION['install'] = 'vatsim'; |
397 | - if (file_exists('tmp/ivae_feb2013.zip')) $_SESSION['next'] = 'Insert IVAO data'; |
|
398 | - else $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
434 | + if (file_exists('tmp/ivae_feb2013.zip')) { |
|
435 | + $_SESSION['next'] = 'Insert IVAO data'; |
|
436 | + } else { |
|
437 | + $_SESSION['next'] = 'Insert VATSIM data (IVAO not found)'; |
|
438 | + } |
|
399 | 439 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
400 | 440 | $_SESSION['install'] = 'vatsim'; |
401 | 441 | $_SESSION['next'] = 'Insert phpVMS data'; |
@@ -416,33 +456,43 @@ discard block |
||
416 | 456 | if ($error != '') { |
417 | 457 | $_SESSION['error'] = $error; |
418 | 458 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
419 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
459 | + } else { |
|
460 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
461 | + } |
|
420 | 462 | } else { |
421 | 463 | $error .= update_db::update_vatsim(); |
422 | 464 | if ($error != '') { |
423 | 465 | $_SESSION['error'] = $error; |
424 | 466 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
425 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
467 | + } else { |
|
468 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
469 | + } |
|
426 | 470 | } |
427 | 471 | } elseif (isset($globalVATSIM) && $globalVATSIM) { |
428 | 472 | $error .= update_db::update_vatsim(); |
429 | 473 | if ($error != '') { |
430 | 474 | $_SESSION['error'] = $error; |
431 | 475 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data')); |
432 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
476 | + } else { |
|
477 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data')); |
|
478 | + } |
|
433 | 479 | } elseif (isset($globalIVAO) && $globalIVAO) { |
434 | 480 | if (file_exists('tmp/ivae_feb2013.zip')) { |
435 | 481 | $error .= update_db::update_IVAO(); |
436 | 482 | if ($error != '') { |
437 | 483 | $_SESSION['error'] = $error; |
438 | 484 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert IVAO data')); |
439 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
485 | + } else { |
|
486 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert IVAO data')); |
|
487 | + } |
|
440 | 488 | } else { |
441 | 489 | $error .= update_db::update_vatsim(); |
442 | 490 | if ($error != '') { |
443 | 491 | $_SESSION['error'] = $error; |
444 | 492 | $_SESSION['errorlst'] = array_merge($_SESSION['errorlst'],array('Insert VATSIM data (IVAO not found)')); |
445 | - } else $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
493 | + } else { |
|
494 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert VATSIM data (IVAO not found)')); |
|
495 | + } |
|
446 | 496 | } |
447 | 497 | } elseif (isset($globalphpVMS) && $globalphpVMS) { |
448 | 498 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert phpVMS data')); |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | <p> |
189 | 189 | <label for="siteurl">Site directory</label> |
190 | 190 | <?php |
191 | - // Try to detect site directory |
|
192 | - if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
191 | + // Try to detect site directory |
|
192 | + if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
|
193 | 193 | if (isset($_SERVER['REQUEST_URI'])) { |
194 | 194 | $URL = $_SERVER['REQUEST_URI']; |
195 | 195 | $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
196 | 196 | } |
197 | - } |
|
197 | + } |
|
198 | 198 | ?> |
199 | 199 | <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
200 | 200 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
@@ -373,17 +373,17 @@ discard block |
||
373 | 373 | </tr> |
374 | 374 | |
375 | 375 | <?php |
376 | - if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
376 | + if (isset($globalDBuser) && isset($globalDBpass) && $globalDBuser != '' && $globalDBpass != '') { |
|
377 | 377 | ?> |
378 | 378 | <!-- |
379 | 379 | <?php |
380 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | - $Connection = new Connection(); |
|
380 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
381 | + $Connection = new Connection(); |
|
382 | 382 | ?> |
383 | 383 | --> |
384 | 384 | <?php |
385 | 385 | if ($Connection->db != NULL) { |
386 | - if ($Connection->tableExists('source_location')) { |
|
386 | + if ($Connection->tableExists('source_location')) { |
|
387 | 387 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
388 | 388 | $Source = new Source(); |
389 | 389 | //$alllocations = $Source->getAllLocationInfo(); |
@@ -403,9 +403,9 @@ discard block |
||
403 | 403 | |
404 | 404 | <?php |
405 | 405 | } |
406 | - } |
|
406 | + } |
|
407 | + } |
|
407 | 408 | } |
408 | - } |
|
409 | 409 | ?> |
410 | 410 | |
411 | 411 | <tr> |
@@ -515,12 +515,12 @@ discard block |
||
515 | 515 | ?> |
516 | 516 | <tr> |
517 | 517 | <?php |
518 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
518 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
519 | 519 | ?> |
520 | 520 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
521 | 521 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
522 | 522 | <?php |
523 | - } else { |
|
523 | + } else { |
|
524 | 524 | $hostport = explode(':',$source['host']); |
525 | 525 | if (isset($hostport[1])) { |
526 | 526 | $host = $hostport[0]; |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
534 | 534 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php print $port; ?>" /></td> |
535 | 535 | <?php |
536 | - } |
|
536 | + } |
|
537 | 537 | ?> |
538 | 538 | <td> |
539 | 539 | <select name="format[]" id="format"> |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | </thead> |
674 | 674 | <tbody> |
675 | 675 | <?php |
676 | - if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
676 | + if (isset($globalNewsFeeds) && !empty($globalNewsFeeds)) { |
|
677 | 677 | foreach ($globalNewsFeeds as $type => $feedslng) { |
678 | - foreach ($feedslng as $lng => $feeds) { |
|
678 | + foreach ($feedslng as $lng => $feeds) { |
|
679 | 679 | foreach ($feeds as $feed) { |
680 | 680 | ?> |
681 | 681 | <tr> |
@@ -700,9 +700,9 @@ discard block |
||
700 | 700 | |
701 | 701 | <?php |
702 | 702 | } |
703 | - } |
|
703 | + } |
|
704 | + } |
|
704 | 705 | } |
705 | - } |
|
706 | 706 | ?> |
707 | 707 | <tr> |
708 | 708 | <td><input type="url" name="newsurl[]" /></td> |
@@ -1092,7 +1092,7 @@ discard block |
||
1092 | 1092 | <br /> |
1093 | 1093 | <p> |
1094 | 1094 | <?php |
1095 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1095 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
1096 | 1096 | ?> |
1097 | 1097 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1098 | 1098 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -1102,11 +1102,11 @@ discard block |
||
1102 | 1102 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
1103 | 1103 | <?php |
1104 | 1104 | } |
1105 | - } else { |
|
1105 | + } else { |
|
1106 | 1106 | ?> |
1107 | 1107 | <b>PHP GD is not installed, you can't change color of aircraft icon on map</b> |
1108 | 1108 | <?php |
1109 | - } |
|
1109 | + } |
|
1110 | 1110 | ?> |
1111 | 1111 | </p> |
1112 | 1112 | <br /> |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | </p> |
1131 | 1131 | <?php |
1132 | 1132 | require('../footer.php'); |
1133 | - exit; |
|
1133 | + exit; |
|
1134 | 1134 | } |
1135 | 1135 | // ' |
1136 | 1136 | $settings = array(); |
@@ -1221,8 +1221,8 @@ discard block |
||
1221 | 1221 | |
1222 | 1222 | $sources = array(); |
1223 | 1223 | foreach ($source_name as $keys => $name) { |
1224 | - 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]); |
|
1225 | - 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]); |
|
1224 | + 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]); |
|
1225 | + 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]); |
|
1226 | 1226 | } |
1227 | 1227 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1228 | 1228 | |
@@ -1232,13 +1232,13 @@ discard block |
||
1232 | 1232 | |
1233 | 1233 | $newsfeeds = array(); |
1234 | 1234 | foreach($newsurl as $newskey => $url) { |
1235 | - if ($url != '') { |
|
1235 | + if ($url != '') { |
|
1236 | 1236 | $type = $newstype[$newskey]; |
1237 | 1237 | $lng = $newslng[$newskey]; |
1238 | 1238 | if (isset($newsfeeds[$type][$lng])) { |
1239 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1239 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1240 | 1240 | } else $newsfeeds[$type][$lng] = array($url); |
1241 | - } |
|
1241 | + } |
|
1242 | 1242 | } |
1243 | 1243 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
1244 | 1244 | |
@@ -1681,14 +1681,14 @@ discard block |
||
1681 | 1681 | |
1682 | 1682 | // Set some defaults values... |
1683 | 1683 | if (!isset($globalAircraftImageSources)) { |
1684 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1684 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1685 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1686 | 1686 | } |
1687 | 1687 | |
1688 | 1688 | if (!isset($globalSchedulesSources)) { |
1689 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | - } |
|
1689 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1690 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1691 | + } |
|
1692 | 1692 | |
1693 | 1693 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1694 | 1694 | |
@@ -1736,21 +1736,21 @@ discard block |
||
1736 | 1736 | $popi = false; |
1737 | 1737 | $popw = false; |
1738 | 1738 | foreach ($_SESSION['done'] as $done) { |
1739 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | - if ($done == 'Create database') $pop = true; |
|
1741 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1739 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1740 | + if ($done == 'Create database') $pop = true; |
|
1741 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1742 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1743 | + if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
1744 | 1744 | } |
1745 | 1745 | if ($pop) { |
1746 | - sleep(5); |
|
1747 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1746 | + sleep(5); |
|
1747 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
1748 | 1748 | } else if ($popi) { |
1749 | - sleep(5); |
|
1750 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1749 | + sleep(5); |
|
1750 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
1751 | 1751 | } else if ($popw) { |
1752 | - sleep(5); |
|
1753 | - print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1752 | + sleep(5); |
|
1753 | + print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
|
1754 | 1754 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
1755 | 1755 | print '</div></ul>'; |
1756 | 1756 | print '<div id="error"></div>'; |
@@ -1816,7 +1816,7 @@ discard block |
||
1816 | 1816 | unset($_COOKIE['install']); |
1817 | 1817 | print '<div class="info column"><ul>'; |
1818 | 1818 | foreach ($_SESSION['done'] as $done) { |
1819 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1819 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
1820 | 1820 | } |
1821 | 1821 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
1822 | 1822 | print '</ul></div>'; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | require_once(dirname(__FILE__).'/class.create_db.php'); |
23 | 23 | require_once(dirname(__FILE__).'/class.update_schema.php'); |
24 | 24 | require_once(dirname(__FILE__).'/class.settings.php'); |
25 | -$title="Install"; |
|
25 | +$title = "Install"; |
|
26 | 26 | require(dirname(__FILE__).'/../require/settings.php'); |
27 | 27 | require_once(dirname(__FILE__).'/../require/class.Common.php'); |
28 | 28 | require(dirname(__FILE__).'/header.php'); |
@@ -93,8 +93,8 @@ discard block |
||
93 | 93 | if (!extension_loaded('curl')) { |
94 | 94 | $error[] = "Curl is not loaded."; |
95 | 95 | } |
96 | - if(function_exists('apache_get_modules') ){ |
|
97 | - if(!in_array('mod_rewrite',apache_get_modules())) { |
|
96 | + if (function_exists('apache_get_modules')) { |
|
97 | + if (!in_array('mod_rewrite', apache_get_modules())) { |
|
98 | 98 | $error[] = "mod_rewrite is not available."; |
99 | 99 | } |
100 | 100 | /* |
@@ -113,22 +113,22 @@ discard block |
||
113 | 113 | $alllng = $Language->listLocaleDir(); |
114 | 114 | if (count($alllng) != count($availablelng)) { |
115 | 115 | $notavailable = array(); |
116 | - foreach($alllng as $lng) { |
|
116 | + foreach ($alllng as $lng) { |
|
117 | 117 | if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
118 | 118 | } |
119 | - print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
119 | + print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ', $notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
|
120 | 120 | } |
121 | 121 | } |
122 | 122 | print '<div class="alert alert-info">If you use MySQL or MariaDB, check that <i>max_allowed_packet</i> >= 8M, else import of some tables can fail.</div>'; |
123 | 123 | if (isset($_SERVER['REQUEST_SCHEME']) && isset($_SERVER['SERVER_NAME']) && isset($_SERVER['SERVER_PORT']) && isset($_SERVER['REQUEST_URI'])) { |
124 | 124 | if (function_exists('get_headers')) { |
125 | 125 | //$check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
126 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'live/geojson?test',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
127 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
126 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'live/geojson?test', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
127 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
128 | 128 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
129 | 129 | } else { |
130 | - $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/','install'),'search',str_replace('index.php','',$_SERVER["REQUEST_URI"]))); |
|
131 | - if (isset($check_header[0]) && !stripos($check_header[0],"200 OK")) { |
|
130 | + $check_header = @get_headers($_SERVER['REQUEST_SCHEME'].'://'.$_SERVER["SERVER_NAME"].':'.$_SERVER["SERVER_PORT"].str_replace(array('install/', 'install'), 'search', str_replace('index.php', '', $_SERVER["REQUEST_URI"]))); |
|
131 | + if (isset($check_header[0]) && !stripos($check_header[0], "200 OK")) { |
|
132 | 132 | print '<div class="alert alert-danger"><strong>Error</strong> Check your configuration, rewrite don\'t seems to work well. If using Apache, you need to desactivate MultiViews <a href="https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration">https://github.com/Ysurac/FlightAirMap/wiki/Apache-configuration</a></div>'; |
133 | 133 | } |
134 | 134 | } |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | if ((!isset($globalURL) || $globalURL == '') && (!isset($globalDBuser) || $globalDBuser == '')) { |
209 | 209 | if (isset($_SERVER['REQUEST_URI'])) { |
210 | 210 | $URL = $_SERVER['REQUEST_URI']; |
211 | - $globalURL = str_replace('/install','',str_replace('/install/','',str_replace('/install/index.php','',$URL))); |
|
211 | + $globalURL = str_replace('/install', '', str_replace('/install/', '', str_replace('/install/index.php', '', $URL))); |
|
212 | 212 | } |
213 | 213 | } |
214 | 214 | ?> |
@@ -531,13 +531,13 @@ discard block |
||
531 | 531 | ?> |
532 | 532 | <tr> |
533 | 533 | <?php |
534 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
534 | + if (filter_var($source['host'], FILTER_VALIDATE_URL)) { |
|
535 | 535 | ?> |
536 | 536 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
537 | 537 | <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
538 | 538 | <?php |
539 | 539 | } else { |
540 | - $hostport = explode(':',$source['host']); |
|
540 | + $hostport = explode(':', $source['host']); |
|
541 | 541 | if (isset($hostport[1])) { |
542 | 542 | $host = $hostport[0]; |
543 | 543 | $port = $hostport[1]; |
@@ -587,7 +587,7 @@ discard block |
||
587 | 587 | <select name="timezones[]" id="timezones"> |
588 | 588 | <?php |
589 | 589 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
590 | - foreach($timezonelist as $timezones){ |
|
590 | + foreach ($timezonelist as $timezones) { |
|
591 | 591 | if (isset($source['timezone']) && $source['timezone'] == $timezones) { |
592 | 592 | print '<option selected>'.$timezones.'</option>'; |
593 | 593 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
@@ -642,7 +642,7 @@ discard block |
||
642 | 642 | <select name="timezones[]" id="timezones"> |
643 | 643 | <?php |
644 | 644 | $timezonelist = DateTimeZone::listIdentifiers(DateTimeZone::ALL); |
645 | - foreach($timezonelist as $timezones){ |
|
645 | + foreach ($timezonelist as $timezones) { |
|
646 | 646 | if ($timezones == 'UTC') { |
647 | 647 | print '<option selected>'.$timezones.'</option>'; |
648 | 648 | } else print '<option>'.$timezones.'</option>'; |
@@ -1105,7 +1105,7 @@ discard block |
||
1105 | 1105 | <br /> |
1106 | 1106 | <p> |
1107 | 1107 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1108 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1108 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize; ?>" /> |
|
1109 | 1109 | </p> |
1110 | 1110 | <br /> |
1111 | 1111 | <p> |
@@ -1167,14 +1167,14 @@ discard block |
||
1167 | 1167 | $error = ''; |
1168 | 1168 | |
1169 | 1169 | if (isset($_POST['dbtype'])) { |
1170 | - $dbtype = filter_input(INPUT_POST,'dbtype',FILTER_SANITIZE_STRING); |
|
1171 | - $dbroot = filter_input(INPUT_POST,'dbroot',FILTER_SANITIZE_STRING); |
|
1172 | - $dbrootpass = filter_input(INPUT_POST,'dbrootpass',FILTER_SANITIZE_STRING); |
|
1173 | - $dbname = filter_input(INPUT_POST,'dbname',FILTER_SANITIZE_STRING); |
|
1174 | - $dbuser = filter_input(INPUT_POST,'dbuser',FILTER_SANITIZE_STRING); |
|
1175 | - $dbuserpass = filter_input(INPUT_POST,'dbuserpass',FILTER_SANITIZE_STRING); |
|
1176 | - $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
|
1177 | - $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
|
1170 | + $dbtype = filter_input(INPUT_POST, 'dbtype', FILTER_SANITIZE_STRING); |
|
1171 | + $dbroot = filter_input(INPUT_POST, 'dbroot', FILTER_SANITIZE_STRING); |
|
1172 | + $dbrootpass = filter_input(INPUT_POST, 'dbrootpass', FILTER_SANITIZE_STRING); |
|
1173 | + $dbname = filter_input(INPUT_POST, 'dbname', FILTER_SANITIZE_STRING); |
|
1174 | + $dbuser = filter_input(INPUT_POST, 'dbuser', FILTER_SANITIZE_STRING); |
|
1175 | + $dbuserpass = filter_input(INPUT_POST, 'dbuserpass', FILTER_SANITIZE_STRING); |
|
1176 | + $dbhost = filter_input(INPUT_POST, 'dbhost', FILTER_SANITIZE_STRING); |
|
1177 | + $dbport = filter_input(INPUT_POST, 'dbport', FILTER_SANITIZE_STRING); |
|
1178 | 1178 | |
1179 | 1179 | if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
1180 | 1180 | if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
@@ -1194,49 +1194,49 @@ discard block |
||
1194 | 1194 | } else $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
1195 | 1195 | */ |
1196 | 1196 | |
1197 | - $settings = array_merge($settings,array('globalDBdriver' => $dbtype,'globalDBhost' => $dbhost,'globalDBuser' => $dbuser,'globalDBport' => $dbport,'globalDBpass' => $dbuserpass,'globalDBname' => $dbname)); |
|
1197 | + $settings = array_merge($settings, array('globalDBdriver' => $dbtype, 'globalDBhost' => $dbhost, 'globalDBuser' => $dbuser, 'globalDBport' => $dbport, 'globalDBpass' => $dbuserpass, 'globalDBname' => $dbname)); |
|
1198 | 1198 | |
1199 | - $sitename = filter_input(INPUT_POST,'sitename',FILTER_SANITIZE_STRING); |
|
1200 | - $siteurl = filter_input(INPUT_POST,'siteurl',FILTER_SANITIZE_STRING); |
|
1201 | - $timezone = filter_input(INPUT_POST,'timezone',FILTER_SANITIZE_STRING); |
|
1202 | - $language = filter_input(INPUT_POST,'language',FILTER_SANITIZE_STRING); |
|
1203 | - $settings = array_merge($settings,array('globalName' => $sitename,'globalURL' => $siteurl, 'globalTimezone' => $timezone,'globalLanguage' => $language)); |
|
1199 | + $sitename = filter_input(INPUT_POST, 'sitename', FILTER_SANITIZE_STRING); |
|
1200 | + $siteurl = filter_input(INPUT_POST, 'siteurl', FILTER_SANITIZE_STRING); |
|
1201 | + $timezone = filter_input(INPUT_POST, 'timezone', FILTER_SANITIZE_STRING); |
|
1202 | + $language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING); |
|
1203 | + $settings = array_merge($settings, array('globalName' => $sitename, 'globalURL' => $siteurl, 'globalTimezone' => $timezone, 'globalLanguage' => $language)); |
|
1204 | 1204 | |
1205 | - $mapprovider = filter_input(INPUT_POST,'mapprovider',FILTER_SANITIZE_STRING); |
|
1206 | - $mapboxid = filter_input(INPUT_POST,'mapboxid',FILTER_SANITIZE_STRING); |
|
1207 | - $mapboxtoken = filter_input(INPUT_POST,'mapboxtoken',FILTER_SANITIZE_STRING); |
|
1208 | - $googlekey = filter_input(INPUT_POST,'googlekey',FILTER_SANITIZE_STRING); |
|
1209 | - $bingkey = filter_input(INPUT_POST,'bingkey',FILTER_SANITIZE_STRING); |
|
1210 | - $openweathermapkey = filter_input(INPUT_POST,'openweathermapkey',FILTER_SANITIZE_STRING); |
|
1211 | - $mapquestkey = filter_input(INPUT_POST,'mapquestkey',FILTER_SANITIZE_STRING); |
|
1212 | - $hereappid = filter_input(INPUT_POST,'hereappid',FILTER_SANITIZE_STRING); |
|
1213 | - $hereappcode = filter_input(INPUT_POST,'hereappcode',FILTER_SANITIZE_STRING); |
|
1214 | - $settings = array_merge($settings,array('globalMapProvider' => $mapprovider,'globalMapboxId' => $mapboxid,'globalMapboxToken' => $mapboxtoken,'globalGoogleAPIKey' => $googlekey,'globalBingMapKey' => $bingkey,'globalHereappID' => $hereappid,'globalHereappCode' => $hereappcode,'globalMapQuestKey' => $mapquestkey,'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1205 | + $mapprovider = filter_input(INPUT_POST, 'mapprovider', FILTER_SANITIZE_STRING); |
|
1206 | + $mapboxid = filter_input(INPUT_POST, 'mapboxid', FILTER_SANITIZE_STRING); |
|
1207 | + $mapboxtoken = filter_input(INPUT_POST, 'mapboxtoken', FILTER_SANITIZE_STRING); |
|
1208 | + $googlekey = filter_input(INPUT_POST, 'googlekey', FILTER_SANITIZE_STRING); |
|
1209 | + $bingkey = filter_input(INPUT_POST, 'bingkey', FILTER_SANITIZE_STRING); |
|
1210 | + $openweathermapkey = filter_input(INPUT_POST, 'openweathermapkey', FILTER_SANITIZE_STRING); |
|
1211 | + $mapquestkey = filter_input(INPUT_POST, 'mapquestkey', FILTER_SANITIZE_STRING); |
|
1212 | + $hereappid = filter_input(INPUT_POST, 'hereappid', FILTER_SANITIZE_STRING); |
|
1213 | + $hereappcode = filter_input(INPUT_POST, 'hereappcode', FILTER_SANITIZE_STRING); |
|
1214 | + $settings = array_merge($settings, array('globalMapProvider' => $mapprovider, 'globalMapboxId' => $mapboxid, 'globalMapboxToken' => $mapboxtoken, 'globalGoogleAPIKey' => $googlekey, 'globalBingMapKey' => $bingkey, 'globalHereappID' => $hereappid, 'globalHereappCode' => $hereappcode, 'globalMapQuestKey' => $mapquestkey, 'globalOpenWeatherMapKey' => $openweathermapkey)); |
|
1215 | 1215 | |
1216 | - $latitudemax = filter_input(INPUT_POST,'latitudemax',FILTER_SANITIZE_STRING); |
|
1217 | - $latitudemin = filter_input(INPUT_POST,'latitudemin',FILTER_SANITIZE_STRING); |
|
1218 | - $longitudemax = filter_input(INPUT_POST,'longitudemax',FILTER_SANITIZE_STRING); |
|
1219 | - $longitudemin = filter_input(INPUT_POST,'longitudemin',FILTER_SANITIZE_STRING); |
|
1220 | - $livezoom = filter_input(INPUT_POST,'livezoom',FILTER_SANITIZE_NUMBER_INT); |
|
1221 | - $settings = array_merge($settings,array('globalLatitudeMax' => $latitudemax,'globalLatitudeMin' => $latitudemin,'globalLongitudeMax' => $longitudemax,'globalLongitudeMin' => $longitudemin,'globalLiveZoom' => $livezoom)); |
|
1216 | + $latitudemax = filter_input(INPUT_POST, 'latitudemax', FILTER_SANITIZE_STRING); |
|
1217 | + $latitudemin = filter_input(INPUT_POST, 'latitudemin', FILTER_SANITIZE_STRING); |
|
1218 | + $longitudemax = filter_input(INPUT_POST, 'longitudemax', FILTER_SANITIZE_STRING); |
|
1219 | + $longitudemin = filter_input(INPUT_POST, 'longitudemin', FILTER_SANITIZE_STRING); |
|
1220 | + $livezoom = filter_input(INPUT_POST, 'livezoom', FILTER_SANITIZE_NUMBER_INT); |
|
1221 | + $settings = array_merge($settings, array('globalLatitudeMax' => $latitudemax, 'globalLatitudeMin' => $latitudemin, 'globalLongitudeMax' => $longitudemax, 'globalLongitudeMin' => $longitudemin, 'globalLiveZoom' => $livezoom)); |
|
1222 | 1222 | |
1223 | - $squawk_country = filter_input(INPUT_POST,'squawk_country',FILTER_SANITIZE_STRING); |
|
1224 | - $settings = array_merge($settings,array('globalSquawkCountry' => $squawk_country)); |
|
1223 | + $squawk_country = filter_input(INPUT_POST, 'squawk_country', FILTER_SANITIZE_STRING); |
|
1224 | + $settings = array_merge($settings, array('globalSquawkCountry' => $squawk_country)); |
|
1225 | 1225 | |
1226 | - $latitudecenter = filter_input(INPUT_POST,'latitudecenter',FILTER_SANITIZE_STRING); |
|
1227 | - $longitudecenter = filter_input(INPUT_POST,'longitudecenter',FILTER_SANITIZE_STRING); |
|
1228 | - $settings = array_merge($settings,array('globalCenterLatitude' => $latitudecenter,'globalCenterLongitude' => $longitudecenter)); |
|
1226 | + $latitudecenter = filter_input(INPUT_POST, 'latitudecenter', FILTER_SANITIZE_STRING); |
|
1227 | + $longitudecenter = filter_input(INPUT_POST, 'longitudecenter', FILTER_SANITIZE_STRING); |
|
1228 | + $settings = array_merge($settings, array('globalCenterLatitude' => $latitudecenter, 'globalCenterLongitude' => $longitudecenter)); |
|
1229 | 1229 | |
1230 | - $acars = filter_input(INPUT_POST,'acars',FILTER_SANITIZE_STRING); |
|
1230 | + $acars = filter_input(INPUT_POST, 'acars', FILTER_SANITIZE_STRING); |
|
1231 | 1231 | if ($acars == 'acars') { |
1232 | - $settings = array_merge($settings,array('globalACARS' => 'TRUE')); |
|
1232 | + $settings = array_merge($settings, array('globalACARS' => 'TRUE')); |
|
1233 | 1233 | } else { |
1234 | - $settings = array_merge($settings,array('globalACARS' => 'FALSE')); |
|
1234 | + $settings = array_merge($settings, array('globalACARS' => 'FALSE')); |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | - $flightawareusername = filter_input(INPUT_POST,'flightawareusername',FILTER_SANITIZE_STRING); |
|
1238 | - $flightawarepassword = filter_input(INPUT_POST,'flightawarepassword',FILTER_SANITIZE_STRING); |
|
1239 | - $settings = array_merge($settings,array('globalFlightAwareUsername' => $flightawareusername,'globalFlightAwarePassword' => $flightawarepassword)); |
|
1237 | + $flightawareusername = filter_input(INPUT_POST, 'flightawareusername', FILTER_SANITIZE_STRING); |
|
1238 | + $flightawarepassword = filter_input(INPUT_POST, 'flightawarepassword', FILTER_SANITIZE_STRING); |
|
1239 | + $settings = array_merge($settings, array('globalFlightAwareUsername' => $flightawareusername, 'globalFlightAwarePassword' => $flightawarepassword)); |
|
1240 | 1240 | |
1241 | 1241 | $source_name = $_POST['source_name']; |
1242 | 1242 | $source_latitude = $_POST['source_latitude']; |
@@ -1250,8 +1250,8 @@ discard block |
||
1250 | 1250 | |
1251 | 1251 | $sources = array(); |
1252 | 1252 | foreach ($source_name as $keys => $name) { |
1253 | - 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]); |
|
1254 | - 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]); |
|
1253 | + 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]); |
|
1254 | + 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]); |
|
1255 | 1255 | } |
1256 | 1256 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
1257 | 1257 | |
@@ -1260,16 +1260,16 @@ discard block |
||
1260 | 1260 | $newstype = $_POST['newstype']; |
1261 | 1261 | |
1262 | 1262 | $newsfeeds = array(); |
1263 | - foreach($newsurl as $newskey => $url) { |
|
1263 | + foreach ($newsurl as $newskey => $url) { |
|
1264 | 1264 | if ($url != '') { |
1265 | 1265 | $type = $newstype[$newskey]; |
1266 | 1266 | $lng = $newslng[$newskey]; |
1267 | 1267 | if (isset($newsfeeds[$type][$lng])) { |
1268 | - $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
|
1268 | + $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng], array($url)); |
|
1269 | 1269 | } else $newsfeeds[$type][$lng] = array($url); |
1270 | 1270 | } |
1271 | 1271 | } |
1272 | - $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
|
1272 | + $settings = array_merge($settings, array('globalNewsFeeds' => $newsfeeds)); |
|
1273 | 1273 | |
1274 | 1274 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
1275 | 1275 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -1280,27 +1280,27 @@ discard block |
||
1280 | 1280 | $sbsurl = $_POST['sbsurl']; |
1281 | 1281 | */ |
1282 | 1282 | |
1283 | - $globalvatsim = filter_input(INPUT_POST,'globalvatsim',FILTER_SANITIZE_STRING); |
|
1284 | - $globalva = filter_input(INPUT_POST,'globalva',FILTER_SANITIZE_STRING); |
|
1285 | - $globalivao = filter_input(INPUT_POST,'globalivao',FILTER_SANITIZE_STRING); |
|
1286 | - $globalphpvms = filter_input(INPUT_POST,'globalphpvms',FILTER_SANITIZE_STRING); |
|
1287 | - $globalvam = filter_input(INPUT_POST,'globalvam',FILTER_SANITIZE_STRING); |
|
1288 | - $globalsbs = filter_input(INPUT_POST,'globalsbs',FILTER_SANITIZE_STRING); |
|
1289 | - $globalaprs = filter_input(INPUT_POST,'globalaprs',FILTER_SANITIZE_STRING); |
|
1290 | - $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
|
1283 | + $globalvatsim = filter_input(INPUT_POST, 'globalvatsim', FILTER_SANITIZE_STRING); |
|
1284 | + $globalva = filter_input(INPUT_POST, 'globalva', FILTER_SANITIZE_STRING); |
|
1285 | + $globalivao = filter_input(INPUT_POST, 'globalivao', FILTER_SANITIZE_STRING); |
|
1286 | + $globalphpvms = filter_input(INPUT_POST, 'globalphpvms', FILTER_SANITIZE_STRING); |
|
1287 | + $globalvam = filter_input(INPUT_POST, 'globalvam', FILTER_SANITIZE_STRING); |
|
1288 | + $globalsbs = filter_input(INPUT_POST, 'globalsbs', FILTER_SANITIZE_STRING); |
|
1289 | + $globalaprs = filter_input(INPUT_POST, 'globalaprs', FILTER_SANITIZE_STRING); |
|
1290 | + $datasource = filter_input(INPUT_POST, 'datasource', FILTER_SANITIZE_STRING); |
|
1291 | 1291 | |
1292 | - $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
|
1293 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1294 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1295 | - $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
|
1296 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1297 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1298 | - $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
|
1299 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1300 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1301 | - $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
|
1302 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1303 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1292 | + $globalaircraft = filter_input(INPUT_POST, 'globalaircraft', FILTER_SANITIZE_STRING); |
|
1293 | + if ($globalaircraft == 'aircraft') $settings = array_merge($settings, array('globalAircraft' => 'TRUE')); |
|
1294 | + else $settings = array_merge($settings, array('globalAircraft' => 'FALSE')); |
|
1295 | + $globaltracker = filter_input(INPUT_POST, 'globaltracker', FILTER_SANITIZE_STRING); |
|
1296 | + if ($globaltracker == 'tracker') $settings = array_merge($settings, array('globalTracker' => 'TRUE')); |
|
1297 | + else $settings = array_merge($settings, array('globalTracker' => 'FALSE')); |
|
1298 | + $globalmarine = filter_input(INPUT_POST, 'globalmarine', FILTER_SANITIZE_STRING); |
|
1299 | + if ($globalmarine == 'marine') $settings = array_merge($settings, array('globalMarine' => 'TRUE')); |
|
1300 | + else $settings = array_merge($settings, array('globalMarine' => 'FALSE')); |
|
1301 | + $globalsatellite = filter_input(INPUT_POST, 'globalsatellite', FILTER_SANITIZE_STRING); |
|
1302 | + if ($globalsatellite == 'satellite') $settings = array_merge($settings, array('globalSatellite' => 'TRUE')); |
|
1303 | + else $settings = array_merge($settings, array('globalSatellite' => 'FALSE')); |
|
1304 | 1304 | |
1305 | 1305 | /* |
1306 | 1306 | $globalSBS1Hosts = array(); |
@@ -1316,7 +1316,7 @@ discard block |
||
1316 | 1316 | } |
1317 | 1317 | $settings = array_merge($settings,array('globalSBS1Hosts' => $globalSBS1Hosts)); |
1318 | 1318 | */ |
1319 | - $settings_comment = array_merge($settings_comment,array('globalSBS1Hosts')); |
|
1319 | + $settings_comment = array_merge($settings_comment, array('globalSBS1Hosts')); |
|
1320 | 1320 | $host = $_POST['host']; |
1321 | 1321 | $port = $_POST['port']; |
1322 | 1322 | $name = $_POST['name']; |
@@ -1333,115 +1333,115 @@ discard block |
||
1333 | 1333 | else $cov = 'FALSE'; |
1334 | 1334 | if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
1335 | 1335 | else $arch = 'FALSE'; |
1336 | - if (strpos($format[$key],'_callback')) { |
|
1337 | - $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
|
1336 | + if (strpos($format[$key], '_callback')) { |
|
1337 | + $gSources[] = array('host' => $h, 'pass' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'TRUE'); |
|
1338 | 1338 | } elseif ($h != '' || $name[$key] != '') { |
1339 | - $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
|
1339 | + $gSources[] = array('host' => $h, 'port' => $port[$key], 'name' => $name[$key], 'format' => $format[$key], 'sourcestats' => $cov, 'noarchive' => $arch, 'timezone' => $timezones[$key], 'callback' => 'FALSE'); |
|
1340 | 1340 | } |
1341 | 1341 | if ($format[$key] == 'airwhere') $forcepilots = true; |
1342 | 1342 | } |
1343 | - $settings = array_merge($settings,array('globalSources' => $gSources)); |
|
1343 | + $settings = array_merge($settings, array('globalSources' => $gSources)); |
|
1344 | 1344 | |
1345 | 1345 | /* |
1346 | 1346 | $sbstimeout = filter_input(INPUT_POST,'sbstimeout',FILTER_SANITIZE_NUMBER_INT); |
1347 | 1347 | $settings = array_merge($settings,array('globalSourcesTimeOut' => $sbstimeout)); |
1348 | 1348 | */ |
1349 | - $acarshost = filter_input(INPUT_POST,'acarshost',FILTER_SANITIZE_STRING); |
|
1350 | - $acarsport = filter_input(INPUT_POST,'acarsport',FILTER_SANITIZE_NUMBER_INT); |
|
1351 | - $settings = array_merge($settings,array('globalACARSHost' => $acarshost,'globalACARSPort' => $acarsport)); |
|
1349 | + $acarshost = filter_input(INPUT_POST, 'acarshost', FILTER_SANITIZE_STRING); |
|
1350 | + $acarsport = filter_input(INPUT_POST, 'acarsport', FILTER_SANITIZE_NUMBER_INT); |
|
1351 | + $settings = array_merge($settings, array('globalACARSHost' => $acarshost, 'globalACARSPort' => $acarsport)); |
|
1352 | 1352 | |
1353 | - $bitly = filter_input(INPUT_POST,'bitly',FILTER_SANITIZE_STRING); |
|
1354 | - $settings = array_merge($settings,array('globalBitlyAccessToken' => $bitly)); |
|
1353 | + $bitly = filter_input(INPUT_POST, 'bitly', FILTER_SANITIZE_STRING); |
|
1354 | + $settings = array_merge($settings, array('globalBitlyAccessToken' => $bitly)); |
|
1355 | 1355 | |
1356 | - $customcss = filter_input(INPUT_POST,'customcss',FILTER_SANITIZE_STRING); |
|
1357 | - $settings = array_merge($settings,array('globalCustomCSS' => $customcss)); |
|
1356 | + $customcss = filter_input(INPUT_POST, 'customcss', FILTER_SANITIZE_STRING); |
|
1357 | + $settings = array_merge($settings, array('globalCustomCSS' => $customcss)); |
|
1358 | 1358 | |
1359 | - $map3dtile = filter_input(INPUT_POST,'map3dtileset',FILTER_SANITIZE_STRING); |
|
1360 | - $settings = array_merge($settings,array('globalMap3DTiles' => $map3dtile)); |
|
1359 | + $map3dtile = filter_input(INPUT_POST, 'map3dtileset', FILTER_SANITIZE_STRING); |
|
1360 | + $settings = array_merge($settings, array('globalMap3DTiles' => $map3dtile)); |
|
1361 | 1361 | |
1362 | - $notamsource = filter_input(INPUT_POST,'notamsource',FILTER_SANITIZE_STRING); |
|
1363 | - $settings = array_merge($settings,array('globalNOTAMSource' => $notamsource)); |
|
1364 | - $metarsource = filter_input(INPUT_POST,'metarsource',FILTER_SANITIZE_STRING); |
|
1365 | - $settings = array_merge($settings,array('globalMETARurl' => $metarsource)); |
|
1362 | + $notamsource = filter_input(INPUT_POST, 'notamsource', FILTER_SANITIZE_STRING); |
|
1363 | + $settings = array_merge($settings, array('globalNOTAMSource' => $notamsource)); |
|
1364 | + $metarsource = filter_input(INPUT_POST, 'metarsource', FILTER_SANITIZE_STRING); |
|
1365 | + $settings = array_merge($settings, array('globalMETARurl' => $metarsource)); |
|
1366 | 1366 | |
1367 | - $zoilatitude = filter_input(INPUT_POST,'zoilatitude',FILTER_SANITIZE_STRING); |
|
1368 | - $zoilongitude = filter_input(INPUT_POST,'zoilongitude',FILTER_SANITIZE_STRING); |
|
1369 | - $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
|
1367 | + $zoilatitude = filter_input(INPUT_POST, 'zoilatitude', FILTER_SANITIZE_STRING); |
|
1368 | + $zoilongitude = filter_input(INPUT_POST, 'zoilongitude', FILTER_SANITIZE_STRING); |
|
1369 | + $zoidistance = filter_input(INPUT_POST, 'zoidistance', FILTER_SANITIZE_NUMBER_INT); |
|
1370 | 1370 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1371 | - $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
|
1372 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1371 | + $settings = array_merge($settings, array('globalDistanceIgnore' => array('latitude' => $zoilatitude, 'longitude' => $zoilongitude, 'distance' => $zoidistance))); |
|
1372 | + } else $settings = array_merge($settings, array('globalDistanceIgnore' => array())); |
|
1373 | 1373 | |
1374 | - $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
|
1375 | - $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
|
1376 | - $maprefresh = filter_input(INPUT_POST,'maprefresh',FILTER_SANITIZE_NUMBER_INT); |
|
1377 | - $settings = array_merge($settings,array('globalMapRefresh' => $maprefresh)); |
|
1378 | - $mapidle = filter_input(INPUT_POST,'mapidle',FILTER_SANITIZE_NUMBER_INT); |
|
1379 | - $settings = array_merge($settings,array('globalMapIdleTimeout' => $mapidle)); |
|
1380 | - $minfetch = filter_input(INPUT_POST,'minfetch',FILTER_SANITIZE_NUMBER_INT); |
|
1381 | - $settings = array_merge($settings,array('globalMinFetch' => $minfetch)); |
|
1382 | - $closestmindist = filter_input(INPUT_POST,'closestmindist',FILTER_SANITIZE_NUMBER_INT); |
|
1383 | - $settings = array_merge($settings,array('globalClosestMinDist' => $closestmindist)); |
|
1374 | + $refresh = filter_input(INPUT_POST, 'refresh', FILTER_SANITIZE_NUMBER_INT); |
|
1375 | + $settings = array_merge($settings, array('globalLiveInterval' => $refresh)); |
|
1376 | + $maprefresh = filter_input(INPUT_POST, 'maprefresh', FILTER_SANITIZE_NUMBER_INT); |
|
1377 | + $settings = array_merge($settings, array('globalMapRefresh' => $maprefresh)); |
|
1378 | + $mapidle = filter_input(INPUT_POST, 'mapidle', FILTER_SANITIZE_NUMBER_INT); |
|
1379 | + $settings = array_merge($settings, array('globalMapIdleTimeout' => $mapidle)); |
|
1380 | + $minfetch = filter_input(INPUT_POST, 'minfetch', FILTER_SANITIZE_NUMBER_INT); |
|
1381 | + $settings = array_merge($settings, array('globalMinFetch' => $minfetch)); |
|
1382 | + $closestmindist = filter_input(INPUT_POST, 'closestmindist', FILTER_SANITIZE_NUMBER_INT); |
|
1383 | + $settings = array_merge($settings, array('globalClosestMinDist' => $closestmindist)); |
|
1384 | 1384 | |
1385 | - $aircraftsize = filter_input(INPUT_POST,'aircraftsize',FILTER_SANITIZE_NUMBER_INT); |
|
1386 | - $settings = array_merge($settings,array('globalAircraftSize' => $aircraftsize)); |
|
1385 | + $aircraftsize = filter_input(INPUT_POST, 'aircraftsize', FILTER_SANITIZE_NUMBER_INT); |
|
1386 | + $settings = array_merge($settings, array('globalAircraftSize' => $aircraftsize)); |
|
1387 | 1387 | |
1388 | - $archivemonths = filter_input(INPUT_POST,'archivemonths',FILTER_SANITIZE_NUMBER_INT); |
|
1389 | - $settings = array_merge($settings,array('globalArchiveMonths' => $archivemonths)); |
|
1388 | + $archivemonths = filter_input(INPUT_POST, 'archivemonths', FILTER_SANITIZE_NUMBER_INT); |
|
1389 | + $settings = array_merge($settings, array('globalArchiveMonths' => $archivemonths)); |
|
1390 | 1390 | |
1391 | - $archiveyear = filter_input(INPUT_POST,'archiveyear',FILTER_SANITIZE_STRING); |
|
1391 | + $archiveyear = filter_input(INPUT_POST, 'archiveyear', FILTER_SANITIZE_STRING); |
|
1392 | 1392 | if ($archiveyear == "archiveyear") { |
1393 | - $settings = array_merge($settings,array('globalArchiveYear' => 'TRUE')); |
|
1393 | + $settings = array_merge($settings, array('globalArchiveYear' => 'TRUE')); |
|
1394 | 1394 | } else { |
1395 | - $settings = array_merge($settings,array('globalArchiveYear' => 'FALSE')); |
|
1395 | + $settings = array_merge($settings, array('globalArchiveYear' => 'FALSE')); |
|
1396 | 1396 | } |
1397 | - $archivekeepmonths = filter_input(INPUT_POST,'archivekeepmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1398 | - $settings = array_merge($settings,array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1399 | - $archivekeeptrackmonths = filter_input(INPUT_POST,'archivekeeptrackmonths',FILTER_SANITIZE_NUMBER_INT); |
|
1400 | - $settings = array_merge($settings,array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1397 | + $archivekeepmonths = filter_input(INPUT_POST, 'archivekeepmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1398 | + $settings = array_merge($settings, array('globalArchiveKeepMonths' => $archivekeepmonths)); |
|
1399 | + $archivekeeptrackmonths = filter_input(INPUT_POST, 'archivekeeptrackmonths', FILTER_SANITIZE_NUMBER_INT); |
|
1400 | + $settings = array_merge($settings, array('globalArchiveKeepTrackMonths' => $archivekeeptrackmonths)); |
|
1401 | 1401 | |
1402 | - $britishairways = filter_input(INPUT_POST,'britishairways',FILTER_SANITIZE_STRING); |
|
1403 | - $settings = array_merge($settings,array('globalBritishAirwaysKey' => $britishairways)); |
|
1404 | - $transavia = filter_input(INPUT_POST,'transavia',FILTER_SANITIZE_STRING); |
|
1405 | - $settings = array_merge($settings,array('globalTransaviaKey' => $transavia)); |
|
1402 | + $britishairways = filter_input(INPUT_POST, 'britishairways', FILTER_SANITIZE_STRING); |
|
1403 | + $settings = array_merge($settings, array('globalBritishAirwaysKey' => $britishairways)); |
|
1404 | + $transavia = filter_input(INPUT_POST, 'transavia', FILTER_SANITIZE_STRING); |
|
1405 | + $settings = array_merge($settings, array('globalTransaviaKey' => $transavia)); |
|
1406 | 1406 | |
1407 | - $lufthansakey = filter_input(INPUT_POST,'lufthansakey',FILTER_SANITIZE_STRING); |
|
1408 | - $lufthansasecret = filter_input(INPUT_POST,'lufthansasecret',FILTER_SANITIZE_STRING); |
|
1409 | - $settings = array_merge($settings,array('globalLufthansaKey' => array('key' => $lufthansakey,'secret' => $lufthansasecret))); |
|
1407 | + $lufthansakey = filter_input(INPUT_POST, 'lufthansakey', FILTER_SANITIZE_STRING); |
|
1408 | + $lufthansasecret = filter_input(INPUT_POST, 'lufthansasecret', FILTER_SANITIZE_STRING); |
|
1409 | + $settings = array_merge($settings, array('globalLufthansaKey' => array('key' => $lufthansakey, 'secret' => $lufthansasecret))); |
|
1410 | 1410 | |
1411 | 1411 | // Create in settings.php keys not yet configurable if not already here |
1412 | 1412 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1413 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1413 | + if (!isset($globalDebug)) $settings = array_merge($settings, array('globalDebug' => 'TRUE')); |
|
1414 | 1414 | |
1415 | - $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
|
1415 | + $resetyearstats = filter_input(INPUT_POST, 'resetyearstats', FILTER_SANITIZE_STRING); |
|
1416 | 1416 | if ($resetyearstats == 'resetyearstats') { |
1417 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'TRUE')); |
|
1417 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'TRUE')); |
|
1418 | 1418 | } else { |
1419 | - $settings = array_merge($settings,array('globalDeleteLastYearStats' => 'FALSE')); |
|
1419 | + $settings = array_merge($settings, array('globalDeleteLastYearStats' => 'FALSE')); |
|
1420 | 1420 | } |
1421 | 1421 | |
1422 | - $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
|
1422 | + $archive = filter_input(INPUT_POST, 'archive', FILTER_SANITIZE_STRING); |
|
1423 | 1423 | if ($archive == 'archive') { |
1424 | - $settings = array_merge($settings,array('globalArchive' => 'TRUE')); |
|
1424 | + $settings = array_merge($settings, array('globalArchive' => 'TRUE')); |
|
1425 | 1425 | } else { |
1426 | - $settings = array_merge($settings,array('globalArchive' => 'FALSE')); |
|
1426 | + $settings = array_merge($settings, array('globalArchive' => 'FALSE')); |
|
1427 | 1427 | } |
1428 | - $archiveresults = filter_input(INPUT_POST,'archiveresults',FILTER_SANITIZE_STRING); |
|
1428 | + $archiveresults = filter_input(INPUT_POST, 'archiveresults', FILTER_SANITIZE_STRING); |
|
1429 | 1429 | if ($archiveresults == 'archiveresults') { |
1430 | - $settings = array_merge($settings,array('globalArchiveResults' => 'TRUE')); |
|
1430 | + $settings = array_merge($settings, array('globalArchiveResults' => 'TRUE')); |
|
1431 | 1431 | } else { |
1432 | - $settings = array_merge($settings,array('globalArchiveResults' => 'FALSE')); |
|
1432 | + $settings = array_merge($settings, array('globalArchiveResults' => 'FALSE')); |
|
1433 | 1433 | } |
1434 | - $daemon = filter_input(INPUT_POST,'daemon',FILTER_SANITIZE_STRING); |
|
1434 | + $daemon = filter_input(INPUT_POST, 'daemon', FILTER_SANITIZE_STRING); |
|
1435 | 1435 | if ($daemon == 'daemon') { |
1436 | - $settings = array_merge($settings,array('globalDaemon' => 'TRUE')); |
|
1436 | + $settings = array_merge($settings, array('globalDaemon' => 'TRUE')); |
|
1437 | 1437 | } else { |
1438 | - $settings = array_merge($settings,array('globalDaemon' => 'FALSE')); |
|
1438 | + $settings = array_merge($settings, array('globalDaemon' => 'FALSE')); |
|
1439 | 1439 | } |
1440 | - $schedules = filter_input(INPUT_POST,'schedules',FILTER_SANITIZE_STRING); |
|
1440 | + $schedules = filter_input(INPUT_POST, 'schedules', FILTER_SANITIZE_STRING); |
|
1441 | 1441 | if ($schedules == 'schedules') { |
1442 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE')); |
|
1442 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE')); |
|
1443 | 1443 | } else { |
1444 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE')); |
|
1444 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE')); |
|
1445 | 1445 | } |
1446 | 1446 | |
1447 | 1447 | /* |
@@ -1452,286 +1452,286 @@ discard block |
||
1452 | 1452 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE','globalSBS1' => 'TRUE')); |
1453 | 1453 | } |
1454 | 1454 | */ |
1455 | - $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
|
1456 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1457 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1458 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1459 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1455 | + $settings = array_merge($settings, array('globalFlightAware' => 'FALSE')); |
|
1456 | + if ($globalsbs == 'sbs') $settings = array_merge($settings, array('globalSBS1' => 'TRUE')); |
|
1457 | + else $settings = array_merge($settings, array('globalSBS1' => 'FALSE')); |
|
1458 | + if ($globalaprs == 'aprs') $settings = array_merge($settings, array('globalAPRS' => 'TRUE')); |
|
1459 | + else $settings = array_merge($settings, array('globalAPRS' => 'FALSE')); |
|
1460 | 1460 | $va = false; |
1461 | 1461 | if ($globalivao == 'ivao') { |
1462 | - $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
|
1462 | + $settings = array_merge($settings, array('globalIVAO' => 'TRUE')); |
|
1463 | 1463 | $va = true; |
1464 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1464 | + } else $settings = array_merge($settings, array('globalIVAO' => 'FALSE')); |
|
1465 | 1465 | if ($globalvatsim == 'vatsim') { |
1466 | - $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
|
1466 | + $settings = array_merge($settings, array('globalVATSIM' => 'TRUE')); |
|
1467 | 1467 | $va = true; |
1468 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1468 | + } else $settings = array_merge($settings, array('globalVATSIM' => 'FALSE')); |
|
1469 | 1469 | if ($globalphpvms == 'phpvms') { |
1470 | - $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
|
1470 | + $settings = array_merge($settings, array('globalphpVMS' => 'TRUE')); |
|
1471 | 1471 | $va = true; |
1472 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1472 | + } else $settings = array_merge($settings, array('globalphpVMS' => 'FALSE')); |
|
1473 | 1473 | if ($globalvam == 'vam') { |
1474 | - $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
|
1474 | + $settings = array_merge($settings, array('globalVAM' => 'TRUE')); |
|
1475 | 1475 | $va = true; |
1476 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1476 | + } else $settings = array_merge($settings, array('globalVAM' => 'FALSE')); |
|
1477 | 1477 | if ($va) { |
1478 | - $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
|
1479 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1478 | + $settings = array_merge($settings, array('globalSchedulesFetch' => 'FALSE', 'globalTranslationFetch' => 'FALSE')); |
|
1479 | + } else $settings = array_merge($settings, array('globalSchedulesFetch' => 'TRUE', 'globalTranslationFetch' => 'TRUE')); |
|
1480 | 1480 | if ($globalva == 'va' || $va) { |
1481 | - $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
|
1482 | - $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1481 | + $settings = array_merge($settings, array('globalVA' => 'TRUE')); |
|
1482 | + $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1483 | 1483 | } else { |
1484 | - $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
|
1485 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1486 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1484 | + $settings = array_merge($settings, array('globalVA' => 'FALSE')); |
|
1485 | + if ($forcepilots) $settings = array_merge($settings, array('globalUsePilot' => 'TRUE', 'globalUseOwner' => 'FALSE')); |
|
1486 | + else $settings = array_merge($settings, array('globalUsePilot' => 'FALSE', 'globalUseOwner' => 'TRUE')); |
|
1487 | 1487 | } |
1488 | 1488 | |
1489 | 1489 | |
1490 | - $mapoffline = filter_input(INPUT_POST,'mapoffline',FILTER_SANITIZE_STRING); |
|
1490 | + $mapoffline = filter_input(INPUT_POST, 'mapoffline', FILTER_SANITIZE_STRING); |
|
1491 | 1491 | if ($mapoffline == 'mapoffline') { |
1492 | - $settings = array_merge($settings,array('globalMapOffline' => 'TRUE')); |
|
1492 | + $settings = array_merge($settings, array('globalMapOffline' => 'TRUE')); |
|
1493 | 1493 | } else { |
1494 | - $settings = array_merge($settings,array('globalMapOffline' => 'FALSE')); |
|
1494 | + $settings = array_merge($settings, array('globalMapOffline' => 'FALSE')); |
|
1495 | 1495 | } |
1496 | - $globaloffline = filter_input(INPUT_POST,'globaloffline',FILTER_SANITIZE_STRING); |
|
1496 | + $globaloffline = filter_input(INPUT_POST, 'globaloffline', FILTER_SANITIZE_STRING); |
|
1497 | 1497 | if ($globaloffline == 'globaloffline') { |
1498 | - $settings = array_merge($settings,array('globalOffline' => 'TRUE')); |
|
1498 | + $settings = array_merge($settings, array('globalOffline' => 'TRUE')); |
|
1499 | 1499 | } else { |
1500 | - $settings = array_merge($settings,array('globalOffline' => 'FALSE')); |
|
1500 | + $settings = array_merge($settings, array('globalOffline' => 'FALSE')); |
|
1501 | 1501 | } |
1502 | 1502 | |
1503 | - $notam = filter_input(INPUT_POST,'notam',FILTER_SANITIZE_STRING); |
|
1503 | + $notam = filter_input(INPUT_POST, 'notam', FILTER_SANITIZE_STRING); |
|
1504 | 1504 | if ($notam == 'notam') { |
1505 | - $settings = array_merge($settings,array('globalNOTAM' => 'TRUE')); |
|
1505 | + $settings = array_merge($settings, array('globalNOTAM' => 'TRUE')); |
|
1506 | 1506 | } else { |
1507 | - $settings = array_merge($settings,array('globalNOTAM' => 'FALSE')); |
|
1507 | + $settings = array_merge($settings, array('globalNOTAM' => 'FALSE')); |
|
1508 | 1508 | } |
1509 | - $owner = filter_input(INPUT_POST,'owner',FILTER_SANITIZE_STRING); |
|
1509 | + $owner = filter_input(INPUT_POST, 'owner', FILTER_SANITIZE_STRING); |
|
1510 | 1510 | if ($owner == 'owner') { |
1511 | - $settings = array_merge($settings,array('globalOwner' => 'TRUE')); |
|
1511 | + $settings = array_merge($settings, array('globalOwner' => 'TRUE')); |
|
1512 | 1512 | } else { |
1513 | - $settings = array_merge($settings,array('globalOwner' => 'FALSE')); |
|
1513 | + $settings = array_merge($settings, array('globalOwner' => 'FALSE')); |
|
1514 | 1514 | } |
1515 | - $map3d = filter_input(INPUT_POST,'map3d',FILTER_SANITIZE_STRING); |
|
1515 | + $map3d = filter_input(INPUT_POST, 'map3d', FILTER_SANITIZE_STRING); |
|
1516 | 1516 | if ($map3d == 'map3d') { |
1517 | - $settings = array_merge($settings,array('globalMap3D' => 'TRUE')); |
|
1517 | + $settings = array_merge($settings, array('globalMap3D' => 'TRUE')); |
|
1518 | 1518 | } else { |
1519 | - $settings = array_merge($settings,array('globalMap3D' => 'FALSE')); |
|
1519 | + $settings = array_merge($settings, array('globalMap3D' => 'FALSE')); |
|
1520 | 1520 | } |
1521 | - $crash = filter_input(INPUT_POST,'crash',FILTER_SANITIZE_STRING); |
|
1521 | + $crash = filter_input(INPUT_POST, 'crash', FILTER_SANITIZE_STRING); |
|
1522 | 1522 | if ($crash == 'crash') { |
1523 | - $settings = array_merge($settings,array('globalAccidents' => 'TRUE')); |
|
1523 | + $settings = array_merge($settings, array('globalAccidents' => 'TRUE')); |
|
1524 | 1524 | } else { |
1525 | - $settings = array_merge($settings,array('globalAccidents' => 'FALSE')); |
|
1525 | + $settings = array_merge($settings, array('globalAccidents' => 'FALSE')); |
|
1526 | 1526 | } |
1527 | - $fires = filter_input(INPUT_POST,'fires',FILTER_SANITIZE_STRING); |
|
1527 | + $fires = filter_input(INPUT_POST, 'fires', FILTER_SANITIZE_STRING); |
|
1528 | 1528 | if ($fires == 'fires') { |
1529 | - $settings = array_merge($settings,array('globalMapFires' => 'TRUE')); |
|
1529 | + $settings = array_merge($settings, array('globalMapFires' => 'TRUE')); |
|
1530 | 1530 | } else { |
1531 | - $settings = array_merge($settings,array('globalMapFires' => 'FALSE')); |
|
1531 | + $settings = array_merge($settings, array('globalMapFires' => 'FALSE')); |
|
1532 | 1532 | } |
1533 | - $firessupport = filter_input(INPUT_POST,'firessupport',FILTER_SANITIZE_STRING); |
|
1533 | + $firessupport = filter_input(INPUT_POST, 'firessupport', FILTER_SANITIZE_STRING); |
|
1534 | 1534 | if ($firessupport == 'firessupport') { |
1535 | - $settings = array_merge($settings,array('globalFires' => 'TRUE')); |
|
1535 | + $settings = array_merge($settings, array('globalFires' => 'TRUE')); |
|
1536 | 1536 | } else { |
1537 | - $settings = array_merge($settings,array('globalFires' => 'FALSE')); |
|
1537 | + $settings = array_merge($settings, array('globalFires' => 'FALSE')); |
|
1538 | 1538 | } |
1539 | - $mapsatellites = filter_input(INPUT_POST,'mapsatellites',FILTER_SANITIZE_STRING); |
|
1539 | + $mapsatellites = filter_input(INPUT_POST, 'mapsatellites', FILTER_SANITIZE_STRING); |
|
1540 | 1540 | if ($mapsatellites == 'mapsatellites') { |
1541 | - $settings = array_merge($settings,array('globalMapSatellites' => 'TRUE')); |
|
1541 | + $settings = array_merge($settings, array('globalMapSatellites' => 'TRUE')); |
|
1542 | 1542 | } else { |
1543 | - $settings = array_merge($settings,array('globalMapSatellites' => 'FALSE')); |
|
1543 | + $settings = array_merge($settings, array('globalMapSatellites' => 'FALSE')); |
|
1544 | 1544 | } |
1545 | - $map3ddefault = filter_input(INPUT_POST,'map3ddefault',FILTER_SANITIZE_STRING); |
|
1545 | + $map3ddefault = filter_input(INPUT_POST, 'map3ddefault', FILTER_SANITIZE_STRING); |
|
1546 | 1546 | if ($map3ddefault == 'map3ddefault') { |
1547 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'TRUE')); |
|
1547 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'TRUE')); |
|
1548 | 1548 | } else { |
1549 | - $settings = array_merge($settings,array('globalMap3Ddefault' => 'FALSE')); |
|
1549 | + $settings = array_merge($settings, array('globalMap3Ddefault' => 'FALSE')); |
|
1550 | 1550 | } |
1551 | - $one3dmodel = filter_input(INPUT_POST,'one3dmodel',FILTER_SANITIZE_STRING); |
|
1551 | + $one3dmodel = filter_input(INPUT_POST, 'one3dmodel', FILTER_SANITIZE_STRING); |
|
1552 | 1552 | if ($one3dmodel == 'one3dmodel') { |
1553 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'TRUE')); |
|
1553 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'TRUE')); |
|
1554 | 1554 | } else { |
1555 | - $settings = array_merge($settings,array('globalMap3DOneModel' => 'FALSE')); |
|
1555 | + $settings = array_merge($settings, array('globalMap3DOneModel' => 'FALSE')); |
|
1556 | 1556 | } |
1557 | - $map3dliveries = filter_input(INPUT_POST,'map3dliveries',FILTER_SANITIZE_STRING); |
|
1557 | + $map3dliveries = filter_input(INPUT_POST, 'map3dliveries', FILTER_SANITIZE_STRING); |
|
1558 | 1558 | if ($map3dliveries == 'map3dliveries') { |
1559 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'TRUE')); |
|
1559 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'TRUE')); |
|
1560 | 1560 | } else { |
1561 | - $settings = array_merge($settings,array('globalMap3DLiveries' => 'FALSE')); |
|
1561 | + $settings = array_merge($settings, array('globalMap3DLiveries' => 'FALSE')); |
|
1562 | 1562 | } |
1563 | - $map3dshadows = filter_input(INPUT_POST,'map3dshadows',FILTER_SANITIZE_STRING); |
|
1563 | + $map3dshadows = filter_input(INPUT_POST, 'map3dshadows', FILTER_SANITIZE_STRING); |
|
1564 | 1564 | if ($map3dshadows == 'map3dshadows') { |
1565 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'TRUE')); |
|
1565 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'TRUE')); |
|
1566 | 1566 | } else { |
1567 | - $settings = array_merge($settings,array('globalMap3DShadows' => 'FALSE')); |
|
1567 | + $settings = array_merge($settings, array('globalMap3DShadows' => 'FALSE')); |
|
1568 | 1568 | } |
1569 | - $translate = filter_input(INPUT_POST,'translate',FILTER_SANITIZE_STRING); |
|
1569 | + $translate = filter_input(INPUT_POST, 'translate', FILTER_SANITIZE_STRING); |
|
1570 | 1570 | if ($translate == 'translate') { |
1571 | - $settings = array_merge($settings,array('globalTranslate' => 'TRUE')); |
|
1571 | + $settings = array_merge($settings, array('globalTranslate' => 'TRUE')); |
|
1572 | 1572 | } else { |
1573 | - $settings = array_merge($settings,array('globalTranslate' => 'FALSE')); |
|
1573 | + $settings = array_merge($settings, array('globalTranslate' => 'FALSE')); |
|
1574 | 1574 | } |
1575 | - $realairlines = filter_input(INPUT_POST,'realairlines',FILTER_SANITIZE_STRING); |
|
1575 | + $realairlines = filter_input(INPUT_POST, 'realairlines', FILTER_SANITIZE_STRING); |
|
1576 | 1576 | if ($realairlines == 'realairlines') { |
1577 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'TRUE')); |
|
1577 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'TRUE')); |
|
1578 | 1578 | } else { |
1579 | - $settings = array_merge($settings,array('globalUseRealAirlines' => 'FALSE')); |
|
1579 | + $settings = array_merge($settings, array('globalUseRealAirlines' => 'FALSE')); |
|
1580 | 1580 | } |
1581 | - $estimation = filter_input(INPUT_POST,'estimation',FILTER_SANITIZE_STRING); |
|
1581 | + $estimation = filter_input(INPUT_POST, 'estimation', FILTER_SANITIZE_STRING); |
|
1582 | 1582 | if ($estimation == 'estimation') { |
1583 | - $settings = array_merge($settings,array('globalMapEstimation' => 'TRUE')); |
|
1583 | + $settings = array_merge($settings, array('globalMapEstimation' => 'TRUE')); |
|
1584 | 1584 | } else { |
1585 | - $settings = array_merge($settings,array('globalMapEstimation' => 'FALSE')); |
|
1585 | + $settings = array_merge($settings, array('globalMapEstimation' => 'FALSE')); |
|
1586 | 1586 | } |
1587 | - $metar = filter_input(INPUT_POST,'metar',FILTER_SANITIZE_STRING); |
|
1587 | + $metar = filter_input(INPUT_POST, 'metar', FILTER_SANITIZE_STRING); |
|
1588 | 1588 | if ($metar == 'metar') { |
1589 | - $settings = array_merge($settings,array('globalMETAR' => 'TRUE')); |
|
1589 | + $settings = array_merge($settings, array('globalMETAR' => 'TRUE')); |
|
1590 | 1590 | } else { |
1591 | - $settings = array_merge($settings,array('globalMETAR' => 'FALSE')); |
|
1591 | + $settings = array_merge($settings, array('globalMETAR' => 'FALSE')); |
|
1592 | 1592 | } |
1593 | - $metarcycle = filter_input(INPUT_POST,'metarcycle',FILTER_SANITIZE_STRING); |
|
1593 | + $metarcycle = filter_input(INPUT_POST, 'metarcycle', FILTER_SANITIZE_STRING); |
|
1594 | 1594 | if ($metarcycle == 'metarcycle') { |
1595 | - $settings = array_merge($settings,array('globalMETARcycle' => 'TRUE')); |
|
1595 | + $settings = array_merge($settings, array('globalMETARcycle' => 'TRUE')); |
|
1596 | 1596 | } else { |
1597 | - $settings = array_merge($settings,array('globalMETARcycle' => 'FALSE')); |
|
1597 | + $settings = array_merge($settings, array('globalMETARcycle' => 'FALSE')); |
|
1598 | 1598 | } |
1599 | - $fork = filter_input(INPUT_POST,'fork',FILTER_SANITIZE_STRING); |
|
1599 | + $fork = filter_input(INPUT_POST, 'fork', FILTER_SANITIZE_STRING); |
|
1600 | 1600 | if ($fork == 'fork') { |
1601 | - $settings = array_merge($settings,array('globalFork' => 'TRUE')); |
|
1601 | + $settings = array_merge($settings, array('globalFork' => 'TRUE')); |
|
1602 | 1602 | } else { |
1603 | - $settings = array_merge($settings,array('globalFork' => 'FALSE')); |
|
1603 | + $settings = array_merge($settings, array('globalFork' => 'FALSE')); |
|
1604 | 1604 | } |
1605 | 1605 | |
1606 | - $colormap = filter_input(INPUT_POST,'colormap',FILTER_SANITIZE_STRING); |
|
1606 | + $colormap = filter_input(INPUT_POST, 'colormap', FILTER_SANITIZE_STRING); |
|
1607 | 1607 | if ($colormap == 'colormap') { |
1608 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'TRUE')); |
|
1608 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'TRUE')); |
|
1609 | 1609 | } else { |
1610 | - $settings = array_merge($settings,array('globalMapAltitudeColor' => 'FALSE')); |
|
1610 | + $settings = array_merge($settings, array('globalMapAltitudeColor' => 'FALSE')); |
|
1611 | 1611 | } |
1612 | 1612 | |
1613 | 1613 | if (isset($_POST['aircrafticoncolor'])) { |
1614 | - $aircrafticoncolor = filter_input(INPUT_POST,'aircrafticoncolor',FILTER_SANITIZE_STRING); |
|
1615 | - $settings = array_merge($settings,array('globalAircraftIconColor' => substr($aircrafticoncolor,1))); |
|
1614 | + $aircrafticoncolor = filter_input(INPUT_POST, 'aircrafticoncolor', FILTER_SANITIZE_STRING); |
|
1615 | + $settings = array_merge($settings, array('globalAircraftIconColor' => substr($aircrafticoncolor, 1))); |
|
1616 | 1616 | } |
1617 | 1617 | |
1618 | - $airportzoom = filter_input(INPUT_POST,'airportzoom',FILTER_SANITIZE_NUMBER_INT); |
|
1619 | - $settings = array_merge($settings,array('globalAirportZoom' => $airportzoom)); |
|
1618 | + $airportzoom = filter_input(INPUT_POST, 'airportzoom', FILTER_SANITIZE_NUMBER_INT); |
|
1619 | + $settings = array_merge($settings, array('globalAirportZoom' => $airportzoom)); |
|
1620 | 1620 | |
1621 | - $unitdistance = filter_input(INPUT_POST,'unitdistance',FILTER_SANITIZE_STRING); |
|
1622 | - $settings = array_merge($settings,array('globalUnitDistance' => $unitdistance)); |
|
1623 | - $unitaltitude = filter_input(INPUT_POST,'unitaltitude',FILTER_SANITIZE_STRING); |
|
1624 | - $settings = array_merge($settings,array('globalUnitAltitude' => $unitaltitude)); |
|
1625 | - $unitspeed = filter_input(INPUT_POST,'unitspeed',FILTER_SANITIZE_STRING); |
|
1626 | - $settings = array_merge($settings,array('globalUnitSpeed' => $unitspeed)); |
|
1621 | + $unitdistance = filter_input(INPUT_POST, 'unitdistance', FILTER_SANITIZE_STRING); |
|
1622 | + $settings = array_merge($settings, array('globalUnitDistance' => $unitdistance)); |
|
1623 | + $unitaltitude = filter_input(INPUT_POST, 'unitaltitude', FILTER_SANITIZE_STRING); |
|
1624 | + $settings = array_merge($settings, array('globalUnitAltitude' => $unitaltitude)); |
|
1625 | + $unitspeed = filter_input(INPUT_POST, 'unitspeed', FILTER_SANITIZE_STRING); |
|
1626 | + $settings = array_merge($settings, array('globalUnitSpeed' => $unitspeed)); |
|
1627 | 1627 | |
1628 | - $mappopup = filter_input(INPUT_POST,'mappopup',FILTER_SANITIZE_STRING); |
|
1628 | + $mappopup = filter_input(INPUT_POST, 'mappopup', FILTER_SANITIZE_STRING); |
|
1629 | 1629 | if ($mappopup == 'mappopup') { |
1630 | - $settings = array_merge($settings,array('globalMapPopup' => 'TRUE')); |
|
1630 | + $settings = array_merge($settings, array('globalMapPopup' => 'TRUE')); |
|
1631 | 1631 | } else { |
1632 | - $settings = array_merge($settings,array('globalMapPopup' => 'FALSE')); |
|
1632 | + $settings = array_merge($settings, array('globalMapPopup' => 'FALSE')); |
|
1633 | 1633 | } |
1634 | - $airportpopup = filter_input(INPUT_POST,'airportpopup',FILTER_SANITIZE_STRING); |
|
1634 | + $airportpopup = filter_input(INPUT_POST, 'airportpopup', FILTER_SANITIZE_STRING); |
|
1635 | 1635 | if ($airportpopup == 'airportpopup') { |
1636 | - $settings = array_merge($settings,array('globalAirportPopup' => 'TRUE')); |
|
1636 | + $settings = array_merge($settings, array('globalAirportPopup' => 'TRUE')); |
|
1637 | 1637 | } else { |
1638 | - $settings = array_merge($settings,array('globalAirportPopup' => 'FALSE')); |
|
1638 | + $settings = array_merge($settings, array('globalAirportPopup' => 'FALSE')); |
|
1639 | 1639 | } |
1640 | - $maphistory = filter_input(INPUT_POST,'maphistory',FILTER_SANITIZE_STRING); |
|
1640 | + $maphistory = filter_input(INPUT_POST, 'maphistory', FILTER_SANITIZE_STRING); |
|
1641 | 1641 | if ($maphistory == 'maphistory') { |
1642 | - $settings = array_merge($settings,array('globalMapHistory' => 'TRUE')); |
|
1642 | + $settings = array_merge($settings, array('globalMapHistory' => 'TRUE')); |
|
1643 | 1643 | } else { |
1644 | - $settings = array_merge($settings,array('globalMapHistory' => 'FALSE')); |
|
1644 | + $settings = array_merge($settings, array('globalMapHistory' => 'FALSE')); |
|
1645 | 1645 | } |
1646 | - $maptooltip = filter_input(INPUT_POST,'maptooltip',FILTER_SANITIZE_STRING); |
|
1646 | + $maptooltip = filter_input(INPUT_POST, 'maptooltip', FILTER_SANITIZE_STRING); |
|
1647 | 1647 | if ($maptooltip == 'maptooltip') { |
1648 | - $settings = array_merge($settings,array('globalMapTooltip' => 'TRUE')); |
|
1648 | + $settings = array_merge($settings, array('globalMapTooltip' => 'TRUE')); |
|
1649 | 1649 | } else { |
1650 | - $settings = array_merge($settings,array('globalMapTooltip' => 'FALSE')); |
|
1650 | + $settings = array_merge($settings, array('globalMapTooltip' => 'FALSE')); |
|
1651 | 1651 | } |
1652 | - $flightroute = filter_input(INPUT_POST,'flightroute',FILTER_SANITIZE_STRING); |
|
1652 | + $flightroute = filter_input(INPUT_POST, 'flightroute', FILTER_SANITIZE_STRING); |
|
1653 | 1653 | if ($flightroute == 'flightroute') { |
1654 | - $settings = array_merge($settings,array('globalMapRoute' => 'TRUE')); |
|
1654 | + $settings = array_merge($settings, array('globalMapRoute' => 'TRUE')); |
|
1655 | 1655 | } else { |
1656 | - $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
|
1656 | + $settings = array_merge($settings, array('globalMapRoute' => 'FALSE')); |
|
1657 | 1657 | } |
1658 | - $flightremainingroute = filter_input(INPUT_POST,'flightremainingroute',FILTER_SANITIZE_STRING); |
|
1658 | + $flightremainingroute = filter_input(INPUT_POST, 'flightremainingroute', FILTER_SANITIZE_STRING); |
|
1659 | 1659 | if ($flightremainingroute == 'flightremainingroute') { |
1660 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'TRUE')); |
|
1660 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'TRUE')); |
|
1661 | 1661 | } else { |
1662 | - $settings = array_merge($settings,array('globalMapRemainingRoute' => 'FALSE')); |
|
1662 | + $settings = array_merge($settings, array('globalMapRemainingRoute' => 'FALSE')); |
|
1663 | 1663 | } |
1664 | - $allflights = filter_input(INPUT_POST,'allflights',FILTER_SANITIZE_STRING); |
|
1664 | + $allflights = filter_input(INPUT_POST, 'allflights', FILTER_SANITIZE_STRING); |
|
1665 | 1665 | if ($allflights == 'allflights') { |
1666 | - $settings = array_merge($settings,array('globalAllFlights' => 'TRUE')); |
|
1666 | + $settings = array_merge($settings, array('globalAllFlights' => 'TRUE')); |
|
1667 | 1667 | } else { |
1668 | - $settings = array_merge($settings,array('globalAllFlights' => 'FALSE')); |
|
1668 | + $settings = array_merge($settings, array('globalAllFlights' => 'FALSE')); |
|
1669 | 1669 | } |
1670 | - $bbox = filter_input(INPUT_POST,'bbox',FILTER_SANITIZE_STRING); |
|
1670 | + $bbox = filter_input(INPUT_POST, 'bbox', FILTER_SANITIZE_STRING); |
|
1671 | 1671 | if ($bbox == 'bbox') { |
1672 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'TRUE')); |
|
1672 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'TRUE')); |
|
1673 | 1673 | } else { |
1674 | - $settings = array_merge($settings,array('globalMapUseBbox' => 'FALSE')); |
|
1674 | + $settings = array_merge($settings, array('globalMapUseBbox' => 'FALSE')); |
|
1675 | 1675 | } |
1676 | - $groundaltitude = filter_input(INPUT_POST,'groundaltitude',FILTER_SANITIZE_STRING); |
|
1676 | + $groundaltitude = filter_input(INPUT_POST, 'groundaltitude', FILTER_SANITIZE_STRING); |
|
1677 | 1677 | if ($groundaltitude == 'groundaltitude') { |
1678 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'TRUE')); |
|
1678 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'TRUE')); |
|
1679 | 1679 | } else { |
1680 | - $settings = array_merge($settings,array('globalGroundAltitude' => 'FALSE')); |
|
1680 | + $settings = array_merge($settings, array('globalGroundAltitude' => 'FALSE')); |
|
1681 | 1681 | } |
1682 | - $waypoints = filter_input(INPUT_POST,'waypoints',FILTER_SANITIZE_STRING); |
|
1682 | + $waypoints = filter_input(INPUT_POST, 'waypoints', FILTER_SANITIZE_STRING); |
|
1683 | 1683 | if ($waypoints == 'waypoints') { |
1684 | - $settings = array_merge($settings,array('globalWaypoints' => 'TRUE')); |
|
1684 | + $settings = array_merge($settings, array('globalWaypoints' => 'TRUE')); |
|
1685 | 1685 | } else { |
1686 | - $settings = array_merge($settings,array('globalWaypoints' => 'FALSE')); |
|
1686 | + $settings = array_merge($settings, array('globalWaypoints' => 'FALSE')); |
|
1687 | 1687 | } |
1688 | - $geoid = filter_input(INPUT_POST,'geoid',FILTER_SANITIZE_STRING); |
|
1688 | + $geoid = filter_input(INPUT_POST, 'geoid', FILTER_SANITIZE_STRING); |
|
1689 | 1689 | if ($geoid == 'geoid') { |
1690 | - $settings = array_merge($settings,array('globalGeoid' => 'TRUE')); |
|
1690 | + $settings = array_merge($settings, array('globalGeoid' => 'TRUE')); |
|
1691 | 1691 | } else { |
1692 | - $settings = array_merge($settings,array('globalGeoid' => 'FALSE')); |
|
1692 | + $settings = array_merge($settings, array('globalGeoid' => 'FALSE')); |
|
1693 | 1693 | } |
1694 | - $geoid_source = filter_input(INPUT_POST,'geoid_source',FILTER_SANITIZE_STRING); |
|
1695 | - $settings = array_merge($settings,array('globalGeoidSource' => $geoid_source)); |
|
1694 | + $geoid_source = filter_input(INPUT_POST, 'geoid_source', FILTER_SANITIZE_STRING); |
|
1695 | + $settings = array_merge($settings, array('globalGeoidSource' => $geoid_source)); |
|
1696 | 1696 | |
1697 | - $noairlines = filter_input(INPUT_POST,'noairlines',FILTER_SANITIZE_STRING); |
|
1697 | + $noairlines = filter_input(INPUT_POST, 'noairlines', FILTER_SANITIZE_STRING); |
|
1698 | 1698 | if ($noairlines == 'noairlines') { |
1699 | - $settings = array_merge($settings,array('globalNoAirlines' => 'TRUE')); |
|
1699 | + $settings = array_merge($settings, array('globalNoAirlines' => 'TRUE')); |
|
1700 | 1700 | } else { |
1701 | - $settings = array_merge($settings,array('globalNoAirlines' => 'FALSE')); |
|
1701 | + $settings = array_merge($settings, array('globalNoAirlines' => 'FALSE')); |
|
1702 | 1702 | } |
1703 | 1703 | |
1704 | - $tsk = filter_input(INPUT_POST,'tsk',FILTER_SANITIZE_STRING); |
|
1704 | + $tsk = filter_input(INPUT_POST, 'tsk', FILTER_SANITIZE_STRING); |
|
1705 | 1705 | if ($tsk == 'tsk') { |
1706 | - $settings = array_merge($settings,array('globalTSK' => 'TRUE')); |
|
1706 | + $settings = array_merge($settings, array('globalTSK' => 'TRUE')); |
|
1707 | 1707 | } else { |
1708 | - $settings = array_merge($settings,array('globalTSK' => 'FALSE')); |
|
1708 | + $settings = array_merge($settings, array('globalTSK' => 'FALSE')); |
|
1709 | 1709 | } |
1710 | - $mapmatching = filter_input(INPUT_POST,'mapmatching',FILTER_SANITIZE_STRING); |
|
1710 | + $mapmatching = filter_input(INPUT_POST, 'mapmatching', FILTER_SANITIZE_STRING); |
|
1711 | 1711 | if ($mapmatching == 'mapmatching') { |
1712 | - $settings = array_merge($settings,array('globalMapMatching' => 'TRUE')); |
|
1712 | + $settings = array_merge($settings, array('globalMapMatching' => 'TRUE')); |
|
1713 | 1713 | } else { |
1714 | - $settings = array_merge($settings,array('globalMapMatching' => 'FALSE')); |
|
1714 | + $settings = array_merge($settings, array('globalMapMatching' => 'FALSE')); |
|
1715 | 1715 | } |
1716 | - $mapmatchingsource = filter_input(INPUT_POST,'mapmatchingsource',FILTER_SANITIZE_STRING); |
|
1717 | - $settings = array_merge($settings,array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1718 | - $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
|
1719 | - $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
|
1716 | + $mapmatchingsource = filter_input(INPUT_POST, 'mapmatchingsource', FILTER_SANITIZE_STRING); |
|
1717 | + $settings = array_merge($settings, array('globalMapMatchingSource' => $mapmatchingsource)); |
|
1718 | + $graphhopper = filter_input(INPUT_POST, 'graphhopper', FILTER_SANITIZE_STRING); |
|
1719 | + $settings = array_merge($settings, array('globalGraphHopperKey' => $graphhopper)); |
|
1720 | 1720 | |
1721 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
1721 | + if (!isset($globalTransaction)) $settings = array_merge($settings, array('globalTransaction' => 'TRUE')); |
|
1722 | 1722 | |
1723 | 1723 | // Set some defaults values... |
1724 | 1724 | if (!isset($globalAircraftImageSources)) { |
1725 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
1726 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1725 | + $globalAircraftImageSources = array('ivaomtl', 'wikimedia', 'airportdata', 'deviantart', 'flickr', 'bing', 'jetphotos', 'planepictures', 'planespotters'); |
|
1726 | + $settings = array_merge($settings, array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
1727 | 1727 | } |
1728 | 1728 | |
1729 | 1729 | if (!isset($globalSchedulesSources)) { |
1730 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
1731 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1730 | + $globalSchedulesSources = array('flightmapper', 'costtotravel', 'flightradar24', 'flightaware'); |
|
1731 | + $settings = array_merge($settings, array('globalSchedulesSources' => $globalSchedulesSources)); |
|
1732 | 1732 | } |
1733 | 1733 | |
1734 | - $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
|
1734 | + $settings = array_merge($settings, array('globalInstalled' => 'TRUE')); |
|
1735 | 1735 | |
1736 | 1736 | if ($error == '') settings::modify_settings($settings); |
1737 | 1737 | if ($error == '') settings::comment_settings($settings_comment); |
@@ -4,11 +4,19 @@ discard block |
||
4 | 4 | if (isset($_SESSION['error'])) { |
5 | 5 | header('Content-Encoding: none;'); |
6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
11 | -} |
|
7 | + if (isset($_SESSION['error'])) { |
|
8 | + unset($_SESSION['error']); |
|
9 | + } |
|
10 | + if (isset($_SESSION['errorlst'])) { |
|
11 | + unset($_SESSION['errorlst']); |
|
12 | + } |
|
13 | + if (isset($_SESSION['next'])) { |
|
14 | + unset($_SESSION['next']); |
|
15 | + } |
|
16 | + if (isset($_SESSION['install'])) { |
|
17 | + unset($_SESSION['install']); |
|
18 | + } |
|
19 | + } |
|
12 | 20 | /* |
13 | 21 | if (isset($_SESSION['errorlst'])) { |
14 | 22 | header('Content-Encoding: none;'); |
@@ -114,7 +122,9 @@ discard block |
||
114 | 122 | if (count($alllng) != count($availablelng)) { |
115 | 123 | $notavailable = array(); |
116 | 124 | foreach($alllng as $lng) { |
117 | - if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
|
125 | + if (!isset($availablelng[$lng])) { |
|
126 | + $notavailable[] = $lng; |
|
127 | + } |
|
118 | 128 | } |
119 | 129 | print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
120 | 130 | } |
@@ -175,31 +185,49 @@ discard block |
||
175 | 185 | </div> |
176 | 186 | <p> |
177 | 187 | <label for="dbhost">Database hostname</label> |
178 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
188 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
189 | + print $globalDBhost; |
|
190 | +} |
|
191 | +?>" /> |
|
179 | 192 | </p> |
180 | 193 | <p> |
181 | 194 | <label for="dbport">Database port</label> |
182 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
195 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
196 | + print $globalDBport; |
|
197 | +} |
|
198 | +?>" /> |
|
183 | 199 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
184 | 200 | </p> |
185 | 201 | <p> |
186 | 202 | <label for="dbname">Database name</label> |
187 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
203 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
204 | + print $globalDBname; |
|
205 | +} |
|
206 | +?>" /> |
|
188 | 207 | </p> |
189 | 208 | <p> |
190 | 209 | <label for="dbuser">Database user</label> |
191 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
210 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
211 | + print $globalDBuser; |
|
212 | +} |
|
213 | +?>" /> |
|
192 | 214 | </p> |
193 | 215 | <p> |
194 | 216 | <label for="dbuserpass">Database user password</label> |
195 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
217 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
218 | + print $globalDBpass; |
|
219 | +} |
|
220 | +?>" /> |
|
196 | 221 | </p> |
197 | 222 | </fieldset> |
198 | 223 | <fieldset id="site"> |
199 | 224 | <legend>Site configuration</legend> |
200 | 225 | <p> |
201 | 226 | <label for="sitename">Site name</label> |
202 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
227 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
228 | + print $globalName; |
|
229 | +} |
|
230 | +?>" /> |
|
203 | 231 | </p> |
204 | 232 | <p> |
205 | 233 | <label for="siteurl">Site directory</label> |
@@ -212,18 +240,27 @@ discard block |
||
212 | 240 | } |
213 | 241 | } |
214 | 242 | ?> |
215 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
243 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
244 | + print $globalURL; |
|
245 | +} |
|
246 | +?>" /> |
|
216 | 247 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
217 | 248 | <p class="help-block">Can be empty</p> |
218 | 249 | </p> |
219 | 250 | <p> |
220 | 251 | <label for="timezone">Timezone</label> |
221 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
252 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
253 | + print $globalTimezone; |
|
254 | +} |
|
255 | +?>" /> |
|
222 | 256 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
223 | 257 | </p> |
224 | 258 | <p> |
225 | 259 | <label for="language">Language</label> |
226 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
260 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
261 | + print $globalLanguage; |
|
262 | +} |
|
263 | +?>" /> |
|
227 | 264 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
228 | 265 | </p> |
229 | 266 | </fieldset> |
@@ -243,11 +280,17 @@ discard block |
||
243 | 280 | <div id="mapbox_data"> |
244 | 281 | <p> |
245 | 282 | <label for="mapboxid">Mapbox id</label> |
246 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
283 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
284 | + print $globalMapboxId; |
|
285 | +} |
|
286 | +?>" /> |
|
247 | 287 | </p> |
248 | 288 | <p> |
249 | 289 | <label for="mapboxtoken">Mapbox token</label> |
250 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
290 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
291 | + print $globalMapboxToken; |
|
292 | +} |
|
293 | +?>" /> |
|
251 | 294 | </p> |
252 | 295 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
253 | 296 | </div> |
@@ -255,7 +298,10 @@ discard block |
||
255 | 298 | <div id="google_data"> |
256 | 299 | <p> |
257 | 300 | <label for="googlekey">Google API key</label> |
258 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
301 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
302 | + print $globalGoogleAPIKey; |
|
303 | +} |
|
304 | +?>" /> |
|
259 | 305 | <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> |
260 | 306 | </p> |
261 | 307 | </div> |
@@ -263,7 +309,10 @@ discard block |
||
263 | 309 | <div id="bing_data"> |
264 | 310 | <p> |
265 | 311 | <label for="bingkey">Bing Map key</label> |
266 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
312 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
313 | + print $globalBingMapKey; |
|
314 | +} |
|
315 | +?>" /> |
|
267 | 316 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
268 | 317 | </p> |
269 | 318 | </div> |
@@ -271,7 +320,10 @@ discard block |
||
271 | 320 | <div id="mapquest_data"> |
272 | 321 | <p> |
273 | 322 | <label for="mapquestkey">MapQuest key</label> |
274 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
323 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
324 | + print $globalMapQuestKey; |
|
325 | +} |
|
326 | +?>" /> |
|
275 | 327 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
276 | 328 | </p> |
277 | 329 | </div> |
@@ -279,11 +331,17 @@ discard block |
||
279 | 331 | <div id="here_data"> |
280 | 332 | <p> |
281 | 333 | <label for="hereappid">Here App_Id</label> |
282 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
334 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
335 | + print $globalHereappId; |
|
336 | +} |
|
337 | +?>" /> |
|
283 | 338 | </p> |
284 | 339 | <p> |
285 | 340 | <label for="hereappcode">Here App_Code</label> |
286 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
341 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
342 | + print $globalHereappCode; |
|
343 | +} |
|
344 | +?>" /> |
|
287 | 345 | </p> |
288 | 346 | <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> |
289 | 347 | </div> |
@@ -291,7 +349,10 @@ discard block |
||
291 | 349 | <div id="openweathermap_data"> |
292 | 350 | <p> |
293 | 351 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
294 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
352 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
353 | + print $globalOpenWeatherMapKey; |
|
354 | +} |
|
355 | +?>" /> |
|
295 | 356 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
296 | 357 | </p> |
297 | 358 | </div> |
@@ -320,42 +381,86 @@ discard block |
||
320 | 381 | <legend>Coverage area</legend> |
321 | 382 | <p> |
322 | 383 | <label for="latitudemax">The maximum latitude (north)</label> |
323 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
384 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
385 | + print $globalLatitudeMax; |
|
386 | +} |
|
387 | +?>" /> |
|
324 | 388 | </p> |
325 | 389 | <p> |
326 | 390 | <label for="latitudemin">The minimum latitude (south)</label> |
327 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
391 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
392 | + print $globalLatitudeMin; |
|
393 | +} |
|
394 | +?>" /> |
|
328 | 395 | </p> |
329 | 396 | <p> |
330 | 397 | <label for="longitudemax">The maximum longitude (west)</label> |
331 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
398 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
399 | + print $globalLongitudeMax; |
|
400 | +} |
|
401 | +?>" /> |
|
332 | 402 | </p> |
333 | 403 | <p> |
334 | 404 | <label for="longitudemin">The minimum longitude (east)</label> |
335 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
405 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
406 | + print $globalLongitudeMin; |
|
407 | +} |
|
408 | +?>" /> |
|
336 | 409 | </p> |
337 | 410 | <p> |
338 | 411 | <label for="latitudecenter">The latitude center</label> |
339 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
412 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
413 | + print $globalCenterLatitude; |
|
414 | +} |
|
415 | +?>" /> |
|
340 | 416 | </p> |
341 | 417 | <p> |
342 | 418 | <label for="longitudecenter">The longitude center</label> |
343 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
419 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
420 | + print $globalCenterLongitude; |
|
421 | +} |
|
422 | +?>" /> |
|
344 | 423 | </p> |
345 | 424 | <p> |
346 | 425 | <label for="livezoom">Default Zoom on live map</label> |
347 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
426 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
427 | + print $globalLiveZoom; |
|
428 | +} else { |
|
429 | + print '9'; |
|
430 | +} |
|
431 | +?>" /> |
|
348 | 432 | </p> |
349 | 433 | <p> |
350 | 434 | <label for="squawk_country">Country for squawk usage</label> |
351 | 435 | <select name="squawk_country" id="squawk_country"> |
352 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
353 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
354 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
355 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
356 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
357 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
358 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
436 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
437 | + print ' selected '; |
|
438 | +} |
|
439 | +?>>UK</option> |
|
440 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
441 | + print ' selected '; |
|
442 | +} |
|
443 | +?>>NZ</option> |
|
444 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
445 | + print ' selected '; |
|
446 | +} |
|
447 | +?>>US</option> |
|
448 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
449 | + print ' selected '; |
|
450 | +} |
|
451 | +?>>AU</option> |
|
452 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
453 | + print ' selected '; |
|
454 | +} |
|
455 | +?>>NL</option> |
|
456 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
457 | + print ' selected '; |
|
458 | +} |
|
459 | +?>>FR</option> |
|
460 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
461 | + print ' selected '; |
|
462 | +} |
|
463 | +?>>TR</option> |
|
359 | 464 | </select> |
360 | 465 | </p> |
361 | 466 | </fieldset> |
@@ -364,15 +469,24 @@ discard block |
||
364 | 469 | <p><i>Only put in DB flights that are inside a circle</i></p> |
365 | 470 | <p> |
366 | 471 | <label for="latitude">Center latitude</label> |
367 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
472 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
473 | + echo $globalDistanceIgnore['latitude']; |
|
474 | +} |
|
475 | +?>" /> |
|
368 | 476 | </p> |
369 | 477 | <p> |
370 | 478 | <label for="longitude">Center longitude</label> |
371 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
479 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
480 | + echo $globalDistanceIgnore['longitude']; |
|
481 | +} |
|
482 | +?>" /> |
|
372 | 483 | </p> |
373 | 484 | <p> |
374 | 485 | <label for="Distance">Distance (in km)</label> |
375 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
486 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
487 | + echo $globalDistanceIgnore['distance']; |
|
488 | +} |
|
489 | +?>" /> |
|
376 | 490 | </p> |
377 | 491 | </fieldset> |
378 | 492 | <fieldset id="sourceloc"> |
@@ -488,11 +602,17 @@ discard block |
||
488 | 602 | <div id="flightaware_data"> |
489 | 603 | <p> |
490 | 604 | <label for="flightawareusername">FlightAware username</label> |
491 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
605 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
606 | + print $globalFlightAwareUsername; |
|
607 | +} |
|
608 | +?>" /> |
|
492 | 609 | </p> |
493 | 610 | <p> |
494 | 611 | <label for="flightawarepassword">FlightAware password/API key</label> |
495 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
612 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
613 | + print $globalFlightAwarePassword; |
|
614 | +} |
|
615 | +?>" /> |
|
496 | 616 | </p> |
497 | 617 | </div> |
498 | 618 | --> |
@@ -534,7 +654,10 @@ discard block |
||
534 | 654 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
535 | 655 | ?> |
536 | 656 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
537 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
657 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
658 | + print $source['port']; |
|
659 | +} |
|
660 | +?>" /></td> |
|
538 | 661 | <?php |
539 | 662 | } else { |
540 | 663 | $hostport = explode(':',$source['host']); |
@@ -553,36 +676,114 @@ discard block |
||
553 | 676 | ?> |
554 | 677 | <td> |
555 | 678 | <select name="format[]" id="format"> |
556 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
557 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
558 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
559 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
560 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
561 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
562 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
563 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
564 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
565 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
566 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
567 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
568 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
569 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
570 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
571 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
572 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
573 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
574 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
575 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
576 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
577 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
578 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
679 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
680 | + print 'selected'; |
|
681 | +} |
|
682 | +?>>Auto</option> |
|
683 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
684 | + print 'selected'; |
|
685 | +} |
|
686 | +?>>SBS</option> |
|
687 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
688 | + print 'selected'; |
|
689 | +} |
|
690 | +?>>TSV</option> |
|
691 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
692 | + print 'selected'; |
|
693 | +} |
|
694 | +?>>Raw</option> |
|
695 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
696 | + print 'selected'; |
|
697 | +} |
|
698 | +?>>Dump1090 aircraft.json</option> |
|
699 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
700 | + print 'selected'; |
|
701 | +} |
|
702 | +?>>Planefinder client</option> |
|
703 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
704 | + print 'selected'; |
|
705 | +} |
|
706 | +?>>APRS</option> |
|
707 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
708 | + print 'selected'; |
|
709 | +} |
|
710 | +?>>Radarcape deltadb.txt</option> |
|
711 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
712 | + print 'selected'; |
|
713 | +} |
|
714 | +?>>Vatsim</option> |
|
715 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
716 | + print 'selected'; |
|
717 | +} |
|
718 | +?>>Virtual Radar Server AircraftList.json</option> |
|
719 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
720 | + print 'selected'; |
|
721 | +} |
|
722 | +?>>Virtual Radar Server TCP</option> |
|
723 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
724 | + print 'selected'; |
|
725 | +} |
|
726 | +?>>phpVMS</option> |
|
727 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
728 | + print 'selected'; |
|
729 | +} |
|
730 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
731 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
732 | + print 'selected'; |
|
733 | +} |
|
734 | +?>>Virtual Airlines Manager</option> |
|
735 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
736 | + print 'selected'; |
|
737 | +} |
|
738 | +?>>IVAO</option> |
|
739 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
740 | + print 'selected'; |
|
741 | +} |
|
742 | +?>>FlightGear Multiplayer</option> |
|
743 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
744 | + print 'selected'; |
|
745 | +} |
|
746 | +?>>FlightGear Singleplayer</option> |
|
747 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
748 | + print 'selected'; |
|
749 | +} |
|
750 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
751 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
752 | + print 'selected'; |
|
753 | +} |
|
754 | +?>>ACARS SBS-3 over TCP</option> |
|
755 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
756 | + print 'selected'; |
|
757 | +} |
|
758 | +?>>NMEA AIS over TCP</option> |
|
759 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
760 | + print 'selected'; |
|
761 | +} |
|
762 | +?>>AirWhere website</option> |
|
763 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
764 | + print 'selected'; |
|
765 | +} |
|
766 | +?>>HidnSeek Callback</option> |
|
767 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
768 | + print 'selected'; |
|
769 | +} |
|
770 | +?>>Blitzortung</option> |
|
579 | 771 | </select> |
580 | 772 | </td> |
581 | 773 | <td> |
582 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
774 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
775 | + print $source['name']; |
|
776 | +} |
|
777 | +?>" /> |
|
583 | 778 | </td> |
584 | - <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> |
|
585 | - <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> |
|
779 | + <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']) { |
|
780 | + print 'checked'; |
|
781 | +} |
|
782 | +?> /></td> |
|
783 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
784 | + print 'checked'; |
|
785 | +} |
|
786 | +?> /></td> |
|
586 | 787 | <td> |
587 | 788 | <select name="timezones[]" id="timezones"> |
588 | 789 | <?php |
@@ -592,7 +793,9 @@ discard block |
||
592 | 793 | print '<option selected>'.$timezones.'</option>'; |
593 | 794 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
594 | 795 | print '<option selected>'.$timezones.'</option>'; |
595 | - } else print '<option>'.$timezones.'</option>'; |
|
796 | + } else { |
|
797 | + print '<option>'.$timezones.'</option>'; |
|
798 | + } |
|
596 | 799 | } |
597 | 800 | ?> |
598 | 801 | </select> |
@@ -645,7 +848,9 @@ discard block |
||
645 | 848 | foreach($timezonelist as $timezones){ |
646 | 849 | if ($timezones == 'UTC') { |
647 | 850 | print '<option selected>'.$timezones.'</option>'; |
648 | - } else print '<option>'.$timezones.'</option>'; |
|
851 | + } else { |
|
852 | + print '<option>'.$timezones.'</option>'; |
|
853 | + } |
|
649 | 854 | } |
650 | 855 | ?> |
651 | 856 | </select> |
@@ -670,11 +875,17 @@ discard block |
||
670 | 875 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
671 | 876 | <p> |
672 | 877 | <label for="acarshost">ACARS UDP host</label> |
673 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
878 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
879 | + print $globalACARSHost; |
|
880 | +} |
|
881 | +?>" /> |
|
674 | 882 | </p> |
675 | 883 | <p> |
676 | 884 | <label for="acarsport">ACARS UDP port</label> |
677 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
885 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
886 | + print $globalACARSPort; |
|
887 | +} |
|
888 | +?>" /> |
|
678 | 889 | </p> |
679 | 890 | </fieldset> |
680 | 891 | </div> |
@@ -700,17 +911,38 @@ discard block |
||
700 | 911 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
701 | 912 | <td> |
702 | 913 | <select name="newslang[]"> |
703 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
704 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
914 | + <option value="en"<?php if ($lng == 'en') { |
|
915 | + print ' selected'; |
|
916 | +} |
|
917 | +?>>English</option> |
|
918 | + <option value="fr"<?php if ($lng == 'fr') { |
|
919 | + print ' selected'; |
|
920 | +} |
|
921 | +?>>French</option> |
|
705 | 922 | </select> |
706 | 923 | </td> |
707 | 924 | <td> |
708 | 925 | <select name="newstype[]"> |
709 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
710 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
711 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
712 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
713 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
926 | + <option value="global"<?php if ($type == 'global') { |
|
927 | + print ' selected'; |
|
928 | +} |
|
929 | +?>>Global</option> |
|
930 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
931 | + print ' selected'; |
|
932 | +} |
|
933 | +?>>Aircraft</option> |
|
934 | + <option value="marine"<?php if ($type == 'marine') { |
|
935 | + print ' selected'; |
|
936 | +} |
|
937 | +?>>Marine</option> |
|
938 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
939 | + print ' selected'; |
|
940 | +} |
|
941 | +?>>Tracker</option> |
|
942 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
943 | + print ' selected'; |
|
944 | +} |
|
945 | +?>>Satellite</option> |
|
714 | 946 | </select> |
715 | 947 | </td> |
716 | 948 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -852,13 +1084,19 @@ discard block |
||
852 | 1084 | <div id="schedules_options"> |
853 | 1085 | <p> |
854 | 1086 | <label for="britishairways">British Airways API Key</label> |
855 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
1087 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
1088 | + print $globalBritishAirwaysKey; |
|
1089 | +} |
|
1090 | +?>" /> |
|
856 | 1091 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
857 | 1092 | </p> |
858 | 1093 | <!-- |
859 | 1094 | <p> |
860 | 1095 | <label for="transavia">Transavia Test API Consumer Key</label> |
861 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
1096 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
1097 | + print $globalTransaviaKey; |
|
1098 | +} |
|
1099 | +?>" /> |
|
862 | 1100 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
863 | 1101 | </p> |
864 | 1102 | --> |
@@ -867,10 +1105,16 @@ discard block |
||
867 | 1105 | <b>Lufthansa API Key</b> |
868 | 1106 | <p> |
869 | 1107 | <label for="lufthansakey">Key</label> |
870 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
1108 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
1109 | + print $globalLufthansaKey['key']; |
|
1110 | +} |
|
1111 | +?>" /> |
|
871 | 1112 | </p><p> |
872 | 1113 | <label for="lufthansasecret">Secret</label> |
873 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
1114 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
1115 | + print $globalLufthansaKey['secret']; |
|
1116 | +} |
|
1117 | +?>" /> |
|
874 | 1118 | </p> |
875 | 1119 | </div> |
876 | 1120 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -880,11 +1124,17 @@ discard block |
||
880 | 1124 | <b>FlightAware API Key</b> |
881 | 1125 | <p> |
882 | 1126 | <label for="flightawareusername">Username</label> |
883 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
1127 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
1128 | + print $globalFlightAwareUsername; |
|
1129 | +} |
|
1130 | +?>" /> |
|
884 | 1131 | </p> |
885 | 1132 | <p> |
886 | 1133 | <label for="flightawarepassword">API key</label> |
887 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
1134 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
1135 | + print $globalFlightAwarePassword; |
|
1136 | +} |
|
1137 | +?>" /> |
|
888 | 1138 | </p> |
889 | 1139 | </div> |
890 | 1140 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -901,10 +1151,22 @@ discard block |
||
901 | 1151 | <p> |
902 | 1152 | <label for="mapmatchingsource">Map Matching source</label> |
903 | 1153 | <select name="mapmatchingsource" id="mapmatchingsource"> |
904 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
905 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
906 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
907 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
1154 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
1155 | + print 'selected="selected" '; |
|
1156 | +} |
|
1157 | +?>>FlightAirMap Map Matching</option> |
|
1158 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
1159 | + print 'selected="selected" '; |
|
1160 | +} |
|
1161 | +?>>GraphHopper</option> |
|
1162 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
1163 | + print 'selected="selected" '; |
|
1164 | +} |
|
1165 | +?>>OSMR</option> |
|
1166 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
1167 | + print 'selected="selected" '; |
|
1168 | +} |
|
1169 | +?>>Mapbox</option> |
|
908 | 1170 | </select> |
909 | 1171 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
910 | 1172 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -912,7 +1174,10 @@ discard block |
||
912 | 1174 | <br /> |
913 | 1175 | <p> |
914 | 1176 | <label for="graphhopper">GraphHopper API Key</label> |
915 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
1177 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
1178 | + print $globalGraphHopperKey; |
|
1179 | +} |
|
1180 | +?>" /> |
|
916 | 1181 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
917 | 1182 | </p> |
918 | 1183 | </div> |
@@ -930,7 +1195,10 @@ discard block |
||
930 | 1195 | </p> |
931 | 1196 | <p> |
932 | 1197 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
933 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
1198 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
1199 | + print $globalNOTAMSource; |
|
1200 | +} |
|
1201 | +?>" /> |
|
934 | 1202 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
935 | 1203 | </p> |
936 | 1204 | <br /> |
@@ -946,14 +1214,20 @@ discard block |
||
946 | 1214 | <div id="metarsrc"> |
947 | 1215 | <p> |
948 | 1216 | <label for="metarsource">URL of your METAR source</label> |
949 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
1217 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
1218 | + print $globalMETARurl; |
|
1219 | +} |
|
1220 | +?>" /> |
|
950 | 1221 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
951 | 1222 | </p> |
952 | 1223 | </div> |
953 | 1224 | <br /> |
954 | 1225 | <p> |
955 | 1226 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
956 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
1227 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
1228 | + print $globalBitlyAccessToken; |
|
1229 | +} |
|
1230 | +?>" /> |
|
957 | 1231 | </p> |
958 | 1232 | <br /> |
959 | 1233 | <p> |
@@ -969,11 +1243,26 @@ discard block |
||
969 | 1243 | <p> |
970 | 1244 | <label for="geoid_source">Geoid Source</label> |
971 | 1245 | <select name="geoid_source" id="geoid_source"> |
972 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
973 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
974 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
975 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
976 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
1246 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
1247 | + print ' selected="selected"'; |
|
1248 | +} |
|
1249 | +?>>EGM96 15' (2.1MB)</option> |
|
1250 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
1251 | + print ' selected="selected"'; |
|
1252 | +} |
|
1253 | +?>>EGM96 5' (19MB)</option> |
|
1254 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
1255 | + print ' selected="selected"'; |
|
1256 | +} |
|
1257 | +?>>EGM2008 5' (19MB)</option> |
|
1258 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
1259 | + print ' selected="selected"'; |
|
1260 | +} |
|
1261 | +?>>EGM2008 2.5' (75MB)</option> |
|
1262 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
1263 | + print ' selected="selected"'; |
|
1264 | +} |
|
1265 | +?>>EGM2008 1' (470MB)</option> |
|
977 | 1266 | </select> |
978 | 1267 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
979 | 1268 | </p> |
@@ -995,7 +1284,12 @@ discard block |
||
995 | 1284 | </p> |
996 | 1285 | <p> |
997 | 1286 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
998 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
1287 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
1288 | + print $globalArchiveMonths; |
|
1289 | +} else { |
|
1290 | + echo '1'; |
|
1291 | +} |
|
1292 | +?>" /> |
|
999 | 1293 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
1000 | 1294 | </p> |
1001 | 1295 | <p> |
@@ -1005,12 +1299,22 @@ discard block |
||
1005 | 1299 | </p> |
1006 | 1300 | <p> |
1007 | 1301 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
1008 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
1302 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
1303 | + print $globalArchiveKeepMonths; |
|
1304 | +} else { |
|
1305 | + echo '1'; |
|
1306 | +} |
|
1307 | +?>" /> |
|
1009 | 1308 | <p class="help-block">0 to disable</p> |
1010 | 1309 | </p> |
1011 | 1310 | <p> |
1012 | 1311 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
1013 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
1312 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
1313 | + print $globalArchiveKeepTrackMonths; |
|
1314 | +} else { |
|
1315 | + echo '1'; |
|
1316 | +} |
|
1317 | +?>" /> |
|
1014 | 1318 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
1015 | 1319 | </p> |
1016 | 1320 | <br /> |
@@ -1020,7 +1324,12 @@ discard block |
||
1020 | 1324 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
1021 | 1325 | <div id="cronends"> |
1022 | 1326 | <label for="cronend">Run script for xx seconds</label> |
1023 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
1327 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
1328 | + print $globalCronEnd; |
|
1329 | +} else { |
|
1330 | + print '0'; |
|
1331 | +} |
|
1332 | +?>" /> |
|
1024 | 1333 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
1025 | 1334 | </div> |
1026 | 1335 | </p> |
@@ -1073,20 +1382,40 @@ discard block |
||
1073 | 1382 | <br /> |
1074 | 1383 | <p> |
1075 | 1384 | <label for="refresh">Show flights detected since xxx seconds</label> |
1076 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
1385 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
1386 | + echo $globalLiveInterval; |
|
1387 | +} else { |
|
1388 | + echo '200'; |
|
1389 | +} |
|
1390 | +?>" /> |
|
1077 | 1391 | </p> |
1078 | 1392 | <p> |
1079 | 1393 | <label for="maprefresh">Live map refresh (in seconds)</label> |
1080 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
1394 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
1395 | + echo $globalMapRefresh; |
|
1396 | +} else { |
|
1397 | + echo '30'; |
|
1398 | +} |
|
1399 | +?>" /> |
|
1081 | 1400 | </p> |
1082 | 1401 | <p> |
1083 | 1402 | <label for="mapidle">Map idle timeout (in minutes)</label> |
1084 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
1403 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
1404 | + echo $globalMapIdleTimeout; |
|
1405 | +} else { |
|
1406 | + echo '30'; |
|
1407 | +} |
|
1408 | +?>" /> |
|
1085 | 1409 | <p class="help-block">0 to disable</p> |
1086 | 1410 | </p> |
1087 | 1411 | <p> |
1088 | 1412 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
1089 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
1413 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
1414 | + echo $globalMinFetch; |
|
1415 | +} else { |
|
1416 | + echo '20'; |
|
1417 | +} |
|
1418 | +?>" /> |
|
1090 | 1419 | </p> |
1091 | 1420 | <p> |
1092 | 1421 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1100,12 +1429,20 @@ discard block |
||
1100 | 1429 | <br /> |
1101 | 1430 | <p> |
1102 | 1431 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
1103 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
1432 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
1433 | + echo $globalClosestMinDist; |
|
1434 | +} else { |
|
1435 | + echo '50'; |
|
1436 | +} |
|
1437 | +?>" /> |
|
1104 | 1438 | </p> |
1105 | 1439 | <br /> |
1106 | 1440 | <p> |
1107 | 1441 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
1108 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
1442 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
1443 | + echo $globalAircraftSize; |
|
1444 | +} |
|
1445 | +?>" /> |
|
1109 | 1446 | </p> |
1110 | 1447 | <br /> |
1111 | 1448 | <p> |
@@ -1124,7 +1461,12 @@ discard block |
||
1124 | 1461 | if (extension_loaded('gd') && function_exists('gd_info')) { |
1125 | 1462 | ?> |
1126 | 1463 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
1127 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
1464 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
1465 | + echo $globalAircraftIconColor; |
|
1466 | +} else { |
|
1467 | + echo '1a3151'; |
|
1468 | +} |
|
1469 | +?>" /> |
|
1128 | 1470 | <?php |
1129 | 1471 | if (!is_writable('../cache')) { |
1130 | 1472 | ?> |
@@ -1142,14 +1484,27 @@ discard block |
||
1142 | 1484 | <p> |
1143 | 1485 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
1144 | 1486 | <div class="range"> |
1145 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
1146 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
1487 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
1488 | + echo $globalAirportZoom; |
|
1489 | +} else { |
|
1490 | + echo '7'; |
|
1491 | +} |
|
1492 | +?>" /> |
|
1493 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
1494 | + echo $globalAirportZoom; |
|
1495 | +} else { |
|
1496 | + echo '7'; |
|
1497 | +} |
|
1498 | +?></output> |
|
1147 | 1499 | </div> |
1148 | 1500 | </p> |
1149 | 1501 | <br /> |
1150 | 1502 | <p> |
1151 | 1503 | <label for="customcss">Custom CSS web path</label> |
1152 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
1504 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
1505 | + echo $globalCustomCSS; |
|
1506 | +} |
|
1507 | +?>" /> |
|
1153 | 1508 | </p> |
1154 | 1509 | </fieldset> |
1155 | 1510 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1176,8 +1531,12 @@ discard block |
||
1176 | 1531 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
1177 | 1532 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
1178 | 1533 | |
1179 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
1180 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1534 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
1535 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
1536 | + } |
|
1537 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
1538 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
1539 | + } |
|
1181 | 1540 | |
1182 | 1541 | $_SESSION['database_root'] = $dbroot; |
1183 | 1542 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1245,15 +1604,23 @@ discard block |
||
1245 | 1604 | $source_city = $_POST['source_city']; |
1246 | 1605 | $source_country = $_POST['source_country']; |
1247 | 1606 | $source_ref = $_POST['source_ref']; |
1248 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
1249 | - else $source_id = array(); |
|
1607 | + if (isset($source_id)) { |
|
1608 | + $source_id = $_POST['source_id']; |
|
1609 | + } else { |
|
1610 | + $source_id = array(); |
|
1611 | + } |
|
1250 | 1612 | |
1251 | 1613 | $sources = array(); |
1252 | 1614 | foreach ($source_name as $keys => $name) { |
1253 | - 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]); |
|
1254 | - 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]); |
|
1615 | + if (isset($source_id[$keys])) { |
|
1616 | + $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]); |
|
1617 | + } else { |
|
1618 | + $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]); |
|
1619 | + } |
|
1620 | + } |
|
1621 | + if (count($sources) > 0) { |
|
1622 | + $_SESSION['sources'] = $sources; |
|
1255 | 1623 | } |
1256 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
1257 | 1624 | |
1258 | 1625 | $newsurl = $_POST['newsurl']; |
1259 | 1626 | $newslng = $_POST['newslang']; |
@@ -1266,7 +1633,9 @@ discard block |
||
1266 | 1633 | $lng = $newslng[$newskey]; |
1267 | 1634 | if (isset($newsfeeds[$type][$lng])) { |
1268 | 1635 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
1269 | - } else $newsfeeds[$type][$lng] = array($url); |
|
1636 | + } else { |
|
1637 | + $newsfeeds[$type][$lng] = array($url); |
|
1638 | + } |
|
1270 | 1639 | } |
1271 | 1640 | } |
1272 | 1641 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1290,17 +1659,29 @@ discard block |
||
1290 | 1659 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
1291 | 1660 | |
1292 | 1661 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
1293 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1294 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1662 | + if ($globalaircraft == 'aircraft') { |
|
1663 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
1664 | + } else { |
|
1665 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
1666 | + } |
|
1295 | 1667 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
1296 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1297 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1668 | + if ($globaltracker == 'tracker') { |
|
1669 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
1670 | + } else { |
|
1671 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
1672 | + } |
|
1298 | 1673 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
1299 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1300 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1674 | + if ($globalmarine == 'marine') { |
|
1675 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
1676 | + } else { |
|
1677 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
1678 | + } |
|
1301 | 1679 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
1302 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1303 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1680 | + if ($globalsatellite == 'satellite') { |
|
1681 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
1682 | + } else { |
|
1683 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
1684 | + } |
|
1304 | 1685 | |
1305 | 1686 | /* |
1306 | 1687 | $globalSBS1Hosts = array(); |
@@ -1322,23 +1703,37 @@ discard block |
||
1322 | 1703 | $name = $_POST['name']; |
1323 | 1704 | $format = $_POST['format']; |
1324 | 1705 | $timezones = $_POST['timezones']; |
1325 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
1326 | - else $sourcestats = array(); |
|
1327 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
1328 | - else $noarchive = array(); |
|
1706 | + if (isset($_POST['sourcestats'])) { |
|
1707 | + $sourcestats = $_POST['sourcestats']; |
|
1708 | + } else { |
|
1709 | + $sourcestats = array(); |
|
1710 | + } |
|
1711 | + if (isset($_POST['noarchive'])) { |
|
1712 | + $noarchive = $_POST['noarchive']; |
|
1713 | + } else { |
|
1714 | + $noarchive = array(); |
|
1715 | + } |
|
1329 | 1716 | $gSources = array(); |
1330 | 1717 | $forcepilots = false; |
1331 | 1718 | foreach ($host as $key => $h) { |
1332 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
1333 | - else $cov = 'FALSE'; |
|
1334 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
1335 | - else $arch = 'FALSE'; |
|
1719 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
1720 | + $cov = 'TRUE'; |
|
1721 | + } else { |
|
1722 | + $cov = 'FALSE'; |
|
1723 | + } |
|
1724 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
1725 | + $arch = 'TRUE'; |
|
1726 | + } else { |
|
1727 | + $arch = 'FALSE'; |
|
1728 | + } |
|
1336 | 1729 | if (strpos($format[$key],'_callback')) { |
1337 | 1730 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
1338 | 1731 | } elseif ($h != '' || $name[$key] != '') { |
1339 | 1732 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
1340 | 1733 | } |
1341 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
1734 | + if ($format[$key] == 'airwhere') { |
|
1735 | + $forcepilots = true; |
|
1736 | + } |
|
1342 | 1737 | } |
1343 | 1738 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
1344 | 1739 | |
@@ -1369,7 +1764,9 @@ discard block |
||
1369 | 1764 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
1370 | 1765 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
1371 | 1766 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
1372 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1767 | + } else { |
|
1768 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
1769 | + } |
|
1373 | 1770 | |
1374 | 1771 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
1375 | 1772 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1410,7 +1807,9 @@ discard block |
||
1410 | 1807 | |
1411 | 1808 | // Create in settings.php keys not yet configurable if not already here |
1412 | 1809 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
1413 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1810 | + if (!isset($globalDebug)) { |
|
1811 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
1812 | + } |
|
1414 | 1813 | |
1415 | 1814 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
1416 | 1815 | if ($resetyearstats == 'resetyearstats') { |
@@ -1453,37 +1852,56 @@ discard block |
||
1453 | 1852 | } |
1454 | 1853 | */ |
1455 | 1854 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
1456 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1457 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1458 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1459 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1855 | + if ($globalsbs == 'sbs') { |
|
1856 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
1857 | + } else { |
|
1858 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
1859 | + } |
|
1860 | + if ($globalaprs == 'aprs') { |
|
1861 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
1862 | + } else { |
|
1863 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
1864 | + } |
|
1460 | 1865 | $va = false; |
1461 | 1866 | if ($globalivao == 'ivao') { |
1462 | 1867 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
1463 | 1868 | $va = true; |
1464 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1869 | + } else { |
|
1870 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
1871 | + } |
|
1465 | 1872 | if ($globalvatsim == 'vatsim') { |
1466 | 1873 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
1467 | 1874 | $va = true; |
1468 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1875 | + } else { |
|
1876 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
1877 | + } |
|
1469 | 1878 | if ($globalphpvms == 'phpvms') { |
1470 | 1879 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
1471 | 1880 | $va = true; |
1472 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1881 | + } else { |
|
1882 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
1883 | + } |
|
1473 | 1884 | if ($globalvam == 'vam') { |
1474 | 1885 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
1475 | 1886 | $va = true; |
1476 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1887 | + } else { |
|
1888 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
1889 | + } |
|
1477 | 1890 | if ($va) { |
1478 | 1891 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
1479 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1892 | + } else { |
|
1893 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
1894 | + } |
|
1480 | 1895 | if ($globalva == 'va' || $va) { |
1481 | 1896 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
1482 | 1897 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
1483 | 1898 | } else { |
1484 | 1899 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
1485 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1486 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1900 | + if ($forcepilots) { |
|
1901 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
1902 | + } else { |
|
1903 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
1904 | + } |
|
1487 | 1905 | } |
1488 | 1906 | |
1489 | 1907 | |
@@ -1718,7 +2136,9 @@ discard block |
||
1718 | 2136 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
1719 | 2137 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
1720 | 2138 | |
1721 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2139 | + if (!isset($globalTransaction)) { |
|
2140 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
2141 | + } |
|
1722 | 2142 | |
1723 | 2143 | // Set some defaults values... |
1724 | 2144 | if (!isset($globalAircraftImageSources)) { |
@@ -1733,15 +2153,23 @@ discard block |
||
1733 | 2153 | |
1734 | 2154 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
1735 | 2155 | |
1736 | - if ($error == '') settings::modify_settings($settings); |
|
1737 | - if ($error == '') settings::comment_settings($settings_comment); |
|
2156 | + if ($error == '') { |
|
2157 | + settings::modify_settings($settings); |
|
2158 | + } |
|
2159 | + if ($error == '') { |
|
2160 | + settings::comment_settings($settings_comment); |
|
2161 | + } |
|
1738 | 2162 | if ($error != '') { |
1739 | 2163 | print '<div class="info column">'.$error.'</div>'; |
1740 | 2164 | require('../footer.php'); |
1741 | 2165 | exit; |
1742 | 2166 | } else { |
1743 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
1744 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
2167 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
2168 | + $_SESSION['waypoints'] = 1; |
|
2169 | + } |
|
2170 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
2171 | + $_SESSION['owner'] = 1; |
|
2172 | + } |
|
1745 | 2173 | if (isset($_POST['createdb'])) { |
1746 | 2174 | $_SESSION['install'] = 'database_create'; |
1747 | 2175 | } else { |
@@ -1778,10 +2206,18 @@ discard block |
||
1778 | 2206 | $popw = false; |
1779 | 2207 | foreach ($_SESSION['done'] as $done) { |
1780 | 2208 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
1781 | - if ($done == 'Create database') $pop = true; |
|
1782 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
1783 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
1784 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
2209 | + if ($done == 'Create database') { |
|
2210 | + $pop = true; |
|
2211 | + } |
|
2212 | + if ($_SESSION['install'] == 'database_create') { |
|
2213 | + $pop = true; |
|
2214 | + } |
|
2215 | + if ($_SESSION['install'] == 'database_import') { |
|
2216 | + $popi = true; |
|
2217 | + } |
|
2218 | + if ($_SESSION['install'] == 'waypoints') { |
|
2219 | + $popw = true; |
|
2220 | + } |
|
1785 | 2221 | } |
1786 | 2222 | if ($pop) { |
1787 | 2223 | sleep(5); |
@@ -1792,7 +2228,9 @@ discard block |
||
1792 | 2228 | } else if ($popw) { |
1793 | 2229 | sleep(5); |
1794 | 2230 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
1795 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2231 | + } else { |
|
2232 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
2233 | + } |
|
1796 | 2234 | print '</div></ul>'; |
1797 | 2235 | print '<div id="error"></div>'; |
1798 | 2236 | /* foreach ($_SESSION['done'] as $done) { |