@@ -7,17 +7,17 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 12 | 12 | if ($sort != '') { |
| 13 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", $sort); |
|
| 13 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", $sort); |
|
| 14 | 14 | } else { |
| 15 | - $spotter_array = $Spotter->getSpotterDataByIdent($ident,"0,1", ''); |
|
| 15 | + $spotter_array = $Spotter->getSpotterDataByIdent($ident, "0,1", ''); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | if (!empty($spotter_array)) |
| 19 | 19 | { |
| 20 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['ident']); |
|
| 20 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['ident']); |
|
| 21 | 21 | require_once('header.php'); |
| 22 | 22 | print '<div class="info column">'; |
| 23 | 23 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | include('ident-sub-menu.php'); |
| 29 | 29 | print '<div class="column">'; |
| 30 | 30 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 31 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights using the ident/callsign <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 31 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights using the ident/callsign <strong>%s</strong>."), $spotter_array[0]['ident']).'</p>'; |
|
| 32 | 32 | |
| 33 | 33 | $aircraft_array = $Spotter->countAllAircraftTypesByIdent($ident); |
| 34 | 34 | if (!empty($aircraft_array)) |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | print '</thead>'; |
| 44 | 44 | print '<tbody>'; |
| 45 | 45 | $i = 1; |
| 46 | - foreach($aircraft_array as $aircraft_item) |
|
| 46 | + foreach ($aircraft_array as $aircraft_item) |
|
| 47 | 47 | { |
| 48 | 48 | print '<tr>'; |
| 49 | 49 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,22 +7,22 @@ discard block |
||
| 7 | 7 | die(); |
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$pilot = filter_input(INPUT_GET,'pilot',FILTER_SANITIZE_STRING); |
|
| 12 | -$year = filter_input(INPUT_GET,'year',FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | -$month = filter_input(INPUT_GET,'month',FILTER_SANITIZE_NUMBER_INT); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$pilot = filter_input(INPUT_GET, 'pilot', FILTER_SANITIZE_STRING); |
|
| 12 | +$year = filter_input(INPUT_GET, 'year', FILTER_SANITIZE_NUMBER_INT); |
|
| 13 | +$month = filter_input(INPUT_GET, 'month', FILTER_SANITIZE_NUMBER_INT); |
|
| 14 | 14 | $filter = array(); |
| 15 | -if ($year != '') $filter = array_merge($filter,array('year' => $year)); |
|
| 16 | -if ($month != '') $filter = array_merge($filter,array('month' => $month)); |
|
| 15 | +if ($year != '') $filter = array_merge($filter, array('year' => $year)); |
|
| 16 | +if ($month != '') $filter = array_merge($filter, array('month' => $month)); |
|
| 17 | 17 | if ($sort != '') { |
| 18 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", $sort,$filter); |
|
| 18 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", $sort, $filter); |
|
| 19 | 19 | } else { |
| 20 | - $spotter_array = $Spotter->getSpotterDataByPilot($pilot,"0,1", '',$filter); |
|
| 20 | + $spotter_array = $Spotter->getSpotterDataByPilot($pilot, "0,1", '', $filter); |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | if (!empty($spotter_array)) |
| 24 | 24 | { |
| 25 | - $title = sprintf(_("Most Common Aircraft of %s"),$spotter_array[0]['pilot_name']); |
|
| 25 | + $title = sprintf(_("Most Common Aircraft of %s"), $spotter_array[0]['pilot_name']); |
|
| 26 | 26 | require_once('header.php'); |
| 27 | 27 | print '<div class="info column">'; |
| 28 | 28 | print '<h1>'.$spotter_array[0]['pilot_name'].'</h1>'; |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | include('pilot-sub-menu.php'); |
| 34 | 34 | print '<div class="column">'; |
| 35 | 35 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 36 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights piloted by <strong>%s</strong>."),$spotter_array[0]['pilot_name']).'</p>'; |
|
| 36 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights piloted by <strong>%s</strong>."), $spotter_array[0]['pilot_name']).'</p>'; |
|
| 37 | 37 | |
| 38 | - $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot,$filter); |
|
| 38 | + $aircraft_array = $Spotter->countAllAircraftTypesByPilot($pilot, $filter); |
|
| 39 | 39 | if (!empty($aircraft_array)) |
| 40 | 40 | { |
| 41 | 41 | print '<div class="table-responsive">'; |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | print '</thead>'; |
| 48 | 48 | print '<tbody>'; |
| 49 | 49 | $i = 1; |
| 50 | - foreach($aircraft_array as $aircraft_item) |
|
| 50 | + foreach ($aircraft_array as $aircraft_item) |
|
| 51 | 51 | { |
| 52 | 52 | print '<tr>'; |
| 53 | 53 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | |
| 11 | -$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING)))); |
|
| 12 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | +$country = ucwords(str_replace("-", " ", urldecode(filter_input(INPUT_GET, 'country', FILTER_SANITIZE_STRING)))); |
|
| 12 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 13 | 13 | $spotter_array = $Spotter->getSpotterDataByCountry($country, "0,1", $sort); |
| 14 | 14 | |
| 15 | 15 | if (!empty($spotter_array)) |
| 16 | 16 | { |
| 17 | - $title = sprintf(_("Most Common Aircraft from %s"),$country); |
|
| 17 | + $title = sprintf(_("Most Common Aircraft from %s"), $country); |
|
| 18 | 18 | |
| 19 | 19 | require_once('header.php'); |
| 20 | 20 | print '<div class="select-item">'; |
@@ -22,9 +22,9 @@ discard block |
||
| 22 | 22 | print '<select name="country" class="selectpicker" data-live-search="true">'; |
| 23 | 23 | print '<option></option>'; |
| 24 | 24 | $all_countries = $Spotter->getAllCountries(); |
| 25 | - foreach($all_countries as $all_country) |
|
| 25 | + foreach ($all_countries as $all_country) |
|
| 26 | 26 | { |
| 27 | - if($country == $all_country['country']) |
|
| 27 | + if ($country == $all_country['country']) |
|
| 28 | 28 | { |
| 29 | 29 | print '<option value="'.strtolower(str_replace(" ", "-", $all_country['country'])).'" selected="selected">'.$all_country['country'].'</option>'; |
| 30 | 30 | } else { |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | if ($_GET['country'] != "NA") |
| 40 | 40 | { |
| 41 | 41 | print '<div class="info column">'; |
| 42 | - print '<h1>'.sprintf(_("Airports & Airlines from %s"),$country).'</h1>'; |
|
| 42 | + print '<h1>'.sprintf(_("Airports & Airlines from %s"), $country).'</h1>'; |
|
| 43 | 43 | print '</div>'; |
| 44 | 44 | } else { |
| 45 | 45 | print '<div class="alert alert-warning">'._("This special country profile shows all flights that do <u>not</u> have a country of a airline or departure/arrival airport associated with them.").'</div>'; |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | include('country-sub-menu.php'); |
| 49 | 49 | print '<div class="column">'; |
| 50 | 50 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 51 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."),$country).'</p>'; |
|
| 51 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights from <strong>%s</strong>."), $country).'</p>'; |
|
| 52 | 52 | |
| 53 | 53 | $aircraft_array = $Spotter->countAllAircraftTypesByCountry($country); |
| 54 | 54 | if (!empty($aircraft_array)) |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | print '</thead>'; |
| 63 | 63 | print '<tbody>'; |
| 64 | 64 | $i = 1; |
| 65 | - foreach($aircraft_array as $aircraft_item) |
|
| 65 | + foreach ($aircraft_array as $aircraft_item) |
|
| 66 | 66 | { |
| 67 | 67 | print '<tr>'; |
| 68 | 68 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -7,15 +7,15 @@ discard block |
||
| 7 | 7 | require_once('require/class.Connection.php'); |
| 8 | 8 | require_once('require/class.Spotter.php'); |
| 9 | 9 | require_once('require/class.Language.php'); |
| 10 | -$sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 11 | -$departure_airport = filter_input(INPUT_GET,'departure_airport',FILTER_SANITIZE_STRING); |
|
| 12 | -$arrival_airport = filter_input(INPUT_GET,'arrival_airport',FILTER_SANITIZE_STRING); |
|
| 10 | +$sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 11 | +$departure_airport = filter_input(INPUT_GET, 'departure_airport', FILTER_SANITIZE_STRING); |
|
| 12 | +$arrival_airport = filter_input(INPUT_GET, 'arrival_airport', FILTER_SANITIZE_STRING); |
|
| 13 | 13 | $Spotter = new Spotter(); |
| 14 | 14 | $spotter_array = $Spotter->getSpotterDataByRoute($departure_airport, $arrival_airport, "0,1", $sort); |
| 15 | 15 | |
| 16 | 16 | if (!empty($spotter_array)) |
| 17 | 17 | { |
| 18 | - $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']); |
|
| 18 | + $title = sprintf(_("Most Common Aircraft between %s (%s), %s - %s (%s), %s"), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']); |
|
| 19 | 19 | require_once('header.php'); |
| 20 | 20 | print '<div class="info column">'; |
| 21 | 21 | print '<h1>'._("Flights between").' '.$spotter_array[0]['departure_airport_name'].' ('.$spotter_array[0]['departure_airport_icao'].'), '.$spotter_array[0]['departure_airport_country'].' - '.$spotter_array[0]['arrival_airport_name'].' ('.$spotter_array[0]['arrival_airport_icao'].'), '.$spotter_array[0]['arrival_airport_country'].'</h1>'; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | include('route-sub-menu.php'); |
| 27 | 27 | print '<div class="column">'; |
| 28 | 28 | print '<h2>'._("Most Common Aircraft").'</h2>'; |
| 29 | - print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."),$spotter_array[0]['departure_airport_name'],$spotter_array[0]['departure_airport_icao'],$spotter_array[0]['departure_airport_country'],$spotter_array[0]['arrival_airport_name'],$spotter_array[0]['arrival_airport_icao'],$spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 29 | + print '<p>'.sprintf(_("The statistic below shows the most common aircraft of flights between <strong>%s (%s), %s</strong> and <strong>%s (%s), %s</strong>."), $spotter_array[0]['departure_airport_name'], $spotter_array[0]['departure_airport_icao'], $spotter_array[0]['departure_airport_country'], $spotter_array[0]['arrival_airport_name'], $spotter_array[0]['arrival_airport_icao'], $spotter_array[0]['arrival_airport_country']).'</p>'; |
|
| 30 | 30 | |
| 31 | 31 | $aircraft_array = $Spotter->countAllAircraftTypesByRoute($departure_airport, $arrival_airport); |
| 32 | 32 | if (!empty($aircraft_array)) |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | print '</thead>'; |
| 42 | 42 | print '<tbody>'; |
| 43 | 43 | $i = 1; |
| 44 | - foreach($aircraft_array as $aircraft_item) |
|
| 44 | + foreach ($aircraft_array as $aircraft_item) |
|
| 45 | 45 | { |
| 46 | 46 | print '<tr>'; |
| 47 | 47 | print '<td><strong>'.$i.'</strong></td>'; |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * Translated to PHP of GeographicLib/src/Geoid.cpp |
| 12 | 12 | * by Ycarus <[email protected]> in 2017 |
| 13 | 13 | */ |
| 14 | -class GeoidHeight { |
|
| 14 | +class GeoidHeight { |
|
| 15 | 15 | private $c0 = 240; |
| 16 | 16 | private $c3 = [[9, -18, -88, 0, 96, 90, 0, 0, -60, -20], [-9, 18, 8, 0, -96, 30, 0, 0, 60, -20], [9, -88, -18, 90, 96, 0, -20, -60, 0, 0], [186, -42, -42, -150, -96, -150, 60, 60, 60, 60], [54, 162, -78, 30, -24, -90, -60, 60, -60, 60], [-9, -32, 18, 30, 24, 0, 20, -60, 0, 0], [-9, 8, 18, 30, -96, 0, -20, 60, 0, 0], [54, -78, 162, -90, -24, 30, 60, -60, 60, -60], [-54, 78, 78, 90, 144, 90, -60, -60, -60, -60], [9, -8, -18, -30, -24, 0, 20, 60, 0, 0], [-9, 18, -32, 0, 24, 30, 0, 0, -60, 20], [9, -18, -8, 0, -24, -30, 0, 0, 60, 20]]; |
| 17 | 17 | private $c0n = 372; |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | private $v10 = null; |
| 35 | 35 | private $v11 = null; |
| 36 | 36 | |
| 37 | - public function __construct($name='') { |
|
| 37 | + public function __construct($name = '') { |
|
| 38 | 38 | global $globalGeoidSource; |
| 39 | 39 | //if ($name == '') $name = dirname(__FILE__).'/../install/tmp/egm2008-1.pgm'; |
| 40 | 40 | if ($name == '') { |
@@ -45,35 +45,35 @@ discard block |
||
| 45 | 45 | if (file_exists($name) === FALSE) { |
| 46 | 46 | throw new Exception($name." doesn't exist"); |
| 47 | 47 | } |
| 48 | - $f = @fopen($name,"r"); |
|
| 48 | + $f = @fopen($name, "r"); |
|
| 49 | 49 | if ($f === FALSE) { |
| 50 | 50 | throw new Exception("Can't open ".$name); |
| 51 | 51 | } |
| 52 | - $line = fgets($f,4096); |
|
| 52 | + $line = fgets($f, 4096); |
|
| 53 | 53 | if (trim($line) != 'P5') { |
| 54 | 54 | throw new Exception('No PGM header'); |
| 55 | 55 | } |
| 56 | 56 | $headerlen = strlen($line); |
| 57 | 57 | while (true) { |
| 58 | - $line = fgets($f,4096); |
|
| 58 | + $line = fgets($f, 4096); |
|
| 59 | 59 | if ((strlen($line) == 0)) { |
| 60 | 60 | throw new Exception('EOF before end of file header'); |
| 61 | 61 | } |
| 62 | 62 | $headerlen += strlen($line); |
| 63 | - if (strpos($line,'# Offset ') !== FALSE) { |
|
| 63 | + if (strpos($line, '# Offset ') !== FALSE) { |
|
| 64 | 64 | $this->offset = substr($line, 9); |
| 65 | - } else if (strpos($line,'# Scale ') !== FALSE) { |
|
| 65 | + } else if (strpos($line, '# Scale ') !== FALSE) { |
|
| 66 | 66 | $this->scale = substr($line, 8); |
| 67 | - } else if ((strpos($line,'#') === FALSE)) { |
|
| 68 | - list($this->width, $this->height) = preg_split('/\s+/',$line); |
|
| 67 | + } else if ((strpos($line, '#') === FALSE)) { |
|
| 68 | + list($this->width, $this->height) = preg_split('/\s+/', $line); |
|
| 69 | 69 | break; |
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | - $line = fgets($f,4096); |
|
| 72 | + $line = fgets($f, 4096); |
|
| 73 | 73 | $headerlen += strlen($line); |
| 74 | - $levels = (int)$line; |
|
| 75 | - $this->width = (int)$this->width; |
|
| 76 | - $this->height = (int)$this->height; |
|
| 74 | + $levels = (int) $line; |
|
| 75 | + $this->width = (int) $this->width; |
|
| 76 | + $this->height = (int) $this->height; |
|
| 77 | 77 | if (($levels != 65535)) { |
| 78 | 78 | throw new Exception('PGM file must have 65535 gray levels ('.$levels.')'); |
| 79 | 79 | } |
@@ -88,42 +88,42 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | $fullsize = filesize($name); |
| 91 | - if ((($fullsize - $headerlen) != (($this->width * $this->height) * 2))) { |
|
| 91 | + if ((($fullsize - $headerlen) != (($this->width*$this->height)*2))) { |
|
| 92 | 92 | throw new Exception('File has the wrong length'); |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | $this->headerlen = $headerlen; |
| 96 | - $this->raw= $f; |
|
| 97 | - $this->rlonres = ($this->width / 360.0); |
|
| 98 | - $this->rlatres = (($this->height - 1) / 180.0); |
|
| 96 | + $this->raw = $f; |
|
| 97 | + $this->rlonres = ($this->width/360.0); |
|
| 98 | + $this->rlatres = (($this->height - 1)/180.0); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - private function _rawval($ix,$iy) { |
|
| 101 | + private function _rawval($ix, $iy) { |
|
| 102 | 102 | if (($iy < 0)) { |
| 103 | 103 | $iy = -$iy; |
| 104 | - $ix += ($this->width / 2); |
|
| 104 | + $ix += ($this->width/2); |
|
| 105 | 105 | } else if (($iy >= $this->height)) { |
| 106 | - $iy = ((2 * ($this->height - 1)) - $iy); |
|
| 107 | - $ix += ($this->width / 2); |
|
| 106 | + $iy = ((2*($this->height - 1)) - $iy); |
|
| 107 | + $ix += ($this->width/2); |
|
| 108 | 108 | } |
| 109 | 109 | if (($ix < 0)) { |
| 110 | 110 | $ix += $this->width; |
| 111 | 111 | } else if (($ix >= $this->width)) { |
| 112 | 112 | $ix -= $this->width; |
| 113 | 113 | } |
| 114 | - $k = ((($iy * $this->width) + $ix) * 2) + $this->headerlen; |
|
| 115 | - fseek($this->raw,$k); |
|
| 116 | - return unpack('n',fread($this->raw,2))[1]; |
|
| 114 | + $k = ((($iy*$this->width) + $ix)*2) + $this->headerlen; |
|
| 115 | + fseek($this->raw, $k); |
|
| 116 | + return unpack('n', fread($this->raw, 2))[1]; |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | - public function get($lat,$lon,$cubic=true) { |
|
| 119 | + public function get($lat, $lon, $cubic = true) { |
|
| 120 | 120 | if (($lon < 0)) { |
| 121 | 121 | $lon += 360; |
| 122 | 122 | } |
| 123 | - $fy = ((90 - $lat) * $this->rlatres); |
|
| 124 | - $fx = ($lon * $this->rlonres); |
|
| 125 | - $iy = (int)$fy; |
|
| 126 | - $ix = (int)$fx; |
|
| 123 | + $fy = ((90 - $lat)*$this->rlatres); |
|
| 124 | + $fx = ($lon*$this->rlonres); |
|
| 125 | + $iy = (int) $fy; |
|
| 126 | + $ix = (int) $fx; |
|
| 127 | 127 | $fx -= $ix; |
| 128 | 128 | $fy -= $iy; |
| 129 | 129 | $t = array(); |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $c3x = $this->c3; |
| 151 | 151 | $c0x = $this->c0; |
| 152 | 152 | } |
| 153 | - for ($i = 0; $i < 10;++$i) { |
|
| 153 | + for ($i = 0; $i < 10; ++$i) { |
|
| 154 | 154 | $t[$i] = 0; |
| 155 | 155 | for ($j = 0; $j < 12; ++$j) { |
| 156 | 156 | $t[$i] += $v[$j]*$c3x[$j][$i]; |
@@ -161,13 +161,13 @@ discard block |
||
| 161 | 161 | $this->t = $t; |
| 162 | 162 | } else $t = $this->t; |
| 163 | 163 | if (!($cubic)) { |
| 164 | - $a = (((1 - $fx) * $this->v00) + ($fx * $this->v01)); |
|
| 165 | - $b = (((1 - $fx) * $this->v10) + ($fx * $this->v11)); |
|
| 166 | - $h = (((1 - $fy) * $a) + ($fy * $b)); |
|
| 164 | + $a = (((1 - $fx)*$this->v00) + ($fx*$this->v01)); |
|
| 165 | + $b = (((1 - $fx)*$this->v10) + ($fx*$this->v11)); |
|
| 166 | + $h = (((1 - $fy)*$a) + ($fy*$b)); |
|
| 167 | 167 | } else { |
| 168 | - $h = (($t[0] + ($fx * ($t[1] + ($fx * ($t[3] + ($fx * $t[6])))))) + ($fy * (($t[2] + ($fx * ($t[4] + ($fx * $t[7])))) + ($fy * (($t[5] + ($fx * $t[8])) + ($fy * $t[9])))))); |
|
| 168 | + $h = (($t[0] + ($fx*($t[1] + ($fx*($t[3] + ($fx*$t[6])))))) + ($fy*(($t[2] + ($fx*($t[4] + ($fx*$t[7])))) + ($fy*(($t[5] + ($fx*$t[8])) + ($fy*$t[9])))))); |
|
| 169 | 169 | } |
| 170 | - return ((float)$this->offset + ((float)$this->scale * (float)$h)); |
|
| 170 | + return ((float) $this->offset + ((float) $this->scale*(float) $h)); |
|
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | /* |
@@ -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 ($airline['airline_icao'] != '') { |
| 45 | 45 | if (isset($airline_icao) && $airline_icao != 'all' && $airline_icao == $airline['airline_icao']) { |
| 46 | 46 | print '<option value="'.$airline['airline_icao'].'" selected>'.$airline['airline_name'].'</option>'; |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (!isset($type) || $type == 'aircraft') { |
| 66 | 66 | ?> |
| 67 | 67 | <li class="dropdown"> |
| 68 | - <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="#" > |
|
| 68 | + <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="#" > |
|
| 69 | 69 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 70 | 70 | </a> |
| 71 | 71 | <ul class="dropdown-menu"> |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | </ul> |
| 77 | 77 | </li> |
| 78 | 78 | <li class="dropdown"> |
| 79 | - <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="#"> |
|
| 79 | + <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="#"> |
|
| 80 | 80 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 81 | 81 | </a> |
| 82 | 82 | <ul class="dropdown-menu" role="menu"> |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | </ul> |
| 93 | 93 | </li> |
| 94 | 94 | <li class="dropdown"> |
| 95 | - <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="#"> |
|
| 95 | + <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="#"> |
|
| 96 | 96 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 97 | 97 | </a> |
| 98 | 98 | <ul class="dropdown-menu" role="menu"> |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | </ul> |
| 104 | 104 | </li> |
| 105 | 105 | <li class="dropdown"> |
| 106 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 106 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 107 | 107 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 108 | 108 | </a> |
| 109 | 109 | <ul class="dropdown-menu" role="menu"> |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | </ul> |
| 113 | 113 | </li> |
| 114 | 114 | <li class="dropdown"> |
| 115 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 115 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 116 | 116 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 117 | 117 | </a> |
| 118 | 118 | <ul class="dropdown-menu" role="menu"> |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | if (isset($globalAccidents) && $globalAccidents && (!isset($airline_icao) || $airline_icao == '' || $airline_icao == 'all')) { |
| 125 | 125 | ?> |
| 126 | 126 | <li class="dropdown"> |
| 127 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 127 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 128 | 128 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 129 | 129 | </a> |
| 130 | 130 | <ul class="dropdown-menu" role="menu"> |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 140 | 140 | ?> |
| 141 | 141 | <li class="dropdown"> |
| 142 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 142 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 143 | 143 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 144 | 144 | </a> |
| 145 | 145 | <ul class="dropdown-menu" role="menu"> |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | if (!isset($type) || $type == 'aircraft') { |
| 170 | 170 | ?> |
| 171 | 171 | <li class="dropdown"> |
| 172 | - <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="#" > |
|
| 172 | + <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="#" > |
|
| 173 | 173 | <?php echo _("Aircraft"); ?> <span class="caret"></span> |
| 174 | 174 | </a> |
| 175 | 175 | <ul class="dropdown-menu"> |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | </ul> |
| 181 | 181 | </li> |
| 182 | 182 | <li class="dropdown"> |
| 183 | - <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="#"> |
|
| 183 | + <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="#"> |
|
| 184 | 184 | <?php echo _("Airline"); ?> <span class="caret"></span> |
| 185 | 185 | </a> |
| 186 | 186 | <ul class="dropdown-menu" role="menu"> |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | </ul> |
| 197 | 197 | </li> |
| 198 | 198 | <li class="dropdown"> |
| 199 | - <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="#"> |
|
| 199 | + <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="#"> |
|
| 200 | 200 | <?php echo _("Airport"); ?> <span class="caret"></span> |
| 201 | 201 | </a> |
| 202 | 202 | <ul class="dropdown-menu" role="menu"> |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | </li> |
| 209 | 209 | <!-- |
| 210 | 210 | <li class="dropdown"> |
| 211 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 211 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-route-airport" || strtolower($current_page) == "statistics-route-waypoint") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 212 | 212 | <?php echo _("Route"); ?> <span class="caret"></span> |
| 213 | 213 | </a> |
| 214 | 214 | <ul class="dropdown-menu" role="menu"> |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | --> |
| 220 | 220 | <!-- |
| 221 | 221 | <li class="dropdown"> |
| 222 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 222 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 223 | 223 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 224 | 224 | </a> |
| 225 | 225 | <ul class="dropdown-menu" role="menu"> |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | ?> |
| 234 | 234 | <!-- |
| 235 | 235 | <li class="dropdown"> |
| 236 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 236 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-fatalities-year" || strtolower($current_page) == "statistics-fatalities-month") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 237 | 237 | <?php echo _("Fatalities"); ?> <span class="caret"></span> |
| 238 | 238 | </a> |
| 239 | 239 | <ul class="dropdown-menu" role="menu"> |
@@ -249,7 +249,7 @@ discard block |
||
| 249 | 249 | } elseif ($type == 'marine' || $type == 'tracker') { |
| 250 | 250 | ?> |
| 251 | 251 | <li class="dropdown"> |
| 252 | - <a class="dropdown-toggle <?php if(strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time"){ print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 252 | + <a class="dropdown-toggle <?php if (strtolower($current_page) == "statistics-date" || strtolower($current_page) == "statistics-time") { print 'active'; } ?>" data-toggle="dropdown" href="#"> |
|
| 253 | 253 | <?php echo _("Date & Time"); ?> <span class="caret"></span> |
| 254 | 254 | </a> |
| 255 | 255 | <ul class="dropdown-menu" role="menu"> |
@@ -175,8 +175,7 @@ discard block |
||
| 175 | 175 | '\~' => 'TNC Stream SW'); |
| 176 | 176 | |
| 177 | 177 | private function urshift($n, $s) { |
| 178 | - return ($n >= 0) ? ($n >> $s) : |
|
| 179 | - (($n & 0x7fffffff) >> $s) | |
|
| 178 | + return ($n >= 0) ? ($n >> $s) : (($n&0x7fffffff) >> $s)| |
|
| 180 | 179 | (0x40000000 >> ($s - 1)); |
| 181 | 180 | } |
| 182 | 181 | |
@@ -192,7 +191,7 @@ discard block |
||
| 192 | 191 | $input_len = strlen($input); |
| 193 | 192 | |
| 194 | 193 | /* Find the end of header checking for NULL bytes while doing it. */ |
| 195 | - $splitpos = strpos($input,':'); |
|
| 194 | + $splitpos = strpos($input, ':'); |
|
| 196 | 195 | |
| 197 | 196 | /* Check that end was found and body has at least one byte. */ |
| 198 | 197 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
@@ -202,14 +201,14 @@ discard block |
||
| 202 | 201 | |
| 203 | 202 | if ($debug) echo 'input : '.$input."\n"; |
| 204 | 203 | /* Save header and body. */ |
| 205 | - $body = substr($input,$splitpos+1,$input_len); |
|
| 204 | + $body = substr($input, $splitpos + 1, $input_len); |
|
| 206 | 205 | $body_len = strlen($body); |
| 207 | - $header = substr($input,0,$splitpos); |
|
| 206 | + $header = substr($input, 0, $splitpos); |
|
| 208 | 207 | if ($debug) echo 'header : '.$header."\n"; |
| 209 | 208 | |
| 210 | 209 | /* Parse source, target and path. */ |
| 211 | 210 | //FLRDF0A52>APRS,qAS,LSTB |
| 212 | - if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
|
| 211 | + if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/', $header, $matches)) { |
|
| 213 | 212 | $ident = $matches[1]; |
| 214 | 213 | $all_elements = $matches[2]; |
| 215 | 214 | if ($ident == 'AIRCRAFT') { |
@@ -226,13 +225,13 @@ discard block |
||
| 226 | 225 | if ($debug) 'No ident'."\n"; |
| 227 | 226 | return false; |
| 228 | 227 | } |
| 229 | - $elements = explode(',',$all_elements); |
|
| 228 | + $elements = explode(',', $all_elements); |
|
| 230 | 229 | $source = end($elements); |
| 231 | 230 | $result['source'] = $source; |
| 232 | 231 | foreach ($elements as $element) { |
| 233 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
| 232 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/', $element)) { |
|
| 234 | 233 | //if ($element == 'TCPIP*') return false; |
| 235 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
| 234 | + } elseif (!preg_match('/^([0-9A-F]{32})$/', $element)) { |
|
| 236 | 235 | if ($debug) echo 'element : '.$element."\n"; |
| 237 | 236 | return false; |
| 238 | 237 | } |
@@ -245,14 +244,14 @@ discard block |
||
| 245 | 244 | */ |
| 246 | 245 | } |
| 247 | 246 | |
| 248 | - $type = substr($body,0,1); |
|
| 247 | + $type = substr($body, 0, 1); |
|
| 249 | 248 | if ($debug) echo 'type : '.$type."\n"; |
| 250 | 249 | if ($type == ';') { |
| 251 | 250 | if (isset($result['source_type']) && $result['source_type'] == 'modes') { |
| 252 | - $result['address'] = trim(substr($body,1,9)); |
|
| 251 | + $result['address'] = trim(substr($body, 1, 9)); |
|
| 253 | 252 | } elseif (isset($result['source_type']) && $result['source_type'] == 'ais') { |
| 254 | - $result['mmsi'] = trim(substr($body,1,9)); |
|
| 255 | - } else $result['ident'] = trim(substr($body,1,9)); |
|
| 253 | + $result['mmsi'] = trim(substr($body, 1, 9)); |
|
| 254 | + } else $result['ident'] = trim(substr($body, 1, 9)); |
|
| 256 | 255 | } elseif ($type == ',') { |
| 257 | 256 | // Invalid data or test data |
| 258 | 257 | return false; |
@@ -260,20 +259,20 @@ discard block |
||
| 260 | 259 | |
| 261 | 260 | // Check for Timestamp |
| 262 | 261 | $find = false; |
| 263 | - $body_parse = substr($body,1); |
|
| 264 | - if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
|
| 265 | - $body_parse = substr($body_parse,10); |
|
| 262 | + $body_parse = substr($body, 1); |
|
| 263 | + if (preg_match('/^;(.){9}\*/', $body, $matches)) { |
|
| 264 | + $body_parse = substr($body_parse, 10); |
|
| 266 | 265 | $find = true; |
| 267 | 266 | } |
| 268 | - if (preg_match('/^`(.*)\//',$body,$matches)) { |
|
| 269 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
| 267 | + if (preg_match('/^`(.*)\//', $body, $matches)) { |
|
| 268 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
| 270 | 269 | $find = true; |
| 271 | 270 | } |
| 272 | - if (preg_match("/^'(.*)\//",$body,$matches)) { |
|
| 273 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
| 271 | + if (preg_match("/^'(.*)\//", $body, $matches)) { |
|
| 272 | + $body_parse = substr($body_parse, strlen($matches[1]) - 1); |
|
| 274 | 273 | $find = true; |
| 275 | 274 | } |
| 276 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
|
| 275 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/', $body_parse, $matches)) { |
|
| 277 | 276 | $find = true; |
| 278 | 277 | $timestamp = $matches[0]; |
| 279 | 278 | if ($matches[4] == 'h') { |
@@ -286,17 +285,17 @@ discard block |
||
| 286 | 285 | // This work or not ? |
| 287 | 286 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
| 288 | 287 | } |
| 289 | - $body_parse = substr($body_parse,7); |
|
| 288 | + $body_parse = substr($body_parse, 7); |
|
| 290 | 289 | $result['timestamp'] = $timestamp; |
| 291 | 290 | } |
| 292 | - if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
|
| 291 | + if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/', $body_parse, $matches)) { |
|
| 293 | 292 | $find = true; |
| 294 | 293 | $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
| 295 | - $body_parse = substr($body_parse,8); |
|
| 294 | + $body_parse = substr($body_parse, 8); |
|
| 296 | 295 | $result['timestamp'] = $timestamp; |
| 297 | 296 | } |
| 298 | 297 | //if (strlen($body_parse) > 19) { |
| 299 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
| 298 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/', $body_parse, $matches)) { |
|
| 300 | 299 | $find = true; |
| 301 | 300 | // 4658.70N/00707.78Ez |
| 302 | 301 | $sind = strtoupper($matches[3]); |
@@ -318,11 +317,11 @@ discard block |
||
| 318 | 317 | */ |
| 319 | 318 | $latitude = $lat + floatval($lat_min)/60; |
| 320 | 319 | $longitude = $lon + floatval($lon_min)/60; |
| 321 | - if ($sind == 'S') $latitude = 0-$latitude; |
|
| 322 | - if ($wind == 'W') $longitude = 0-$longitude; |
|
| 320 | + if ($sind == 'S') $latitude = 0 - $latitude; |
|
| 321 | + if ($wind == 'W') $longitude = 0 - $longitude; |
|
| 323 | 322 | $result['latitude'] = $latitude; |
| 324 | 323 | $result['longitude'] = $longitude; |
| 325 | - $body_parse = substr($body_parse,18); |
|
| 324 | + $body_parse = substr($body_parse, 18); |
|
| 326 | 325 | $body_parse_len = strlen($body_parse); |
| 327 | 326 | } |
| 328 | 327 | $body_parse_len = strlen($body_parse); |
@@ -349,22 +348,22 @@ discard block |
||
| 349 | 348 | //' |
| 350 | 349 | //if ($type != ';' && $type != '>') { |
| 351 | 350 | if ($type != '') { |
| 352 | - $body_parse = substr($body_parse,1); |
|
| 351 | + $body_parse = substr($body_parse, 1); |
|
| 353 | 352 | $body_parse_len = strlen($body_parse); |
| 354 | 353 | $result['symbol_code'] = $symbol_code; |
| 355 | 354 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
| 356 | 355 | if ($symbol_code != '_') { |
| 357 | 356 | } |
| 358 | 357 | if ($body_parse_len >= 7) { |
| 359 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
| 360 | - $course = substr($body_parse,0,3); |
|
| 358 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/', $body_parse)) { |
|
| 359 | + $course = substr($body_parse, 0, 3); |
|
| 361 | 360 | $tmp_s = intval($course); |
| 362 | 361 | if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
| 363 | - $speed = substr($body_parse,4,3); |
|
| 362 | + $speed = substr($body_parse, 4, 3); |
|
| 364 | 363 | if ($speed != '...') { |
| 365 | 364 | $result['speed'] = intval($speed); |
| 366 | 365 | } |
| 367 | - $body_parse = substr($body_parse,7); |
|
| 366 | + $body_parse = substr($body_parse, 7); |
|
| 368 | 367 | } |
| 369 | 368 | // Check PHGR, PHG, RNG |
| 370 | 369 | } |
@@ -374,11 +373,11 @@ discard block |
||
| 374 | 373 | } |
| 375 | 374 | */ |
| 376 | 375 | if (strlen($body_parse) > 0) { |
| 377 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
| 376 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/', $body_parse, $matches)) { |
|
| 378 | 377 | $altitude = intval($matches[1]); |
| 379 | 378 | $result['altitude'] = $altitude; |
| 380 | 379 | //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
| 381 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
| 380 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/', '', $body_parse)); |
|
| 382 | 381 | } |
| 383 | 382 | } |
| 384 | 383 | // Telemetry |
@@ -388,58 +387,58 @@ discard block |
||
| 388 | 387 | } |
| 389 | 388 | */ |
| 390 | 389 | // DAO |
| 391 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
| 390 | + if (preg_match('/^!([0-9A-Z]{3})/', $body_parse, $matches)) { |
|
| 392 | 391 | $dao = $matches[1]; |
| 393 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
| 392 | + if (preg_match('/^([A-Z])([0-9]{2})/', $dao)) { |
|
| 394 | 393 | $dao_split = str_split($dao); |
| 395 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
| 396 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
| 394 | + $lat_off = (($dao_split[1]) - 48.0)*0.001/60.0; |
|
| 395 | + $lon_off = (($dao_split[2]) - 48.0)*0.001/60.0; |
|
| 397 | 396 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
| 398 | 397 | else $result['latitude'] += $lat_off; |
| 399 | 398 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
| 400 | 399 | else $result['longitude'] += $lon_off; |
| 401 | 400 | } |
| 402 | - $body_parse = substr($body_parse,6); |
|
| 401 | + $body_parse = substr($body_parse, 6); |
|
| 403 | 402 | } |
| 404 | - if (preg_match('/CS=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
| 405 | - $result['ident'] = str_replace('_',' ',$matches[1]); |
|
| 403 | + if (preg_match('/CS=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
| 404 | + $result['ident'] = str_replace('_', ' ', $matches[1]); |
|
| 406 | 405 | } |
| 407 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
| 406 | + if (preg_match('/SQ=([0-9]{4})/', $body_parse, $matches)) { |
|
| 408 | 407 | $result['squawk'] = $matches[1]; |
| 409 | 408 | } |
| 410 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
| 409 | + if (preg_match('/AI=([0-9A-Z]{4})/', $body_parse, $matches)) { |
|
| 411 | 410 | $result['aircraft_icao'] = $matches[1]; |
| 412 | 411 | } |
| 413 | - if (preg_match('/VR=([-0-9]*)/',$body_parse,$matches)) { |
|
| 412 | + if (preg_match('/VR=([-0-9]*)/', $body_parse, $matches)) { |
|
| 414 | 413 | $result['verticalrate'] = $matches[1]; |
| 415 | 414 | } |
| 416 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
| 415 | + if (preg_match('/TI=([0-9]*)/', $body_parse, $matches)) { |
|
| 417 | 416 | $result['typeid'] = $matches[1]; |
| 418 | 417 | } |
| 419 | - if (preg_match('/SI=([0-9]*)/',$body_parse,$matches)) { |
|
| 418 | + if (preg_match('/SI=([0-9]*)/', $body_parse, $matches)) { |
|
| 420 | 419 | $result['statusid'] = $matches[1]; |
| 421 | 420 | } |
| 422 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
| 421 | + if (preg_match('/IMO=([0-9]{7})/', $body_parse, $matches)) { |
|
| 423 | 422 | $result['imo'] = $matches[1]; |
| 424 | 423 | } |
| 425 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
| 424 | + if (preg_match('/AD=([0-9]*)/', $body_parse, $matches)) { |
|
| 426 | 425 | $result['arrival_date'] = $matches[1]; |
| 427 | 426 | } |
| 428 | - if (preg_match('/AC=([0-9A-Z_]*)/',$body_parse,$matches)) { |
|
| 429 | - $result['arrival_code'] = str_replace('_',' ',$matches[1]); |
|
| 427 | + if (preg_match('/AC=([0-9A-Z_]*)/', $body_parse, $matches)) { |
|
| 428 | + $result['arrival_code'] = str_replace('_', ' ', $matches[1]); |
|
| 430 | 429 | } |
| 431 | 430 | // OGN comment |
| 432 | 431 | //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
| 433 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
| 432 | + if (preg_match('/^id([0-9A-F]{8})/', $body_parse, $matches)) { |
|
| 434 | 433 | $id = $matches[1]; |
| 435 | 434 | //$mode = substr($id,0,2); |
| 436 | - $address = substr($id,2); |
|
| 437 | - $addressType = (intval(substr($id,0,2),16))&3; |
|
| 435 | + $address = substr($id, 2); |
|
| 436 | + $addressType = (intval(substr($id, 0, 2), 16))&3; |
|
| 438 | 437 | if ($addressType == 0) $result['addresstype'] = "RANDOM"; |
| 439 | 438 | elseif ($addressType == 1) $result['addresstype'] = "ICAO"; |
| 440 | 439 | elseif ($addressType == 2) $result['addresstype'] = "FLARM"; |
| 441 | 440 | elseif ($addressType == 3) $result['addresstype'] = "OGN"; |
| 442 | - $aircraftType = $this->urshift(((intval(substr($id,0,2),16)) & 0b1111100),2); |
|
| 441 | + $aircraftType = $this->urshift(((intval(substr($id, 0, 2), 16))&0b1111100), 2); |
|
| 443 | 442 | $result['aircrafttype_code'] = $aircraftType; |
| 444 | 443 | if ($aircraftType == 0) $result['aircrafttype'] = "UNKNOWN"; |
| 445 | 444 | elseif ($aircraftType == 1) $result['aircrafttype'] = "GLIDER"; |
@@ -456,110 +455,110 @@ discard block |
||
| 456 | 455 | elseif ($aircraftType == 12) $result['aircrafttype'] = "AIRSHIP"; |
| 457 | 456 | elseif ($aircraftType == 13) $result['aircrafttype'] = "UAV"; |
| 458 | 457 | elseif ($aircraftType == 15) $result['aircrafttype'] = "STATIC_OBJECT"; |
| 459 | - $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
|
| 458 | + $stealth = (intval(substr($id, 0, 2), 16)&0b10000000) != 0; |
|
| 460 | 459 | $result['stealth'] = $stealth; |
| 461 | 460 | $result['address'] = $address; |
| 462 | 461 | } |
| 463 | 462 | //Comment |
| 464 | 463 | $result['comment'] = trim($body_parse); |
| 465 | 464 | // parse weather |
| 466 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
| 465 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
| 467 | 466 | $result['wind_dir'] = intval($matches[1]); |
| 468 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
| 469 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
| 470 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
| 471 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
| 472 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
| 467 | + $result['wind_speed'] = round(intval($matches[2])*1.60934, 1); |
|
| 468 | + $result['wind_gust'] = round(intval($matches[3])*1.60934, 1); |
|
| 469 | + $result['temp'] = round(5/9*((intval($matches[4])) - 32), 1); |
|
| 470 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
| 471 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
| 473 | 472 | $result['wind_dir'] = intval($matches[1]); |
| 474 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
| 475 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
| 476 | - $result['temp'] = round(5/9*(($matches[4])-32),1); |
|
| 477 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
| 478 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
| 473 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
| 474 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
| 475 | + $result['temp'] = round(5/9*(($matches[4]) - 32), 1); |
|
| 476 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
| 477 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/', $body_parse, $matches)) { |
|
| 479 | 478 | $result['wind_dir'] = intval($matches[1]); |
| 480 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
| 481 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
| 482 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
| 483 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
| 479 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
| 480 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
| 481 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
| 482 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/', $body_parse, $matches)) { |
|
| 484 | 483 | $result['wind_dir'] = intval($matches[1]); |
| 485 | - $result['wind_speed'] = round($matches[2]*1.60934,1); |
|
| 486 | - $result['wind_gust'] = round($matches[3]*1.60934,1); |
|
| 487 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
| 484 | + $result['wind_speed'] = round($matches[2]*1.60934, 1); |
|
| 485 | + $result['wind_gust'] = round($matches[3]*1.60934, 1); |
|
| 486 | + $body_parse = substr($body_parse, strlen($matches[0]) + 1); |
|
| 488 | 487 | } |
| 489 | 488 | // temperature |
| 490 | 489 | //g012t088r000p000P000h38b10110 |
| 491 | 490 | //g011t086r000p000P000h29b10198 |
| 492 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
| 493 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 494 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 495 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 496 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
| 497 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
| 491 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
| 492 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 493 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 494 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 495 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 496 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
| 498 | 497 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
| 499 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
| 500 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 501 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
| 502 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 503 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 504 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 505 | - if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1,1); |
|
| 506 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
| 498 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
| 499 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 500 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3,4})r([0-9 \\.]{3})P([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2,3})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
| 501 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 502 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 503 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 504 | + if ($matches[5] != '...') $result['precipitation'] = round((intval($matches[5])/100)*25.1, 1); |
|
| 505 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 507 | 506 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
| 508 | - if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10),1); |
|
| 509 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 510 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
| 511 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 512 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 513 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 514 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
| 515 | - if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1,1); |
|
| 507 | + if ($matches[7] != '...') $result['pressure'] = round((intval($matches[7])/10), 1); |
|
| 508 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 509 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
| 510 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 511 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 512 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 513 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 514 | + if ($matches[5] != '...') $result['precipitation24h'] = round((intval($matches[5])/100)*25.1, 1); |
|
| 516 | 515 | if ($matches[7] != '...') $result['humidity'] = intval($matches[7]); |
| 517 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
| 518 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 519 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
| 520 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 521 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 522 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 523 | - if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1,1); |
|
| 516 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
| 517 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 518 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})P([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
| 519 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 520 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 521 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 522 | + if ($matches[4] != '...') $result['precipitation24h'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 524 | 523 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
| 525 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
| 526 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 527 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/',$body_parse,$matches)) { |
|
| 528 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 529 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 530 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 531 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
| 524 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
| 525 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 526 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})b([0-9 \\.]{5})h([0-9 \\.]{2})/', $body_parse, $matches)) { |
|
| 527 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 528 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 529 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 530 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 532 | 531 | if ($matches[6] != '...') $result['humidity'] = intval($matches[6]); |
| 533 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
| 534 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 535 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
| 536 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 537 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 538 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 539 | - if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1,1); |
|
| 532 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
| 533 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 534 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{3})p([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
| 535 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 536 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 537 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 538 | + if ($matches[4] != '...') $result['precipitation'] = round((intval($matches[4])/100)*25.1, 1); |
|
| 540 | 539 | if ($matches[5] != '...') $result['humidity'] = intval($matches[5]); |
| 541 | - if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10),1); |
|
| 542 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 543 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
| 544 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 545 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 540 | + if ($matches[6] != '...') $result['pressure'] = round((intval($matches[6])/10), 1); |
|
| 541 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 542 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
| 543 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 544 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 546 | 545 | if ($matches[2] != '...') $result['humidity'] = intval($matches[3]); |
| 547 | - if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10),1); |
|
| 548 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 549 | - } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/',$body_parse,$matches)) { |
|
| 550 | - if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934,1); |
|
| 551 | - if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2]))-32),1); |
|
| 552 | - if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1,1); |
|
| 546 | + if ($matches[4] != '...') $result['pressure'] = round((intval($matches[4])/10), 1); |
|
| 547 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 548 | + } elseif (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9 \\.]{3})t([0-9 \\.]{3})r([0-9 \\.]{2,3})h([0-9 \\.]{2})b([0-9 \\.]{5})/', $body_parse, $matches)) { |
|
| 549 | + if ($matches[1] != '...') $result['wind_gust'] = round($matches[1]*1.60934, 1); |
|
| 550 | + if ($matches[2] != '...') $result['temp'] = round(5/9*((intval($matches[2])) - 32), 1); |
|
| 551 | + if ($matches[3] != '...') $result['rain'] = round((intval($matches[3])/100)*25.1, 1); |
|
| 553 | 552 | if ($matches[4] != '...') $result['humidity'] = intval($matches[4]); |
| 554 | - if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10),1); |
|
| 555 | - $body_parse = substr($body_parse,strlen($matches[0])); |
|
| 553 | + if ($matches[5] != '...') $result['pressure'] = round((intval($matches[5])/10), 1); |
|
| 554 | + $body_parse = substr($body_parse, strlen($matches[0])); |
|
| 556 | 555 | } |
| 557 | 556 | $result['comment'] = trim($body_parse); |
| 558 | 557 | } |
| 559 | 558 | } else $result['comment'] = trim($body_parse); |
| 560 | 559 | } |
| 561 | - if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
|
| 562 | - if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
|
| 560 | + if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'], 4); |
|
| 561 | + if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'], 4); |
|
| 563 | 562 | if ($debug) print_r($result); |
| 564 | 563 | return $result; |
| 565 | 564 | } |
@@ -568,34 +567,34 @@ discard block |
||
| 568 | 567 | * Connect to APRS server |
| 569 | 568 | */ |
| 570 | 569 | public function connect() { |
| 571 | - global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
| 570 | + global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass, $globalName, $globalServerAPRShost, $globalServerAPRSport; |
|
| 572 | 571 | $aprs_connect = 0; |
| 573 | 572 | $aprs_keep = 120; |
| 574 | 573 | $aprs_last_tx = time(); |
| 575 | 574 | if (isset($globalAPRSversion)) $aprs_version = $globalAPRSversion; |
| 576 | - else $aprs_version = 'FlightAirMap '.str_replace(' ','_',$globalName); |
|
| 575 | + else $aprs_version = 'FlightAirMap '.str_replace(' ', '_', $globalName); |
|
| 577 | 576 | if (isset($globalServerAPRSssid)) $aprs_ssid = $globalServerAPRSssid; |
| 578 | - else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ','_',$globalName)),0,8); |
|
| 577 | + else $aprs_ssid = substr('FAM'.strtoupper(str_replace(' ', '_', $globalName)), 0, 8); |
|
| 579 | 578 | if (isset($globalServerAPRSpass)) $aprs_pass = $globalServerAPRSpass; |
| 580 | 579 | else $aprs_pass = '-1'; |
| 581 | - $aprs_filter = ''; |
|
| 580 | + $aprs_filter = ''; |
|
| 582 | 581 | $aprs_login = "user {$aprs_ssid} pass {$aprs_pass} vers {$aprs_version}\n"; |
| 583 | 582 | $Common = new Common(); |
| 584 | - $s = $Common->create_socket($globalServerAPRShost,$globalServerAPRSport,$errno,$errstr); |
|
| 583 | + $s = $Common->create_socket($globalServerAPRShost, $globalServerAPRSport, $errno, $errstr); |
|
| 585 | 584 | if ($s !== false) { |
| 586 | 585 | echo 'Connected to APRS server! '."\n"; |
| 587 | 586 | $authstart = time(); |
| 588 | 587 | $this->socket = $s; |
| 589 | - $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
|
| 590 | - socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE,1); |
|
| 591 | - while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
|
| 588 | + $send = socket_send($this->socket, $aprs_login, strlen($aprs_login), 0); |
|
| 589 | + socket_set_option($this->socket, SOL_SOCKET, SO_KEEPALIVE, 1); |
|
| 590 | + while ($msgin = socket_read($this->socket, 1000, PHP_NORMAL_READ)) { |
|
| 592 | 591 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
| 593 | 592 | echo 'APRS user verified !'."\n"; |
| 594 | 593 | $this->connected = true; |
| 595 | 594 | return true; |
| 596 | 595 | break; |
| 597 | 596 | } |
| 598 | - if (time()-$authstart > 5) { |
|
| 597 | + if (time() - $authstart > 5) { |
|
| 599 | 598 | echo 'APRS timeout'."\n"; |
| 600 | 599 | break; |
| 601 | 600 | } |
@@ -617,7 +616,7 @@ discard block |
||
| 617 | 616 | public function send($data) { |
| 618 | 617 | global $globalDebug; |
| 619 | 618 | if ($this->connected === false) $this->connect(); |
| 620 | - $send = socket_send( $this->socket , $data , strlen($data),0); |
|
| 619 | + $send = socket_send($this->socket, $data, strlen($data), 0); |
|
| 621 | 620 | if ($send === FALSE) { |
| 622 | 621 | if ($globalDebug) echo 'Reconnect...'; |
| 623 | 622 | socket_close($this->socket); |
@@ -627,17 +626,17 @@ discard block |
||
| 627 | 626 | } |
| 628 | 627 | |
| 629 | 628 | class APRSSpotter extends APRS { |
| 630 | - public function addLiveSpotterData($id,$ident,$aircraft_icao,$departure_airport,$arrival_airport,$latitude,$longitude,$waypoints,$altitude,$altitude_real,$heading,$speed,$datetime,$departure_airport_time,$arrival_airport_time,$squawk,$route_stop,$hex,$putinarchive,$registration,$pilot_id,$pilot_name, $verticalrate, $noarchive, $ground,$format_source,$source_name,$over_country) { |
|
| 629 | + public function addLiveSpotterData($id, $ident, $aircraft_icao, $departure_airport, $arrival_airport, $latitude, $longitude, $waypoints, $altitude, $altitude_real, $heading, $speed, $datetime, $departure_airport_time, $arrival_airport_time, $squawk, $route_stop, $hex, $putinarchive, $registration, $pilot_id, $pilot_name, $verticalrate, $noarchive, $ground, $format_source, $source_name, $over_country) { |
|
| 631 | 630 | $Common = new Common(); |
| 632 | 631 | date_default_timezone_set('UTC'); |
| 633 | 632 | if ($latitude != '' && $longitude != '') { |
| 634 | 633 | $lat = $latitude; |
| 635 | 634 | $long = $longitude; |
| 636 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
| 637 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
| 638 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
| 639 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
| 640 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
| 635 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
| 636 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
| 637 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
| 638 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
| 639 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
| 641 | 640 | $w = $w1.$w2; |
| 642 | 641 | //$w = '00'; |
| 643 | 642 | $custom = ''; |
@@ -664,26 +663,26 @@ discard block |
||
| 664 | 663 | $geoid= round($GeoidClass->get($lat,$long)*3.28084,2); |
| 665 | 664 | $altitude_real = round($altitude_real + $geoid); |
| 666 | 665 | */ |
| 667 | - $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His',strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude_real,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
| 666 | + $this->send('AIRCRAFT>APRS,TCPIP*:;'.$hex.' *'.date('His', strtotime($datetime)).'h'.$coordinate.'^'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude_real, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
| 668 | 667 | } |
| 669 | 668 | } |
| 670 | 669 | } |
| 671 | 670 | class APRSMarine extends APRS { |
| 672 | - public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed,$datetime, $putinarchive,$mmsi,$type,$typeid,$imo,$callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source,$source_name,$over_country) { |
|
| 671 | + public function addLiveMarineData($id, $ident, $latitude, $longitude, $heading, $speed, $datetime, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country) { |
|
| 673 | 672 | $Common = new Common(); |
| 674 | 673 | date_default_timezone_set('UTC'); |
| 675 | 674 | if ($latitude != '' && $longitude != '') { |
| 676 | - $latitude = $Common->convertDM($latitude,'latitude'); |
|
| 677 | - $longitude = $Common->convertDM($longitude,'longitude'); |
|
| 678 | - $coordinate = sprintf("%02d",$latitude['deg']).str_pad(number_format($latitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d",$longitude['deg']).str_pad(number_format($longitude['min'],2,'.',''),5,'0',STR_PAD_LEFT).$longitude['NSEW']; |
|
| 679 | - $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'],2,'.',''))*1000)); |
|
| 680 | - $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'],2,'.',''))*1000)); |
|
| 675 | + $latitude = $Common->convertDM($latitude, 'latitude'); |
|
| 676 | + $longitude = $Common->convertDM($longitude, 'longitude'); |
|
| 677 | + $coordinate = sprintf("%02d", $latitude['deg']).str_pad(number_format($latitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$latitude['NSEW'].'/'.sprintf("%03d", $longitude['deg']).str_pad(number_format($longitude['min'], 2, '.', ''), 5, '0', STR_PAD_LEFT).$longitude['NSEW']; |
|
| 678 | + $w1 = abs(ceil(($latitude['min'] - number_format($latitude['min'], 2, '.', ''))*1000)); |
|
| 679 | + $w2 = abs(ceil(($longitude['min'] - number_format($longitude['min'], 2, '.', ''))*1000)); |
|
| 681 | 680 | $w = $w1.$w2; |
| 682 | 681 | //$w = '00'; |
| 683 | 682 | $custom = ''; |
| 684 | 683 | if ($ident != '') { |
| 685 | 684 | if ($custom != '') $custom .= '/'; |
| 686 | - $custom .= 'CS='.str_replace(' ','_',$ident); |
|
| 685 | + $custom .= 'CS='.str_replace(' ', '_', $ident); |
|
| 687 | 686 | } |
| 688 | 687 | if ($typeid != '') { |
| 689 | 688 | if ($custom != '') $custom .= '/'; |
@@ -703,11 +702,11 @@ discard block |
||
| 703 | 702 | } |
| 704 | 703 | if ($arrival_code != '') { |
| 705 | 704 | if ($custom != '') $custom .= '/'; |
| 706 | - $custom .= 'AC='.str_replace(' ','_',$arrival_code); |
|
| 705 | + $custom .= 'AC='.str_replace(' ', '_', $arrival_code); |
|
| 707 | 706 | } |
| 708 | 707 | if ($custom != '') $custom = ' '.$custom; |
| 709 | 708 | $altitude = 0; |
| 710 | - $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His',strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading,3,'0',STR_PAD_LEFT).'/'.str_pad($speed,3,'0',STR_PAD_LEFT).'/A='.str_pad($altitude,6,'0',STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
| 709 | + $this->send('MARINE>APRS,TCPIP*:;'.$mmsi.'*'.date('His', strtotime($datetime)).'h'.$coordinate.'s'.str_pad($heading, 3, '0', STR_PAD_LEFT).'/'.str_pad($speed, 3, '0', STR_PAD_LEFT).'/A='.str_pad($altitude, 6, '0', STR_PAD_LEFT).' !W'.$w.'!'.$custom."\n"); |
|
| 711 | 710 | } |
| 712 | 711 | } |
| 713 | 712 | } |
@@ -16,14 +16,14 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | if (isset($_GET['coord'])) |
| 18 | 18 | { |
| 19 | - $coords = explode(',',$_GET['coord']); |
|
| 19 | + $coords = explode(',', $_GET['coord']); |
|
| 20 | 20 | if ($globalDBdriver == 'mysql') { |
| 21 | 21 | $query = "SELECT *, ST_AsWKB(SHAPE) AS wkb FROM airspace WHERE ST_Intersects(SHAPE, ST_Envelope(linestring(point(:minlon,:minlat), point(:maxlon,:maxlat))))"; |
| 22 | 22 | try { |
| 23 | 23 | $sth = $Connection->db->prepare($query); |
| 24 | - $sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3])); |
|
| 24 | + $sth->execute(array(':minlon' => $coords[0], ':minlat' => $coords[1], ':maxlon' => $coords[2], ':maxlat' => $coords[3])); |
|
| 25 | 25 | //$sth->execute(); |
| 26 | - } catch(PDOException $e) { |
|
| 26 | + } catch (PDOException $e) { |
|
| 27 | 27 | echo "error"; |
| 28 | 28 | } |
| 29 | 29 | } else { |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $sth = $Connection->db->prepare($query); |
| 33 | 33 | //$sth->execute(array(':minlon' => $coords[0],':minlat' => $coords[1],':maxlon' => $coords[2],':maxlat' => $coords[3])); |
| 34 | 34 | $sth->execute(); |
| 35 | - } catch(PDOException $e) { |
|
| 35 | + } catch (PDOException $e) { |
|
| 36 | 36 | echo "error"; |
| 37 | 37 | } |
| 38 | 38 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | try { |
| 46 | 46 | $sth = $Connection->db->prepare($query); |
| 47 | 47 | $sth->execute(); |
| 48 | - } catch(PDOException $e) { |
|
| 48 | + } catch (PDOException $e) { |
|
| 49 | 49 | echo "error"; |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -75,22 +75,22 @@ discard block |
||
| 75 | 75 | if (isset($properties['ceiling'])) $properties['tops'] = $properties['ceiling']; |
| 76 | 76 | if (isset($properties['floor'])) $properties['base'] = $properties['floor']; |
| 77 | 77 | if (isset($properties['tops'])) { |
| 78 | - if (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['tops']),$matches)) { |
|
| 78 | + if (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['tops']), $matches)) { |
|
| 79 | 79 | $properties['upper_limit'] = round($matches['alt']*100*0.38048); |
| 80 | - } elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['tops']),$matches)) { |
|
| 80 | + } elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['tops']), $matches)) { |
|
| 81 | 81 | $properties['upper_limit'] = round($matches['alt']*0.38048); |
| 82 | - } elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['tops']),$matches)) { |
|
| 82 | + } elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['tops']), $matches)) { |
|
| 83 | 83 | $properties['upper_limit'] = $matches['alt']; |
| 84 | 84 | } |
| 85 | 85 | } |
| 86 | 86 | if (isset($properties['base'])) { |
| 87 | 87 | if ($properties['base'] == 'SFC' || $properties['base'] == 'MSL' || $properties['base'] == 'GROUND' || $properties['base'] == 'GND') { |
| 88 | 88 | $properties['lower_limit'] = 0; |
| 89 | - } elseif (preg_match('/^FL(\s)*(?<alt>\d+)/',strtoupper($properties['base']),$matches)) { |
|
| 89 | + } elseif (preg_match('/^FL(\s)*(?<alt>\d+)/', strtoupper($properties['base']), $matches)) { |
|
| 90 | 90 | $properties['lower_limit'] = round($matches['alt']*100*0.38048); |
| 91 | - } elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/',strtoupper($properties['base']),$matches)) { |
|
| 91 | + } elseif (preg_match('/^(?<alt>\d+)(\s)*(FT|AGL|ALT|MSL)/', strtoupper($properties['base']), $matches)) { |
|
| 92 | 92 | $properties['lower_limit'] = round($matches['alt']*0.38048); |
| 93 | - } elseif (preg_match('/^(?<alt>\d+)(\s)*M/',strtoupper($properties['base']),$matches)) { |
|
| 93 | + } elseif (preg_match('/^(?<alt>\d+)(\s)*M/', strtoupper($properties['base']), $matches)) { |
|
| 94 | 94 | $properties['lower_limit'] = $matches['alt']; |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | // This script can be slow... |
| 3 | 3 | set_time_limit(0); |
| 4 | -ini_set('max_execution_time',6000); |
|
| 4 | +ini_set('max_execution_time', 6000); |
|
| 5 | 5 | require_once('require/class.Connection.php'); |
| 6 | 6 | require_once('require/class.Common.php'); |
| 7 | 7 | |
@@ -63,24 +63,24 @@ discard block |
||
| 63 | 63 | $min = false; |
| 64 | 64 | $allhistory = false; |
| 65 | 65 | $filter['source'] = array(); |
| 66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 66 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'], array('vatsimtxt')); |
|
| 67 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'], array('whazzup')); |
|
| 68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'], array('phpvmacars')); |
|
| 69 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'], array('sbs', 'famaprs')); |
|
| 70 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'], array('aprs')); |
|
| 71 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'], FILTER_SANITIZE_STRING); |
|
| 72 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'], FILTER_SANITIZE_STRING); |
|
| 73 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',', $_COOKIE['filter_Airlines']), FILTER_SANITIZE_STRING); |
|
| 74 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',', $_COOKIE['filter_Sources']), FILTER_SANITIZE_STRING); |
|
| 75 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'], FILTER_SANITIZE_STRING); |
|
| 76 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'], FILTER_SANITIZE_STRING); |
|
| 77 | 77 | |
| 78 | 78 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 79 | 79 | $min = true; |
| 80 | 80 | } else $min = false; |
| 81 | 81 | |
| 82 | 82 | if (isset($_GET['ident'])) { |
| 83 | - $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 83 | + $ident = filter_input(INPUT_GET, 'ident', FILTER_SANITIZE_STRING); |
|
| 84 | 84 | $from_archive = true; |
| 85 | 85 | if ($tracker) { |
| 86 | 86 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $allhistory = true; |
| 95 | 95 | } |
| 96 | 96 | elseif (isset($_GET['flightaware_id'])) { |
| 97 | - $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 97 | + $flightaware_id = filter_input(INPUT_GET, 'flightaware_id', FILTER_SANITIZE_STRING); |
|
| 98 | 98 | $from_archive = true; |
| 99 | 99 | if ($tracker) { |
| 100 | 100 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
@@ -109,26 +109,26 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
| 111 | 111 | $from_archive = true; |
| 112 | - $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
|
| 112 | + $begindate = filter_input(INPUT_GET, 'begindate', FILTER_SANITIZE_NUMBER_INT); |
|
| 113 | 113 | if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
| 114 | 114 | else $begindate = $begindate - 3000; |
| 115 | - $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
|
| 116 | - $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
|
| 117 | - $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
|
| 115 | + $enddate = filter_input(INPUT_GET, 'enddate', FILTER_SANITIZE_NUMBER_INT); |
|
| 116 | + $archivespeed = filter_input(INPUT_GET, 'speed', FILTER_SANITIZE_NUMBER_INT); |
|
| 117 | + $part = filter_input(INPUT_GET, 'part', FILTER_SANITIZE_NUMBER_INT); |
|
| 118 | 118 | if ($part == '') $part = 0; |
| 119 | 119 | |
| 120 | 120 | if ($begindate != '' && $enddate != '') { |
| 121 | - $begindate = date('Y-m-d H:i:s',$begindate); |
|
| 122 | - $enddate = date('Y-m-d H:i:s',$enddate); |
|
| 121 | + $begindate = date('Y-m-d H:i:s', $begindate); |
|
| 122 | + $enddate = date('Y-m-d H:i:s', $enddate); |
|
| 123 | 123 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
| 124 | 124 | if ($tracker) { |
| 125 | - $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
|
| 125 | + $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate, $enddate, $filter); |
|
| 126 | 126 | } |
| 127 | 127 | elseif ($marine) { |
| 128 | - $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
|
| 128 | + $spotter_array = $MarineArchive->getMinLiveMarineData($begindate, $enddate, $filter); |
|
| 129 | 129 | } |
| 130 | 130 | else { |
| 131 | - $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
|
| 131 | + $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate, $enddate, $filter, $part); |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | if ($flightcnt == '') $flightcnt = 0; |
| 140 | 140 | } else $flightcnt = 0; |
| 141 | 141 | |
| 142 | -$sqltime = round(microtime(true)-$begintime,2); |
|
| 142 | +$sqltime = round(microtime(true) - $begintime, 2); |
|
| 143 | 143 | |
| 144 | 144 | $pfi = ''; |
| 145 | 145 | //var_dump($spotter_array); |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $begin = true; |
| 155 | 155 | if (!empty($spotter_array) && is_array($spotter_array)) { |
| 156 | 156 | $output .= '"features": ['; |
| 157 | - foreach($spotter_array as $spotter_item) { |
|
| 157 | + foreach ($spotter_array as $spotter_item) { |
|
| 158 | 158 | $j++; |
| 159 | 159 | date_default_timezone_set('UTC'); |
| 160 | 160 | if ($tracker) { |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | if ($begin) { |
| 179 | 179 | if ($j > 1) { |
| 180 | 180 | if (isset($output_time)) { |
| 181 | - $output_time = substr($output_time, 0, -1); |
|
| 181 | + $output_time = substr($output_time, 0, -1); |
|
| 182 | 182 | $output .= '"time": ['.$output_time.']'; |
| 183 | 183 | } |
| 184 | 184 | $output .= '},'; |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | $output .= '"type": "LineString",'; |
| 188 | 188 | $output .= '"coordinates": ['; |
| 189 | 189 | if (isset($output_history)) { |
| 190 | - $output_history = substr($output_history, 0, -1); |
|
| 190 | + $output_history = substr($output_history, 0, -1); |
|
| 191 | 191 | $output .= $output_history; |
| 192 | 192 | } |
| 193 | 193 | $output .= ']}},'; |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | $output .= '"fi": "'.$pfi.'",'; |
| 219 | 219 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 220 | 220 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 221 | - $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
|
| 221 | + $output .= '"c": "'.str_replace('\\', '', $spotter_item['ident']).'",'; |
|
| 222 | 222 | //" |
| 223 | 223 | } else { |
| 224 | 224 | $output .= '"c": "NA",'; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | |
| 353 | 353 | if ($j > 1) { |
| 354 | 354 | if (isset($output_time)) { |
| 355 | - $output_time = substr($output_time, 0, -1); |
|
| 355 | + $output_time = substr($output_time, 0, -1); |
|
| 356 | 356 | $output .= '"time": ['.$output_time.']'; |
| 357 | 357 | } |
| 358 | 358 | $output .= '},'; |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | $output .= '"type": "LineString",'; |
| 362 | 362 | $output .= '"coordinates": ['; |
| 363 | 363 | if (isset($output_history)) { |
| 364 | - $output_history = substr($output_history, 0, -1); |
|
| 364 | + $output_history = substr($output_history, 0, -1); |
|
| 365 | 365 | $output .= $output_history; |
| 366 | 366 | } |
| 367 | 367 | $output .= ']'; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | $output = substr($output, 0, -1); |
| 373 | 373 | $output .= ']'; |
| 374 | 374 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 375 | - $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
|
| 375 | + $output .= '"totaltime": "'.round(microtime(true) - $begintime, 2).'",'; |
|
| 376 | 376 | if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
| 377 | 377 | $output .= '"fc": "'.$flightcnt.'"'; |
| 378 | 378 | } else { |