@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Arrival Airports by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Arrival Airports by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | require_once('header.php'); |
14 | 14 | print '<div class="select-item">'; |
15 | 15 | print '<form action="'.$globalURL.'/date" method="post">'; |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | print '</form>'; |
20 | 20 | print '</div>'; |
21 | 21 | print '<div class="info column">'; |
22 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
22 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
23 | 23 | print '</div>'; |
24 | 24 | |
25 | 25 | include('date-sub-menu.php'); |
26 | 26 | print '<div class="column">'; |
27 | 27 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
28 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
28 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
29 | 29 | |
30 | 30 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByDate($date); |
31 | 31 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | ["'._("Country").'", "'._("# of times").'"], '; |
39 | 39 | |
40 | 40 | $country_data = ''; |
41 | - foreach($airport_country_array as $airport_item) |
|
41 | + foreach ($airport_country_array as $airport_item) |
|
42 | 42 | { |
43 | 43 | $country_data .= '[ "'.$airport_item['arrival_airport_country'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
44 | 44 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | print '</thead>'; |
73 | 73 | print '<tbody>'; |
74 | 74 | $i = 1; |
75 | - foreach($airport_country_array as $airport_item) |
|
75 | + foreach ($airport_country_array as $airport_item) |
|
76 | 76 | { |
77 | 77 | print '<tr>'; |
78 | 78 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,16 +3,16 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | 8 | |
9 | 9 | $Spotter = new Spotter(); |
10 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
10 | +if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
11 | 11 | else $spotter_array = array(); |
12 | 12 | |
13 | 13 | if (!empty($spotter_array)) |
14 | 14 | { |
15 | - $title = sprintf(_("Most Common Airlines by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
15 | + $title = sprintf(_("Most Common Airlines by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
16 | 16 | require_once('header.php'); |
17 | 17 | print '<div class="select-item">'; |
18 | 18 | print '<form action="'.$globalURL.'/date" method="post">'; |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | print '</div>'; |
24 | 24 | |
25 | 25 | print '<div class="info column">'; |
26 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
26 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
27 | 27 | print '</div>'; |
28 | 28 | |
29 | 29 | include('date-sub-menu.php'); |
30 | 30 | print '<div class="column">'; |
31 | 31 | print '<h2>'._("Most Common Airlines by Country").'</h2>'; |
32 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
32 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
33 | 33 | |
34 | 34 | $airline_array = $Spotter->countAllAirlineCountriesByDate($date); |
35 | 35 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | var data = google.visualization.arrayToDataTable([ |
42 | 42 | ["'._("Country").'", "'._("# of times").'"], '; |
43 | 43 | $country_data = ''; |
44 | - foreach($airline_array as $airline_item) |
|
44 | + foreach ($airline_array as $airline_item) |
|
45 | 45 | { |
46 | 46 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
47 | 47 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | print '</thead>'; |
76 | 76 | print '<tbody>'; |
77 | 77 | $i = 1; |
78 | - foreach($airline_array as $airline_item) |
|
78 | + foreach ($airline_array as $airline_item) |
|
79 | 79 | { |
80 | 80 | print '<tr>'; |
81 | 81 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,8 +8,11 @@ |
||
8 | 8 | $date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
9 | 9 | |
10 | 10 | $Spotter = new Spotter(); |
11 | -if (isset($_GET['date'])) $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
12 | -else $spotter_array = array(); |
|
11 | +if (isset($_GET['date'])) { |
|
12 | + $spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
13 | +} else { |
|
14 | + $spotter_array = array(); |
|
15 | +} |
|
13 | 16 | |
14 | 17 | if (!empty($spotter_array)) |
15 | 18 | { |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Departure Airports by Country on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Departure Airports by Country on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | |
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Departure Airports by Country").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows all departure airports by Country of origin of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | $airport_country_array = $Spotter->countAllDepartureAirportCountriesByDate($date); |
32 | 32 | print '<script type="text/javascript" src="https://www.google.com/jsapi"></script>'; |
33 | 33 | print '<div id="chartCountry" class="chart" width="100%"></div> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | var data = google.visualization.arrayToDataTable([ |
39 | 39 | ["'._("Country").'", "'._("# of times").'"], '; |
40 | 40 | $country_data = ''; |
41 | - foreach($airport_country_array as $airport_item) |
|
41 | + foreach ($airport_country_array as $airport_item) |
|
42 | 42 | { |
43 | 43 | $country_data .= '[ "'.$airport_item['departure_airport_country'].'",'.$airport_item['airport_departure_country_count'].'],'; |
44 | 44 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | print '</thead>'; |
73 | 73 | print '<tbody>'; |
74 | 74 | $i = 1; |
75 | - foreach($airport_country_array as $airport_item) |
|
75 | + foreach ($airport_country_array as $airport_item) |
|
76 | 76 | { |
77 | 77 | print '<tr>'; |
78 | 78 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Routes on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Routes on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | |
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Routes").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows the most common routes on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows the most common routes on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | |
32 | 32 | $route_array = $Spotter->countAllRoutesByDate($date); |
33 | 33 | if (!empty($route_array)) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | print '</thead>'; |
45 | 45 | print '<tbody>'; |
46 | 46 | $i = 1; |
47 | - foreach($route_array as $route_item) |
|
47 | + foreach ($route_array as $route_item) |
|
48 | 48 | { |
49 | 49 | print '<tr>'; |
50 | 50 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -3,13 +3,13 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | $Spotter = new Spotter(); |
6 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
7 | -$date = filter_input(INPUT_GET,'date',FILTER_SANITIZE_STRING); |
|
8 | -$spotter_array = $Spotter->getSpotterDataByDate($date,"0,1", $sort); |
|
6 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
7 | +$date = filter_input(INPUT_GET, 'date', FILTER_SANITIZE_STRING); |
|
8 | +$spotter_array = $Spotter->getSpotterDataByDate($date, "0,1", $sort); |
|
9 | 9 | |
10 | 10 | if (!empty($spotter_array)) |
11 | 11 | { |
12 | - $title = sprintf(_("Most Common Aircraft Manufacturer on %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
12 | + $title = sprintf(_("Most Common Aircraft Manufacturer on %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))); |
|
13 | 13 | |
14 | 14 | require_once('header.php'); |
15 | 15 | print '<div class="select-item">'; |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | print '</div>'; |
22 | 22 | |
23 | 23 | print '<div class="info column">'; |
24 | - print '<h1>'.sprintf(_("Flights from %s"),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
24 | + print '<h1>'.sprintf(_("Flights from %s"), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</h1>'; |
|
25 | 25 | print '</div>'; |
26 | 26 | |
27 | 27 | include('date-sub-menu.php'); |
28 | 28 | print '<div class="column">'; |
29 | 29 | print '<h2>'._("Most Common Aircraft Manufacturer").'</h2>'; |
30 | - print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."),date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
30 | + print '<p>'.sprintf(_("The statistic below shows the most common Aircraft Manufacturer of flights on <strong>%s</strong>."), date("l F j, Y", strtotime($spotter_array[0]['date_iso_8601']))).'</p>'; |
|
31 | 31 | |
32 | 32 | $manufacturers_array = $Spotter->countAllAircraftManufacturerByDate($date); |
33 | 33 | if (!empty($manufacturers_array)) |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | print '</thead>'; |
43 | 43 | print '<tbody>'; |
44 | 44 | $i = 1; |
45 | - foreach($manufacturers_array as $manufacturer_item) |
|
45 | + foreach ($manufacturers_array as $manufacturer_item) |
|
46 | 46 | { |
47 | 47 | print '<tr>'; |
48 | 48 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -38,8 +38,12 @@ |
||
38 | 38 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
39 | 39 | include('table-output.php'); |
40 | 40 | print '<div class="pagination">'; |
41 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
42 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
41 | + if ($limit_previous_1 >= 0) { |
|
42 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
43 | + } |
|
44 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
45 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
46 | + } |
|
43 | 47 | print '</div>'; |
44 | 48 | } |
45 | 49 | print '</div>'; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $page_url = $globalURL.'/accident-latest'; |
10 | 10 | |
11 | -if(!isset($_GET['limit'])) |
|
11 | +if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | print '<div class="table column">'; |
36 | 36 | print '<p>'._("The table below shows the latest Accidents.").'</p>'; |
37 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'accident'); |
|
37 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'accident'); |
|
38 | 38 | //print_r($spotter_array); |
39 | 39 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
40 | 40 | include('table-output.php'); |
@@ -388,17 +388,17 @@ discard block |
||
388 | 388 | else { |
389 | 389 | $planespotter_url_array = explode("_", $spotter_item['image']); |
390 | 390 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
391 | - $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
|
391 | + $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
|
392 | 392 | } |
393 | 393 | if (isset($spotter_item['airline_name'])) { |
394 | 394 | print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
395 | 395 | } else { |
396 | 396 | print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
397 | 397 | } |
398 | - } else { |
|
399 | - if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
|
400 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
401 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
398 | + } else { |
|
399 | + if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
|
400 | + $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
401 | + } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
402 | 402 | if (isset($spotter_item['airline_name'])) { |
403 | 403 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
404 | 404 | } else { |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | } |
414 | 414 | } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest"){ |
415 | 415 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
416 | - $spotter_item['squawk'] = '-'; |
|
416 | + $spotter_item['squawk'] = '-'; |
|
417 | 417 | } |
418 | 418 | if ($spotter_item['image_thumbnail'] != "") |
419 | 419 | { |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | else { |
425 | 425 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
426 | 426 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
427 | - $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
|
427 | + $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
|
428 | 428 | } |
429 | 429 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
430 | 430 | print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -436,9 +436,9 @@ discard block |
||
436 | 436 | print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
437 | 437 | } |
438 | 438 | } else { |
439 | - if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
|
440 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
441 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
439 | + if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
|
440 | + $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
441 | + } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
442 | 442 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
443 | 443 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
444 | 444 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | print '</td>'."\n"; |
453 | 453 | } else { |
454 | 454 | print '<td class="aircraft_thumbnail">'."\n"; |
455 | - // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
455 | + // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
456 | 456 | //} |
457 | 457 | if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) { |
458 | 458 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n"; |
@@ -557,13 +557,13 @@ discard block |
||
557 | 557 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
558 | 558 | } else $distance = ''; |
559 | 559 | if ($distance != '') { |
560 | - if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
561 | - echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
|
562 | - } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
563 | - echo '<br/><i>'.round($distance*0.621371).' mi</i>'; |
|
564 | - } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
565 | - echo '<br/><i>'.$distance.' km</i>'; |
|
566 | - } |
|
560 | + if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
561 | + echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
|
562 | + } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
563 | + echo '<br/><i>'.round($distance*0.621371).' mi</i>'; |
|
564 | + } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
565 | + echo '<br/><i>'.$distance.' km</i>'; |
|
566 | + } |
|
567 | 567 | } |
568 | 568 | } |
569 | 569 | print '</td>'."\n"; |
@@ -624,13 +624,13 @@ discard block |
||
624 | 624 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
625 | 625 | } else $distance = ''; |
626 | 626 | if ($distance != '') { |
627 | - if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
628 | - echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
|
629 | - } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
630 | - echo '<br/><i>'.round($distance*0.621371).' mi</i>'; |
|
631 | - } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
632 | - echo '<br/><i>'.$distance.' km</i>'; |
|
633 | - } |
|
627 | + if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
628 | + echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
|
629 | + } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
630 | + echo '<br/><i>'.round($distance*0.621371).' mi</i>'; |
|
631 | + } elseif ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
632 | + echo '<br/><i>'.$distance.' km</i>'; |
|
633 | + } |
|
634 | 634 | } |
635 | 635 | } |
636 | 636 | print '</td>'."\n"; |
@@ -365,7 +365,9 @@ discard block |
||
365 | 365 | if (isset($globalTimezone)) |
366 | 366 | { |
367 | 367 | date_default_timezone_set($globalTimezone); |
368 | - } else date_default_timezone_set('UTC'); |
|
368 | + } else { |
|
369 | + date_default_timezone_set('UTC'); |
|
370 | + } |
|
369 | 371 | if ($showSpecial === true) |
370 | 372 | { |
371 | 373 | print '<tr class="special">'."\n"; |
@@ -384,8 +386,9 @@ discard block |
||
384 | 386 | print '<td class="aircraft_thumbnail">'."\n"; |
385 | 387 | |
386 | 388 | if ($spotter_item['image_source'] == 'planespotters') { |
387 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
388 | - else { |
|
389 | + if ($spotter_item['image_source_website'] != '') { |
|
390 | + $image_src = $spotter_item['image_source_website']; |
|
391 | + } else { |
|
389 | 392 | $planespotter_url_array = explode("_", $spotter_item['image']); |
390 | 393 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
391 | 394 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -398,7 +401,9 @@ discard block |
||
398 | 401 | } else { |
399 | 402 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
400 | 403 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
401 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
404 | + } else { |
|
405 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
406 | + } |
|
402 | 407 | if (isset($spotter_item['airline_name'])) { |
403 | 408 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
404 | 409 | } else { |
@@ -420,8 +425,9 @@ discard block |
||
420 | 425 | print '<td class="aircraft_thumbnail">'."\n"; |
421 | 426 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
422 | 427 | if ($spotter_item['image_source'] == 'planespotters') { |
423 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
424 | - else { |
|
428 | + if ($spotter_item['image_source_website'] != '') { |
|
429 | + $image_src = $spotter_item['image_source_website']; |
|
430 | + } else { |
|
425 | 431 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
426 | 432 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
427 | 433 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -438,7 +444,9 @@ discard block |
||
438 | 444 | } else { |
439 | 445 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
440 | 446 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
441 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
447 | + } else { |
|
448 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
449 | + } |
|
442 | 450 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
443 | 451 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
444 | 452 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -525,15 +533,21 @@ discard block |
||
525 | 533 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
526 | 534 | if ($spotter_item['departure_airport_time'] > 2460) { |
527 | 535 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
528 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
536 | + } else { |
|
537 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
538 | + } |
|
529 | 539 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
530 | 540 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
531 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
541 | + } else { |
|
542 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
543 | + } |
|
532 | 544 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
533 | 545 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
534 | 546 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
535 | 547 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
536 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
548 | + } else { |
|
549 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
550 | + } |
|
537 | 551 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
538 | 552 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
539 | 553 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -555,7 +569,9 @@ discard block |
||
555 | 569 | $longitude = $spotter_item['longitude']; |
556 | 570 | } |
557 | 571 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
558 | - } else $distance = ''; |
|
572 | + } else { |
|
573 | + $distance = ''; |
|
574 | + } |
|
559 | 575 | if ($distance != '') { |
560 | 576 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
561 | 577 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -580,7 +596,9 @@ discard block |
||
580 | 596 | } else { |
581 | 597 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
582 | 598 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
583 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
599 | + if (!isset($Spotter)) { |
|
600 | + $Spotter = new Spotter(); |
|
601 | + } |
|
584 | 602 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
585 | 603 | print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
586 | 604 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
@@ -596,20 +614,28 @@ discard block |
||
596 | 614 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
597 | 615 | if ($spotter_item['arrival_airport_time'] > 2460) { |
598 | 616 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
599 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
617 | + } else { |
|
618 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
619 | + } |
|
600 | 620 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
601 | 621 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
602 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
622 | + } else { |
|
623 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
624 | + } |
|
603 | 625 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
604 | 626 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
605 | 627 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
606 | 628 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
607 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
629 | + } else { |
|
630 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
631 | + } |
|
608 | 632 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
609 | 633 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
610 | 634 | if ($spotter_item['arrival_airport_time'] > 2460) { |
611 | 635 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
612 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
636 | + } else { |
|
637 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
638 | + } |
|
613 | 639 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
614 | 640 | } |
615 | 641 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -622,7 +648,9 @@ discard block |
||
622 | 648 | $longitude = $spotter_item['longitude']; |
623 | 649 | } |
624 | 650 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
625 | - } else $distance = ''; |
|
651 | + } else { |
|
652 | + $distance = ''; |
|
653 | + } |
|
626 | 654 | if ($distance != '') { |
627 | 655 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
628 | 656 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | } |
93 | 93 | print '<th class="more"></th>'; |
94 | 94 | print '</thead>'; |
95 | -} else if (strtolower($current_page) == "upcoming"){ |
|
95 | +} else if (strtolower($current_page) == "upcoming") { |
|
96 | 96 | print '<thead>'; |
97 | 97 | if ($_GET['sort'] == "airline_name_asc") |
98 | 98 | { |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | } |
143 | 143 | */ |
144 | 144 | print '</thead>'; |
145 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
145 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
146 | 146 | print '<thead>'; |
147 | 147 | print '<th class="aircraft_thumbnail"></th>'; |
148 | 148 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | print '</thead>'; |
180 | 180 | } else { |
181 | 181 | |
182 | - if ($hide_th_links === true){ |
|
182 | + if ($hide_th_links === true) { |
|
183 | 183 | print '<thead>'; |
184 | 184 | print '<th class="aircraft_thumbnail"></th>'; |
185 | 185 | if ($_GET['sort'] == "airline_name_asc") |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | print '<tbody>'."\n"; |
363 | -foreach($spotter_array as $spotter_item) |
|
363 | +foreach ($spotter_array as $spotter_item) |
|
364 | 364 | { |
365 | 365 | if (isset($globalTimezone)) |
366 | 366 | { |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
392 | 392 | } |
393 | 393 | if (isset($spotter_item['airline_name'])) { |
394 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
394 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
395 | 395 | } else { |
396 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
396 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
397 | 397 | } |
398 | 398 | } else { |
399 | 399 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
400 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
400 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
401 | 401 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
402 | 402 | if (isset($spotter_item['airline_name'])) { |
403 | 403 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | print '<img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" />'."\n"; |
412 | 412 | print '</td>'."\n"; |
413 | 413 | } |
414 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
414 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
415 | 415 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
416 | 416 | $spotter_item['squawk'] = '-'; |
417 | 417 | } |
@@ -427,17 +427,17 @@ discard block |
||
427 | 427 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
428 | 428 | } |
429 | 429 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
430 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
430 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
431 | 431 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
432 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
432 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
433 | 433 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
434 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
434 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
435 | 435 | } else { |
436 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
436 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
437 | 437 | } |
438 | 438 | } else { |
439 | 439 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
440 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
440 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
441 | 441 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
442 | 442 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
443 | 443 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | } |
501 | 501 | print '</td>'."\n"; |
502 | 502 | // Aircraft type |
503 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
503 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
504 | 504 | print '<td class="type">'."\n"; |
505 | 505 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
506 | 506 | print '<span class="nomobile">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</span>'."\n"; |
@@ -524,22 +524,22 @@ discard block |
||
524 | 524 | } |
525 | 525 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
526 | 526 | if ($spotter_item['departure_airport_time'] > 2460) { |
527 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
528 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
527 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
528 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
529 | 529 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
530 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
530 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
531 | 531 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
532 | 532 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
533 | 533 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
534 | 534 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
535 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
535 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
536 | 536 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
537 | 537 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
538 | 538 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
539 | 539 | if ($spotter_item['departure_airport_time'] > 2460) { |
540 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
540 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
541 | 541 | } else { |
542 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
542 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
543 | 543 | } |
544 | 544 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
545 | 545 | } |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | $latitude = $spotter_item['latitude']; |
555 | 555 | $longitude = $spotter_item['longitude']; |
556 | 556 | } |
557 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
557 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
558 | 558 | } else $distance = ''; |
559 | 559 | if ($distance != '') { |
560 | 560 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -595,20 +595,20 @@ discard block |
||
595 | 595 | } |
596 | 596 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
597 | 597 | if ($spotter_item['arrival_airport_time'] > 2460) { |
598 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
598 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
599 | 599 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
600 | 600 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
601 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
601 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
602 | 602 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
603 | 603 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
604 | 604 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
605 | 605 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
606 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
606 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
607 | 607 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
608 | 608 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
609 | 609 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
610 | 610 | if ($spotter_item['arrival_airport_time'] > 2460) { |
611 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
611 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
612 | 612 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
613 | 613 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
614 | 614 | } |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | $latitude = $spotter_item['latitude']; |
622 | 622 | $longitude = $spotter_item['longitude']; |
623 | 623 | } |
624 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
624 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
625 | 625 | } else $distance = ''; |
626 | 626 | if ($distance != '') { |
627 | 627 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | } |
636 | 636 | print '</td>'."\n"; |
637 | 637 | // Route stop |
638 | - if(strtolower($current_page) != "upcoming"){ |
|
638 | + if (strtolower($current_page) != "upcoming") { |
|
639 | 639 | print '<td class="route_stop">'."\n"; |
640 | 640 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
641 | 641 | print '<span class="nomobile">-</span>'."\n"; |
@@ -659,21 +659,21 @@ discard block |
||
659 | 659 | } else { |
660 | 660 | //if (!isset($globalUnitDistance) || $globalUnitDistance == 'km') { |
661 | 661 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
662 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
663 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
662 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
663 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
664 | 664 | //} elseif ($globalUnitDistance == 'mi') { |
665 | 665 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
666 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
667 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
666 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
667 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
668 | 668 | //} elseif ($globalUnitDistance == 'nm') { |
669 | 669 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
670 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
671 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
670 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
671 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
672 | 672 | } |
673 | 673 | } |
674 | 674 | print '</td>'."\n"; |
675 | 675 | } |
676 | - if(strtolower($current_page) != "upcoming"){ |
|
676 | + if (strtolower($current_page) != "upcoming") { |
|
677 | 677 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
678 | 678 | print '<td class="pilot">'."\n"; |
679 | 679 | if ((!isset($spotter_item['pilot_id']) || $spotter_item['pilot_id'] == '') && (!isset($spotter_item['pilot_name']) || $spotter_item['pilot_name'] == '')) { |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
709 | 709 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
710 | 710 | print '<td class="message"><p>'."\n"; |
711 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
711 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
712 | 712 | print '</p><p class="decode">'; |
713 | 713 | $decode_array = json_decode($spotter_item['decode']); |
714 | 714 | foreach ($decode_array as $key => $value) { |
@@ -718,7 +718,7 @@ discard block |
||
718 | 718 | print '</td>'."\n"; |
719 | 719 | } else { |
720 | 720 | print '<td class="message">'."\n"; |
721 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
721 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
722 | 722 | print '</td>'."\n"; |
723 | 723 | } |
724 | 724 | } |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | } |
744 | 744 | print '</td>'."\n"; |
745 | 745 | print '<td class="message">'."\n"; |
746 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
746 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
747 | 747 | print '</td>'."\n"; |
748 | 748 | } |
749 | 749 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | print '</td>'."\n"; |
770 | 770 | */ |
771 | 771 | print '<td class="message">'."\n"; |
772 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
772 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
773 | 773 | print '</td>'."\n"; |
774 | 774 | } |
775 | 775 | // Date |
@@ -38,8 +38,12 @@ |
||
38 | 38 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
39 | 39 | include('table-output.php'); |
40 | 40 | print '<div class="pagination">'; |
41 | - if ($limit_previous_1 >= 0) print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
42 | - if ($spotter_array[0]['query_number_rows'] == $absolute_difference) print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
41 | + if ($limit_previous_1 >= 0) { |
|
42 | + print '<a href="'.$page_url.'/'.$limit_previous_1.','.$limit_previous_2.'">«'._("Previous Page").'</a>'; |
|
43 | + } |
|
44 | + if ($spotter_array[0]['query_number_rows'] == $absolute_difference) { |
|
45 | + print '<a href="'.$page_url.'/'.$limit_end.','.$limit_next.'">'._("Next Page").'»</a>'; |
|
46 | + } |
|
43 | 47 | print '</div>'; |
44 | 48 | } |
45 | 49 | print '</div>'; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | |
9 | 9 | $page_url = $globalURL.'/accident-latest'; |
10 | 10 | |
11 | -if(!isset($_GET['limit'])) |
|
11 | +if (!isset($_GET['limit'])) |
|
12 | 12 | { |
13 | 13 | $limit_start = 0; |
14 | 14 | $limit_end = 25; |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | |
35 | 35 | print '<div class="table column">'; |
36 | 36 | print '<p>'._("The table below shows the latest Incidents.").'</p>'; |
37 | -$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference,'incident'); |
|
37 | +$spotter_array = $Accident->getAccidentData($limit_start.",".$absolute_difference, 'incident'); |
|
38 | 38 | //print_r($spotter_array); |
39 | 39 | if (!empty($spotter_array) && $spotter_array[0]['query_number_rows'] != 0) { |
40 | 40 | include('table-output.php'); |
@@ -7,109 +7,109 @@ discard block |
||
7 | 7 | public $db; |
8 | 8 | |
9 | 9 | protected $texts = Array( |
10 | - 'MI' => 'Shallow', |
|
11 | - 'PR' => 'Partial', |
|
12 | - 'BC' => 'Low drifting', |
|
13 | - 'BL' => 'Blowing', |
|
14 | - 'SH' => 'Showers', |
|
15 | - 'TS' => 'Thunderstorm', |
|
16 | - 'FZ' => 'Freezing', |
|
17 | - 'DZ' => 'Drizzle', |
|
18 | - 'RA' => 'Rain', |
|
19 | - 'SN' => 'Snow', |
|
20 | - 'SG' => 'Snow Grains', |
|
21 | - 'IC' => 'Ice crystals', |
|
22 | - 'PL' => 'Ice pellets', |
|
23 | - 'GR' => 'Hail', |
|
24 | - 'GS' => 'Small hail', |
|
25 | - 'UP' => 'Unknown', |
|
26 | - 'BR' => 'Mist', |
|
27 | - 'FG' => 'Fog', |
|
28 | - 'FU' => 'Smoke', |
|
29 | - 'VA' => 'Volcanic ash', |
|
30 | - 'DU' => 'Widespread dust', |
|
31 | - 'SA' => 'Sand', |
|
32 | - 'HZ' => 'Haze', |
|
33 | - 'PY' => 'Spray', |
|
34 | - 'PO' => 'Well developed dust / sand whirls', |
|
35 | - 'SQ' => 'Squalls', |
|
36 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
37 | - 'SS' => 'Sandstorm', |
|
38 | - 'DS' => 'Duststorm' |
|
10 | + 'MI' => 'Shallow', |
|
11 | + 'PR' => 'Partial', |
|
12 | + 'BC' => 'Low drifting', |
|
13 | + 'BL' => 'Blowing', |
|
14 | + 'SH' => 'Showers', |
|
15 | + 'TS' => 'Thunderstorm', |
|
16 | + 'FZ' => 'Freezing', |
|
17 | + 'DZ' => 'Drizzle', |
|
18 | + 'RA' => 'Rain', |
|
19 | + 'SN' => 'Snow', |
|
20 | + 'SG' => 'Snow Grains', |
|
21 | + 'IC' => 'Ice crystals', |
|
22 | + 'PL' => 'Ice pellets', |
|
23 | + 'GR' => 'Hail', |
|
24 | + 'GS' => 'Small hail', |
|
25 | + 'UP' => 'Unknown', |
|
26 | + 'BR' => 'Mist', |
|
27 | + 'FG' => 'Fog', |
|
28 | + 'FU' => 'Smoke', |
|
29 | + 'VA' => 'Volcanic ash', |
|
30 | + 'DU' => 'Widespread dust', |
|
31 | + 'SA' => 'Sand', |
|
32 | + 'HZ' => 'Haze', |
|
33 | + 'PY' => 'Spray', |
|
34 | + 'PO' => 'Well developed dust / sand whirls', |
|
35 | + 'SQ' => 'Squalls', |
|
36 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
37 | + 'SS' => 'Sandstorm', |
|
38 | + 'DS' => 'Duststorm' |
|
39 | 39 | ); |
40 | 40 | |
41 | 41 | public function __construct($dbc = null) { |
42 | - $Connection = new Connection($dbc); |
|
43 | - $this->db = $Connection->db; |
|
44 | - } |
|
42 | + $Connection = new Connection($dbc); |
|
43 | + $this->db = $Connection->db; |
|
44 | + } |
|
45 | 45 | |
46 | - public static function check_last_update() { |
|
47 | - global $globalDBdriver; |
|
48 | - if ($globalDBdriver == 'mysql') { |
|
46 | + public static function check_last_update() { |
|
47 | + global $globalDBdriver; |
|
48 | + if ($globalDBdriver == 'mysql') { |
|
49 | 49 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)"; |
50 | 50 | } else { |
51 | 51 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'"; |
52 | 52 | } |
53 | - try { |
|
54 | - $Connection = new Connection(); |
|
55 | - $sth = $Connection->db->prepare($query); |
|
56 | - $sth->execute(); |
|
57 | - } catch(PDOException $e) { |
|
58 | - return "error : ".$e->getMessage(); |
|
59 | - } |
|
60 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
61 | - $sth->closeCursor(); |
|
62 | - if ($row['nb'] > 0) return false; |
|
63 | - else return true; |
|
64 | - } |
|
53 | + try { |
|
54 | + $Connection = new Connection(); |
|
55 | + $sth = $Connection->db->prepare($query); |
|
56 | + $sth->execute(); |
|
57 | + } catch(PDOException $e) { |
|
58 | + return "error : ".$e->getMessage(); |
|
59 | + } |
|
60 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
61 | + $sth->closeCursor(); |
|
62 | + if ($row['nb'] > 0) return false; |
|
63 | + else return true; |
|
64 | + } |
|
65 | 65 | |
66 | - public static function insert_last_update() { |
|
67 | - $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
66 | + public static function insert_last_update() { |
|
67 | + $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
68 | 68 | INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());"; |
69 | - try { |
|
70 | - $Connection = new Connection(); |
|
71 | - $sth = $Connection->db->prepare($query); |
|
72 | - $sth->execute(); |
|
73 | - } catch(PDOException $e) { |
|
74 | - return "error : ".$e->getMessage(); |
|
75 | - } |
|
76 | - } |
|
69 | + try { |
|
70 | + $Connection = new Connection(); |
|
71 | + $sth = $Connection->db->prepare($query); |
|
72 | + $sth->execute(); |
|
73 | + } catch(PDOException $e) { |
|
74 | + return "error : ".$e->getMessage(); |
|
75 | + } |
|
76 | + } |
|
77 | 77 | |
78 | 78 | |
79 | 79 | |
80 | - public function parse($data) { |
|
81 | - //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
82 | - $codes = implode('|', array_keys($this->texts)); |
|
83 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
84 | - //$pieces = explode(' ',$data); |
|
85 | - $pieces = preg_split('/\s/',$data); |
|
86 | - $pos = 0; |
|
87 | - if ($pieces[0] == 'METAR') $pos++; |
|
88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | - $result = array(); |
|
91 | - $result['location'] = $pieces[$pos]; |
|
92 | - $pos++; |
|
93 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
94 | - $result['time'] = substr($pieces[$pos],2,4); |
|
95 | - $c = count($pieces); |
|
96 | - for($pos++; $pos < $c; $pos++) { |
|
97 | - $piece = $pieces[$pos]; |
|
98 | - if ($piece == 'RMK') break; |
|
99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | - if ($piece == 'COR') $result['correction'] = true; |
|
101 | - // Wind Speed |
|
102 | - if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
103 | - $result['wind']['direction'] = (float)$matches[1]; |
|
80 | + public function parse($data) { |
|
81 | + //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
82 | + $codes = implode('|', array_keys($this->texts)); |
|
83 | + $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
84 | + //$pieces = explode(' ',$data); |
|
85 | + $pieces = preg_split('/\s/',$data); |
|
86 | + $pos = 0; |
|
87 | + if ($pieces[0] == 'METAR') $pos++; |
|
88 | + elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | + $result = array(); |
|
91 | + $result['location'] = $pieces[$pos]; |
|
92 | + $pos++; |
|
93 | + $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
94 | + $result['time'] = substr($pieces[$pos],2,4); |
|
95 | + $c = count($pieces); |
|
96 | + for($pos++; $pos < $c; $pos++) { |
|
97 | + $piece = $pieces[$pos]; |
|
98 | + if ($piece == 'RMK') break; |
|
99 | + if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | + if ($piece == 'COR') $result['correction'] = true; |
|
101 | + // Wind Speed |
|
102 | + if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
103 | + $result['wind']['direction'] = (float)$matches[1]; |
|
104 | 104 | $result['wind']['unit'] = $matches[4]; |
105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
105 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
108 | 108 | $result['wind']['gust'] = (float)$matches[3]; |
109 | 109 | $result['wind']['unit'] = $matches[4]; |
110 | 110 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
111 | 111 | $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
112 | - } |
|
112 | + } |
|
113 | 113 | |
114 | 114 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
115 | 115 | $result['wind_direction'] = (float)$matches[1]; |
@@ -126,35 +126,35 @@ discard block |
||
126 | 126 | } |
127 | 127 | } |
128 | 128 | */ |
129 | - // Temperature |
|
130 | - if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
131 | - $temp = (float)$matches[1]; |
|
129 | + // Temperature |
|
130 | + if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
131 | + $temp = (float)$matches[1]; |
|
132 | 132 | if ($matches[1]{0} == 'M') { |
133 | 133 | $temp = ((float)substr($matches[1], 1)) * -1; |
134 | 134 | } |
135 | - $result['temperature'] = $temp; |
|
136 | - $dew = (float)$matches[2]; |
|
135 | + $result['temperature'] = $temp; |
|
136 | + $dew = (float)$matches[2]; |
|
137 | 137 | if ($matches[2]{0} == 'M') { |
138 | 138 | $dew = ((float)substr($matches[2], 1)) * -1; |
139 | 139 | } |
140 | 140 | $result['dew'] = $dew; |
141 | - } |
|
142 | - // QNH |
|
143 | - if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
144 | - // #^(Q|A)(////|[0-9]{4})( )# |
|
145 | - if ($matches[1] == 'Q') { |
|
146 | - // hPa |
|
147 | - $result['QNH'] = $matches[2]; |
|
148 | - } else { |
|
149 | - // inHg |
|
150 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
151 | 141 | } |
152 | - /* |
|
142 | + // QNH |
|
143 | + if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
144 | + // #^(Q|A)(////|[0-9]{4})( )# |
|
145 | + if ($matches[1] == 'Q') { |
|
146 | + // hPa |
|
147 | + $result['QNH'] = $matches[2]; |
|
148 | + } else { |
|
149 | + // inHg |
|
150 | + $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
151 | + } |
|
152 | + /* |
|
153 | 153 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
154 | 154 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
155 | 155 | */ |
156 | - } |
|
157 | - /* |
|
156 | + } |
|
157 | + /* |
|
158 | 158 | // Wind Direction |
159 | 159 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
160 | 160 | $result['wind_direction'] = $matches[1]; |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | $result['speed_variable'] = $matches[1]; |
166 | 166 | } |
167 | 167 | */ |
168 | - // Visibility |
|
169 | - if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
170 | - if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
168 | + // Visibility |
|
169 | + if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
170 | + if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
171 | 171 | $result['visibility'] = (float)$matches[3] * 1609.34; |
172 | 172 | } else { |
173 | 173 | if ($matches[1] == '9999') { |
@@ -180,28 +180,28 @@ discard block |
||
180 | 180 | $result['visibility'] = '> 10000'; |
181 | 181 | $result['weather'] = "CAVOK"; |
182 | 182 | } |
183 | - } |
|
184 | - // Cloud Coverage |
|
185 | - if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
186 | - //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
187 | - $type = $matches[1]; |
|
188 | - $cloud = array(); |
|
189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
197 | - $cloud['type_code'] = $type; |
|
198 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
199 | - $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
200 | - $result['cloud'][] = $cloud; |
|
201 | - } |
|
202 | - // RVR |
|
203 | - if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
204 | - $rvr = array(); |
|
183 | + } |
|
184 | + // Cloud Coverage |
|
185 | + if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
186 | + //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
187 | + $type = $matches[1]; |
|
188 | + $cloud = array(); |
|
189 | + if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | + elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | + elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | + elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | + elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | + elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | + elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | + elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
197 | + $cloud['type_code'] = $type; |
|
198 | + $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
199 | + $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
200 | + $result['cloud'][] = $cloud; |
|
201 | + } |
|
202 | + // RVR |
|
203 | + if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
204 | + $rvr = array(); |
|
205 | 205 | $rvr['runway'] = $matches[1]; |
206 | 206 | $rvr['assessment'] = $matches[2]; |
207 | 207 | $rvr['rvr'] = $matches[3]; |
@@ -210,33 +210,33 @@ discard block |
||
210 | 210 | $result['RVR'] = $rvr; |
211 | 211 | } |
212 | 212 | |
213 | - //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
214 | - if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
215 | - //print_r($matches); |
|
216 | - // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
217 | - $result['RVR']['runway'] = $matches[1]; |
|
218 | - $result['RVR']['deposits'] = $matches[2]; |
|
219 | - $result['RVR']['extent'] = $matches[3]; |
|
220 | - $result['RVR']['depth'] = $matches[4]; |
|
221 | - $result['RVR']['friction'] = $matches[5]; |
|
222 | - } |
|
223 | - if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
224 | - //echo $piece; |
|
225 | - //print_r($matches); |
|
226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
213 | + //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
214 | + if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
215 | + //print_r($matches); |
|
216 | + // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
217 | + $result['RVR']['runway'] = $matches[1]; |
|
218 | + $result['RVR']['deposits'] = $matches[2]; |
|
219 | + $result['RVR']['extent'] = $matches[3]; |
|
220 | + $result['RVR']['depth'] = $matches[4]; |
|
221 | + $result['RVR']['friction'] = $matches[5]; |
|
222 | + } |
|
223 | + if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
224 | + //echo $piece; |
|
225 | + //print_r($matches); |
|
226 | + if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | + else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
228 | 228 | if (isset($matches[3])) { |
229 | 229 | $range = Array( |
230 | - 'from' => (float)$matches[2], |
|
231 | - 'to' => (float)$matches[4], |
|
232 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
230 | + 'from' => (float)$matches[2], |
|
231 | + 'to' => (float)$matches[4], |
|
232 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
233 | 233 | ); |
234 | 234 | } |
235 | 235 | $result['RVR'] = $matches[1]; |
236 | 236 | $result['RVR_range'] = $range; |
237 | - } |
|
238 | - // Weather |
|
239 | - if (preg_match($regWeather, $piece, $matches)) { |
|
237 | + } |
|
238 | + // Weather |
|
239 | + if (preg_match($regWeather, $piece, $matches)) { |
|
240 | 240 | $text = Array(); |
241 | 241 | switch ($matches[1]) { |
242 | 242 | case '+': |
@@ -259,35 +259,35 @@ discard block |
||
259 | 259 | } |
260 | 260 | if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
261 | 261 | else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
262 | - } |
|
263 | - } |
|
264 | - return $result; |
|
262 | + } |
|
263 | + } |
|
264 | + return $result; |
|
265 | 265 | |
266 | - } |
|
266 | + } |
|
267 | 267 | |
268 | 268 | public function getMETAR($icao) { |
269 | - global $globalMETARcycle, $globalDBdriver; |
|
270 | - if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
271 | - $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
272 | - } else { |
|
273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
275 | - } |
|
276 | - $query_values = array(':icao' => $icao); |
|
277 | - try { |
|
278 | - $sth = $this->db->prepare($query); |
|
279 | - $sth->execute($query_values); |
|
280 | - } catch(PDOException $e) { |
|
281 | - return "error : ".$e->getMessage(); |
|
282 | - } |
|
283 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
284 | - if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
285 | - $all = $this->downloadMETAR($icao); |
|
286 | - } |
|
287 | - return $all; |
|
288 | - } |
|
269 | + global $globalMETARcycle, $globalDBdriver; |
|
270 | + if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
271 | + $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
272 | + } else { |
|
273 | + if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | + else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
275 | + } |
|
276 | + $query_values = array(':icao' => $icao); |
|
277 | + try { |
|
278 | + $sth = $this->db->prepare($query); |
|
279 | + $sth->execute($query_values); |
|
280 | + } catch(PDOException $e) { |
|
281 | + return "error : ".$e->getMessage(); |
|
282 | + } |
|
283 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
284 | + if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
285 | + $all = $this->downloadMETAR($icao); |
|
286 | + } |
|
287 | + return $all; |
|
288 | + } |
|
289 | 289 | |
290 | - public function addMETAR($location,$metar,$date) { |
|
290 | + public function addMETAR($location,$metar,$date) { |
|
291 | 291 | global $globalDBdriver; |
292 | 292 | $date = date('Y-m-d H:i:s',strtotime($date)); |
293 | 293 | if ($globalDBdriver == 'mysql') { |
@@ -295,104 +295,104 @@ discard block |
||
295 | 295 | } else { |
296 | 296 | $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);"; |
297 | 297 | } |
298 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
299 | - try { |
|
300 | - $sth = $this->db->prepare($query); |
|
301 | - $sth->execute($query_values); |
|
302 | - } catch(PDOException $e) { |
|
303 | - return "error : ".$e->getMessage(); |
|
304 | - } |
|
305 | - } |
|
298 | + $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
299 | + try { |
|
300 | + $sth = $this->db->prepare($query); |
|
301 | + $sth->execute($query_values); |
|
302 | + } catch(PDOException $e) { |
|
303 | + return "error : ".$e->getMessage(); |
|
304 | + } |
|
305 | + } |
|
306 | 306 | |
307 | - public function deleteMETAR($id) { |
|
308 | - $query = "DELETE FROM metar WHERE id = :id"; |
|
309 | - $query_values = array(':id' => $id); |
|
310 | - try { |
|
311 | - $sth = $this->db->prepare($query); |
|
312 | - $sth->execute($query_values); |
|
313 | - } catch(PDOException $e) { |
|
314 | - return "error : ".$e->getMessage(); |
|
315 | - } |
|
316 | - } |
|
317 | - public function deleteAllMETARLocation() { |
|
318 | - $query = "DELETE FROM metar"; |
|
319 | - try { |
|
320 | - $sth = $this->db->prepare($query); |
|
321 | - $sth->execute(); |
|
322 | - } catch(PDOException $e) { |
|
323 | - return "error : ".$e->getMessage(); |
|
324 | - } |
|
325 | - } |
|
307 | + public function deleteMETAR($id) { |
|
308 | + $query = "DELETE FROM metar WHERE id = :id"; |
|
309 | + $query_values = array(':id' => $id); |
|
310 | + try { |
|
311 | + $sth = $this->db->prepare($query); |
|
312 | + $sth->execute($query_values); |
|
313 | + } catch(PDOException $e) { |
|
314 | + return "error : ".$e->getMessage(); |
|
315 | + } |
|
316 | + } |
|
317 | + public function deleteAllMETARLocation() { |
|
318 | + $query = "DELETE FROM metar"; |
|
319 | + try { |
|
320 | + $sth = $this->db->prepare($query); |
|
321 | + $sth->execute(); |
|
322 | + } catch(PDOException $e) { |
|
323 | + return "error : ".$e->getMessage(); |
|
324 | + } |
|
325 | + } |
|
326 | 326 | |
327 | - public function addMETARCycle() { |
|
328 | - global $globalDebug, $globalIVAO; |
|
329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
330 | - date_default_timezone_set("UTC"); |
|
331 | - $Common = new Common(); |
|
332 | - if (isset($globalIVAO) && $globalIVAO) { |
|
333 | - //$cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
327 | + public function addMETARCycle() { |
|
328 | + global $globalDebug, $globalIVAO; |
|
329 | + if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
330 | + date_default_timezone_set("UTC"); |
|
331 | + $Common = new Common(); |
|
332 | + if (isset($globalIVAO) && $globalIVAO) { |
|
333 | + //$cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
334 | 334 | $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
335 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
336 | - } else { |
|
335 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
336 | + } else { |
|
337 | 337 | //$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT'); |
338 | 338 | $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
339 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
340 | - } |
|
341 | - if ($handle) { |
|
339 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
340 | + } |
|
341 | + if ($handle) { |
|
342 | 342 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
343 | 343 | $date = ''; |
344 | - //foreach(explode("\n",$cycle) as $line) { |
|
345 | - while(($line = fgets($handle,4096)) !== false) { |
|
344 | + //foreach(explode("\n",$cycle) as $line) { |
|
345 | + while(($line = fgets($handle,4096)) !== false) { |
|
346 | 346 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
347 | 347 | $date = $line; |
348 | - } elseif ($line != '') { |
|
349 | - //$this->parse($line); |
|
350 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
351 | - $pos = 0; |
|
352 | - $pieces = preg_split('/\s/',$line); |
|
353 | - if ($pieces[0] == 'METAR') $pos++; |
|
354 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
355 | - $location = $pieces[$pos]; |
|
356 | - echo $this->addMETAR($location,$line,$date); |
|
357 | - } |
|
358 | - } |
|
359 | - fclose($handle); |
|
360 | - } |
|
361 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
348 | + } elseif ($line != '') { |
|
349 | + //$this->parse($line); |
|
350 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
351 | + $pos = 0; |
|
352 | + $pieces = preg_split('/\s/',$line); |
|
353 | + if ($pieces[0] == 'METAR') $pos++; |
|
354 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
355 | + $location = $pieces[$pos]; |
|
356 | + echo $this->addMETAR($location,$line,$date); |
|
357 | + } |
|
358 | + } |
|
359 | + fclose($handle); |
|
360 | + } |
|
361 | + if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
362 | 362 | |
363 | - } |
|
364 | - public function downloadMETAR($icao) { |
|
365 | - global $globalMETARurl; |
|
366 | - if ($globalMETARurl == '') return array(); |
|
367 | - date_default_timezone_set("UTC"); |
|
368 | - $Common = new Common(); |
|
369 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
370 | - $cycle = $Common->getData($url); |
|
371 | - $date = ''; |
|
372 | - foreach(explode("\n",$cycle) as $line) { |
|
373 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
374 | - //echo "date : ".$line."\n"; |
|
375 | - $date = $line; |
|
376 | - } |
|
377 | - if ($line != '') { |
|
378 | - //$this->parse($line); |
|
379 | - //echo $line; |
|
380 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
381 | - $pos = 0; |
|
382 | - $pieces = preg_split('/\s/',$line); |
|
383 | - if ($pieces[0] == 'METAR') $pos++; |
|
384 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
385 | - $location = $pieces[$pos]; |
|
386 | - if (strlen($location == 4)) { |
|
387 | - $this->addMETAR($location,$line,$date); |
|
388 | - return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
389 | - } else return array(); |
|
390 | - } |
|
391 | - //echo $line."\n"; |
|
392 | - } |
|
393 | - return array(); |
|
363 | + } |
|
364 | + public function downloadMETAR($icao) { |
|
365 | + global $globalMETARurl; |
|
366 | + if ($globalMETARurl == '') return array(); |
|
367 | + date_default_timezone_set("UTC"); |
|
368 | + $Common = new Common(); |
|
369 | + $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
370 | + $cycle = $Common->getData($url); |
|
371 | + $date = ''; |
|
372 | + foreach(explode("\n",$cycle) as $line) { |
|
373 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
374 | + //echo "date : ".$line."\n"; |
|
375 | + $date = $line; |
|
376 | + } |
|
377 | + if ($line != '') { |
|
378 | + //$this->parse($line); |
|
379 | + //echo $line; |
|
380 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
381 | + $pos = 0; |
|
382 | + $pieces = preg_split('/\s/',$line); |
|
383 | + if ($pieces[0] == 'METAR') $pos++; |
|
384 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
385 | + $location = $pieces[$pos]; |
|
386 | + if (strlen($location == 4)) { |
|
387 | + $this->addMETAR($location,$line,$date); |
|
388 | + return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
389 | + } else return array(); |
|
390 | + } |
|
391 | + //echo $line."\n"; |
|
392 | + } |
|
393 | + return array(); |
|
394 | 394 | |
395 | - } |
|
395 | + } |
|
396 | 396 | } |
397 | 397 | /* |
398 | 398 | $METAR = new METAR(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | $Connection = new Connection(); |
55 | 55 | $sth = $Connection->db->prepare($query); |
56 | 56 | $sth->execute(); |
57 | - } catch(PDOException $e) { |
|
57 | + } catch (PDOException $e) { |
|
58 | 58 | return "error : ".$e->getMessage(); |
59 | 59 | } |
60 | 60 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | $Connection = new Connection(); |
71 | 71 | $sth = $Connection->db->prepare($query); |
72 | 72 | $sth->execute(); |
73 | - } catch(PDOException $e) { |
|
73 | + } catch (PDOException $e) { |
|
74 | 74 | return "error : ".$e->getMessage(); |
75 | 75 | } |
76 | 76 | } |
@@ -80,9 +80,9 @@ discard block |
||
80 | 80 | public function parse($data) { |
81 | 81 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
82 | 82 | $codes = implode('|', array_keys($this->texts)); |
83 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
83 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
84 | 84 | //$pieces = explode(' ',$data); |
85 | - $pieces = preg_split('/\s/',$data); |
|
85 | + $pieces = preg_split('/\s/', $data); |
|
86 | 86 | $pos = 0; |
87 | 87 | if ($pieces[0] == 'METAR') $pos++; |
88 | 88 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -90,25 +90,25 @@ discard block |
||
90 | 90 | $result = array(); |
91 | 91 | $result['location'] = $pieces[$pos]; |
92 | 92 | $pos++; |
93 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
94 | - $result['time'] = substr($pieces[$pos],2,4); |
|
93 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
94 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
95 | 95 | $c = count($pieces); |
96 | - for($pos++; $pos < $c; $pos++) { |
|
96 | + for ($pos++; $pos < $c; $pos++) { |
|
97 | 97 | $piece = $pieces[$pos]; |
98 | 98 | if ($piece == 'RMK') break; |
99 | 99 | if ($piece == 'AUTO') $result['auto'] = true; |
100 | 100 | if ($piece == 'COR') $result['correction'] = true; |
101 | 101 | // Wind Speed |
102 | 102 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
103 | - $result['wind']['direction'] = (float)$matches[1]; |
|
103 | + $result['wind']['direction'] = (float) $matches[1]; |
|
104 | 104 | $result['wind']['unit'] = $matches[4]; |
105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
108 | - $result['wind']['gust'] = (float)$matches[3]; |
|
105 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
106 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
107 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
108 | + $result['wind']['gust'] = (float) $matches[3]; |
|
109 | 109 | $result['wind']['unit'] = $matches[4]; |
110 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
111 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
110 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
111 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | */ |
129 | 129 | // Temperature |
130 | 130 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
131 | - $temp = (float)$matches[1]; |
|
131 | + $temp = (float) $matches[1]; |
|
132 | 132 | if ($matches[1]{0} == 'M') { |
133 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
133 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
134 | 134 | } |
135 | 135 | $result['temperature'] = $temp; |
136 | - $dew = (float)$matches[2]; |
|
136 | + $dew = (float) $matches[2]; |
|
137 | 137 | if ($matches[2]{0} == 'M') { |
138 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
138 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
139 | 139 | } |
140 | 140 | $result['dew'] = $dew; |
141 | 141 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $result['QNH'] = $matches[2]; |
148 | 148 | } else { |
149 | 149 | // inHg |
150 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
150 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
151 | 151 | } |
152 | 152 | /* |
153 | 153 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -168,12 +168,12 @@ discard block |
||
168 | 168 | // Visibility |
169 | 169 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
170 | 170 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
171 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
171 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
172 | 172 | } else { |
173 | 173 | if ($matches[1] == '9999') { |
174 | 174 | $result['visibility'] = '> 10000'; |
175 | 175 | } else { |
176 | - $result['visibility'] = (float)$matches[1]; |
|
176 | + $result['visibility'] = (float) $matches[1]; |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | if (preg_match('#^CAVOK$#', $piece, $matches)) { |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
196 | 196 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
197 | 197 | $cloud['type_code'] = $type; |
198 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
198 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
199 | 199 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
200 | 200 | $result['cloud'][] = $cloud; |
201 | 201 | } |
@@ -205,8 +205,8 @@ discard block |
||
205 | 205 | $rvr['runway'] = $matches[1]; |
206 | 206 | $rvr['assessment'] = $matches[2]; |
207 | 207 | $rvr['rvr'] = $matches[3]; |
208 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
209 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
208 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
209 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
210 | 210 | $result['RVR'] = $rvr; |
211 | 211 | } |
212 | 212 | |
@@ -223,12 +223,12 @@ discard block |
||
223 | 223 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
224 | 224 | //echo $piece; |
225 | 225 | //print_r($matches); |
226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
226 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
228 | 228 | if (isset($matches[3])) { |
229 | 229 | $range = Array( |
230 | - 'from' => (float)$matches[2], |
|
231 | - 'to' => (float)$matches[4], |
|
230 | + 'from' => (float) $matches[2], |
|
231 | + 'to' => (float) $matches[4], |
|
232 | 232 | 'unit' => $matches[5] ? 'FT' : 'M' |
233 | 233 | ); |
234 | 234 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | try { |
278 | 278 | $sth = $this->db->prepare($query); |
279 | 279 | $sth->execute($query_values); |
280 | - } catch(PDOException $e) { |
|
280 | + } catch (PDOException $e) { |
|
281 | 281 | return "error : ".$e->getMessage(); |
282 | 282 | } |
283 | 283 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -287,19 +287,19 @@ discard block |
||
287 | 287 | return $all; |
288 | 288 | } |
289 | 289 | |
290 | - public function addMETAR($location,$metar,$date) { |
|
290 | + public function addMETAR($location, $metar, $date) { |
|
291 | 291 | global $globalDBdriver; |
292 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
292 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
293 | 293 | if ($globalDBdriver == 'mysql') { |
294 | 294 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
295 | 295 | } else { |
296 | 296 | $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);"; |
297 | 297 | } |
298 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
298 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
299 | 299 | try { |
300 | 300 | $sth = $this->db->prepare($query); |
301 | 301 | $sth->execute($query_values); |
302 | - } catch(PDOException $e) { |
|
302 | + } catch (PDOException $e) { |
|
303 | 303 | return "error : ".$e->getMessage(); |
304 | 304 | } |
305 | 305 | } |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | try { |
311 | 311 | $sth = $this->db->prepare($query); |
312 | 312 | $sth->execute($query_values); |
313 | - } catch(PDOException $e) { |
|
313 | + } catch (PDOException $e) { |
|
314 | 314 | return "error : ".$e->getMessage(); |
315 | 315 | } |
316 | 316 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | try { |
320 | 320 | $sth = $this->db->prepare($query); |
321 | 321 | $sth->execute(); |
322 | - } catch(PDOException $e) { |
|
322 | + } catch (PDOException $e) { |
|
323 | 323 | return "error : ".$e->getMessage(); |
324 | 324 | } |
325 | 325 | } |
@@ -331,29 +331,29 @@ discard block |
||
331 | 331 | $Common = new Common(); |
332 | 332 | if (isset($globalIVAO) && $globalIVAO) { |
333 | 333 | //$cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
334 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
335 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
334 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
335 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
336 | 336 | } else { |
337 | 337 | //$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT'); |
338 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
339 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
338 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
339 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
340 | 340 | } |
341 | 341 | if ($handle) { |
342 | 342 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
343 | 343 | $date = ''; |
344 | 344 | //foreach(explode("\n",$cycle) as $line) { |
345 | - while(($line = fgets($handle,4096)) !== false) { |
|
346 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
345 | + while (($line = fgets($handle, 4096)) !== false) { |
|
346 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
347 | 347 | $date = $line; |
348 | 348 | } elseif ($line != '') { |
349 | 349 | //$this->parse($line); |
350 | 350 | if ($date == '') $date = date('Y/m/d H:m'); |
351 | 351 | $pos = 0; |
352 | - $pieces = preg_split('/\s/',$line); |
|
352 | + $pieces = preg_split('/\s/', $line); |
|
353 | 353 | if ($pieces[0] == 'METAR') $pos++; |
354 | 354 | if (strlen($pieces[$pos]) != 4) $pos++; |
355 | 355 | $location = $pieces[$pos]; |
356 | - echo $this->addMETAR($location,$line,$date); |
|
356 | + echo $this->addMETAR($location, $line, $date); |
|
357 | 357 | } |
358 | 358 | } |
359 | 359 | fclose($handle); |
@@ -366,11 +366,11 @@ discard block |
||
366 | 366 | if ($globalMETARurl == '') return array(); |
367 | 367 | date_default_timezone_set("UTC"); |
368 | 368 | $Common = new Common(); |
369 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
369 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
370 | 370 | $cycle = $Common->getData($url); |
371 | 371 | $date = ''; |
372 | - foreach(explode("\n",$cycle) as $line) { |
|
373 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
372 | + foreach (explode("\n", $cycle) as $line) { |
|
373 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
374 | 374 | //echo "date : ".$line."\n"; |
375 | 375 | $date = $line; |
376 | 376 | } |
@@ -379,12 +379,12 @@ discard block |
||
379 | 379 | //echo $line; |
380 | 380 | if ($date == '') $date = date('Y/m/d H:m'); |
381 | 381 | $pos = 0; |
382 | - $pieces = preg_split('/\s/',$line); |
|
382 | + $pieces = preg_split('/\s/', $line); |
|
383 | 383 | if ($pieces[0] == 'METAR') $pos++; |
384 | 384 | if (strlen($pieces[$pos]) != 4) $pos++; |
385 | 385 | $location = $pieces[$pos]; |
386 | 386 | if (strlen($location == 4)) { |
387 | - $this->addMETAR($location,$line,$date); |
|
387 | + $this->addMETAR($location, $line, $date); |
|
388 | 388 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
389 | 389 | } else return array(); |
390 | 390 | } |
@@ -59,8 +59,11 @@ discard block |
||
59 | 59 | } |
60 | 60 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
61 | 61 | $sth->closeCursor(); |
62 | - if ($row['nb'] > 0) return false; |
|
63 | - else return true; |
|
62 | + if ($row['nb'] > 0) { |
|
63 | + return false; |
|
64 | + } else { |
|
65 | + return true; |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | |
66 | 69 | public static function insert_last_update() { |
@@ -84,9 +87,14 @@ discard block |
||
84 | 87 | //$pieces = explode(' ',$data); |
85 | 88 | $pieces = preg_split('/\s/',$data); |
86 | 89 | $pos = 0; |
87 | - if ($pieces[0] == 'METAR') $pos++; |
|
88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
90 | + if ($pieces[0] == 'METAR') { |
|
91 | + $pos++; |
|
92 | + } elseif ($pieces[0] == 'SPECI') { |
|
93 | + $pos++; |
|
94 | + } |
|
95 | + if (strlen($pieces[$pos]) != 4) { |
|
96 | + $pos++; |
|
97 | + } |
|
90 | 98 | $result = array(); |
91 | 99 | $result['location'] = $pieces[$pos]; |
92 | 100 | $pos++; |
@@ -95,16 +103,26 @@ discard block |
||
95 | 103 | $c = count($pieces); |
96 | 104 | for($pos++; $pos < $c; $pos++) { |
97 | 105 | $piece = $pieces[$pos]; |
98 | - if ($piece == 'RMK') break; |
|
99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
100 | - if ($piece == 'COR') $result['correction'] = true; |
|
106 | + if ($piece == 'RMK') { |
|
107 | + break; |
|
108 | + } |
|
109 | + if ($piece == 'AUTO') { |
|
110 | + $result['auto'] = true; |
|
111 | + } |
|
112 | + if ($piece == 'COR') { |
|
113 | + $result['correction'] = true; |
|
114 | + } |
|
101 | 115 | // Wind Speed |
102 | 116 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
103 | 117 | $result['wind']['direction'] = (float)$matches[1]; |
104 | 118 | $result['wind']['unit'] = $matches[4]; |
105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
119 | + if ($result['wind']['unit'] == 'KT') { |
|
120 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
121 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
122 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
123 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
124 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
125 | + } |
|
108 | 126 | $result['wind']['gust'] = (float)$matches[3]; |
109 | 127 | $result['wind']['unit'] = $matches[4]; |
110 | 128 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -186,14 +204,23 @@ discard block |
||
186 | 204 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
187 | 205 | $type = $matches[1]; |
188 | 206 | $cloud = array(); |
189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
207 | + if ($type == 'SKC') { |
|
208 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
209 | + } elseif ($type == 'CLR') { |
|
210 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
211 | + } elseif ($type == 'NSC') { |
|
212 | + $cloud['type'] = 'No significant cloud'; |
|
213 | + } elseif ($type == 'FEW') { |
|
214 | + $cloud['type'] = 'Few'; |
|
215 | + } elseif ($type == 'SCT') { |
|
216 | + $cloud['type'] = 'Scattered'; |
|
217 | + } elseif ($type == 'BKN') { |
|
218 | + $cloud['type'] = 'Broken'; |
|
219 | + } elseif ($type == 'OVC') { |
|
220 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
221 | + } elseif ($type == 'VV') { |
|
222 | + $cloud['type'] = 'Vertical visibility'; |
|
223 | + } |
|
197 | 224 | $cloud['type_code'] = $type; |
198 | 225 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
199 | 226 | $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
@@ -223,8 +250,11 @@ discard block |
||
223 | 250 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
224 | 251 | //echo $piece; |
225 | 252 | //print_r($matches); |
226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
253 | + if (isset($matches[5])) { |
|
254 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
255 | + } else { |
|
256 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
257 | + } |
|
228 | 258 | if (isset($matches[3])) { |
229 | 259 | $range = Array( |
230 | 260 | 'from' => (float)$matches[2], |
@@ -257,8 +287,11 @@ discard block |
||
257 | 287 | if (isset($matches[3])) { |
258 | 288 | $text[] = $this->texts[$matches[3]]; |
259 | 289 | } |
260 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
261 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
290 | + if (!isset($result['weather'])) { |
|
291 | + $result['weather'] = implode(' ', $text); |
|
292 | + } else { |
|
293 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
294 | + } |
|
262 | 295 | } |
263 | 296 | } |
264 | 297 | return $result; |
@@ -270,8 +303,11 @@ discard block |
||
270 | 303 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
271 | 304 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
272 | 305 | } else { |
273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
306 | + if ($globalDBdriver == 'mysql') { |
|
307 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
308 | + } else { |
|
309 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
310 | + } |
|
275 | 311 | } |
276 | 312 | $query_values = array(':icao' => $icao); |
277 | 313 | try { |
@@ -326,7 +362,9 @@ discard block |
||
326 | 362 | |
327 | 363 | public function addMETARCycle() { |
328 | 364 | global $globalDebug, $globalIVAO; |
329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
365 | + if (isset($globalDebug) && $globalDebug) { |
|
366 | + echo "Downloading METAR cycle..."; |
|
367 | + } |
|
330 | 368 | date_default_timezone_set("UTC"); |
331 | 369 | $Common = new Common(); |
332 | 370 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -339,7 +377,9 @@ discard block |
||
339 | 377 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
340 | 378 | } |
341 | 379 | if ($handle) { |
342 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
380 | + if (isset($globalDebug) && $globalDebug) { |
|
381 | + echo "Done - Updating DB..."; |
|
382 | + } |
|
343 | 383 | $date = ''; |
344 | 384 | //foreach(explode("\n",$cycle) as $line) { |
345 | 385 | while(($line = fgets($handle,4096)) !== false) { |
@@ -347,23 +387,33 @@ discard block |
||
347 | 387 | $date = $line; |
348 | 388 | } elseif ($line != '') { |
349 | 389 | //$this->parse($line); |
350 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
390 | + if ($date == '') { |
|
391 | + $date = date('Y/m/d H:m'); |
|
392 | + } |
|
351 | 393 | $pos = 0; |
352 | 394 | $pieces = preg_split('/\s/',$line); |
353 | - if ($pieces[0] == 'METAR') $pos++; |
|
354 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
395 | + if ($pieces[0] == 'METAR') { |
|
396 | + $pos++; |
|
397 | + } |
|
398 | + if (strlen($pieces[$pos]) != 4) { |
|
399 | + $pos++; |
|
400 | + } |
|
355 | 401 | $location = $pieces[$pos]; |
356 | 402 | echo $this->addMETAR($location,$line,$date); |
357 | 403 | } |
358 | 404 | } |
359 | 405 | fclose($handle); |
360 | 406 | } |
361 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
407 | + if (isset($globalDebug) && $globalDebug) { |
|
408 | + echo "Done\n"; |
|
409 | + } |
|
362 | 410 | |
363 | 411 | } |
364 | 412 | public function downloadMETAR($icao) { |
365 | 413 | global $globalMETARurl; |
366 | - if ($globalMETARurl == '') return array(); |
|
414 | + if ($globalMETARurl == '') { |
|
415 | + return array(); |
|
416 | + } |
|
367 | 417 | date_default_timezone_set("UTC"); |
368 | 418 | $Common = new Common(); |
369 | 419 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -377,16 +427,24 @@ discard block |
||
377 | 427 | if ($line != '') { |
378 | 428 | //$this->parse($line); |
379 | 429 | //echo $line; |
380 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
430 | + if ($date == '') { |
|
431 | + $date = date('Y/m/d H:m'); |
|
432 | + } |
|
381 | 433 | $pos = 0; |
382 | 434 | $pieces = preg_split('/\s/',$line); |
383 | - if ($pieces[0] == 'METAR') $pos++; |
|
384 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
435 | + if ($pieces[0] == 'METAR') { |
|
436 | + $pos++; |
|
437 | + } |
|
438 | + if (strlen($pieces[$pos]) != 4) { |
|
439 | + $pos++; |
|
440 | + } |
|
385 | 441 | $location = $pieces[$pos]; |
386 | 442 | if (strlen($location == 4)) { |
387 | 443 | $this->addMETAR($location,$line,$date); |
388 | 444 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
389 | - } else return array(); |
|
445 | + } else { |
|
446 | + return array(); |
|
447 | + } |
|
390 | 448 | } |
391 | 449 | //echo $line."\n"; |
392 | 450 | } |