@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/aircraft'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
| 10 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
| 12 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | if (!empty($spotter_array)) |
| 16 | 16 | { |
| 17 | - $title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
| 17 | + $title = sprintf(_("Most Common Aircraft by Registration from %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
| 18 | 18 | require_once('header.php'); |
| 19 | 19 | print '<div class="select-item">'; |
| 20 | 20 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | $Stats = new Stats(); |
| 24 | 24 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 25 | 25 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 26 | - foreach($aircraft_types as $aircrafttype) |
|
| 26 | + foreach ($aircraft_types as $aircrafttype) |
|
| 27 | 27 | { |
| 28 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 28 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 29 | 29 | { |
| 30 | 30 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 31 | 31 | } else { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | include('aircraft-sub-menu.php'); |
| 52 | 52 | print '<div class="column">'; |
| 53 | 53 | print '<h2>'._("Most Common Aircraft by Registration").'</h2>'; |
| 54 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
| 54 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft by registration of flights from aircraft type <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
| 55 | 55 | |
| 56 | 56 | $aircraft_array = $Spotter->countAllAircraftRegistrationByAircraft($aircraft_type); |
| 57 | 57 | if (!empty($aircraft_array)) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | print '</thead>'; |
| 69 | 69 | print '<tbody>'; |
| 70 | 70 | $i = 1; |
| 71 | - foreach($aircraft_array as $aircraft_item) |
|
| 71 | + foreach ($aircraft_array as $aircraft_item) |
|
| 72 | 72 | { |
| 73 | 73 | print '<tr>'; |
| 74 | 74 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | header('Location: '.$globalURL.'/aircraft'); |
| 9 | 9 | die(); |
| 10 | 10 | } |
| 11 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
| 11 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
| 12 | 12 | $Spotter = new Spotter(); |
| 13 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
| 13 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | if (!empty($spotter_array)) |
| 17 | 17 | { |
| 18 | - $title = sprintf(_("Most Common Airlines from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
| 18 | + $title = sprintf(_("Most Common Airlines from %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
| 19 | 19 | require_once('header.php'); |
| 20 | 20 | print '<div class="select-item">'; |
| 21 | 21 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | $Stats = new Stats(); |
| 25 | 25 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 26 | 26 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 27 | - foreach($aircraft_types as $aircrafttype) |
|
| 27 | + foreach ($aircraft_types as $aircrafttype) |
|
| 28 | 28 | { |
| 29 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 29 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 30 | 30 | { |
| 31 | 31 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 32 | 32 | } else { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | include('aircraft-sub-menu.php'); |
| 53 | 53 | print '<div class="column">'; |
| 54 | 54 | print '<h2>'._("Most Common Airlines").'</h2>'; |
| 55 | - print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
| 55 | + print '<p>'.sprintf(_("The statistic below shows the most common airlines of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
| 56 | 56 | |
| 57 | 57 | $airline_array = $Spotter->countAllAirlinesByAircraft($aircraft_type); |
| 58 | 58 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | print '</thead>'; |
| 71 | 71 | print '<tbody>'; |
| 72 | 72 | $i = 1; |
| 73 | - foreach($airline_array as $airline_item) |
|
| 73 | + foreach ($airline_array as $airline_item) |
|
| 74 | 74 | { |
| 75 | 75 | print '<tr>'; |
| 76 | 76 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/aircraft'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
| 10 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
| 12 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | if (!empty($spotter_array)) |
| 16 | 16 | { |
| 17 | - $title = sprintf(_("Most Common Routes from %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
| 17 | + $title = sprintf(_("Most Common Routes from %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
| 18 | 18 | require_once('header.php'); |
| 19 | 19 | print '<div class="select-item">'; |
| 20 | 20 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | $Stats = new Stats(); |
| 24 | 24 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 25 | 25 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 26 | - foreach($aircraft_types as $aircrafttype) |
|
| 26 | + foreach ($aircraft_types as $aircrafttype) |
|
| 27 | 27 | { |
| 28 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 28 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 29 | 29 | { |
| 30 | 30 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 31 | 31 | } else { |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | include('aircraft-sub-menu.php'); |
| 52 | 52 | print '<div class="column">'; |
| 53 | 53 | print '<h2>'._("Most Common Routes").'</h2>'; |
| 54 | - print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
| 54 | + print '<p>'.sprintf(_("The statistic below shows the most common routes from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
| 55 | 55 | |
| 56 | 56 | $route_array = $Spotter->countAllRoutesByAircraft($aircraft_type); |
| 57 | 57 | if (!empty($route_array)) |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | print '</thead>'; |
| 69 | 69 | print '<tbody>'; |
| 70 | 70 | $i = 1; |
| 71 | - foreach($route_array as $route_item) |
|
| 71 | + foreach ($route_array as $route_item) |
|
| 72 | 72 | { |
| 73 | 73 | print '<tr>'; |
| 74 | 74 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -5,16 +5,16 @@ discard block |
||
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | $Marine = new Marine(); |
| 7 | 7 | $type = 'marine'; |
| 8 | -if (!isset($_GET['type'])){ |
|
| 8 | +if (!isset($_GET['type'])) { |
|
| 9 | 9 | header('Location: '.$globalURL.'/'); |
| 10 | 10 | } else { |
| 11 | 11 | //calculuation for the pagination |
| 12 | - if(!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2) |
|
| 12 | + if (!isset($_GET['limit']) || count(explode(",", $_GET['limit'])) < 2) |
|
| 13 | 13 | { |
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = $limit_explode[0]; |
| 20 | 20 | $limit_end = $limit_explode[1]; |
@@ -28,14 +28,14 @@ discard block |
||
| 28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 30 | 30 | |
| 31 | - $marine_type = filter_input(INPUT_GET,'type',FILTER_SANITIZE_STRING); |
|
| 31 | + $marine_type = filter_input(INPUT_GET, 'type', FILTER_SANITIZE_STRING); |
|
| 32 | 32 | $page_url = $globalURL.'/marine/type/'.$marine_type; |
| 33 | - $sort = htmlspecialchars(filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING)); |
|
| 34 | - $spotter_array = $Marine->getMarineDataByType($marine_type,$limit_start.",".$absolute_difference, $sort); |
|
| 33 | + $sort = htmlspecialchars(filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING)); |
|
| 34 | + $spotter_array = $Marine->getMarineDataByType($marine_type, $limit_start.",".$absolute_difference, $sort); |
|
| 35 | 35 | |
| 36 | 36 | if (!empty($spotter_array)) |
| 37 | 37 | { |
| 38 | - $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['type']); |
|
| 38 | + $title = sprintf(_("Detailed View for %s"), $spotter_array[0]['type']); |
|
| 39 | 39 | require_once('header.php'); |
| 40 | 40 | |
| 41 | 41 | /* |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | //include('aircraft-sub-menu.php'); |
| 76 | 76 | |
| 77 | 77 | print '<div class="table column">'; |
| 78 | - print '<p>'.sprintf(_("The table below shows the detailed information of all marine of type <strong>%s</strong>."),$spotter_array[0]['type']).'</p>'; |
|
| 78 | + print '<p>'.sprintf(_("The table below shows the detailed information of all marine of type <strong>%s</strong>."), $spotter_array[0]['type']).'</p>'; |
|
| 79 | 79 | |
| 80 | 80 | include('table-output.php'); |
| 81 | 81 | |
@@ -7,14 +7,14 @@ discard block |
||
| 7 | 7 | header('Location: '.$globalURL.'/aircraft'); |
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
| 10 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
| 12 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
| 13 | 13 | |
| 14 | 14 | |
| 15 | 15 | if (!empty($spotter_array)) |
| 16 | 16 | { |
| 17 | - $title = sprintf(_("Most Common Departure Airports for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
| 17 | + $title = sprintf(_("Most Common Departure Airports for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
| 18 | 18 | require_once('header.php'); |
| 19 | 19 | print '<div class="select-item">'; |
| 20 | 20 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | $Stats = new Stats(); |
| 24 | 24 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 25 | 25 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 26 | - foreach($aircraft_types as $aircrafttype) |
|
| 26 | + foreach ($aircraft_types as $aircrafttype) |
|
| 27 | 27 | { |
| 28 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 28 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 29 | 29 | { |
| 30 | 30 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 31 | 31 | } else { |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | include('aircraft-sub-menu.php'); |
| 53 | 53 | print '<div class="column">'; |
| 54 | 54 | print '<h2>'._("Most Common Departure Airports").'</h2>'; |
| 55 | - print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
| 55 | + print '<p>'.sprintf(_("The statistic below shows all departure airports of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
| 56 | 56 | $airport_airport_array = $Spotter->countAllDepartureAirportsByAircraft($aircraft_type); |
| 57 | 57 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
| 58 | 58 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | print '<script>'; |
| 62 | 62 | print 'var series = ['; |
| 63 | 63 | $airport_data = ''; |
| 64 | - foreach($airport_airport_array as $airport_item) |
|
| 64 | + foreach ($airport_airport_array as $airport_item) |
|
| 65 | 65 | { |
| 66 | 66 | $airport_data .= '[ "'.$airport_item['airport_departure_icao_count'].'", "'.$airport_item['airport_departure_name'].' ('.$airport_item['airport_departure_icao'].')",'.$airport_item['airport_departure_latitude'].','.$airport_item['airport_departure_longitude'].'],'; |
| 67 | 67 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | print '</thead>'; |
| 117 | 117 | print '<tbody>'; |
| 118 | 118 | $i = 1; |
| 119 | - foreach($airport_airport_array as $airport_item) |
|
| 119 | + foreach ($airport_airport_array as $airport_item) |
|
| 120 | 120 | { |
| 121 | 121 | print '<tr>'; |
| 122 | 122 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | $Spotter = new Spotter(); |
| 29 | 29 | $alliances = $Spotter->getAllAllianceNames(); |
| 30 | 30 | if (!empty($alliances)) { |
| 31 | - foreach($alliances as $alliance) { |
|
| 32 | - if (isset($airline_icao) && str_replace('_',' ',str_replace('alliance_','',$airline_icao)) == $alliance['alliance']) { |
|
| 33 | - print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
| 31 | + foreach ($alliances as $alliance) { |
|
| 32 | + if (isset($airline_icao) && str_replace('_', ' ', str_replace('alliance_', '', $airline_icao)) == $alliance['alliance']) { |
|
| 33 | + print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'" selected>'.$alliance['alliance'].'</option>'; |
|
| 34 | 34 | } else { |
| 35 | - print '<option value="alliance_'.str_replace(' ','_',$alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
| 35 | + print '<option value="alliance_'.str_replace(' ', '_', $alliance['alliance']).'">'.$alliance['alliance'].'</option>'; |
|
| 36 | 36 | } |
| 37 | 37 | } |
| 38 | 38 | print '<option disabled>──────────</option>'; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $Stats = new Stats(); |
| 41 | 41 | if (!isset($filter_name)) $filter_name = ''; |
| 42 | 42 | $airlines = $Stats->getAllAirlineNames($filter_name); |
| 43 | - foreach($airlines as $airline) { |
|
| 43 | + foreach ($airlines as $airline) { |
|
| 44 | 44 | if (isset($airline_icao) && $airline_icao == $airline['airline_icao']) { |
| 45 | 45 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
| 46 | 46 | } else { |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | if (!isset($type) || $type == 'aircraft') { |
| 64 | 64 | ?> |
| 65 | 65 | <li class="dropdown"> |
| 66 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 66 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 67 | 67 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 68 | 68 | </a> |
| 69 | 69 | <ul class="dropdown-menu"> |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | </ul> |
| 75 | 75 | </li> |
| 76 | 76 | <li class="dropdown"> |
| 77 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 77 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 78 | 78 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 79 | 79 | </a> |
| 80 | 80 | <ul class="dropdown-menu" role="menu"> |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | </ul> |
| 91 | 91 | </li> |
| 92 | 92 | <li class="dropdown"> |
| 93 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 93 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 94 | 94 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 95 | 95 | </a> |
| 96 | 96 | <ul class="dropdown-menu" role="menu"> |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | </ul> |
| 102 | 102 | </li> |
| 103 | 103 | <li class="dropdown"> |
| 104 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 104 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 105 | 105 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 106 | 106 | </a> |
| 107 | 107 | <ul class="dropdown-menu" role="menu"> |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | </ul> |
| 111 | 111 | </li> |
| 112 | 112 | <li class="dropdown"> |
| 113 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 113 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 114 | 114 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 115 | 115 | </a> |
| 116 | 116 | <ul class="dropdown-menu" role="menu"> |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
| 123 | 123 | ?> |
| 124 | 124 | <li class="dropdown"> |
| 125 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 125 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 126 | 126 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 127 | 127 | </a> |
| 128 | 128 | <ul class="dropdown-menu" role="menu"> |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 138 | 138 | ?> |
| 139 | 139 | <li class="dropdown"> |
| 140 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 140 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 141 | 141 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 142 | 142 | </a> |
| 143 | 143 | <ul class="dropdown-menu" role="menu"> |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | if (!isset($type) || $type == 'aircraft') { |
| 162 | 162 | ?> |
| 163 | 163 | <li class="dropdown"> |
| 164 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer"){ print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 164 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-aircraft" || strtolower($current_page) == "statistics-registration" || strtolower($current_page) == "statistics-manufacturer") { print 'active'; } ?>" data-toggle="dropdown" href="#" > |
|
| 165 | 165 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 166 | 166 | </a> |
| 167 | 167 | <ul class="dropdown-menu"> |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | </ul> |
| 173 | 173 | </li> |
| 174 | 174 | <li class="dropdown"> |
| 175 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 175 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airline" || strtolower($current_page) == "statistics-airline-country" || strtolower($current_page) == "statistics-callsign") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 176 | 176 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 177 | 177 | </a> |
| 178 | 178 | <ul class="dropdown-menu" role="menu"> |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | </ul> |
| 189 | 189 | </li> |
| 190 | 190 | <li class="dropdown"> |
| 191 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 191 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-airport-departure" || strtolower($current_page) == "statistics-airport-departure-country" || strtolower($current_page) == "statistics-airport-arrival" || strtolower($current_page) == "statistics-airport-arrival-country") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 192 | 192 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 193 | 193 | </a> |
| 194 | 194 | <ul class="dropdown-menu" role="menu"> |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | </li> |
| 201 | 201 | <!-- |
| 202 | 202 | <li class="dropdown"> |
| 203 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 203 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 204 | 204 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 205 | 205 | </a> |
| 206 | 206 | <ul class="dropdown-menu" role="menu"> |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | --> |
| 212 | 212 | <!-- |
| 213 | 213 | <li class="dropdown"> |
| 214 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 214 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 215 | 215 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 216 | 216 | </a> |
| 217 | 217 | <ul class="dropdown-menu" role="menu"> |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | ?> |
| 226 | 226 | <!-- |
| 227 | 227 | <li class="dropdown"> |
| 228 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 228 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 229 | 229 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 230 | 230 | </a> |
| 231 | 231 | <ul class="dropdown-menu" role="menu"> |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 242 | 242 | ?> |
| 243 | 243 | <li class="dropdown"> |
| 244 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 244 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 245 | 245 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 246 | 246 | </a> |
| 247 | 247 | <ul class="dropdown-menu" role="menu"> |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | die(); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | -$aircraft_type = filter_input(INPUT_GET,'aircraft_type',FILTER_SANITIZE_STRING); |
|
| 11 | +$aircraft_type = filter_input(INPUT_GET, 'aircraft_type', FILTER_SANITIZE_STRING); |
|
| 12 | 12 | $Spotter = new Spotter(); |
| 13 | -$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type,"0,1",""); |
|
| 13 | +$spotter_array = $Spotter->getSpotterDataByAircraft($aircraft_type, "0,1", ""); |
|
| 14 | 14 | |
| 15 | 15 | |
| 16 | 16 | if (!empty($spotter_array)) |
| 17 | 17 | { |
| 18 | - $title = sprintf(_("Most Common Arrival Airports by Country for %s (%s)"),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']); |
|
| 18 | + $title = sprintf(_("Most Common Arrival Airports by Country for %s (%s)"), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']); |
|
| 19 | 19 | require_once('header.php'); |
| 20 | 20 | print '<div class="select-item">'; |
| 21 | 21 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
@@ -24,9 +24,9 @@ discard block |
||
| 24 | 24 | $Stats = new Stats(); |
| 25 | 25 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 26 | 26 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 27 | - foreach($aircraft_types as $aircrafttype) |
|
| 27 | + foreach ($aircraft_types as $aircrafttype) |
|
| 28 | 28 | { |
| 29 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 29 | + if ($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 30 | 30 | { |
| 31 | 31 | print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 32 | 32 | } else { |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | include('aircraft-sub-menu.php'); |
| 54 | 54 | print '<div class="column">'; |
| 55 | 55 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
| 56 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s (%s)</strong>."),$spotter_array[0]['aircraft_name'],$spotter_array[0]['aircraft_type']).'</p>'; |
|
| 56 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights from <strong>%s (%s)</strong>."), $spotter_array[0]['aircraft_name'], $spotter_array[0]['aircraft_type']).'</p>'; |
|
| 57 | 57 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByAircraft($aircraft_type); |
| 58 | 58 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
| 59 | 59 | print '<script type="text/javascript" src="'.$globalURL.'/js/topojson.v2.min.js"></script>'; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
| 62 | 62 | print 'var series = ['; |
| 63 | 63 | $country_data = ''; |
| 64 | - foreach($airport_country_array as $airport_item) |
|
| 64 | + foreach ($airport_country_array as $airport_item) |
|
| 65 | 65 | { |
| 66 | 66 | $country_data .= '[ "'.$airport_item['arrival_airport_country_iso3'].'",'.$airport_item['airport_arrival_country_count'].'],'; |
| 67 | 67 | } |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | print '</thead>'; |
| 110 | 110 | print '<tbody>'; |
| 111 | 111 | $i = 1; |
| 112 | - foreach($airport_country_array as $airport_item) |
|
| 112 | + foreach ($airport_country_array as $airport_item) |
|
| 113 | 113 | { |
| 114 | 114 | print '<tr>'; |
| 115 | 115 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,8 +7,8 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $type = 'marine'; |
| 9 | 9 | if (!isset($filter_name)) $filter_name = ''; |
| 10 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 11 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 11 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 12 | 12 | |
| 13 | 13 | require_once('header.php'); |
| 14 | 14 | |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | </div> |
| 21 | 21 | <p>'._("Below are the <strong>Top 10</strong> most common vessel types.").'</p>'; |
| 22 | 22 | |
| 23 | -$type_array = $Marine->countAllMarineTypes(true,0,'',$filter_name,$year,$month); |
|
| 23 | +$type_array = $Marine->countAllMarineTypes(true, 0, '', $filter_name, $year, $month); |
|
| 24 | 24 | print '<div id="chart" class="chart" width="100%"></div><script>'; |
| 25 | 25 | $type_data = ''; |
| 26 | -foreach($type_array as $type_item) |
|
| 26 | +foreach ($type_array as $type_item) |
|
| 27 | 27 | { |
| 28 | 28 | $type_data .= '["'.$type_item['marine_type'].'",'.$type_item['marine_type_count'].'],'; |
| 29 | 29 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | print '</thead>'; |
| 49 | 49 | print '<tbody>'; |
| 50 | 50 | $i = 1; |
| 51 | - foreach($type_array as $type_item) |
|
| 51 | + foreach ($type_array as $type_item) |
|
| 52 | 52 | { |
| 53 | 53 | print '<tr>'; |
| 54 | 54 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -117,31 +117,31 @@ discard block |
||
| 117 | 117 | |
| 118 | 118 | private function make_latf($temp) { // unsigned long |
| 119 | 119 | $flat = 0.0; // float |
| 120 | - $temp = $temp & 0x07FFFFFF; |
|
| 121 | - if ($temp & 0x04000000) { |
|
| 122 | - $temp = $temp ^ 0x07FFFFFF; |
|
| 120 | + $temp = $temp&0x07FFFFFF; |
|
| 121 | + if ($temp&0x04000000) { |
|
| 122 | + $temp = $temp^0x07FFFFFF; |
|
| 123 | 123 | $temp += 1; |
| 124 | - $flat = (float)($temp / (60.0 * 10000.0)); |
|
| 124 | + $flat = (float) ($temp/(60.0*10000.0)); |
|
| 125 | 125 | $flat *= -1.0; |
| 126 | - } else $flat = (float)($temp / (60.0 * 10000.0)); |
|
| 126 | + } else $flat = (float) ($temp/(60.0*10000.0)); |
|
| 127 | 127 | return $flat; // float |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | private function make_lonf($temp) { // unsigned long |
| 131 | 131 | $flon = 0.0; // float |
| 132 | - $temp = $temp & 0x0FFFFFFF; |
|
| 133 | - if ($temp & 0x08000000) { |
|
| 134 | - $temp = $temp ^ 0x0FFFFFFF; |
|
| 132 | + $temp = $temp&0x0FFFFFFF; |
|
| 133 | + if ($temp&0x08000000) { |
|
| 134 | + $temp = $temp^0x0FFFFFFF; |
|
| 135 | 135 | $temp += 1; |
| 136 | - $flon = (float)($temp / (60.0 * 10000.0)); |
|
| 136 | + $flon = (float) ($temp/(60.0*10000.0)); |
|
| 137 | 137 | $flon *= -1.0; |
| 138 | - } else $flon = (float)($temp / (60.0 * 10000.0)); |
|
| 138 | + } else $flon = (float) ($temp/(60.0*10000.0)); |
|
| 139 | 139 | return $flon; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | private function ascii_2_dec($chr) { |
| 143 | - $dec=ord($chr);//get decimal ascii code |
|
| 144 | - $hex=dechex($dec);//convert decimal to hex |
|
| 143 | + $dec = ord($chr); //get decimal ascii code |
|
| 144 | + $hex = dechex($dec); //convert decimal to hex |
|
| 145 | 145 | return ($dec); |
| 146 | 146 | } |
| 147 | 147 | |
@@ -160,15 +160,15 @@ discard block |
||
| 160 | 160 | //only process in the following range: 48-87, 96-119 |
| 161 | 161 | if ($ascii < 48) { } |
| 162 | 162 | else { |
| 163 | - if($ascii>119) { } |
|
| 163 | + if ($ascii > 119) { } |
|
| 164 | 164 | else { |
| 165 | - if ($ascii>87 && $ascii<96) ; |
|
| 165 | + if ($ascii > 87 && $ascii < 96); |
|
| 166 | 166 | else { |
| 167 | - $ascii=$ascii+40; |
|
| 168 | - if ($ascii>128){ |
|
| 169 | - $ascii=$ascii+32; |
|
| 167 | + $ascii = $ascii + 40; |
|
| 168 | + if ($ascii > 128) { |
|
| 169 | + $ascii = $ascii + 32; |
|
| 170 | 170 | } else { |
| 171 | - $ascii=$ascii+40; |
|
| 171 | + $ascii = $ascii + 40; |
|
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | } |
| 178 | 178 | |
| 179 | 179 | private function dec_2_6bit($dec) { |
| 180 | - $bin=decbin($dec); |
|
| 180 | + $bin = decbin($dec); |
|
| 181 | 181 | return(substr($bin, -6)); |
| 182 | 182 | } |
| 183 | 183 | |
@@ -195,11 +195,11 @@ discard block |
||
| 195 | 195 | ); |
| 196 | 196 | // " |
| 197 | 197 | $rv = ''; |
| 198 | - if ($_size % 6 == 0) { |
|
| 199 | - $len = $_size / 6; |
|
| 200 | - for ($i=0; $i<$len; $i++) { |
|
| 201 | - $offset = $i * 6; |
|
| 202 | - $rv .= $ais_chars[ bindec(substr($_str,$_start + $offset,6)) ]; |
|
| 198 | + if ($_size%6 == 0) { |
|
| 199 | + $len = $_size/6; |
|
| 200 | + for ($i = 0; $i < $len; $i++) { |
|
| 201 | + $offset = $i*6; |
|
| 202 | + $rv .= $ais_chars[bindec(substr($_str, $_start + $offset, 6))]; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | return $rv; |
@@ -226,93 +226,93 @@ discard block |
||
| 226 | 226 | $ro->eta_hour = ''; |
| 227 | 227 | $ro->eta_minute = ''; |
| 228 | 228 | $ro->ts = time(); |
| 229 | - $ro->id = bindec(substr($_aisdata,0,6)); |
|
| 230 | - $ro->mmsi = bindec(substr($_aisdata,8,30)); |
|
| 229 | + $ro->id = bindec(substr($_aisdata, 0, 6)); |
|
| 230 | + $ro->mmsi = bindec(substr($_aisdata, 8, 30)); |
|
| 231 | 231 | if ($ro->id >= 1 && $ro->id <= 3) { |
| 232 | - $ro->cog = bindec(substr($_aisdata,116,12))/10; |
|
| 233 | - $ro->sog = bindec(substr($_aisdata,50,10))/10; |
|
| 234 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
| 235 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
| 232 | + $ro->cog = bindec(substr($_aisdata, 116, 12))/10; |
|
| 233 | + $ro->sog = bindec(substr($_aisdata, 50, 10))/10; |
|
| 234 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
| 235 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
| 236 | 236 | $ro->cls = 1; // class A |
| 237 | 237 | } else if ($ro->id == 4) { |
| 238 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,79,28))); |
|
| 239 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,107,27))); |
|
| 238 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 79, 28))); |
|
| 239 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 107, 27))); |
|
| 240 | 240 | $ro->cls = 1; // class A |
| 241 | 241 | } else if ($ro->id == 5) { |
| 242 | - $ro->imo = bindec(substr($_aisdata,40,30)); |
|
| 243 | - $ro->callsign = $this->binchar($_aisdata,70,42); |
|
| 244 | - $ro->name = $this->binchar($_aisdata,112,120); |
|
| 245 | - $ro->typeid = bindec(substr($_aisdata,232,8)); |
|
| 242 | + $ro->imo = bindec(substr($_aisdata, 40, 30)); |
|
| 243 | + $ro->callsign = $this->binchar($_aisdata, 70, 42); |
|
| 244 | + $ro->name = $this->binchar($_aisdata, 112, 120); |
|
| 245 | + $ro->typeid = bindec(substr($_aisdata, 232, 8)); |
|
| 246 | 246 | $ro->type = $this->getShipType($ro->typeid); |
| 247 | 247 | //$ro->to_bow = bindec(substr($_aisdata,240,9)); |
| 248 | 248 | //$ro->to_stern = bindec(substr($_aisdata,249,9)); |
| 249 | 249 | //$ro->to_port = bindec(substr($_aisdata,258,6)); |
| 250 | 250 | //$ro->to_starboard = bindec(substr($_aisdata,264,6)); |
| 251 | - $ro->eta_month = bindec(substr($_aisdata,274,4)); |
|
| 252 | - $ro->eta_day = bindec(substr($_aisdata,278,5)); |
|
| 253 | - $ro->eta_hour = bindec(substr($_aisdata,283,5)); |
|
| 254 | - $ro->eta_minute = bindec(substr($_aisdata,288,6)); |
|
| 251 | + $ro->eta_month = bindec(substr($_aisdata, 274, 4)); |
|
| 252 | + $ro->eta_day = bindec(substr($_aisdata, 278, 5)); |
|
| 253 | + $ro->eta_hour = bindec(substr($_aisdata, 283, 5)); |
|
| 254 | + $ro->eta_minute = bindec(substr($_aisdata, 288, 6)); |
|
| 255 | 255 | //$ro->draught = bindec(substr($_aisdata,294,8)); |
| 256 | - $ro->destination = $this->binchar($_aisdata,302,120); |
|
| 256 | + $ro->destination = $this->binchar($_aisdata, 302, 120); |
|
| 257 | 257 | $ro->cls = 1; // class A |
| 258 | 258 | } else if ($ro->id == 9) { |
| 259 | 259 | // Search and Rescue aircraft position report |
| 260 | 260 | } else if ($ro->id == 18) { |
| 261 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
| 262 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
| 263 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,57,28))); |
|
| 264 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,85,27))); |
|
| 265 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
| 261 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
| 262 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
| 263 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 57, 28))); |
|
| 264 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 85, 27))); |
|
| 265 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
| 266 | 266 | if ($ro->heading == 511) $ro->heading = ''; |
| 267 | 267 | $ro->cls = 2; // class B |
| 268 | 268 | } else if ($ro->id == 19) { |
| 269 | - $ro->cog = bindec(substr($_aisdata,112,12))/10; |
|
| 270 | - $ro->sog = bindec(substr($_aisdata,46,10))/10; |
|
| 271 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,61,28))); |
|
| 272 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,89,27))); |
|
| 273 | - $ro->name = $this->binchar($_aisdata,143,120); |
|
| 269 | + $ro->cog = bindec(substr($_aisdata, 112, 12))/10; |
|
| 270 | + $ro->sog = bindec(substr($_aisdata, 46, 10))/10; |
|
| 271 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 61, 28))); |
|
| 272 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 89, 27))); |
|
| 273 | + $ro->name = $this->binchar($_aisdata, 143, 120); |
|
| 274 | 274 | $ro->cls = 2; // class B |
| 275 | - $ro->heading = bindec(substr($_aisdata,124,9)); |
|
| 275 | + $ro->heading = bindec(substr($_aisdata, 124, 9)); |
|
| 276 | 276 | if ($ro->heading == 511) $ro->heading = ''; |
| 277 | - $ro->typeid = bindec(substr($_aisdata,263,8)); |
|
| 277 | + $ro->typeid = bindec(substr($_aisdata, 263, 8)); |
|
| 278 | 278 | $ro->type = $this->getShipType($ro->typeid); |
| 279 | 279 | //$ro->to_bow = bindec(substr($_aisdata,271,9)); |
| 280 | 280 | //$ro->to_stern = bindec(substr($_aisdata,280,9)); |
| 281 | 281 | //$ro->to_port = bindec(substr($_aisdata,289,6)); |
| 282 | 282 | //$ro->to_starboard = bindec(substr($_aisdata,295,6)); |
| 283 | 283 | } else if ($ro->id == 21) { |
| 284 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,164,28))); |
|
| 285 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,192,27))); |
|
| 286 | - $ro->name = $this->binchar($_aisdata,43,120); |
|
| 284 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 164, 28))); |
|
| 285 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 192, 27))); |
|
| 286 | + $ro->name = $this->binchar($_aisdata, 43, 120); |
|
| 287 | 287 | //$ro->to_bow = bindec(substr($_aisdata,219,9)); |
| 288 | 288 | //$ro->to_stern = bindec(substr($_aisdata,228,9)); |
| 289 | 289 | //$ro->to_port = bindec(substr($_aisdata,237,6)); |
| 290 | 290 | //$ro->to_starboard = bindec(substr($_aisdata,243,6)); |
| 291 | 291 | $ro->cls = 2; // class B |
| 292 | 292 | } else if ($ro->id == 24) { |
| 293 | - $pn = bindec(substr($_aisdata,38,2)); |
|
| 293 | + $pn = bindec(substr($_aisdata, 38, 2)); |
|
| 294 | 294 | if ($pn == 0) { |
| 295 | - $ro->name = $this->binchar($_aisdata,40,120); |
|
| 295 | + $ro->name = $this->binchar($_aisdata, 40, 120); |
|
| 296 | 296 | } |
| 297 | - $ro->typeid = bindec(substr($_aisdata,40,8)); |
|
| 297 | + $ro->typeid = bindec(substr($_aisdata, 40, 8)); |
|
| 298 | 298 | $ro->type = $this->getShipType($ro->typeid); |
| 299 | - $ro->callsign = $this->binchar($_aisdata,90,42); |
|
| 299 | + $ro->callsign = $this->binchar($_aisdata, 90, 42); |
|
| 300 | 300 | //$ro->to_bow = bindec(substr($_aisdata,132,9)); |
| 301 | 301 | //$ro->to_stern = bindec(substr($_aisdata,141,9)); |
| 302 | 302 | //$ro->to_port = bindec(substr($_aisdata,150,6)); |
| 303 | 303 | //$ro->to_starboard = bindec(substr($_aisdata,156,6)); |
| 304 | 304 | $ro->cls = 2; // class B |
| 305 | 305 | } else if ($ro->id == 27) { |
| 306 | - $ro->cog = bindec(substr($_aisdata,85,9)); |
|
| 306 | + $ro->cog = bindec(substr($_aisdata, 85, 9)); |
|
| 307 | 307 | if ($ro->cog == 511) $ro->cog = 0.0; |
| 308 | - $ro->sog = bindec(substr($_aisdata,79,6)); |
|
| 308 | + $ro->sog = bindec(substr($_aisdata, 79, 6)); |
|
| 309 | 309 | if ($ro->sog == 63) $ro->sog = 0.0; |
| 310 | - $ro->lon = $this->make_lonf(bindec(substr($_aisdata,44,18))*10); |
|
| 311 | - $ro->lat = $this->make_latf(bindec(substr($_aisdata,62,17))*10); |
|
| 310 | + $ro->lon = $this->make_lonf(bindec(substr($_aisdata, 44, 18))*10); |
|
| 311 | + $ro->lat = $this->make_latf(bindec(substr($_aisdata, 62, 17))*10); |
|
| 312 | 312 | $ro->cls = 1; // class A |
| 313 | 313 | |
| 314 | 314 | } |
| 315 | - $ro->statusid = bindec(substr($_aisdata,38,4)); |
|
| 315 | + $ro->statusid = bindec(substr($_aisdata, 38, 4)); |
|
| 316 | 316 | $ro->status = $this->getStatus($ro->statusid); |
| 317 | 317 | return $ro; |
| 318 | 318 | } |
@@ -359,7 +359,7 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | |
| 361 | 361 | public function getShipTypeID($type) { |
| 362 | - $typeid = array_search($type,$this->shiptype); |
|
| 362 | + $typeid = array_search($type, $this->shiptype); |
|
| 363 | 363 | if ($typeid !== FALSE) return $typeid; |
| 364 | 364 | else return ''; |
| 365 | 365 | } |
@@ -367,14 +367,14 @@ discard block |
||
| 367 | 367 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
| 368 | 368 | global $port; // tcpip port... |
| 369 | 369 | static $debug_counter = 0; |
| 370 | - $aisdata168='';//six bit array of ascii characters |
|
| 370 | + $aisdata168 = ''; //six bit array of ascii characters |
|
| 371 | 371 | $ais_nmea_array = str_split($_itu); // convert to an array |
| 372 | 372 | foreach ($ais_nmea_array as $value) { |
| 373 | 373 | $dec = $this->ascii_2_dec($value); |
| 374 | 374 | $bit8 = $this->asciidec_2_8bit($dec); |
| 375 | 375 | $bit6 = $this->dec_2_6bit($bit8); |
| 376 | 376 | //echo $value ."-" .$bit6 .""; |
| 377 | - $aisdata168 .=$bit6; |
|
| 377 | + $aisdata168 .= $bit6; |
|
| 378 | 378 | } |
| 379 | 379 | //echo $aisdata168 . "<br/>"; |
| 380 | 380 | //return $this->decode_ais($aisdata168, $aux); |
@@ -397,24 +397,24 @@ discard block |
||
| 397 | 397 | // calculate checksum after ! till * |
| 398 | 398 | // assume 1st ! is valid |
| 399 | 399 | // find * ensure that it is at correct position |
| 400 | - $end = strrpos ( $rawdata , '*' ); |
|
| 400 | + $end = strrpos($rawdata, '*'); |
|
| 401 | 401 | if ($end === FALSE) return -1; // check for NULLS!!! |
| 402 | - $cs = substr( $rawdata, $end + 1 ); |
|
| 403 | - if ( strlen($cs) != 2 ) return -1; // correct cs length |
|
| 404 | - $dcs = (int)hexdec( $cs ); |
|
| 405 | - for ( $alias=1; $alias<$end; $alias++) $chksum ^= ord( $rawdata[$alias] ); // perform XOR for NMEA checksum |
|
| 406 | - if ( $chksum == $dcs ) { // NMEA checksum pass |
|
| 402 | + $cs = substr($rawdata, $end + 1); |
|
| 403 | + if (strlen($cs) != 2) return -1; // correct cs length |
|
| 404 | + $dcs = (int) hexdec($cs); |
|
| 405 | + for ($alias = 1; $alias < $end; $alias++) $chksum ^= ord($rawdata[$alias]); // perform XOR for NMEA checksum |
|
| 406 | + if ($chksum == $dcs) { // NMEA checksum pass |
|
| 407 | 407 | $pcs = explode(',', $rawdata); |
| 408 | 408 | // !AI??? identifier |
| 409 | 409 | if (!isset($pcs[1])) { |
| 410 | 410 | echo "ERROR,INVALID_DATA ".time()." $rawdata\n"; |
| 411 | 411 | return -1; |
| 412 | 412 | } |
| 413 | - $num_seq = (int)$pcs[1]; // number of sequences |
|
| 414 | - $seq = (int)$pcs[2]; // get sequence |
|
| 413 | + $num_seq = (int) $pcs[1]; // number of sequences |
|
| 414 | + $seq = (int) $pcs[2]; // get sequence |
|
| 415 | 415 | // get msg sequence id |
| 416 | 416 | if ($pcs[3] == '') $msg_sid = -1; // non-multipart message, set to -1 |
| 417 | - else $msg_sid = (int)$pcs[3]; // multipart message |
|
| 417 | + else $msg_sid = (int) $pcs[3]; // multipart message |
|
| 418 | 418 | $ais_ch = $pcs[4]; // get AIS channel |
| 419 | 419 | // message sequence checking |
| 420 | 420 | if ($num_seq < 1 || $num_seq > 9) { |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | } |
| 449 | 449 | $itu = $itu.$pcs[5]; // get itu message |
| 450 | - $filler += (int)$pcs[6][0]; // get filler |
|
| 450 | + $filler += (int) $pcs[6][0]; // get filler |
|
| 451 | 451 | if ($num_seq == 1 // valid single message |
| 452 | 452 | || $num_seq == $pseq // valid multi-part message |
| 453 | 453 | ) { |
@@ -469,13 +469,13 @@ discard block |
||
| 469 | 469 | $cbuf = $cbuf.$ibuf; |
| 470 | 470 | $last_pos = 0; |
| 471 | 471 | $result = new stdClass(); |
| 472 | - while ( ($start = strpos($cbuf,"VDM",$last_pos)) !== FALSE) { |
|
| 472 | + while (($start = strpos($cbuf, "VDM", $last_pos)) !== FALSE) { |
|
| 473 | 473 | //while ( ($start = strpos($cbuf,"!AI",$last_pos)) !== FALSE) { |
| 474 | 474 | //DEBUG echo $cbuf; |
| 475 | - if ( ($end = strpos($cbuf,"\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
| 475 | + if (($end = strpos($cbuf, "\r\n", $start)) !== FALSE) { //TBD need to trim? |
|
| 476 | 476 | $tst = substr($cbuf, $start - 3, ($end - $start + 3)); |
| 477 | 477 | //DEBUG echo "[$start $end $tst]\n"; |
| 478 | - $result = $this->process_ais_raw( $tst, "" ); |
|
| 478 | + $result = $this->process_ais_raw($tst, ""); |
|
| 479 | 479 | $last_pos = $end + 1; |
| 480 | 480 | } else break; |
| 481 | 481 | } |
@@ -487,41 +487,41 @@ discard block |
||
| 487 | 487 | // incoming data from serial or IP comms |
| 488 | 488 | public function process_ais_line($cbuf) { |
| 489 | 489 | $result = new stdClass(); |
| 490 | - $start = strpos($cbuf,"VDM"); |
|
| 490 | + $start = strpos($cbuf, "VDM"); |
|
| 491 | 491 | $tst = substr($cbuf, $start - 3); |
| 492 | - $result = $this->process_ais_raw( $tst, "" ); |
|
| 492 | + $result = $this->process_ais_raw($tst, ""); |
|
| 493 | 493 | return $result; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | /* AIS Encoding |
| 497 | 497 | */ |
| 498 | - private function mk_ais_lat( $lat ) { |
|
| 498 | + private function mk_ais_lat($lat) { |
|
| 499 | 499 | //$lat = 1.2569; |
| 500 | - if ($lat<0.0) { |
|
| 500 | + if ($lat < 0.0) { |
|
| 501 | 501 | $lat = -$lat; |
| 502 | - $neg=true; |
|
| 503 | - } else $neg=false; |
|
| 502 | + $neg = true; |
|
| 503 | + } else $neg = false; |
|
| 504 | 504 | $latd = 0x00000000; |
| 505 | - $latd = intval ($lat * 600000.0); |
|
| 506 | - if ($neg==true) { |
|
| 505 | + $latd = intval($lat*600000.0); |
|
| 506 | + if ($neg == true) { |
|
| 507 | 507 | $latd = ~$latd; |
| 508 | - $latd+=1; |
|
| 508 | + $latd += 1; |
|
| 509 | 509 | $latd &= 0x07FFFFFF; |
| 510 | 510 | } |
| 511 | 511 | return $latd; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - private function mk_ais_lon( $lon ) { |
|
| 514 | + private function mk_ais_lon($lon) { |
|
| 515 | 515 | //$lon = 103.851; |
| 516 | - if ($lon<0.0) { |
|
| 516 | + if ($lon < 0.0) { |
|
| 517 | 517 | $lon = -$lon; |
| 518 | - $neg=true; |
|
| 519 | - } else $neg=false; |
|
| 518 | + $neg = true; |
|
| 519 | + } else $neg = false; |
|
| 520 | 520 | $lond = 0x00000000; |
| 521 | - $lond = intval ($lon * 600000.0); |
|
| 522 | - if ($neg==true) { |
|
| 521 | + $lond = intval($lon*600000.0); |
|
| 522 | + if ($neg == true) { |
|
| 523 | 523 | $lond = ~$lond; |
| 524 | - $lond+=1; |
|
| 524 | + $lond += 1; |
|
| 525 | 525 | $lond &= 0x0FFFFFFF; |
| 526 | 526 | } |
| 527 | 527 | return $lond; |
@@ -529,8 +529,8 @@ discard block |
||
| 529 | 529 | |
| 530 | 530 | private function char2bin($name, $max_len) { |
| 531 | 531 | $len = strlen($name); |
| 532 | - if ($len > $max_len) $name = substr($name,0,$max_len); |
|
| 533 | - if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len) * 6); |
|
| 532 | + if ($len > $max_len) $name = substr($name, 0, $max_len); |
|
| 533 | + if ($len < $max_len) $pad = str_repeat('0', ($max_len - $len)*6); |
|
| 534 | 534 | else $pad = ''; |
| 535 | 535 | $rv = ''; |
| 536 | 536 | $ais_chars = array( |
@@ -547,26 +547,26 @@ discard block |
||
| 547 | 547 | if ($_a) foreach ($_a as $_1) { |
| 548 | 548 | if (isset($ais_chars[$_1])) $dec = $ais_chars[$_1]; |
| 549 | 549 | else $dec = 0; |
| 550 | - $bin = str_pad(decbin( $dec ), 6, '0', STR_PAD_LEFT); |
|
| 550 | + $bin = str_pad(decbin($dec), 6, '0', STR_PAD_LEFT); |
|
| 551 | 551 | $rv .= $bin; |
| 552 | 552 | //echo "$_1 $dec ($bin)<br/>"; |
| 553 | 553 | } |
| 554 | 554 | return $rv.$pad; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') { |
|
| 557 | + private function mk_ais($_enc, $_part = 1, $_total = 1, $_seq = '', $_ch = 'A') { |
|
| 558 | 558 | $len_bit = strlen($_enc); |
| 559 | - $rem6 = $len_bit % 6; |
|
| 559 | + $rem6 = $len_bit%6; |
|
| 560 | 560 | $pad6_len = 0; |
| 561 | 561 | if ($rem6) $pad6_len = 6 - $rem6; |
| 562 | 562 | //echo $pad6_len.'<br>'; |
| 563 | 563 | $_enc .= str_repeat("0", $pad6_len); // pad the text... |
| 564 | - $len_enc = strlen($_enc) / 6; |
|
| 564 | + $len_enc = strlen($_enc)/6; |
|
| 565 | 565 | //echo $_enc.' '.$len_enc.'<br/>'; |
| 566 | 566 | $itu = ''; |
| 567 | - for ($i=0; $i<$len_enc; $i++) { |
|
| 568 | - $offset = $i * 6; |
|
| 569 | - $dec = bindec(substr($_enc,$offset,6)); |
|
| 567 | + for ($i = 0; $i < $len_enc; $i++) { |
|
| 568 | + $offset = $i*6; |
|
| 569 | + $dec = bindec(substr($_enc, $offset, 6)); |
|
| 570 | 570 | if ($dec < 40) $dec += 48; |
| 571 | 571 | else $dec += 56; |
| 572 | 572 | //echo chr($dec)." $dec<br/>"; |
@@ -576,15 +576,15 @@ discard block |
||
| 576 | 576 | $chksum = 0; |
| 577 | 577 | $itu = "AIVDM,$_part,$_total,$_seq,$_ch,".$itu.",0"; |
| 578 | 578 | $len_itu = strlen($itu); |
| 579 | - for ($i=0; $i<$len_itu; $i++) { |
|
| 580 | - $chksum ^= ord( $itu[$i] ); |
|
| 579 | + for ($i = 0; $i < $len_itu; $i++) { |
|
| 580 | + $chksum ^= ord($itu[$i]); |
|
| 581 | 581 | } |
| 582 | - $hex_arr = array('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); |
|
| 583 | - $lsb = $chksum & 0x0F; |
|
| 584 | - if ($lsb >=0 && $lsb <= 15 ) $lsbc = $hex_arr[$lsb]; |
|
| 582 | + $hex_arr = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'); |
|
| 583 | + $lsb = $chksum&0x0F; |
|
| 584 | + if ($lsb >= 0 && $lsb <= 15) $lsbc = $hex_arr[$lsb]; |
|
| 585 | 585 | else $lsbc = '0'; |
| 586 | - $msb = (($chksum & 0xF0) >> 4) & 0x0F; |
|
| 587 | - if ($msb >=0 && $msb <= 15 ) $msbc = $hex_arr[$msb]; |
|
| 586 | + $msb = (($chksum&0xF0) >> 4)&0x0F; |
|
| 587 | + if ($msb >= 0 && $msb <= 15) $msbc = $hex_arr[$msb]; |
|
| 588 | 588 | else $msbc = '0'; |
| 589 | 589 | $itu = '!'.$itu."*{$msbc}{$lsbc}\r\n"; |
| 590 | 590 | return $itu; |
@@ -609,14 +609,14 @@ discard block |
||
| 609 | 609 | |
| 610 | 610 | public function mmsitype($mmsi) { |
| 611 | 611 | if (strlen($mmsi) == 9) { |
| 612 | - if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
| 613 | - elseif (substr($mmsi,0,3) == '972') return 'MOB (Man Overboard) device'; |
|
| 614 | - elseif (substr($mmsi,0,3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
| 615 | - elseif (substr($mmsi,0,3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
| 616 | - elseif (substr($mmsi,0,2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
| 617 | - elseif (substr($mmsi,0,2) == '99') return 'Aids to Navigation'; |
|
| 618 | - elseif (substr($mmsi,0,2) == '00') return 'Coastal stations'; |
|
| 619 | - elseif (substr($mmsi,0,1) == '0') return 'Group of ships'; |
|
| 612 | + if (substr($mmsi, 0, 3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
|
| 613 | + elseif (substr($mmsi, 0, 3) == '972') return 'MOB (Man Overboard) device'; |
|
| 614 | + elseif (substr($mmsi, 0, 3) == '970') return 'AIS SART (Search and Rescue Transmitter)'; |
|
| 615 | + elseif (substr($mmsi, 0, 3) == '111') return 'SAR (Search and Rescue) aircraft'; |
|
| 616 | + elseif (substr($mmsi, 0, 2) == '98') return 'Auxiliary craft associated with a parent ship'; |
|
| 617 | + elseif (substr($mmsi, 0, 2) == '99') return 'Aids to Navigation'; |
|
| 618 | + elseif (substr($mmsi, 0, 2) == '00') return 'Coastal stations'; |
|
| 619 | + elseif (substr($mmsi, 0, 1) == '0') return 'Group of ships'; |
|
| 620 | 620 | else return 'Ship'; |
| 621 | 621 | } |
| 622 | 622 | |
@@ -627,19 +627,19 @@ discard block |
||
| 627 | 627 | global $globalDebug; |
| 628 | 628 | $result = array(); |
| 629 | 629 | $data = new stdClass(); |
| 630 | - $start = strpos($buffer,"VDM"); |
|
| 630 | + $start = strpos($buffer, "VDM"); |
|
| 631 | 631 | $tst = substr($buffer, $start - 3); |
| 632 | - $data = $this->process_ais_raw( $tst, "" ); |
|
| 632 | + $data = $this->process_ais_raw($tst, ""); |
|
| 633 | 633 | if (!is_object($data)) { |
| 634 | 634 | //if ($globalDebug) echo '==== Line format not supported : '.$buffer."\n"; |
| 635 | 635 | return array(); |
| 636 | 636 | } |
| 637 | 637 | if ($data->lon != 0) $result['longitude'] = $data->lon; |
| 638 | 638 | if ($data->lat != 0) $result['latitude'] = $data->lat; |
| 639 | - $result['ident'] = trim(str_replace('@','',$data->name)); |
|
| 639 | + $result['ident'] = trim(str_replace('@', '', $data->name)); |
|
| 640 | 640 | $result['timestamp'] = $data->ts; |
| 641 | 641 | $result['mmsi'] = $data->mmsi; |
| 642 | - if (strlen($result['mmsi']) == 8 && substr($result['mmsi'],0,3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
| 642 | + if (strlen($result['mmsi']) == 8 && substr($result['mmsi'], 0, 3) == '669') $result['mmsi'] = '3'.$result['mmsi']; |
|
| 643 | 643 | $result['mmsi_type'] = $this->mmsitype($result['mmsi']); |
| 644 | 644 | if ($data->sog != -1.0) $result['speed'] = $data->sog; |
| 645 | 645 | if ($data->heading !== '') $result['heading'] = $data->heading; |
@@ -649,16 +649,16 @@ discard block |
||
| 649 | 649 | if ($data->type !== '') $result['type'] = $data->type; |
| 650 | 650 | if ($data->typeid !== '') $result['typeid'] = $data->typeid; |
| 651 | 651 | if ($data->imo !== '') $result['imo'] = $data->imo; |
| 652 | - if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@','',$data->callsign)); |
|
| 652 | + if ($data->callsign !== '') $result['callsign'] = trim(str_replace('@', '', $data->callsign)); |
|
| 653 | 653 | if (is_numeric($data->eta_month) && $data->eta_month != 0 && is_numeric($data->eta_day) && $data->eta_day != 0 && $data->eta_hour !== '' && $data->eta_minute !== '') { |
| 654 | - $eta_ts = strtotime(date('Y').'-'.sprintf("%02d",$data->eta_month).'-'.sprintf("%02d",$data->eta_day).' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
| 654 | + $eta_ts = strtotime(date('Y').'-'.sprintf("%02d", $data->eta_month).'-'.sprintf("%02d", $data->eta_day).' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
| 655 | 655 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
| 656 | 656 | } elseif (is_numeric($data->eta_hour) && is_numeric($data->eta_minute)) { |
| 657 | - $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d",$data->eta_hour).':'.sprintf("%02d",$data->eta_minute).':00'); |
|
| 657 | + $eta_ts = strtotime(date('Y-m-d').' '.sprintf("%02d", $data->eta_hour).':'.sprintf("%02d", $data->eta_minute).':00'); |
|
| 658 | 658 | if ($eta_ts != '') $result['eta_ts'] = $eta_ts; |
| 659 | 659 | } |
| 660 | 660 | if ($data->destination != '') { |
| 661 | - $dest = trim(str_replace('@','',$data->destination)); |
|
| 661 | + $dest = trim(str_replace('@', '', $data->destination)); |
|
| 662 | 662 | if ($dest != '') $result['destination'] = $dest; |
| 663 | 663 | } |
| 664 | 664 | $result['all'] = (array) $data; |