@@ -8,7 +8,7 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | require_once('header.php'); |
@@ -8,7 +8,7 @@ |
||
| 8 | 8 | if (!isset($filter_name)) $filter_name = ''; |
| 9 | 9 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 10 | 10 | if ($airline_icao == '' && isset($globalFilter)) { |
| 11 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 11 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | require_once('header.php'); |
@@ -7,109 +7,109 @@ discard block |
||
| 7 | 7 | public $db; |
| 8 | 8 | |
| 9 | 9 | protected $texts = Array( |
| 10 | - 'MI' => 'Shallow', |
|
| 11 | - 'PR' => 'Partial', |
|
| 12 | - 'BC' => 'Low drifting', |
|
| 13 | - 'BL' => 'Blowing', |
|
| 14 | - 'SH' => 'Showers', |
|
| 15 | - 'TS' => 'Thunderstorm', |
|
| 16 | - 'FZ' => 'Freezing', |
|
| 17 | - 'DZ' => 'Drizzle', |
|
| 18 | - 'RA' => 'Rain', |
|
| 19 | - 'SN' => 'Snow', |
|
| 20 | - 'SG' => 'Snow Grains', |
|
| 21 | - 'IC' => 'Ice crystals', |
|
| 22 | - 'PL' => 'Ice pellets', |
|
| 23 | - 'GR' => 'Hail', |
|
| 24 | - 'GS' => 'Small hail', |
|
| 25 | - 'UP' => 'Unknown', |
|
| 26 | - 'BR' => 'Mist', |
|
| 27 | - 'FG' => 'Fog', |
|
| 28 | - 'FU' => 'Smoke', |
|
| 29 | - 'VA' => 'Volcanic ash', |
|
| 30 | - 'DU' => 'Widespread dust', |
|
| 31 | - 'SA' => 'Sand', |
|
| 32 | - 'HZ' => 'Haze', |
|
| 33 | - 'PY' => 'Spray', |
|
| 34 | - 'PO' => 'Well developed dust / sand whirls', |
|
| 35 | - 'SQ' => 'Squalls', |
|
| 36 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
| 37 | - 'SS' => 'Sandstorm', |
|
| 38 | - 'DS' => 'Duststorm' |
|
| 10 | + 'MI' => 'Shallow', |
|
| 11 | + 'PR' => 'Partial', |
|
| 12 | + 'BC' => 'Low drifting', |
|
| 13 | + 'BL' => 'Blowing', |
|
| 14 | + 'SH' => 'Showers', |
|
| 15 | + 'TS' => 'Thunderstorm', |
|
| 16 | + 'FZ' => 'Freezing', |
|
| 17 | + 'DZ' => 'Drizzle', |
|
| 18 | + 'RA' => 'Rain', |
|
| 19 | + 'SN' => 'Snow', |
|
| 20 | + 'SG' => 'Snow Grains', |
|
| 21 | + 'IC' => 'Ice crystals', |
|
| 22 | + 'PL' => 'Ice pellets', |
|
| 23 | + 'GR' => 'Hail', |
|
| 24 | + 'GS' => 'Small hail', |
|
| 25 | + 'UP' => 'Unknown', |
|
| 26 | + 'BR' => 'Mist', |
|
| 27 | + 'FG' => 'Fog', |
|
| 28 | + 'FU' => 'Smoke', |
|
| 29 | + 'VA' => 'Volcanic ash', |
|
| 30 | + 'DU' => 'Widespread dust', |
|
| 31 | + 'SA' => 'Sand', |
|
| 32 | + 'HZ' => 'Haze', |
|
| 33 | + 'PY' => 'Spray', |
|
| 34 | + 'PO' => 'Well developed dust / sand whirls', |
|
| 35 | + 'SQ' => 'Squalls', |
|
| 36 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
| 37 | + 'SS' => 'Sandstorm', |
|
| 38 | + 'DS' => 'Duststorm' |
|
| 39 | 39 | ); |
| 40 | 40 | |
| 41 | 41 | public function __construct($dbc = null) { |
| 42 | - $Connection = new Connection($dbc); |
|
| 43 | - $this->db = $Connection->db; |
|
| 44 | - } |
|
| 42 | + $Connection = new Connection($dbc); |
|
| 43 | + $this->db = $Connection->db; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - public static function check_last_update() { |
|
| 47 | - global $globalDBdriver; |
|
| 48 | - if ($globalDBdriver == 'mysql') { |
|
| 46 | + public static function check_last_update() { |
|
| 47 | + global $globalDBdriver; |
|
| 48 | + if ($globalDBdriver == 'mysql') { |
|
| 49 | 49 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value > DATE_SUB(NOW(), INTERVAL 20 MINUTE)"; |
| 50 | 50 | } else { |
| 51 | 51 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'last_update_metar' AND value::timestamp > CURRENT_TIMESTAMP - INTERVAL '20 MINUTES'"; |
| 52 | 52 | } |
| 53 | - try { |
|
| 54 | - $Connection = new Connection(); |
|
| 55 | - $sth = $Connection->db->prepare($query); |
|
| 56 | - $sth->execute(); |
|
| 57 | - } catch(PDOException $e) { |
|
| 58 | - return "error : ".$e->getMessage(); |
|
| 59 | - } |
|
| 60 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 61 | - $sth->closeCursor(); |
|
| 62 | - if ($row['nb'] > 0) return false; |
|
| 63 | - else return true; |
|
| 64 | - } |
|
| 53 | + try { |
|
| 54 | + $Connection = new Connection(); |
|
| 55 | + $sth = $Connection->db->prepare($query); |
|
| 56 | + $sth->execute(); |
|
| 57 | + } catch(PDOException $e) { |
|
| 58 | + return "error : ".$e->getMessage(); |
|
| 59 | + } |
|
| 60 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 61 | + $sth->closeCursor(); |
|
| 62 | + if ($row['nb'] > 0) return false; |
|
| 63 | + else return true; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public static function insert_last_update() { |
|
| 67 | - $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
| 66 | + public static function insert_last_update() { |
|
| 67 | + $query = "DELETE FROM config WHERE name = 'last_update_metar'; |
|
| 68 | 68 | INSERT INTO config (name,value) VALUES ('last_update_metar',NOW());"; |
| 69 | - try { |
|
| 70 | - $Connection = new Connection(); |
|
| 71 | - $sth = $Connection->db->prepare($query); |
|
| 72 | - $sth->execute(); |
|
| 73 | - } catch(PDOException $e) { |
|
| 74 | - return "error : ".$e->getMessage(); |
|
| 75 | - } |
|
| 76 | - } |
|
| 69 | + try { |
|
| 70 | + $Connection = new Connection(); |
|
| 71 | + $sth = $Connection->db->prepare($query); |
|
| 72 | + $sth->execute(); |
|
| 73 | + } catch(PDOException $e) { |
|
| 74 | + return "error : ".$e->getMessage(); |
|
| 75 | + } |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | - public function parse($data) { |
|
| 81 | - //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
| 82 | - $codes = implode('|', array_keys($this->texts)); |
|
| 83 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
| 84 | - //$pieces = explode(' ',$data); |
|
| 85 | - $pieces = preg_split('/\s/',$data); |
|
| 86 | - $pos = 0; |
|
| 87 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 88 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
| 89 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 90 | - $result = array(); |
|
| 91 | - $result['location'] = $pieces[$pos]; |
|
| 92 | - $pos++; |
|
| 93 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
| 94 | - $result['time'] = substr($pieces[$pos],2,4); |
|
| 95 | - $c = count($pieces); |
|
| 96 | - for($pos++; $pos < $c; $pos++) { |
|
| 97 | - $piece = $pieces[$pos]; |
|
| 98 | - if ($piece == 'RMK') break; |
|
| 99 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
| 100 | - if ($piece == 'COR') $result['correction'] = true; |
|
| 101 | - // Wind Speed |
|
| 102 | - if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
| 103 | - $result['wind']['direction'] = (float)$matches[1]; |
|
| 80 | + public function parse($data) { |
|
| 81 | + //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
|
| 82 | + $codes = implode('|', array_keys($this->texts)); |
|
| 83 | + $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
| 84 | + //$pieces = explode(' ',$data); |
|
| 85 | + $pieces = preg_split('/\s/',$data); |
|
| 86 | + $pos = 0; |
|
| 87 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 88 | + elseif ($pieces[0] == 'SPECI') $pos++; |
|
| 89 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 90 | + $result = array(); |
|
| 91 | + $result['location'] = $pieces[$pos]; |
|
| 92 | + $pos++; |
|
| 93 | + $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
| 94 | + $result['time'] = substr($pieces[$pos],2,4); |
|
| 95 | + $c = count($pieces); |
|
| 96 | + for($pos++; $pos < $c; $pos++) { |
|
| 97 | + $piece = $pieces[$pos]; |
|
| 98 | + if ($piece == 'RMK') break; |
|
| 99 | + if ($piece == 'AUTO') $result['auto'] = true; |
|
| 100 | + if ($piece == 'COR') $result['correction'] = true; |
|
| 101 | + // Wind Speed |
|
| 102 | + if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
|
| 103 | + $result['wind']['direction'] = (float)$matches[1]; |
|
| 104 | 104 | $result['wind']['unit'] = $matches[4]; |
| 105 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
| 106 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
| 107 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
| 105 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
| 106 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
| 107 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
| 108 | 108 | $result['wind']['gust'] = (float)$matches[3]; |
| 109 | 109 | $result['wind']['unit'] = $matches[4]; |
| 110 | 110 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
| 111 | 111 | $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | |
| 114 | 114 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
| 115 | 115 | $result['wind_direction'] = (float)$matches[1]; |
@@ -126,35 +126,35 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | } |
| 128 | 128 | */ |
| 129 | - // Temperature |
|
| 130 | - if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
| 131 | - $temp = (float)$matches[1]; |
|
| 129 | + // Temperature |
|
| 130 | + if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
|
| 131 | + $temp = (float)$matches[1]; |
|
| 132 | 132 | if ($matches[1]{0} == 'M') { |
| 133 | 133 | $temp = ((float)substr($matches[1], 1)) * -1; |
| 134 | 134 | } |
| 135 | - $result['temperature'] = $temp; |
|
| 136 | - $dew = (float)$matches[2]; |
|
| 135 | + $result['temperature'] = $temp; |
|
| 136 | + $dew = (float)$matches[2]; |
|
| 137 | 137 | if ($matches[2]{0} == 'M') { |
| 138 | 138 | $dew = ((float)substr($matches[2], 1)) * -1; |
| 139 | 139 | } |
| 140 | 140 | $result['dew'] = $dew; |
| 141 | - } |
|
| 142 | - // QNH |
|
| 143 | - if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
| 144 | - // #^(Q|A)(////|[0-9]{4})( )# |
|
| 145 | - if ($matches[1] == 'Q') { |
|
| 146 | - // hPa |
|
| 147 | - $result['QNH'] = $matches[2]; |
|
| 148 | - } else { |
|
| 149 | - // inHg |
|
| 150 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
| 151 | 141 | } |
| 152 | - /* |
|
| 142 | + // QNH |
|
| 143 | + if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
|
| 144 | + // #^(Q|A)(////|[0-9]{4})( )# |
|
| 145 | + if ($matches[1] == 'Q') { |
|
| 146 | + // hPa |
|
| 147 | + $result['QNH'] = $matches[2]; |
|
| 148 | + } else { |
|
| 149 | + // inHg |
|
| 150 | + $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
| 151 | + } |
|
| 152 | + /* |
|
| 153 | 153 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
| 154 | 154 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
| 155 | 155 | */ |
| 156 | - } |
|
| 157 | - /* |
|
| 156 | + } |
|
| 157 | + /* |
|
| 158 | 158 | // Wind Direction |
| 159 | 159 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
| 160 | 160 | $result['wind_direction'] = $matches[1]; |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $result['speed_variable'] = $matches[1]; |
| 166 | 166 | } |
| 167 | 167 | */ |
| 168 | - // Visibility |
|
| 169 | - if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
| 170 | - if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
| 168 | + // Visibility |
|
| 169 | + if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
|
| 170 | + if (isset($matches[3]) && strlen($matches[3]) > 0) { |
|
| 171 | 171 | $result['visibility'] = (float)$matches[3] * 1609.34; |
| 172 | 172 | } else { |
| 173 | 173 | if ($matches[1] == '9999') { |
@@ -180,28 +180,28 @@ discard block |
||
| 180 | 180 | $result['visibility'] = '> 10000'; |
| 181 | 181 | $result['weather'] = "CAVOK"; |
| 182 | 182 | } |
| 183 | - } |
|
| 184 | - // Cloud Coverage |
|
| 185 | - if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
| 186 | - //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
| 187 | - $type = $matches[1]; |
|
| 188 | - $cloud = array(); |
|
| 189 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
| 190 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
| 191 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
| 192 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
| 193 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
| 194 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
| 195 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
| 196 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
| 197 | - $cloud['type_code'] = $type; |
|
| 198 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
| 199 | - $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
| 200 | - $result['cloud'][] = $cloud; |
|
| 201 | - } |
|
| 202 | - // RVR |
|
| 203 | - if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
| 204 | - $rvr = array(); |
|
| 183 | + } |
|
| 184 | + // Cloud Coverage |
|
| 185 | + if (preg_match('#^(SKC|CLR|FEW|SCT|BKN|OVC|VV)([0-9]{3})(CB|TCU|CU|CI)?$#', $piece, $matches)) { |
|
| 186 | + //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
|
| 187 | + $type = $matches[1]; |
|
| 188 | + $cloud = array(); |
|
| 189 | + if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
| 190 | + elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
| 191 | + elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
| 192 | + elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
| 193 | + elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
| 194 | + elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
| 195 | + elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
| 196 | + elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
| 197 | + $cloud['type_code'] = $type; |
|
| 198 | + $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
| 199 | + $cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
|
| 200 | + $result['cloud'][] = $cloud; |
|
| 201 | + } |
|
| 202 | + // RVR |
|
| 203 | + if (preg_match('#^(R.+)/([M|P])?(\d{4})(?:V(\d+)|[UDN])?(FT)?$#', $piece, $matches)) { |
|
| 204 | + $rvr = array(); |
|
| 205 | 205 | $rvr['runway'] = $matches[1]; |
| 206 | 206 | $rvr['assessment'] = $matches[2]; |
| 207 | 207 | $rvr['rvr'] = $matches[3]; |
@@ -210,33 +210,33 @@ discard block |
||
| 210 | 210 | $result['RVR'] = $rvr; |
| 211 | 211 | } |
| 212 | 212 | |
| 213 | - //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 214 | - if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
| 215 | - //print_r($matches); |
|
| 216 | - // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
| 217 | - $result['RVR']['runway'] = $matches[1]; |
|
| 218 | - $result['RVR']['deposits'] = $matches[2]; |
|
| 219 | - $result['RVR']['extent'] = $matches[3]; |
|
| 220 | - $result['RVR']['depth'] = $matches[4]; |
|
| 221 | - $result['RVR']['friction'] = $matches[5]; |
|
| 222 | - } |
|
| 223 | - if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 224 | - //echo $piece; |
|
| 225 | - //print_r($matches); |
|
| 226 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
| 227 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
| 213 | + //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 214 | + if (preg_match('#^R(\d{2}[LRC]?)/([\d/])([\d/])([\d/]{2})([\d/]{2})$#', $piece, $matches)) { |
|
| 215 | + //print_r($matches); |
|
| 216 | + // https://github.com/davidmegginson/metar-taf/blob/master/Metar.php |
|
| 217 | + $result['RVR']['runway'] = $matches[1]; |
|
| 218 | + $result['RVR']['deposits'] = $matches[2]; |
|
| 219 | + $result['RVR']['extent'] = $matches[3]; |
|
| 220 | + $result['RVR']['depth'] = $matches[4]; |
|
| 221 | + $result['RVR']['friction'] = $matches[5]; |
|
| 222 | + } |
|
| 223 | + if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
|
| 224 | + //echo $piece; |
|
| 225 | + //print_r($matches); |
|
| 226 | + if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
| 227 | + else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
| 228 | 228 | if (isset($matches[3])) { |
| 229 | 229 | $range = Array( |
| 230 | - 'from' => (float)$matches[2], |
|
| 231 | - 'to' => (float)$matches[4], |
|
| 232 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
| 230 | + 'from' => (float)$matches[2], |
|
| 231 | + 'to' => (float)$matches[4], |
|
| 232 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
| 233 | 233 | ); |
| 234 | 234 | } |
| 235 | 235 | $result['RVR'] = $matches[1]; |
| 236 | 236 | $result['RVR_range'] = $range; |
| 237 | - } |
|
| 238 | - // Weather |
|
| 239 | - if (preg_match($regWeather, $piece, $matches)) { |
|
| 237 | + } |
|
| 238 | + // Weather |
|
| 239 | + if (preg_match($regWeather, $piece, $matches)) { |
|
| 240 | 240 | $text = Array(); |
| 241 | 241 | switch ($matches[1]) { |
| 242 | 242 | case '+': |
@@ -259,35 +259,35 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
| 261 | 261 | else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
| 262 | - } |
|
| 263 | - } |
|
| 264 | - return $result; |
|
| 262 | + } |
|
| 263 | + } |
|
| 264 | + return $result; |
|
| 265 | 265 | |
| 266 | - } |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | 268 | public function getMETAR($icao) { |
| 269 | - global $globalMETARcycle, $globalDBdriver; |
|
| 270 | - if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
| 271 | - $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
| 272 | - } else { |
|
| 273 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
| 274 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
| 275 | - } |
|
| 276 | - $query_values = array(':icao' => $icao); |
|
| 277 | - try { |
|
| 278 | - $sth = $this->db->prepare($query); |
|
| 279 | - $sth->execute($query_values); |
|
| 280 | - } catch(PDOException $e) { |
|
| 281 | - return "error : ".$e->getMessage(); |
|
| 282 | - } |
|
| 283 | - $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 284 | - if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
| 285 | - $all = $this->downloadMETAR($icao); |
|
| 286 | - } |
|
| 287 | - return $all; |
|
| 288 | - } |
|
| 269 | + global $globalMETARcycle, $globalDBdriver; |
|
| 270 | + if (isset($globalMETARcycle) && $globalMETARcycle) { |
|
| 271 | + $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
|
| 272 | + } else { |
|
| 273 | + if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
| 274 | + else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
| 275 | + } |
|
| 276 | + $query_values = array(':icao' => $icao); |
|
| 277 | + try { |
|
| 278 | + $sth = $this->db->prepare($query); |
|
| 279 | + $sth->execute($query_values); |
|
| 280 | + } catch(PDOException $e) { |
|
| 281 | + return "error : ".$e->getMessage(); |
|
| 282 | + } |
|
| 283 | + $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
|
| 284 | + if ((!isset($globalMETARcycle) || $globalMETARcycle === false) && count($all) == 0) { |
|
| 285 | + $all = $this->downloadMETAR($icao); |
|
| 286 | + } |
|
| 287 | + return $all; |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - public function addMETAR($location,$metar,$date) { |
|
| 290 | + public function addMETAR($location,$metar,$date) { |
|
| 291 | 291 | global $globalDBdriver; |
| 292 | 292 | $date = date('Y-m-d H:i:s',strtotime($date)); |
| 293 | 293 | if ($globalDBdriver == 'mysql') { |
@@ -295,106 +295,106 @@ discard block |
||
| 295 | 295 | } else { |
| 296 | 296 | $query = "UPDATE metar SET metar_date = :date, metar = metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
| 297 | 297 | } |
| 298 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
| 299 | - try { |
|
| 300 | - $sth = $this->db->prepare($query); |
|
| 301 | - $sth->execute($query_values); |
|
| 302 | - } catch(PDOException $e) { |
|
| 303 | - return "error : ".$e->getMessage(); |
|
| 304 | - } |
|
| 305 | - } |
|
| 298 | + $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
| 299 | + try { |
|
| 300 | + $sth = $this->db->prepare($query); |
|
| 301 | + $sth->execute($query_values); |
|
| 302 | + } catch(PDOException $e) { |
|
| 303 | + return "error : ".$e->getMessage(); |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - public function deleteMETAR($id) { |
|
| 308 | - $query = "DELETE FROM metar WHERE id = :id"; |
|
| 309 | - $query_values = array(':id' => $id); |
|
| 310 | - try { |
|
| 311 | - $sth = $this->db->prepare($query); |
|
| 312 | - $sth->execute($query_values); |
|
| 313 | - } catch(PDOException $e) { |
|
| 314 | - return "error : ".$e->getMessage(); |
|
| 315 | - } |
|
| 316 | - } |
|
| 317 | - public function deleteAllMETARLocation() { |
|
| 318 | - $query = "DELETE FROM metar"; |
|
| 319 | - try { |
|
| 320 | - $sth = $this->db->prepare($query); |
|
| 321 | - $sth->execute(); |
|
| 322 | - } catch(PDOException $e) { |
|
| 323 | - return "error : ".$e->getMessage(); |
|
| 324 | - } |
|
| 325 | - } |
|
| 307 | + public function deleteMETAR($id) { |
|
| 308 | + $query = "DELETE FROM metar WHERE id = :id"; |
|
| 309 | + $query_values = array(':id' => $id); |
|
| 310 | + try { |
|
| 311 | + $sth = $this->db->prepare($query); |
|
| 312 | + $sth->execute($query_values); |
|
| 313 | + } catch(PDOException $e) { |
|
| 314 | + return "error : ".$e->getMessage(); |
|
| 315 | + } |
|
| 316 | + } |
|
| 317 | + public function deleteAllMETARLocation() { |
|
| 318 | + $query = "DELETE FROM metar"; |
|
| 319 | + try { |
|
| 320 | + $sth = $this->db->prepare($query); |
|
| 321 | + $sth->execute(); |
|
| 322 | + } catch(PDOException $e) { |
|
| 323 | + return "error : ".$e->getMessage(); |
|
| 324 | + } |
|
| 325 | + } |
|
| 326 | 326 | |
| 327 | - public function addMETARCycle() { |
|
| 328 | - global $globalDebug, $globalIVAO, $globalTransaction; |
|
| 329 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
| 330 | - date_default_timezone_set("UTC"); |
|
| 331 | - $Common = new Common(); |
|
| 332 | - if (isset($globalIVAO) && $globalIVAO) { |
|
| 333 | - //$cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
| 327 | + public function addMETARCycle() { |
|
| 328 | + global $globalDebug, $globalIVAO, $globalTransaction; |
|
| 329 | + if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
| 330 | + date_default_timezone_set("UTC"); |
|
| 331 | + $Common = new Common(); |
|
| 332 | + if (isset($globalIVAO) && $globalIVAO) { |
|
| 333 | + //$cycle = $Common->getData('http://wx.ivao.aero/metar.php'); |
|
| 334 | 334 | $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
| 335 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
| 336 | - } else { |
|
| 335 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
| 336 | + } else { |
|
| 337 | 337 | //$cycle = $Common->getData('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT'); |
| 338 | 338 | $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
| 339 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
| 340 | - } |
|
| 341 | - if ($handle) { |
|
| 339 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
| 340 | + } |
|
| 341 | + if ($handle) { |
|
| 342 | 342 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
| 343 | 343 | $date = ''; |
| 344 | - //foreach(explode("\n",$cycle) as $line) { |
|
| 345 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
| 346 | - while(($line = fgets($handle,4096)) !== false) { |
|
| 344 | + //foreach(explode("\n",$cycle) as $line) { |
|
| 345 | + if ($globalTransaction) $this->db->beginTransaction(); |
|
| 346 | + while(($line = fgets($handle,4096)) !== false) { |
|
| 347 | 347 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
| 348 | 348 | $date = $line; |
| 349 | - } elseif ($line != '') { |
|
| 350 | - //$this->parse($line); |
|
| 351 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
| 352 | - $pos = 0; |
|
| 353 | - $pieces = preg_split('/\s/',$line); |
|
| 354 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 355 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 356 | - $location = $pieces[$pos]; |
|
| 357 | - echo $this->addMETAR($location,$line,$date); |
|
| 358 | - } |
|
| 359 | - } |
|
| 360 | - fclose($handle); |
|
| 361 | - if ($globalTransaction) $this->db->commit(); |
|
| 362 | - } |
|
| 363 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
| 349 | + } elseif ($line != '') { |
|
| 350 | + //$this->parse($line); |
|
| 351 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
| 352 | + $pos = 0; |
|
| 353 | + $pieces = preg_split('/\s/',$line); |
|
| 354 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 355 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 356 | + $location = $pieces[$pos]; |
|
| 357 | + echo $this->addMETAR($location,$line,$date); |
|
| 358 | + } |
|
| 359 | + } |
|
| 360 | + fclose($handle); |
|
| 361 | + if ($globalTransaction) $this->db->commit(); |
|
| 362 | + } |
|
| 363 | + if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
| 364 | 364 | |
| 365 | - } |
|
| 366 | - public function downloadMETAR($icao) { |
|
| 367 | - global $globalMETARurl; |
|
| 368 | - if ($globalMETARurl == '') return array(); |
|
| 369 | - date_default_timezone_set("UTC"); |
|
| 370 | - $Common = new Common(); |
|
| 371 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
| 372 | - $cycle = $Common->getData($url); |
|
| 373 | - $date = ''; |
|
| 374 | - foreach(explode("\n",$cycle) as $line) { |
|
| 375 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 376 | - //echo "date : ".$line."\n"; |
|
| 377 | - $date = $line; |
|
| 378 | - } |
|
| 379 | - if ($line != '') { |
|
| 380 | - //$this->parse($line); |
|
| 381 | - //echo $line; |
|
| 382 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
| 383 | - $pos = 0; |
|
| 384 | - $pieces = preg_split('/\s/',$line); |
|
| 385 | - if ($pieces[0] == 'METAR') $pos++; |
|
| 386 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 387 | - $location = $pieces[$pos]; |
|
| 388 | - if (strlen($location == 4)) { |
|
| 389 | - $this->addMETAR($location,$line,$date); |
|
| 390 | - return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
| 391 | - } else return array(); |
|
| 392 | - } |
|
| 393 | - //echo $line."\n"; |
|
| 394 | - } |
|
| 395 | - return array(); |
|
| 365 | + } |
|
| 366 | + public function downloadMETAR($icao) { |
|
| 367 | + global $globalMETARurl; |
|
| 368 | + if ($globalMETARurl == '') return array(); |
|
| 369 | + date_default_timezone_set("UTC"); |
|
| 370 | + $Common = new Common(); |
|
| 371 | + $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
| 372 | + $cycle = $Common->getData($url); |
|
| 373 | + $date = ''; |
|
| 374 | + foreach(explode("\n",$cycle) as $line) { |
|
| 375 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
| 376 | + //echo "date : ".$line."\n"; |
|
| 377 | + $date = $line; |
|
| 378 | + } |
|
| 379 | + if ($line != '') { |
|
| 380 | + //$this->parse($line); |
|
| 381 | + //echo $line; |
|
| 382 | + if ($date == '') $date = date('Y/m/d H:m'); |
|
| 383 | + $pos = 0; |
|
| 384 | + $pieces = preg_split('/\s/',$line); |
|
| 385 | + if ($pieces[0] == 'METAR') $pos++; |
|
| 386 | + if (strlen($pieces[$pos]) != 4) $pos++; |
|
| 387 | + $location = $pieces[$pos]; |
|
| 388 | + if (strlen($location == 4)) { |
|
| 389 | + $this->addMETAR($location,$line,$date); |
|
| 390 | + return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
|
| 391 | + } else return array(); |
|
| 392 | + } |
|
| 393 | + //echo $line."\n"; |
|
| 394 | + } |
|
| 395 | + return array(); |
|
| 396 | 396 | |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | } |
| 399 | 399 | /* |
| 400 | 400 | $METAR = new METAR(); |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
| 31 | - return strpos($key,'filter_') === 0; |
|
| 31 | + return strpos($key,'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
@@ -167,16 +167,16 @@ discard block |
||
| 167 | 167 | } |
| 168 | 168 | ?> |
| 169 | 169 | <?php |
| 170 | - if (isset($_POST['archive'])) { |
|
| 170 | + if (isset($_POST['archive'])) { |
|
| 171 | 171 | ?> |
| 172 | 172 | <?php |
| 173 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 173 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 174 | 174 | ?> |
| 175 | 175 | |
| 176 | 176 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
| 177 | 177 | <?php |
| 178 | - } |
|
| 179 | - } else { |
|
| 178 | + } |
|
| 179 | + } else { |
|
| 180 | 180 | ?> |
| 181 | 181 | <?php |
| 182 | 182 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | ?> |
| 190 | 190 | <?php |
| 191 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 191 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 192 | 192 | ?> |
| 193 | 193 | <?php |
| 194 | 194 | // if (isset($globalBeta) && $globalBeta) { |
@@ -199,13 +199,13 @@ discard block |
||
| 199 | 199 | ?> |
| 200 | 200 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>"></script> |
| 201 | 201 | <?php |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | ?> |
| 204 | 204 | <?php |
| 205 | 205 | // } |
| 206 | 206 | ?> |
| 207 | 207 | <?php |
| 208 | - } |
|
| 208 | + } |
|
| 209 | 209 | } |
| 210 | 210 | ?> |
| 211 | 211 | <?php |
@@ -360,15 +360,15 @@ discard block |
||
| 360 | 360 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
| 361 | 361 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
| 362 | 362 | <?php |
| 363 | - if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 363 | + if ((!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 364 | 364 | ?> |
| 365 | 365 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
| 366 | 366 | <?php |
| 367 | - } else { |
|
| 367 | + } else { |
|
| 368 | 368 | ?> |
| 369 | 369 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
| 370 | 370 | <?php |
| 371 | - } |
|
| 371 | + } |
|
| 372 | 372 | ?> |
| 373 | 373 | <li><hr /></li> |
| 374 | 374 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -376,34 +376,34 @@ discard block |
||
| 376 | 376 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
| 377 | 377 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
| 378 | 378 | <?php |
| 379 | - if ($globalACARS) { |
|
| 380 | - if (isset($globalDemo) && $globalDemo) { |
|
| 381 | - ?> |
|
| 379 | + if ($globalACARS) { |
|
| 380 | + if (isset($globalDemo) && $globalDemo) { |
|
| 381 | + ?> |
|
| 382 | 382 | <li><hr /></li> |
| 383 | 383 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
| 384 | 384 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
| 385 | 385 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
| 386 | 386 | <?php |
| 387 | - } else { |
|
| 388 | - ?> |
|
| 387 | + } else { |
|
| 388 | + ?> |
|
| 389 | 389 | <li><hr /></li> |
| 390 | 390 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
| 391 | 391 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
| 392 | 392 | <?php |
| 393 | - } |
|
| 394 | - } |
|
| 395 | - ?> |
|
| 393 | + } |
|
| 394 | + } |
|
| 395 | + ?> |
|
| 396 | 396 | <?php |
| 397 | - if (isset($globalAccidents) && $globalAccidents) { |
|
| 398 | - ?> |
|
| 397 | + if (isset($globalAccidents) && $globalAccidents) { |
|
| 398 | + ?> |
|
| 399 | 399 | <li><hr /></li> |
| 400 | 400 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
| 401 | 401 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
| 402 | 402 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
| 403 | 403 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
| 404 | 404 | <?php |
| 405 | - } |
|
| 406 | - ?> |
|
| 405 | + } |
|
| 406 | + ?> |
|
| 407 | 407 | <li><hr /></li> |
| 408 | 408 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
| 409 | 409 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
@@ -445,14 +445,14 @@ discard block |
||
| 445 | 445 | <form> |
| 446 | 446 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
| 447 | 447 | <?php |
| 448 | - $Language = new Language(); |
|
| 449 | - $alllang = $Language->getLanguages(); |
|
| 450 | - foreach ($alllang as $key => $lang) { |
|
| 451 | - print '<option value="'.$key.'"'; |
|
| 452 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 453 | - print '>'.$lang[0].'</option>'; |
|
| 454 | - } |
|
| 455 | - ?> |
|
| 448 | + $Language = new Language(); |
|
| 449 | + $alllang = $Language->getLanguages(); |
|
| 450 | + foreach ($alllang as $key => $lang) { |
|
| 451 | + print '<option value="'.$key.'"'; |
|
| 452 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 453 | + print '>'.$lang[0].'</option>'; |
|
| 454 | + } |
|
| 455 | + ?> |
|
| 456 | 456 | </select> |
| 457 | 457 | </form> |
| 458 | 458 | </div> |
@@ -483,18 +483,18 @@ discard block |
||
| 483 | 483 | ?> |
| 484 | 484 | <div class="top-header clear" role="main"> |
| 485 | 485 | <?php |
| 486 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 486 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 487 | 487 | ?> |
| 488 | 488 | <div id="archive-map"></div> |
| 489 | 489 | <?php |
| 490 | - } |
|
| 490 | + } |
|
| 491 | 491 | ?> |
| 492 | 492 | </div> |
| 493 | 493 | <?php |
| 494 | 494 | } |
| 495 | 495 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
| 496 | 496 | { |
| 497 | - ?> |
|
| 497 | + ?> |
|
| 498 | 498 | <div class="top-header clear" role="main"> |
| 499 | 499 | <div id="map"></div> |
| 500 | 500 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -505,15 +505,15 @@ discard block |
||
| 505 | 505 | var zoom = 13; |
| 506 | 506 | //create the map |
| 507 | 507 | <?php |
| 508 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 508 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 509 | 509 | ?> |
| 510 | 510 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 511 | 511 | <?php |
| 512 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 512 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 513 | 513 | ?> |
| 514 | 514 | map = L.map('map', { zoomControl:true }); |
| 515 | 515 | <?php |
| 516 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 516 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 517 | 517 | ?> |
| 518 | 518 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 519 | 519 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -521,22 +521,22 @@ discard block |
||
| 521 | 521 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 522 | 522 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 523 | 523 | <?php |
| 524 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 524 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 525 | 525 | ?> |
| 526 | 526 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 527 | 527 | <?php |
| 528 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 528 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 529 | 529 | ?> |
| 530 | 530 | map = L.map('map', { zoomControl:true }); |
| 531 | 531 | <?php |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | ?> |
| 534 | 534 | //initialize the layer group for the aircrft markers |
| 535 | 535 | var layer_data = L.layerGroup(); |
| 536 | 536 | |
| 537 | 537 | //a few title layers |
| 538 | 538 | <?php |
| 539 | - if ($globalMapProvider == 'Mapbox') { |
|
| 539 | + if ($globalMapProvider == 'Mapbox') { |
|
| 540 | 540 | ?> |
| 541 | 541 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 542 | 542 | maxZoom: 18, |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | token : '<?php print $globalMapboxToken; ?>' |
| 548 | 548 | }).addTo(map); |
| 549 | 549 | <?php |
| 550 | - } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 550 | + } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 551 | 551 | ?> |
| 552 | 552 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 553 | 553 | maxZoom: 18, |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 556 | 556 | }).addTo(map); |
| 557 | 557 | <?php |
| 558 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 558 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 559 | 559 | ?> |
| 560 | 560 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
| 561 | 561 | maxZoom: 18, |
@@ -564,7 +564,7 @@ discard block |
||
| 564 | 564 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
| 565 | 565 | }).addTo(map); |
| 566 | 566 | <?php |
| 567 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 567 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 568 | 568 | ?> |
| 569 | 569 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
| 570 | 570 | maxZoom: 18, |
@@ -573,27 +573,27 @@ discard block |
||
| 573 | 573 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
| 574 | 574 | }).addTo(map); |
| 575 | 575 | <?php |
| 576 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 576 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 577 | 577 | ?> |
| 578 | 578 | var googleLayer = new L.Google('ROADMAP'); |
| 579 | 579 | map.addLayer(googleLayer); |
| 580 | 580 | <?php |
| 581 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 581 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 582 | 582 | ?> |
| 583 | 583 | var googleLayer = new L.Google('SATELLITE'); |
| 584 | 584 | map.addLayer(googleLayer); |
| 585 | 585 | <?php |
| 586 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 586 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 587 | 587 | ?> |
| 588 | 588 | var googleLayer = new L.Google('HYBRID'); |
| 589 | 589 | map.addLayer(googleLayer); |
| 590 | 590 | <?php |
| 591 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 591 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 592 | 592 | ?> |
| 593 | 593 | var googleLayer = new L.Google('Terrain'); |
| 594 | 594 | map.addLayer(googleLayer); |
| 595 | 595 | <?php |
| 596 | - } |
|
| 596 | + } |
|
| 597 | 597 | ?> |
| 598 | 598 | </script> |
| 599 | 599 | </div> |
@@ -55,10 +55,10 @@ discard block |
||
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | - * Get SQL query part for filter used |
|
| 59 | - * @param Array $filter the filter |
|
| 60 | - * @return Array the SQL part |
|
| 61 | - */ |
|
| 58 | + * Get SQL query part for filter used |
|
| 59 | + * @param Array $filter the filter |
|
| 60 | + * @return Array the SQL part |
|
| 61 | + */ |
|
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 64 | 64 | $filters = array(); |
@@ -149,14 +149,14 @@ discard block |
||
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | /** |
| 152 | - * Executes the SQL statements to get the spotter information |
|
| 153 | - * |
|
| 154 | - * @param String $query the SQL query |
|
| 155 | - * @param Array $params parameter of the query |
|
| 156 | - * @param String $limitQuery the limit query |
|
| 157 | - * @return Array the spotter information |
|
| 158 | - * |
|
| 159 | - */ |
|
| 152 | + * Executes the SQL statements to get the spotter information |
|
| 153 | + * |
|
| 154 | + * @param String $query the SQL query |
|
| 155 | + * @param Array $params parameter of the query |
|
| 156 | + * @param String $limitQuery the limit query |
|
| 157 | + * @return Array the spotter information |
|
| 158 | + * |
|
| 159 | + */ |
|
| 160 | 160 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 161 | 161 | { |
| 162 | 162 | global $globalSquawkCountry, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalAirlinesSource, $globalVAM; |
@@ -323,11 +323,11 @@ discard block |
||
| 323 | 323 | if ($aircraft_array[0]['aircraft_shadow'] != NULL) { |
| 324 | 324 | $temp_array['aircraft_shadow'] = $aircraft_array[0]['aircraft_shadow']; |
| 325 | 325 | } else $temp_array['aircraft_shadow'] = 'default.png'; |
| 326 | - } else { |
|
| 327 | - $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 326 | + } else { |
|
| 327 | + $temp_array['aircraft_shadow'] = 'default.png'; |
|
| 328 | 328 | $temp_array['aircraft_name'] = 'N/A'; |
| 329 | 329 | $temp_array['aircraft_manufacturer'] = 'N/A'; |
| 330 | - } |
|
| 330 | + } |
|
| 331 | 331 | } |
| 332 | 332 | $fromsource = NULL; |
| 333 | 333 | if (isset($globalAirlinesSource) && $globalAirlinesSource != '') $fromsource = $globalAirlinesSource; |
@@ -523,11 +523,11 @@ discard block |
||
| 523 | 523 | |
| 524 | 524 | |
| 525 | 525 | /** |
| 526 | - * Gets all the spotter information |
|
| 527 | - * |
|
| 528 | - * @return Array the spotter information |
|
| 529 | - * |
|
| 530 | - */ |
|
| 526 | + * Gets all the spotter information |
|
| 527 | + * |
|
| 528 | + * @return Array the spotter information |
|
| 529 | + * |
|
| 530 | + */ |
|
| 531 | 531 | public function searchSpotterData($q = '', $registration = '', $aircraft_icao = '', $aircraft_manufacturer = '', $highlights = '', $airline_icao = '', $airline_country = '', $airline_type = '', $airport = '', $airport_country = '', $callsign = '', $departure_airport_route = '', $arrival_airport_route = '', $owner = '',$pilot_id = '',$pilot_name = '',$altitude = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 532 | 532 | { |
| 533 | 533 | global $globalTimezone, $globalDBdriver; |
@@ -874,11 +874,11 @@ discard block |
||
| 874 | 874 | |
| 875 | 875 | |
| 876 | 876 | /** |
| 877 | - * Gets all the spotter information based on the latest data entry |
|
| 878 | - * |
|
| 879 | - * @return Array the spotter information |
|
| 880 | - * |
|
| 881 | - */ |
|
| 877 | + * Gets all the spotter information based on the latest data entry |
|
| 878 | + * |
|
| 879 | + * @return Array the spotter information |
|
| 880 | + * |
|
| 881 | + */ |
|
| 882 | 882 | public function getLatestSpotterData($limit = '', $sort = '', $filter = array()) |
| 883 | 883 | { |
| 884 | 884 | global $global_query; |
@@ -917,12 +917,12 @@ discard block |
||
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | |
| 920 | - /** |
|
| 921 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 922 | - * |
|
| 923 | - * @return Array the spotter information |
|
| 924 | - * |
|
| 925 | - */ |
|
| 920 | + /** |
|
| 921 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 922 | + * |
|
| 923 | + * @return Array the spotter information |
|
| 924 | + * |
|
| 925 | + */ |
|
| 926 | 926 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 927 | 927 | { |
| 928 | 928 | date_default_timezone_set('UTC'); |
@@ -950,7 +950,7 @@ discard block |
||
| 950 | 950 | return false; |
| 951 | 951 | } |
| 952 | 952 | } |
| 953 | - $additional_query = ''; |
|
| 953 | + $additional_query = ''; |
|
| 954 | 954 | if ($interval != "") |
| 955 | 955 | { |
| 956 | 956 | if (!is_string($interval)) |
@@ -990,12 +990,12 @@ discard block |
||
| 990 | 990 | } |
| 991 | 991 | |
| 992 | 992 | |
| 993 | - /** |
|
| 994 | - * Gets all the spotter information sorted by the newest aircraft type |
|
| 995 | - * |
|
| 996 | - * @return Array the spotter information |
|
| 997 | - * |
|
| 998 | - */ |
|
| 993 | + /** |
|
| 994 | + * Gets all the spotter information sorted by the newest aircraft type |
|
| 995 | + * |
|
| 996 | + * @return Array the spotter information |
|
| 997 | + * |
|
| 998 | + */ |
|
| 999 | 999 | public function getNewestSpotterDataSortedByAircraftType($limit = '', $sort = '',$filter = array()) |
| 1000 | 1000 | { |
| 1001 | 1001 | global $global_query; |
@@ -1036,11 +1036,11 @@ discard block |
||
| 1036 | 1036 | |
| 1037 | 1037 | |
| 1038 | 1038 | /** |
| 1039 | - * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1040 | - * |
|
| 1041 | - * @return Array the spotter information |
|
| 1042 | - * |
|
| 1043 | - */ |
|
| 1039 | + * Gets all the spotter information sorted by the newest aircraft registration |
|
| 1040 | + * |
|
| 1041 | + * @return Array the spotter information |
|
| 1042 | + * |
|
| 1043 | + */ |
|
| 1044 | 1044 | public function getNewestSpotterDataSortedByAircraftRegistration($limit = '', $sort = '', $filter = array()) |
| 1045 | 1045 | { |
| 1046 | 1046 | global $global_query; |
@@ -1080,11 +1080,11 @@ discard block |
||
| 1080 | 1080 | |
| 1081 | 1081 | |
| 1082 | 1082 | /** |
| 1083 | - * Gets all the spotter information sorted by the newest airline |
|
| 1084 | - * |
|
| 1085 | - * @return Array the spotter information |
|
| 1086 | - * |
|
| 1087 | - */ |
|
| 1083 | + * Gets all the spotter information sorted by the newest airline |
|
| 1084 | + * |
|
| 1085 | + * @return Array the spotter information |
|
| 1086 | + * |
|
| 1087 | + */ |
|
| 1088 | 1088 | public function getNewestSpotterDataSortedByAirline($limit = '', $sort = '',$filter = array()) |
| 1089 | 1089 | { |
| 1090 | 1090 | global $global_query; |
@@ -1123,12 +1123,12 @@ discard block |
||
| 1123 | 1123 | } |
| 1124 | 1124 | |
| 1125 | 1125 | |
| 1126 | - /** |
|
| 1127 | - * Gets all the spotter information sorted by the newest departure airport |
|
| 1128 | - * |
|
| 1129 | - * @return Array the spotter information |
|
| 1130 | - * |
|
| 1131 | - */ |
|
| 1126 | + /** |
|
| 1127 | + * Gets all the spotter information sorted by the newest departure airport |
|
| 1128 | + * |
|
| 1129 | + * @return Array the spotter information |
|
| 1130 | + * |
|
| 1131 | + */ |
|
| 1132 | 1132 | public function getNewestSpotterDataSortedByDepartureAirport($limit = '', $sort = '', $filter = array()) |
| 1133 | 1133 | { |
| 1134 | 1134 | global $global_query; |
@@ -1170,11 +1170,11 @@ discard block |
||
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
| 1173 | - * Gets all the spotter information sorted by the newest arrival airport |
|
| 1174 | - * |
|
| 1175 | - * @return Array the spotter information |
|
| 1176 | - * |
|
| 1177 | - */ |
|
| 1173 | + * Gets all the spotter information sorted by the newest arrival airport |
|
| 1174 | + * |
|
| 1175 | + * @return Array the spotter information |
|
| 1176 | + * |
|
| 1177 | + */ |
|
| 1178 | 1178 | public function getNewestSpotterDataSortedByArrivalAirport($limit = '', $sort = '', $filter = array()) |
| 1179 | 1179 | { |
| 1180 | 1180 | global $global_query; |
@@ -1213,11 +1213,11 @@ discard block |
||
| 1213 | 1213 | |
| 1214 | 1214 | |
| 1215 | 1215 | /** |
| 1216 | - * Gets all the spotter information based on the spotter id |
|
| 1217 | - * |
|
| 1218 | - * @return Array the spotter information |
|
| 1219 | - * |
|
| 1220 | - */ |
|
| 1216 | + * Gets all the spotter information based on the spotter id |
|
| 1217 | + * |
|
| 1218 | + * @return Array the spotter information |
|
| 1219 | + * |
|
| 1220 | + */ |
|
| 1221 | 1221 | public function getSpotterDataByID($id = '') |
| 1222 | 1222 | { |
| 1223 | 1223 | global $global_query; |
@@ -1239,11 +1239,11 @@ discard block |
||
| 1239 | 1239 | |
| 1240 | 1240 | |
| 1241 | 1241 | /** |
| 1242 | - * Gets all the spotter information based on the callsign |
|
| 1243 | - * |
|
| 1244 | - * @return Array the spotter information |
|
| 1245 | - * |
|
| 1246 | - */ |
|
| 1242 | + * Gets all the spotter information based on the callsign |
|
| 1243 | + * |
|
| 1244 | + * @return Array the spotter information |
|
| 1245 | + * |
|
| 1246 | + */ |
|
| 1247 | 1247 | public function getSpotterDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 1248 | 1248 | { |
| 1249 | 1249 | global $global_query; |
@@ -1295,11 +1295,11 @@ discard block |
||
| 1295 | 1295 | } |
| 1296 | 1296 | |
| 1297 | 1297 | /** |
| 1298 | - * Gets all the spotter information based on the owner |
|
| 1299 | - * |
|
| 1300 | - * @return Array the spotter information |
|
| 1301 | - * |
|
| 1302 | - */ |
|
| 1298 | + * Gets all the spotter information based on the owner |
|
| 1299 | + * |
|
| 1300 | + * @return Array the spotter information |
|
| 1301 | + * |
|
| 1302 | + */ |
|
| 1303 | 1303 | public function getSpotterDataByOwner($owner = '', $limit = '', $sort = '', $filter = array()) |
| 1304 | 1304 | { |
| 1305 | 1305 | global $global_query; |
@@ -1352,11 +1352,11 @@ discard block |
||
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | /** |
| 1355 | - * Gets all the spotter information based on the pilot |
|
| 1356 | - * |
|
| 1357 | - * @return Array the spotter information |
|
| 1358 | - * |
|
| 1359 | - */ |
|
| 1355 | + * Gets all the spotter information based on the pilot |
|
| 1356 | + * |
|
| 1357 | + * @return Array the spotter information |
|
| 1358 | + * |
|
| 1359 | + */ |
|
| 1360 | 1360 | public function getSpotterDataByPilot($pilot = '', $limit = '', $sort = '', $filter = array()) |
| 1361 | 1361 | { |
| 1362 | 1362 | global $global_query; |
@@ -1405,11 +1405,11 @@ discard block |
||
| 1405 | 1405 | |
| 1406 | 1406 | |
| 1407 | 1407 | /** |
| 1408 | - * Gets all the spotter information based on the aircraft type |
|
| 1409 | - * |
|
| 1410 | - * @return Array the spotter information |
|
| 1411 | - * |
|
| 1412 | - */ |
|
| 1408 | + * Gets all the spotter information based on the aircraft type |
|
| 1409 | + * |
|
| 1410 | + * @return Array the spotter information |
|
| 1411 | + * |
|
| 1412 | + */ |
|
| 1413 | 1413 | public function getSpotterDataByAircraft($aircraft_type = '', $limit = '', $sort = '', $filter = array()) |
| 1414 | 1414 | { |
| 1415 | 1415 | global $global_query; |
@@ -1463,11 +1463,11 @@ discard block |
||
| 1463 | 1463 | |
| 1464 | 1464 | |
| 1465 | 1465 | /** |
| 1466 | - * Gets all the spotter information based on the aircraft registration |
|
| 1467 | - * |
|
| 1468 | - * @return Array the spotter information |
|
| 1469 | - * |
|
| 1470 | - */ |
|
| 1466 | + * Gets all the spotter information based on the aircraft registration |
|
| 1467 | + * |
|
| 1468 | + * @return Array the spotter information |
|
| 1469 | + * |
|
| 1470 | + */ |
|
| 1471 | 1471 | public function getSpotterDataByRegistration($registration = '', $limit = '', $sort = '', $filter = array()) |
| 1472 | 1472 | { |
| 1473 | 1473 | global $global_query; |
@@ -1524,11 +1524,11 @@ discard block |
||
| 1524 | 1524 | |
| 1525 | 1525 | |
| 1526 | 1526 | /** |
| 1527 | - * Gets all the spotter information based on the airline |
|
| 1528 | - * |
|
| 1529 | - * @return Array the spotter information |
|
| 1530 | - * |
|
| 1531 | - */ |
|
| 1527 | + * Gets all the spotter information based on the airline |
|
| 1528 | + * |
|
| 1529 | + * @return Array the spotter information |
|
| 1530 | + * |
|
| 1531 | + */ |
|
| 1532 | 1532 | public function getSpotterDataByAirline($airline = '', $limit = '', $sort = '',$filters = array()) |
| 1533 | 1533 | { |
| 1534 | 1534 | global $global_query; |
@@ -1581,11 +1581,11 @@ discard block |
||
| 1581 | 1581 | |
| 1582 | 1582 | |
| 1583 | 1583 | /** |
| 1584 | - * Gets all the spotter information based on the airport |
|
| 1585 | - * |
|
| 1586 | - * @return Array the spotter information |
|
| 1587 | - * |
|
| 1588 | - */ |
|
| 1584 | + * Gets all the spotter information based on the airport |
|
| 1585 | + * |
|
| 1586 | + * @return Array the spotter information |
|
| 1587 | + * |
|
| 1588 | + */ |
|
| 1589 | 1589 | public function getSpotterDataByAirport($airport = '', $limit = '', $sort = '',$filters = array()) |
| 1590 | 1590 | { |
| 1591 | 1591 | global $global_query; |
@@ -1639,11 +1639,11 @@ discard block |
||
| 1639 | 1639 | |
| 1640 | 1640 | |
| 1641 | 1641 | /** |
| 1642 | - * Gets all the spotter information based on the date |
|
| 1643 | - * |
|
| 1644 | - * @return Array the spotter information |
|
| 1645 | - * |
|
| 1646 | - */ |
|
| 1642 | + * Gets all the spotter information based on the date |
|
| 1643 | + * |
|
| 1644 | + * @return Array the spotter information |
|
| 1645 | + * |
|
| 1646 | + */ |
|
| 1647 | 1647 | public function getSpotterDataByDate($date = '', $limit = '', $sort = '',$filter = array()) |
| 1648 | 1648 | { |
| 1649 | 1649 | global $global_query, $globalTimezone, $globalDBdriver; |
@@ -1707,11 +1707,11 @@ discard block |
||
| 1707 | 1707 | |
| 1708 | 1708 | |
| 1709 | 1709 | /** |
| 1710 | - * Gets all the spotter information based on the country name |
|
| 1711 | - * |
|
| 1712 | - * @return Array the spotter information |
|
| 1713 | - * |
|
| 1714 | - */ |
|
| 1710 | + * Gets all the spotter information based on the country name |
|
| 1711 | + * |
|
| 1712 | + * @return Array the spotter information |
|
| 1713 | + * |
|
| 1714 | + */ |
|
| 1715 | 1715 | public function getSpotterDataByCountry($country = '', $limit = '', $sort = '',$filters = array()) |
| 1716 | 1716 | { |
| 1717 | 1717 | global $global_query; |
@@ -1765,11 +1765,11 @@ discard block |
||
| 1765 | 1765 | |
| 1766 | 1766 | |
| 1767 | 1767 | /** |
| 1768 | - * Gets all the spotter information based on the manufacturer name |
|
| 1769 | - * |
|
| 1770 | - * @return Array the spotter information |
|
| 1771 | - * |
|
| 1772 | - */ |
|
| 1768 | + * Gets all the spotter information based on the manufacturer name |
|
| 1769 | + * |
|
| 1770 | + * @return Array the spotter information |
|
| 1771 | + * |
|
| 1772 | + */ |
|
| 1773 | 1773 | public function getSpotterDataByManufacturer($aircraft_manufacturer = '', $limit = '', $sort = '', $filters = array()) |
| 1774 | 1774 | { |
| 1775 | 1775 | global $global_query; |
@@ -1825,13 +1825,13 @@ discard block |
||
| 1825 | 1825 | |
| 1826 | 1826 | |
| 1827 | 1827 | /** |
| 1828 | - * Gets a list of all aircraft that take a route |
|
| 1829 | - * |
|
| 1830 | - * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1831 | - * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1832 | - * @return Array the spotter information |
|
| 1833 | - * |
|
| 1834 | - */ |
|
| 1828 | + * Gets a list of all aircraft that take a route |
|
| 1829 | + * |
|
| 1830 | + * @param String $departure_airport_icao ICAO code of departure airport |
|
| 1831 | + * @param String $arrival_airport_icao ICAO code of arrival airport |
|
| 1832 | + * @return Array the spotter information |
|
| 1833 | + * |
|
| 1834 | + */ |
|
| 1835 | 1835 | public function getSpotterDataByRoute($departure_airport_icao = '', $arrival_airport_icao = '', $limit = '', $sort = '', $filters = array()) |
| 1836 | 1836 | { |
| 1837 | 1837 | global $global_query; |
@@ -1900,11 +1900,11 @@ discard block |
||
| 1900 | 1900 | |
| 1901 | 1901 | |
| 1902 | 1902 | /** |
| 1903 | - * Gets all the spotter information based on the special column in the table |
|
| 1904 | - * |
|
| 1905 | - * @return Array the spotter information |
|
| 1906 | - * |
|
| 1907 | - */ |
|
| 1903 | + * Gets all the spotter information based on the special column in the table |
|
| 1904 | + * |
|
| 1905 | + * @return Array the spotter information |
|
| 1906 | + * |
|
| 1907 | + */ |
|
| 1908 | 1908 | public function getSpotterDataByHighlight($limit = '', $sort = '', $filter = array()) |
| 1909 | 1909 | { |
| 1910 | 1910 | global $global_query; |
@@ -1943,11 +1943,11 @@ discard block |
||
| 1943 | 1943 | } |
| 1944 | 1944 | |
| 1945 | 1945 | /** |
| 1946 | - * Gets all the highlight based on a aircraft registration |
|
| 1947 | - * |
|
| 1948 | - * @return String the highlight text |
|
| 1949 | - * |
|
| 1950 | - */ |
|
| 1946 | + * Gets all the highlight based on a aircraft registration |
|
| 1947 | + * |
|
| 1948 | + * @return String the highlight text |
|
| 1949 | + * |
|
| 1950 | + */ |
|
| 1951 | 1951 | public function getHighlightByRegistration($registration,$filter = array()) |
| 1952 | 1952 | { |
| 1953 | 1953 | global $global_query; |
@@ -1969,13 +1969,13 @@ discard block |
||
| 1969 | 1969 | |
| 1970 | 1970 | |
| 1971 | 1971 | /** |
| 1972 | - * Gets the squawk usage from squawk code |
|
| 1973 | - * |
|
| 1974 | - * @param String $squawk squawk code |
|
| 1975 | - * @param String $country country |
|
| 1976 | - * @return String usage |
|
| 1977 | - * |
|
| 1978 | - */ |
|
| 1972 | + * Gets the squawk usage from squawk code |
|
| 1973 | + * |
|
| 1974 | + * @param String $squawk squawk code |
|
| 1975 | + * @param String $country country |
|
| 1976 | + * @return String usage |
|
| 1977 | + * |
|
| 1978 | + */ |
|
| 1979 | 1979 | public function getSquawkUsage($squawk = '',$country = 'FR') |
| 1980 | 1980 | { |
| 1981 | 1981 | |
@@ -1996,12 +1996,12 @@ discard block |
||
| 1996 | 1996 | } |
| 1997 | 1997 | |
| 1998 | 1998 | /** |
| 1999 | - * Gets the airport icao from the iata |
|
| 2000 | - * |
|
| 2001 | - * @param String $airport_iata the iata code of the airport |
|
| 2002 | - * @return String airport iata |
|
| 2003 | - * |
|
| 2004 | - */ |
|
| 1999 | + * Gets the airport icao from the iata |
|
| 2000 | + * |
|
| 2001 | + * @param String $airport_iata the iata code of the airport |
|
| 2002 | + * @return String airport iata |
|
| 2003 | + * |
|
| 2004 | + */ |
|
| 2005 | 2005 | public function getAirportIcao($airport_iata = '') |
| 2006 | 2006 | { |
| 2007 | 2007 | |
@@ -2021,14 +2021,14 @@ discard block |
||
| 2021 | 2021 | } |
| 2022 | 2022 | |
| 2023 | 2023 | /** |
| 2024 | - * Gets the airport distance |
|
| 2025 | - * |
|
| 2026 | - * @param String $airport_icao the icao code of the airport |
|
| 2027 | - * @param Float $latitude the latitude |
|
| 2028 | - * @param Float $longitude the longitude |
|
| 2029 | - * @return Float distance to the airport |
|
| 2030 | - * |
|
| 2031 | - */ |
|
| 2024 | + * Gets the airport distance |
|
| 2025 | + * |
|
| 2026 | + * @param String $airport_icao the icao code of the airport |
|
| 2027 | + * @param Float $latitude the latitude |
|
| 2028 | + * @param Float $longitude the longitude |
|
| 2029 | + * @return Float distance to the airport |
|
| 2030 | + * |
|
| 2031 | + */ |
|
| 2032 | 2032 | public function getAirportDistance($airport_icao,$latitude,$longitude) |
| 2033 | 2033 | { |
| 2034 | 2034 | |
@@ -2049,12 +2049,12 @@ discard block |
||
| 2049 | 2049 | } |
| 2050 | 2050 | |
| 2051 | 2051 | /** |
| 2052 | - * Gets the airport info based on the icao |
|
| 2053 | - * |
|
| 2054 | - * @param String $airport the icao code of the airport |
|
| 2055 | - * @return Array airport information |
|
| 2056 | - * |
|
| 2057 | - */ |
|
| 2052 | + * Gets the airport info based on the icao |
|
| 2053 | + * |
|
| 2054 | + * @param String $airport the icao code of the airport |
|
| 2055 | + * @return Array airport information |
|
| 2056 | + * |
|
| 2057 | + */ |
|
| 2058 | 2058 | public function getAllAirportInfo($airport = '') |
| 2059 | 2059 | { |
| 2060 | 2060 | |
@@ -2100,12 +2100,12 @@ discard block |
||
| 2100 | 2100 | } |
| 2101 | 2101 | |
| 2102 | 2102 | /** |
| 2103 | - * Gets the airport info based on the country |
|
| 2104 | - * |
|
| 2105 | - * @param Array $countries Airports countries |
|
| 2106 | - * @return Array airport information |
|
| 2107 | - * |
|
| 2108 | - */ |
|
| 2103 | + * Gets the airport info based on the country |
|
| 2104 | + * |
|
| 2105 | + * @param Array $countries Airports countries |
|
| 2106 | + * @return Array airport information |
|
| 2107 | + * |
|
| 2108 | + */ |
|
| 2109 | 2109 | public function getAllAirportInfobyCountry($countries) |
| 2110 | 2110 | { |
| 2111 | 2111 | $lst_countries = ''; |
@@ -2143,12 +2143,12 @@ discard block |
||
| 2143 | 2143 | } |
| 2144 | 2144 | |
| 2145 | 2145 | /** |
| 2146 | - * Gets airports info based on the coord |
|
| 2147 | - * |
|
| 2148 | - * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2149 | - * @return Array airport information |
|
| 2150 | - * |
|
| 2151 | - */ |
|
| 2146 | + * Gets airports info based on the coord |
|
| 2147 | + * |
|
| 2148 | + * @param Array $coord Airports longitude min,latitude min, longitude max, latitude max |
|
| 2149 | + * @return Array airport information |
|
| 2150 | + * |
|
| 2151 | + */ |
|
| 2152 | 2152 | public function getAllAirportInfobyCoord($coord) |
| 2153 | 2153 | { |
| 2154 | 2154 | global $globalDBdriver; |
@@ -2179,12 +2179,12 @@ discard block |
||
| 2179 | 2179 | } |
| 2180 | 2180 | |
| 2181 | 2181 | /** |
| 2182 | - * Gets waypoints info based on the coord |
|
| 2183 | - * |
|
| 2184 | - * @param Array $coord waypoints coord |
|
| 2185 | - * @return Array airport information |
|
| 2186 | - * |
|
| 2187 | - */ |
|
| 2182 | + * Gets waypoints info based on the coord |
|
| 2183 | + * |
|
| 2184 | + * @param Array $coord waypoints coord |
|
| 2185 | + * @return Array airport information |
|
| 2186 | + * |
|
| 2187 | + */ |
|
| 2188 | 2188 | public function getAllWaypointsInfobyCoord($coord) |
| 2189 | 2189 | { |
| 2190 | 2190 | if (is_array($coord)) { |
@@ -2218,12 +2218,12 @@ discard block |
||
| 2218 | 2218 | |
| 2219 | 2219 | |
| 2220 | 2220 | /** |
| 2221 | - * Gets the airline info based on the icao code or iata code |
|
| 2222 | - * |
|
| 2223 | - * @param String $airline_icao the iata code of the airport |
|
| 2224 | - * @return Array airport information |
|
| 2225 | - * |
|
| 2226 | - */ |
|
| 2221 | + * Gets the airline info based on the icao code or iata code |
|
| 2222 | + * |
|
| 2223 | + * @param String $airline_icao the iata code of the airport |
|
| 2224 | + * @return Array airport information |
|
| 2225 | + * |
|
| 2226 | + */ |
|
| 2227 | 2227 | public function getAllAirlineInfo($airline_icao, $fromsource = NULL) |
| 2228 | 2228 | { |
| 2229 | 2229 | global $globalUseRealAirlines; |
@@ -2254,7 +2254,7 @@ discard block |
||
| 2254 | 2254 | } else { |
| 2255 | 2255 | $sth->execute(array(':airline_icao' => $airline_icao,':fromsource' => $fromsource)); |
| 2256 | 2256 | } |
| 2257 | - /* |
|
| 2257 | + /* |
|
| 2258 | 2258 | $airline_array = array(); |
| 2259 | 2259 | $temp_array = array(); |
| 2260 | 2260 | |
@@ -2287,12 +2287,12 @@ discard block |
||
| 2287 | 2287 | } |
| 2288 | 2288 | |
| 2289 | 2289 | /** |
| 2290 | - * Gets the airline info based on the airline name |
|
| 2291 | - * |
|
| 2292 | - * @param String $airline_name the name of the airline |
|
| 2293 | - * @return Array airline information |
|
| 2294 | - * |
|
| 2295 | - */ |
|
| 2290 | + * Gets the airline info based on the airline name |
|
| 2291 | + * |
|
| 2292 | + * @param String $airline_name the name of the airline |
|
| 2293 | + * @return Array airline information |
|
| 2294 | + * |
|
| 2295 | + */ |
|
| 2296 | 2296 | public function getAllAirlineInfoByName($airline_name, $fromsource = NULL) |
| 2297 | 2297 | { |
| 2298 | 2298 | global $globalUseRealAirlines; |
@@ -2320,12 +2320,12 @@ discard block |
||
| 2320 | 2320 | |
| 2321 | 2321 | |
| 2322 | 2322 | /** |
| 2323 | - * Gets the aircraft info based on the aircraft type |
|
| 2324 | - * |
|
| 2325 | - * @param String $aircraft_type the aircraft type |
|
| 2326 | - * @return Array aircraft information |
|
| 2327 | - * |
|
| 2328 | - */ |
|
| 2323 | + * Gets the aircraft info based on the aircraft type |
|
| 2324 | + * |
|
| 2325 | + * @param String $aircraft_type the aircraft type |
|
| 2326 | + * @return Array aircraft information |
|
| 2327 | + * |
|
| 2328 | + */ |
|
| 2329 | 2329 | public function getAllAircraftInfo($aircraft_type) |
| 2330 | 2330 | { |
| 2331 | 2331 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2357,12 +2357,12 @@ discard block |
||
| 2357 | 2357 | } |
| 2358 | 2358 | |
| 2359 | 2359 | /** |
| 2360 | - * Gets the aircraft icao based on the aircraft name/type |
|
| 2361 | - * |
|
| 2362 | - * @param String $aircraft_type the aircraft type |
|
| 2363 | - * @return String aircraft information |
|
| 2364 | - * |
|
| 2365 | - */ |
|
| 2360 | + * Gets the aircraft icao based on the aircraft name/type |
|
| 2361 | + * |
|
| 2362 | + * @param String $aircraft_type the aircraft type |
|
| 2363 | + * @return String aircraft information |
|
| 2364 | + * |
|
| 2365 | + */ |
|
| 2366 | 2366 | public function getAircraftIcao($aircraft_type) |
| 2367 | 2367 | { |
| 2368 | 2368 | $aircraft_type = filter_var($aircraft_type,FILTER_SANITIZE_STRING); |
@@ -2387,12 +2387,12 @@ discard block |
||
| 2387 | 2387 | } |
| 2388 | 2388 | |
| 2389 | 2389 | /** |
| 2390 | - * Gets the aircraft info based on the aircraft modes |
|
| 2391 | - * |
|
| 2392 | - * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2393 | - * @return String aircraft type |
|
| 2394 | - * |
|
| 2395 | - */ |
|
| 2390 | + * Gets the aircraft info based on the aircraft modes |
|
| 2391 | + * |
|
| 2392 | + * @param String $aircraft_modes the aircraft ident (hex) |
|
| 2393 | + * @return String aircraft type |
|
| 2394 | + * |
|
| 2395 | + */ |
|
| 2396 | 2396 | public function getAllAircraftType($aircraft_modes) |
| 2397 | 2397 | { |
| 2398 | 2398 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -2412,12 +2412,12 @@ discard block |
||
| 2412 | 2412 | } |
| 2413 | 2413 | |
| 2414 | 2414 | /** |
| 2415 | - * Gets the aircraft info based on the aircraft registration |
|
| 2416 | - * |
|
| 2417 | - * @param String $registration the aircraft registration |
|
| 2418 | - * @return String aircraft type |
|
| 2419 | - * |
|
| 2420 | - */ |
|
| 2415 | + * Gets the aircraft info based on the aircraft registration |
|
| 2416 | + * |
|
| 2417 | + * @param String $registration the aircraft registration |
|
| 2418 | + * @return String aircraft type |
|
| 2419 | + * |
|
| 2420 | + */ |
|
| 2421 | 2421 | public function getAllAircraftTypeByRegistration($registration) |
| 2422 | 2422 | { |
| 2423 | 2423 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2435,12 +2435,12 @@ discard block |
||
| 2435 | 2435 | } |
| 2436 | 2436 | |
| 2437 | 2437 | /** |
| 2438 | - * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2439 | - * |
|
| 2440 | - * @param String $registration the aircraft registration |
|
| 2441 | - * @return Array spotter_id and flightaware_id |
|
| 2442 | - * |
|
| 2443 | - */ |
|
| 2438 | + * Gets the spotter_id and flightaware_id based on the aircraft registration |
|
| 2439 | + * |
|
| 2440 | + * @param String $registration the aircraft registration |
|
| 2441 | + * @return Array spotter_id and flightaware_id |
|
| 2442 | + * |
|
| 2443 | + */ |
|
| 2444 | 2444 | public function getAllIDByRegistration($registration) |
| 2445 | 2445 | { |
| 2446 | 2446 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2459,12 +2459,12 @@ discard block |
||
| 2459 | 2459 | } |
| 2460 | 2460 | |
| 2461 | 2461 | /** |
| 2462 | - * Gets correct aircraft operator code |
|
| 2463 | - * |
|
| 2464 | - * @param String $operator the aircraft operator code (callsign) |
|
| 2465 | - * @return String aircraft operator code |
|
| 2466 | - * |
|
| 2467 | - */ |
|
| 2462 | + * Gets correct aircraft operator code |
|
| 2463 | + * |
|
| 2464 | + * @param String $operator the aircraft operator code (callsign) |
|
| 2465 | + * @return String aircraft operator code |
|
| 2466 | + * |
|
| 2467 | + */ |
|
| 2468 | 2468 | public function getOperator($operator) |
| 2469 | 2469 | { |
| 2470 | 2470 | $operator = filter_var($operator,FILTER_SANITIZE_STRING); |
@@ -2481,16 +2481,16 @@ discard block |
||
| 2481 | 2481 | } |
| 2482 | 2482 | |
| 2483 | 2483 | /** |
| 2484 | - * Gets the aircraft route based on the aircraft callsign |
|
| 2485 | - * |
|
| 2486 | - * @param String $callsign the aircraft callsign |
|
| 2487 | - * @return Array aircraft type |
|
| 2488 | - * |
|
| 2489 | - */ |
|
| 2484 | + * Gets the aircraft route based on the aircraft callsign |
|
| 2485 | + * |
|
| 2486 | + * @param String $callsign the aircraft callsign |
|
| 2487 | + * @return Array aircraft type |
|
| 2488 | + * |
|
| 2489 | + */ |
|
| 2490 | 2490 | public function getRouteInfo($callsign) |
| 2491 | 2491 | { |
| 2492 | 2492 | $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
| 2493 | - if ($callsign == '') return array(); |
|
| 2493 | + if ($callsign == '') return array(); |
|
| 2494 | 2494 | $query = "SELECT routes.Operator_ICAO, routes.FromAirport_ICAO, routes.ToAirport_ICAO, routes.RouteStop, routes.FromAirport_Time, routes.ToAirport_Time FROM routes WHERE CallSign = :callsign LIMIT 1"; |
| 2495 | 2495 | |
| 2496 | 2496 | $sth = $this->db->prepare($query); |
@@ -2504,12 +2504,12 @@ discard block |
||
| 2504 | 2504 | } |
| 2505 | 2505 | |
| 2506 | 2506 | /** |
| 2507 | - * Gets the aircraft info based on the aircraft registration |
|
| 2508 | - * |
|
| 2509 | - * @param String $registration the aircraft registration |
|
| 2510 | - * @return Array aircraft information |
|
| 2511 | - * |
|
| 2512 | - */ |
|
| 2507 | + * Gets the aircraft info based on the aircraft registration |
|
| 2508 | + * |
|
| 2509 | + * @param String $registration the aircraft registration |
|
| 2510 | + * @return Array aircraft information |
|
| 2511 | + * |
|
| 2512 | + */ |
|
| 2513 | 2513 | public function getAircraftInfoByRegistration($registration) |
| 2514 | 2514 | { |
| 2515 | 2515 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2536,12 +2536,12 @@ discard block |
||
| 2536 | 2536 | } |
| 2537 | 2537 | |
| 2538 | 2538 | /** |
| 2539 | - * Gets the aircraft owner & base based on the aircraft registration |
|
| 2540 | - * |
|
| 2541 | - * @param String $registration the aircraft registration |
|
| 2542 | - * @return Array aircraft information |
|
| 2543 | - * |
|
| 2544 | - */ |
|
| 2539 | + * Gets the aircraft owner & base based on the aircraft registration |
|
| 2540 | + * |
|
| 2541 | + * @param String $registration the aircraft registration |
|
| 2542 | + * @return Array aircraft information |
|
| 2543 | + * |
|
| 2544 | + */ |
|
| 2545 | 2545 | public function getAircraftOwnerByRegistration($registration) |
| 2546 | 2546 | { |
| 2547 | 2547 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -2558,11 +2558,11 @@ discard block |
||
| 2558 | 2558 | |
| 2559 | 2559 | |
| 2560 | 2560 | /** |
| 2561 | - * Gets all flights (but with only little info) |
|
| 2562 | - * |
|
| 2563 | - * @return Array basic flight information |
|
| 2564 | - * |
|
| 2565 | - */ |
|
| 2561 | + * Gets all flights (but with only little info) |
|
| 2562 | + * |
|
| 2563 | + * @return Array basic flight information |
|
| 2564 | + * |
|
| 2565 | + */ |
|
| 2566 | 2566 | public function getAllFlightsforSitemap() |
| 2567 | 2567 | { |
| 2568 | 2568 | //$query = "SELECT spotter_output.spotter_id, spotter_output.ident, spotter_output.airline_name, spotter_output.aircraft_name, spotter_output.aircraft_icao FROM spotter_output ORDER BY LIMIT "; |
@@ -2570,7 +2570,7 @@ discard block |
||
| 2570 | 2570 | |
| 2571 | 2571 | $sth = $this->db->prepare($query); |
| 2572 | 2572 | $sth->execute(); |
| 2573 | - /* |
|
| 2573 | + /* |
|
| 2574 | 2574 | $flight_array = array(); |
| 2575 | 2575 | $temp_array = array(); |
| 2576 | 2576 | |
@@ -2592,11 +2592,11 @@ discard block |
||
| 2592 | 2592 | } |
| 2593 | 2593 | |
| 2594 | 2594 | /** |
| 2595 | - * Gets a list of all aircraft manufacturers |
|
| 2596 | - * |
|
| 2597 | - * @return Array list of aircraft types |
|
| 2598 | - * |
|
| 2599 | - */ |
|
| 2595 | + * Gets a list of all aircraft manufacturers |
|
| 2596 | + * |
|
| 2597 | + * @return Array list of aircraft types |
|
| 2598 | + * |
|
| 2599 | + */ |
|
| 2600 | 2600 | public function getAllManufacturers() |
| 2601 | 2601 | { |
| 2602 | 2602 | /* |
@@ -2625,11 +2625,11 @@ discard block |
||
| 2625 | 2625 | |
| 2626 | 2626 | |
| 2627 | 2627 | /** |
| 2628 | - * Gets a list of all aircraft types |
|
| 2629 | - * |
|
| 2630 | - * @return Array list of aircraft types |
|
| 2631 | - * |
|
| 2632 | - */ |
|
| 2628 | + * Gets a list of all aircraft types |
|
| 2629 | + * |
|
| 2630 | + * @return Array list of aircraft types |
|
| 2631 | + * |
|
| 2632 | + */ |
|
| 2633 | 2633 | public function getAllAircraftTypes($filters = array()) |
| 2634 | 2634 | { |
| 2635 | 2635 | /* |
@@ -2664,11 +2664,11 @@ discard block |
||
| 2664 | 2664 | |
| 2665 | 2665 | |
| 2666 | 2666 | /** |
| 2667 | - * Gets a list of all aircraft registrations |
|
| 2668 | - * |
|
| 2669 | - * @return Array list of aircraft registrations |
|
| 2670 | - * |
|
| 2671 | - */ |
|
| 2667 | + * Gets a list of all aircraft registrations |
|
| 2668 | + * |
|
| 2669 | + * @return Array list of aircraft registrations |
|
| 2670 | + * |
|
| 2671 | + */ |
|
| 2672 | 2672 | public function getAllAircraftRegistrations($filters = array()) |
| 2673 | 2673 | { |
| 2674 | 2674 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2693,12 +2693,12 @@ discard block |
||
| 2693 | 2693 | } |
| 2694 | 2694 | |
| 2695 | 2695 | /** |
| 2696 | - * Gets all source name |
|
| 2697 | - * |
|
| 2698 | - * @param String type format of source |
|
| 2699 | - * @return Array list of source name |
|
| 2700 | - * |
|
| 2701 | - */ |
|
| 2696 | + * Gets all source name |
|
| 2697 | + * |
|
| 2698 | + * @param String type format of source |
|
| 2699 | + * @return Array list of source name |
|
| 2700 | + * |
|
| 2701 | + */ |
|
| 2702 | 2702 | public function getAllSourceName($type = '',$filters = array()) |
| 2703 | 2703 | { |
| 2704 | 2704 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2729,11 +2729,11 @@ discard block |
||
| 2729 | 2729 | |
| 2730 | 2730 | |
| 2731 | 2731 | /** |
| 2732 | - * Gets a list of all airline names |
|
| 2733 | - * |
|
| 2734 | - * @return Array list of airline names |
|
| 2735 | - * |
|
| 2736 | - */ |
|
| 2732 | + * Gets a list of all airline names |
|
| 2733 | + * |
|
| 2734 | + * @return Array list of airline names |
|
| 2735 | + * |
|
| 2736 | + */ |
|
| 2737 | 2737 | public function getAllAirlineNames($airline_type = '',$forsource = NULL,$filters = array()) |
| 2738 | 2738 | { |
| 2739 | 2739 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2782,11 +2782,11 @@ discard block |
||
| 2782 | 2782 | } |
| 2783 | 2783 | |
| 2784 | 2784 | /** |
| 2785 | - * Gets a list of all alliance names |
|
| 2786 | - * |
|
| 2787 | - * @return Array list of alliance names |
|
| 2788 | - * |
|
| 2789 | - */ |
|
| 2785 | + * Gets a list of all alliance names |
|
| 2786 | + * |
|
| 2787 | + * @return Array list of alliance names |
|
| 2788 | + * |
|
| 2789 | + */ |
|
| 2790 | 2790 | public function getAllAllianceNames($forsource = NULL,$filters = array()) |
| 2791 | 2791 | { |
| 2792 | 2792 | global $globalAirlinesSource,$globalVATSIM, $globalIVAO; |
@@ -2811,11 +2811,11 @@ discard block |
||
| 2811 | 2811 | } |
| 2812 | 2812 | |
| 2813 | 2813 | /** |
| 2814 | - * Gets a list of all airline countries |
|
| 2815 | - * |
|
| 2816 | - * @return Array list of airline countries |
|
| 2817 | - * |
|
| 2818 | - */ |
|
| 2814 | + * Gets a list of all airline countries |
|
| 2815 | + * |
|
| 2816 | + * @return Array list of airline countries |
|
| 2817 | + * |
|
| 2818 | + */ |
|
| 2819 | 2819 | public function getAllAirlineCountries($filters = array()) |
| 2820 | 2820 | { |
| 2821 | 2821 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2843,11 +2843,11 @@ discard block |
||
| 2843 | 2843 | |
| 2844 | 2844 | |
| 2845 | 2845 | /** |
| 2846 | - * Gets a list of all departure & arrival names |
|
| 2847 | - * |
|
| 2848 | - * @return Array list of airport names |
|
| 2849 | - * |
|
| 2850 | - */ |
|
| 2846 | + * Gets a list of all departure & arrival names |
|
| 2847 | + * |
|
| 2848 | + * @return Array list of airport names |
|
| 2849 | + * |
|
| 2850 | + */ |
|
| 2851 | 2851 | public function getAllAirportNames($filters = array()) |
| 2852 | 2852 | { |
| 2853 | 2853 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2895,11 +2895,11 @@ discard block |
||
| 2895 | 2895 | } |
| 2896 | 2896 | |
| 2897 | 2897 | /** |
| 2898 | - * Gets a list of all owner names |
|
| 2899 | - * |
|
| 2900 | - * @return Array list of owner names |
|
| 2901 | - * |
|
| 2902 | - */ |
|
| 2898 | + * Gets a list of all owner names |
|
| 2899 | + * |
|
| 2900 | + * @return Array list of owner names |
|
| 2901 | + * |
|
| 2902 | + */ |
|
| 2903 | 2903 | public function getAllOwnerNames($filters = array()) |
| 2904 | 2904 | { |
| 2905 | 2905 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2913,11 +2913,11 @@ discard block |
||
| 2913 | 2913 | } |
| 2914 | 2914 | |
| 2915 | 2915 | /** |
| 2916 | - * Gets a list of all pilot names and pilot ids |
|
| 2917 | - * |
|
| 2918 | - * @return Array list of pilot names and pilot ids |
|
| 2919 | - * |
|
| 2920 | - */ |
|
| 2916 | + * Gets a list of all pilot names and pilot ids |
|
| 2917 | + * |
|
| 2918 | + * @return Array list of pilot names and pilot ids |
|
| 2919 | + * |
|
| 2920 | + */ |
|
| 2921 | 2921 | public function getAllPilotNames($filters = array()) |
| 2922 | 2922 | { |
| 2923 | 2923 | $filter_query = $this->getFilter($filters,true,true); |
@@ -2932,11 +2932,11 @@ discard block |
||
| 2932 | 2932 | |
| 2933 | 2933 | |
| 2934 | 2934 | /** |
| 2935 | - * Gets a list of all departure & arrival airport countries |
|
| 2936 | - * |
|
| 2937 | - * @return Array list of airport countries |
|
| 2938 | - * |
|
| 2939 | - */ |
|
| 2935 | + * Gets a list of all departure & arrival airport countries |
|
| 2936 | + * |
|
| 2937 | + * @return Array list of airport countries |
|
| 2938 | + * |
|
| 2939 | + */ |
|
| 2940 | 2940 | public function getAllAirportCountries($filters = array()) |
| 2941 | 2941 | { |
| 2942 | 2942 | $airport_array = array(); |
@@ -2984,11 +2984,11 @@ discard block |
||
| 2984 | 2984 | |
| 2985 | 2985 | |
| 2986 | 2986 | /** |
| 2987 | - * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2988 | - * |
|
| 2989 | - * @return Array list of countries |
|
| 2990 | - * |
|
| 2991 | - */ |
|
| 2987 | + * Gets a list of all countries (airline, departure airport & arrival airport) |
|
| 2988 | + * |
|
| 2989 | + * @return Array list of countries |
|
| 2990 | + * |
|
| 2991 | + */ |
|
| 2992 | 2992 | public function getAllCountries($filters = array()) |
| 2993 | 2993 | { |
| 2994 | 2994 | $Connection= new Connection($this->db); |
@@ -3065,11 +3065,11 @@ discard block |
||
| 3065 | 3065 | |
| 3066 | 3066 | |
| 3067 | 3067 | /** |
| 3068 | - * Gets a list of all idents/callsigns |
|
| 3069 | - * |
|
| 3070 | - * @return Array list of ident/callsign names |
|
| 3071 | - * |
|
| 3072 | - */ |
|
| 3068 | + * Gets a list of all idents/callsigns |
|
| 3069 | + * |
|
| 3070 | + * @return Array list of ident/callsign names |
|
| 3071 | + * |
|
| 3072 | + */ |
|
| 3073 | 3073 | public function getAllIdents($filters = array()) |
| 3074 | 3074 | { |
| 3075 | 3075 | $filter_query = $this->getFilter($filters,true,true); |
@@ -3093,9 +3093,9 @@ discard block |
||
| 3093 | 3093 | } |
| 3094 | 3094 | |
| 3095 | 3095 | /** |
| 3096 | - * Get a list of flights from airport since 7 days |
|
| 3097 | - * @return Array number, icao, name and city of airports |
|
| 3098 | - */ |
|
| 3096 | + * Get a list of flights from airport since 7 days |
|
| 3097 | + * @return Array number, icao, name and city of airports |
|
| 3098 | + */ |
|
| 3099 | 3099 | |
| 3100 | 3100 | public function getLast7DaysAirportsDeparture($airport_icao = '',$filters = array()) { |
| 3101 | 3101 | global $globalTimezone, $globalDBdriver; |
@@ -3126,9 +3126,9 @@ discard block |
||
| 3126 | 3126 | } |
| 3127 | 3127 | |
| 3128 | 3128 | /** |
| 3129 | - * Get a list of flights from airport since 7 days |
|
| 3130 | - * @return Array number, icao, name and city of airports |
|
| 3131 | - */ |
|
| 3129 | + * Get a list of flights from airport since 7 days |
|
| 3130 | + * @return Array number, icao, name and city of airports |
|
| 3131 | + */ |
|
| 3132 | 3132 | |
| 3133 | 3133 | public function getLast7DaysAirportsDepartureByAirlines($airport_icao = '') { |
| 3134 | 3134 | global $globalTimezone, $globalDBdriver; |
@@ -3158,9 +3158,9 @@ discard block |
||
| 3158 | 3158 | } |
| 3159 | 3159 | |
| 3160 | 3160 | /** |
| 3161 | - * Get a list of flights from detected airport since 7 days |
|
| 3162 | - * @return Array number, icao, name and city of airports |
|
| 3163 | - */ |
|
| 3161 | + * Get a list of flights from detected airport since 7 days |
|
| 3162 | + * @return Array number, icao, name and city of airports |
|
| 3163 | + */ |
|
| 3164 | 3164 | |
| 3165 | 3165 | public function getLast7DaysDetectedAirportsDeparture($airport_icao = '', $filters = array()) { |
| 3166 | 3166 | global $globalTimezone, $globalDBdriver; |
@@ -3198,9 +3198,9 @@ discard block |
||
| 3198 | 3198 | } |
| 3199 | 3199 | |
| 3200 | 3200 | /** |
| 3201 | - * Get a list of flights from detected airport since 7 days |
|
| 3202 | - * @return Array number, icao, name and city of airports |
|
| 3203 | - */ |
|
| 3201 | + * Get a list of flights from detected airport since 7 days |
|
| 3202 | + * @return Array number, icao, name and city of airports |
|
| 3203 | + */ |
|
| 3204 | 3204 | |
| 3205 | 3205 | public function getLast7DaysDetectedAirportsDepartureByAirlines($airport_icao = '') { |
| 3206 | 3206 | global $globalTimezone, $globalDBdriver; |
@@ -3242,9 +3242,9 @@ discard block |
||
| 3242 | 3242 | |
| 3243 | 3243 | |
| 3244 | 3244 | /** |
| 3245 | - * Get a list of flights to airport since 7 days |
|
| 3246 | - * @return Array number, icao, name and city of airports |
|
| 3247 | - */ |
|
| 3245 | + * Get a list of flights to airport since 7 days |
|
| 3246 | + * @return Array number, icao, name and city of airports |
|
| 3247 | + */ |
|
| 3248 | 3248 | |
| 3249 | 3249 | public function getLast7DaysAirportsArrival($airport_icao = '', $filters = array()) { |
| 3250 | 3250 | global $globalTimezone, $globalDBdriver; |
@@ -3277,9 +3277,9 @@ discard block |
||
| 3277 | 3277 | |
| 3278 | 3278 | |
| 3279 | 3279 | /** |
| 3280 | - * Get a list of flights detected to airport since 7 days |
|
| 3281 | - * @return Array number, icao, name and city of airports |
|
| 3282 | - */ |
|
| 3280 | + * Get a list of flights detected to airport since 7 days |
|
| 3281 | + * @return Array number, icao, name and city of airports |
|
| 3282 | + */ |
|
| 3283 | 3283 | |
| 3284 | 3284 | public function getLast7DaysDetectedAirportsArrival($airport_icao = '',$filters = array()) { |
| 3285 | 3285 | global $globalTimezone, $globalDBdriver; |
@@ -3320,9 +3320,9 @@ discard block |
||
| 3320 | 3320 | |
| 3321 | 3321 | |
| 3322 | 3322 | /** |
| 3323 | - * Get a list of flights to airport since 7 days |
|
| 3324 | - * @return Array number, icao, name and city of airports |
|
| 3325 | - */ |
|
| 3323 | + * Get a list of flights to airport since 7 days |
|
| 3324 | + * @return Array number, icao, name and city of airports |
|
| 3325 | + */ |
|
| 3326 | 3326 | |
| 3327 | 3327 | public function getLast7DaysAirportsArrivalByAirlines($airport_icao = '') { |
| 3328 | 3328 | global $globalTimezone, $globalDBdriver; |
@@ -3354,9 +3354,9 @@ discard block |
||
| 3354 | 3354 | |
| 3355 | 3355 | |
| 3356 | 3356 | /** |
| 3357 | - * Get a list of flights detected to airport since 7 days |
|
| 3358 | - * @return Array number, icao, name and city of airports |
|
| 3359 | - */ |
|
| 3357 | + * Get a list of flights detected to airport since 7 days |
|
| 3358 | + * @return Array number, icao, name and city of airports |
|
| 3359 | + */ |
|
| 3360 | 3360 | |
| 3361 | 3361 | public function getLast7DaysDetectedAirportsArrivalByAirlines($airport_icao = '') { |
| 3362 | 3362 | global $globalTimezone, $globalDBdriver; |
@@ -3400,11 +3400,11 @@ discard block |
||
| 3400 | 3400 | |
| 3401 | 3401 | |
| 3402 | 3402 | /** |
| 3403 | - * Gets a list of all dates |
|
| 3404 | - * |
|
| 3405 | - * @return Array list of date names |
|
| 3406 | - * |
|
| 3407 | - */ |
|
| 3403 | + * Gets a list of all dates |
|
| 3404 | + * |
|
| 3405 | + * @return Array list of date names |
|
| 3406 | + * |
|
| 3407 | + */ |
|
| 3408 | 3408 | public function getAllDates() |
| 3409 | 3409 | { |
| 3410 | 3410 | global $globalTimezone, $globalDBdriver; |
@@ -3445,11 +3445,11 @@ discard block |
||
| 3445 | 3445 | |
| 3446 | 3446 | |
| 3447 | 3447 | /** |
| 3448 | - * Gets all route combinations |
|
| 3449 | - * |
|
| 3450 | - * @return Array the route list |
|
| 3451 | - * |
|
| 3452 | - */ |
|
| 3448 | + * Gets all route combinations |
|
| 3449 | + * |
|
| 3450 | + * @return Array the route list |
|
| 3451 | + * |
|
| 3452 | + */ |
|
| 3453 | 3453 | public function getAllRoutes() |
| 3454 | 3454 | { |
| 3455 | 3455 | $query = "SELECT DISTINCT concat(spotter_output.departure_airport_icao, ' - ', spotter_output.arrival_airport_icao) AS route, spotter_output.departure_airport_icao, spotter_output.arrival_airport_icao |
@@ -3475,13 +3475,13 @@ discard block |
||
| 3475 | 3475 | } |
| 3476 | 3476 | |
| 3477 | 3477 | /** |
| 3478 | - * Update ident spotter data |
|
| 3479 | - * |
|
| 3480 | - * @param String $flightaware_id the ID from flightaware |
|
| 3481 | - * @param String $ident the flight ident |
|
| 3482 | - * @return String success or false |
|
| 3483 | - * |
|
| 3484 | - */ |
|
| 3478 | + * Update ident spotter data |
|
| 3479 | + * |
|
| 3480 | + * @param String $flightaware_id the ID from flightaware |
|
| 3481 | + * @param String $ident the flight ident |
|
| 3482 | + * @return String success or false |
|
| 3483 | + * |
|
| 3484 | + */ |
|
| 3485 | 3485 | public function updateIdentSpotterData($flightaware_id = '', $ident = '',$fromsource = NULL) |
| 3486 | 3486 | { |
| 3487 | 3487 | if (!is_numeric(substr($ident, 0, 3))) |
@@ -3502,14 +3502,14 @@ discard block |
||
| 3502 | 3502 | } else { |
| 3503 | 3503 | $airline_array = $this->getAllAirlineInfo("NA"); |
| 3504 | 3504 | } |
| 3505 | - $airline_name = $airline_array[0]['name']; |
|
| 3506 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3507 | - $airline_country = $airline_array[0]['country']; |
|
| 3508 | - $airline_type = $airline_array[0]['type']; |
|
| 3505 | + $airline_name = $airline_array[0]['name']; |
|
| 3506 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3507 | + $airline_country = $airline_array[0]['country']; |
|
| 3508 | + $airline_type = $airline_array[0]['type']; |
|
| 3509 | 3509 | |
| 3510 | 3510 | |
| 3511 | 3511 | $query = 'UPDATE spotter_output SET ident = :ident, airline_name = :airline_name, airline_icao = :airline_icao, airline_country = :airline_country, airline_type = :airline_type WHERE flightaware_id = :flightaware_id'; |
| 3512 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3512 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type); |
|
| 3513 | 3513 | |
| 3514 | 3514 | try { |
| 3515 | 3515 | $sth = $this->db->prepare($query); |
@@ -3522,19 +3522,19 @@ discard block |
||
| 3522 | 3522 | |
| 3523 | 3523 | } |
| 3524 | 3524 | /** |
| 3525 | - * Update latest spotter data |
|
| 3526 | - * |
|
| 3527 | - * @param String $flightaware_id the ID from flightaware |
|
| 3528 | - * @param String $ident the flight ident |
|
| 3529 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3530 | - * @return String success or false |
|
| 3531 | - * |
|
| 3532 | - */ |
|
| 3525 | + * Update latest spotter data |
|
| 3526 | + * |
|
| 3527 | + * @param String $flightaware_id the ID from flightaware |
|
| 3528 | + * @param String $ident the flight ident |
|
| 3529 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3530 | + * @return String success or false |
|
| 3531 | + * |
|
| 3532 | + */ |
|
| 3533 | 3533 | public function updateLatestSpotterData($flightaware_id = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $ground = false, $groundspeed = NULL, $date = '', $arrival_airport_icao = '',$arrival_airport_time = '') |
| 3534 | 3534 | { |
| 3535 | 3535 | if ($groundspeed == '') $groundspeed = NULL; |
| 3536 | 3536 | $query = 'UPDATE spotter_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_altitude = :last_altitude, last_ground = :last_ground, last_seen = :last_seen, real_arrival_airport_icao = :real_arrival_airport_icao, real_arrival_airport_time = :real_arrival_airport_time, last_ground_speed = :last_ground_speed WHERE flightaware_id = :flightaware_id'; |
| 3537 | - $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3537 | + $query_values = array(':flightaware_id' => $flightaware_id,':real_arrival_airport_icao' => $arrival_airport_icao,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_altitude' => $altitude,':last_ground_speed' => $groundspeed,':last_seen' => $date,':real_arrival_airport_time' => $arrival_airport_time, ':last_ground' => $ground, ':ident' => $ident); |
|
| 3538 | 3538 | |
| 3539 | 3539 | try { |
| 3540 | 3540 | $sth = $this->db->prepare($query); |
@@ -3548,32 +3548,32 @@ discard block |
||
| 3548 | 3548 | } |
| 3549 | 3549 | |
| 3550 | 3550 | /** |
| 3551 | - * Adds a new spotter data |
|
| 3552 | - * |
|
| 3553 | - * @param String $flightaware_id the ID from flightaware |
|
| 3554 | - * @param String $ident the flight ident |
|
| 3555 | - * @param String $aircraft_icao the aircraft type |
|
| 3556 | - * @param String $departure_airport_icao the departure airport |
|
| 3557 | - * @param String $arrival_airport_icao the arrival airport |
|
| 3558 | - * @param String $latitude latitude of flight |
|
| 3559 | - * @param String $longitude latitude of flight |
|
| 3560 | - * @param String $waypoints waypoints of flight |
|
| 3561 | - * @param String $altitude altitude of flight |
|
| 3562 | - * @param String $heading heading of flight |
|
| 3563 | - * @param String $groundspeed speed of flight |
|
| 3564 | - * @param String $date date of flight |
|
| 3565 | - * @param String $departure_airport_time departure time of flight |
|
| 3566 | - * @param String $arrival_airport_time arrival time of flight |
|
| 3567 | - * @param String $squawk squawk code of flight |
|
| 3568 | - * @param String $route_stop route stop of flight |
|
| 3569 | - * @param String $highlight highlight or not |
|
| 3570 | - * @param String $ModeS ModesS code of flight |
|
| 3571 | - * @param String $registration registration code of flight |
|
| 3572 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3573 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3574 | - * @param String $verticalrate vertival rate of flight |
|
| 3575 | - * @return String success or false |
|
| 3576 | - */ |
|
| 3551 | + * Adds a new spotter data |
|
| 3552 | + * |
|
| 3553 | + * @param String $flightaware_id the ID from flightaware |
|
| 3554 | + * @param String $ident the flight ident |
|
| 3555 | + * @param String $aircraft_icao the aircraft type |
|
| 3556 | + * @param String $departure_airport_icao the departure airport |
|
| 3557 | + * @param String $arrival_airport_icao the arrival airport |
|
| 3558 | + * @param String $latitude latitude of flight |
|
| 3559 | + * @param String $longitude latitude of flight |
|
| 3560 | + * @param String $waypoints waypoints of flight |
|
| 3561 | + * @param String $altitude altitude of flight |
|
| 3562 | + * @param String $heading heading of flight |
|
| 3563 | + * @param String $groundspeed speed of flight |
|
| 3564 | + * @param String $date date of flight |
|
| 3565 | + * @param String $departure_airport_time departure time of flight |
|
| 3566 | + * @param String $arrival_airport_time arrival time of flight |
|
| 3567 | + * @param String $squawk squawk code of flight |
|
| 3568 | + * @param String $route_stop route stop of flight |
|
| 3569 | + * @param String $highlight highlight or not |
|
| 3570 | + * @param String $ModeS ModesS code of flight |
|
| 3571 | + * @param String $registration registration code of flight |
|
| 3572 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 3573 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 3574 | + * @param String $verticalrate vertival rate of flight |
|
| 3575 | + * @return String success or false |
|
| 3576 | + */ |
|
| 3577 | 3577 | public function addSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $departure_airport_time = '', $arrival_airport_time = '',$squawk = '', $route_stop = '', $highlight = '', $ModeS = '', $registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $ground = false,$format_source = '', $source_name = '') |
| 3578 | 3578 | { |
| 3579 | 3579 | global $globalURL, $globalIVAO, $globalVATSIM, $globalphpVMS, $globalDebugTimeElapsed, $globalAirlinesSource, $globalVAM; |
@@ -3788,8 +3788,8 @@ discard block |
||
| 3788 | 3788 | |
| 3789 | 3789 | if ($globalIVAO && $aircraft_icao != '') |
| 3790 | 3790 | { |
| 3791 | - if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3792 | - else $airline_icao = ''; |
|
| 3791 | + if (isset($airline_array[0]['icao'])) $airline_icao = $airline_array[0]['icao']; |
|
| 3792 | + else $airline_icao = ''; |
|
| 3793 | 3793 | $image_array = $Image->getSpotterImage('',$aircraft_icao,$airline_icao); |
| 3794 | 3794 | if (!isset($image_array[0]['registration'])) |
| 3795 | 3795 | { |
@@ -3820,53 +3820,53 @@ discard block |
||
| 3820 | 3820 | |
| 3821 | 3821 | if (count($airline_array) == 0) |
| 3822 | 3822 | { |
| 3823 | - $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3824 | - } |
|
| 3825 | - if (count($aircraft_array) == 0) |
|
| 3826 | - { |
|
| 3827 | - $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3828 | - } |
|
| 3829 | - if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3830 | - { |
|
| 3831 | - $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3832 | - } |
|
| 3833 | - if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3834 | - { |
|
| 3835 | - $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3836 | - } |
|
| 3837 | - if ($registration == '') $registration = 'NA'; |
|
| 3838 | - if ($latitude == '' && $longitude == '') { |
|
| 3839 | - $latitude = 0; |
|
| 3840 | - $longitude = 0; |
|
| 3841 | - } |
|
| 3842 | - if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3843 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3844 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3845 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3846 | - if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3847 | - $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3823 | + $airline_array = $this->getAllAirlineInfo('NA'); |
|
| 3824 | + } |
|
| 3825 | + if (count($aircraft_array) == 0) |
|
| 3826 | + { |
|
| 3827 | + $aircraft_array = $this->getAllAircraftInfo('NA'); |
|
| 3828 | + } |
|
| 3829 | + if (count($departure_airport_array) == 0 || $departure_airport_array[0]['icao'] == '' || $departure_airport_icao == '') |
|
| 3830 | + { |
|
| 3831 | + $departure_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3832 | + } |
|
| 3833 | + if (count($arrival_airport_array) == 0 || $arrival_airport_array[0]['icao'] == '' || $arrival_airport_icao == '') |
|
| 3834 | + { |
|
| 3835 | + $arrival_airport_array = $this->getAllAirportInfo('NA'); |
|
| 3836 | + } |
|
| 3837 | + if ($registration == '') $registration = 'NA'; |
|
| 3838 | + if ($latitude == '' && $longitude == '') { |
|
| 3839 | + $latitude = 0; |
|
| 3840 | + $longitude = 0; |
|
| 3841 | + } |
|
| 3842 | + if ($squawk == '' || $Common->isInteger($squawk) === false) $squawk = NULL; |
|
| 3843 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false) $verticalrate = NULL; |
|
| 3844 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 3845 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 3846 | + if (!isset($aircraft_owner)) $aircraft_owner = NULL; |
|
| 3847 | + $query = "INSERT INTO spotter_output (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop,highlight,ModeS, pilot_id, pilot_name, verticalrate, owner_name, ground, format_source, source_name) |
|
| 3848 | 3848 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name,:departure_airport_city,:departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date, :departure_airport_time, :arrival_airport_time, :squawk, :route_stop, :highlight, :ModeS, :pilot_id, :pilot_name, :verticalrate, :owner_name,:ground, :format_source, :source_name)"; |
| 3849 | 3849 | |
| 3850 | - $airline_name = $airline_array[0]['name']; |
|
| 3851 | - $airline_icao = $airline_array[0]['icao']; |
|
| 3852 | - $airline_country = $airline_array[0]['country']; |
|
| 3853 | - $airline_type = $airline_array[0]['type']; |
|
| 3850 | + $airline_name = $airline_array[0]['name']; |
|
| 3851 | + $airline_icao = $airline_array[0]['icao']; |
|
| 3852 | + $airline_country = $airline_array[0]['country']; |
|
| 3853 | + $airline_type = $airline_array[0]['type']; |
|
| 3854 | 3854 | if ($airline_type == '') { |
| 3855 | 3855 | $timeelapsed = microtime(true); |
| 3856 | 3856 | $airline_type = $this->getAircraftTypeBymodeS($ModeS); |
| 3857 | 3857 | if ($globalDebugTimeElapsed) echo 'ADD SPOTTER DATA : Time elapsed for getAircraftTypeBymodes : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 3858 | 3858 | } |
| 3859 | 3859 | if ($airline_type == null) $airline_type = ''; |
| 3860 | - $aircraft_type = $aircraft_array[0]['type']; |
|
| 3861 | - $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3862 | - $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3863 | - $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3864 | - $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3860 | + $aircraft_type = $aircraft_array[0]['type']; |
|
| 3861 | + $aircraft_manufacturer = $aircraft_array[0]['manufacturer']; |
|
| 3862 | + $departure_airport_name = $departure_airport_array[0]['name']; |
|
| 3863 | + $departure_airport_city = $departure_airport_array[0]['city']; |
|
| 3864 | + $departure_airport_country = $departure_airport_array[0]['country']; |
|
| 3865 | 3865 | |
| 3866 | - $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3867 | - $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3868 | - $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3869 | - $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3866 | + $arrival_airport_name = $arrival_airport_array[0]['name']; |
|
| 3867 | + $arrival_airport_city = $arrival_airport_array[0]['city']; |
|
| 3868 | + $arrival_airport_country = $arrival_airport_array[0]['country']; |
|
| 3869 | + $query_values = array(':flightaware_id' => $flightaware_id,':ident' => $ident, ':registration' => $registration,':airline_name' => $airline_name,':airline_icao' => $airline_icao,':airline_country' => $airline_country,':airline_type' => $airline_type,':aircraft_icao' => $aircraft_icao,':aircraft_type' => $aircraft_type,':aircraft_manufacturer' => $aircraft_manufacturer,':departure_airport_icao' => $departure_airport_icao,':departure_airport_name' => $departure_airport_name,':departure_airport_city' => $departure_airport_city,':departure_airport_country' => $departure_airport_country,':arrival_airport_icao' => $arrival_airport_icao,':arrival_airport_name' => $arrival_airport_name,':arrival_airport_city' => $arrival_airport_city,':arrival_airport_country' => $arrival_airport_country,':latitude' => $latitude,':longitude' => $longitude, ':waypoints' => $waypoints,':altitude' => $altitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date,':departure_airport_time' => $departure_airport_time,':arrival_airport_time' => $arrival_airport_time, ':squawk' => $squawk, ':route_stop' => $route_stop, ':highlight' => $highlight, ':ModeS' => $ModeS, ':pilot_id' => $pilot_id, ':pilot_name' => $pilot_name, ':verticalrate' => $verticalrate, ':owner_name' => $aircraft_owner, ':format_source' => $format_source, ':ground' => $ground, ':source_name' => $source_name); |
|
| 3870 | 3870 | |
| 3871 | 3871 | try { |
| 3872 | 3872 | |
@@ -3874,7 +3874,7 @@ discard block |
||
| 3874 | 3874 | $sth->execute($query_values); |
| 3875 | 3875 | $this->db = null; |
| 3876 | 3876 | } catch (PDOException $e) { |
| 3877 | - return "error : ".$e->getMessage(); |
|
| 3877 | + return "error : ".$e->getMessage(); |
|
| 3878 | 3878 | } |
| 3879 | 3879 | |
| 3880 | 3880 | return "success"; |
@@ -3883,11 +3883,11 @@ discard block |
||
| 3883 | 3883 | |
| 3884 | 3884 | |
| 3885 | 3885 | /** |
| 3886 | - * Gets the aircraft ident within the last hour |
|
| 3887 | - * |
|
| 3888 | - * @return String the ident |
|
| 3889 | - * |
|
| 3890 | - */ |
|
| 3886 | + * Gets the aircraft ident within the last hour |
|
| 3887 | + * |
|
| 3888 | + * @return String the ident |
|
| 3889 | + * |
|
| 3890 | + */ |
|
| 3891 | 3891 | public function getIdentFromLastHour($ident) |
| 3892 | 3892 | { |
| 3893 | 3893 | global $globalDBdriver, $globalTimezone; |
@@ -3903,11 +3903,11 @@ discard block |
||
| 3903 | 3903 | AND spotter_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 3904 | 3904 | AND spotter_output.date < now() AT TIME ZONE 'UTC'"; |
| 3905 | 3905 | $query_data = array(':ident' => $ident); |
| 3906 | - } |
|
| 3906 | + } |
|
| 3907 | 3907 | |
| 3908 | 3908 | $sth = $this->db->prepare($query); |
| 3909 | 3909 | $sth->execute($query_data); |
| 3910 | - $ident_result=''; |
|
| 3910 | + $ident_result=''; |
|
| 3911 | 3911 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 3912 | 3912 | { |
| 3913 | 3913 | $ident_result = $row['ident']; |
@@ -3918,11 +3918,11 @@ discard block |
||
| 3918 | 3918 | |
| 3919 | 3919 | |
| 3920 | 3920 | /** |
| 3921 | - * Gets the aircraft data from the last 20 seconds |
|
| 3922 | - * |
|
| 3923 | - * @return Array the spotter data |
|
| 3924 | - * |
|
| 3925 | - */ |
|
| 3921 | + * Gets the aircraft data from the last 20 seconds |
|
| 3922 | + * |
|
| 3923 | + * @return Array the spotter data |
|
| 3924 | + * |
|
| 3925 | + */ |
|
| 3926 | 3926 | public function getRealTimeData($q = '') |
| 3927 | 3927 | { |
| 3928 | 3928 | global $globalDBdriver; |
@@ -3966,11 +3966,11 @@ discard block |
||
| 3966 | 3966 | |
| 3967 | 3967 | |
| 3968 | 3968 | /** |
| 3969 | - * Gets all airlines that have flown over |
|
| 3970 | - * |
|
| 3971 | - * @return Array the airline list |
|
| 3972 | - * |
|
| 3973 | - */ |
|
| 3969 | + * Gets all airlines that have flown over |
|
| 3970 | + * |
|
| 3971 | + * @return Array the airline list |
|
| 3972 | + * |
|
| 3973 | + */ |
|
| 3974 | 3974 | public function countAllAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(), $year = '', $month = '', $day = '') |
| 3975 | 3975 | { |
| 3976 | 3976 | global $globalDBdriver; |
@@ -3984,7 +3984,7 @@ discard block |
||
| 3984 | 3984 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 3985 | 3985 | } |
| 3986 | 3986 | } |
| 3987 | - if ($sincedate != '') { |
|
| 3987 | + if ($sincedate != '') { |
|
| 3988 | 3988 | if ($globalDBdriver == 'mysql') { |
| 3989 | 3989 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 3990 | 3990 | } else { |
@@ -4038,26 +4038,26 @@ discard block |
||
| 4038 | 4038 | } |
| 4039 | 4039 | |
| 4040 | 4040 | /** |
| 4041 | - * Gets all pilots that have flown over |
|
| 4042 | - * |
|
| 4043 | - * @return Array the pilots list |
|
| 4044 | - * |
|
| 4045 | - */ |
|
| 4041 | + * Gets all pilots that have flown over |
|
| 4042 | + * |
|
| 4043 | + * @return Array the pilots list |
|
| 4044 | + * |
|
| 4045 | + */ |
|
| 4046 | 4046 | public function countAllPilots($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '',$day = '') |
| 4047 | 4047 | { |
| 4048 | 4048 | global $globalDBdriver; |
| 4049 | 4049 | $filter_query = $this->getFilter($filters,true,true); |
| 4050 | 4050 | $query = "SELECT DISTINCT spotter_output.pilot_id, s.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 4051 | 4051 | FROM spotter_output LEFT JOIN (SELECT DISTINCT pilot_id, pilot_name, max(date) as date FROM spotter_output GROUP BY pilot_id, pilot_name) s ON s.pilot_id = spotter_output.pilot_id".$filter_query." spotter_output.pilot_id <> ''"; |
| 4052 | - if ($olderthanmonths > 0) { |
|
| 4053 | - if ($globalDBdriver == 'mysql') { |
|
| 4052 | + if ($olderthanmonths > 0) { |
|
| 4053 | + if ($globalDBdriver == 'mysql') { |
|
| 4054 | 4054 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4055 | 4055 | } else { |
| 4056 | 4056 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4057 | 4057 | } |
| 4058 | 4058 | } |
| 4059 | - if ($sincedate != '') { |
|
| 4060 | - if ($globalDBdriver == 'mysql') { |
|
| 4059 | + if ($sincedate != '') { |
|
| 4060 | + if ($globalDBdriver == 'mysql') { |
|
| 4061 | 4061 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 4062 | 4062 | } else { |
| 4063 | 4063 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4112,25 +4112,25 @@ discard block |
||
| 4112 | 4112 | } |
| 4113 | 4113 | |
| 4114 | 4114 | /** |
| 4115 | - * Gets all pilots that have flown over |
|
| 4116 | - * |
|
| 4117 | - * @return Array the pilots list |
|
| 4118 | - * |
|
| 4119 | - */ |
|
| 4115 | + * Gets all pilots that have flown over |
|
| 4116 | + * |
|
| 4117 | + * @return Array the pilots list |
|
| 4118 | + * |
|
| 4119 | + */ |
|
| 4120 | 4120 | public function countAllPilotsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '') |
| 4121 | 4121 | { |
| 4122 | 4122 | global $globalDBdriver; |
| 4123 | 4123 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.pilot_id, spotter_output.pilot_name, COUNT(spotter_output.pilot_id) AS pilot_count, spotter_output.format_source |
| 4124 | 4124 | FROM spotter_output WHERE spotter_output.pilot_id <> '' "; |
| 4125 | - if ($olderthanmonths > 0) { |
|
| 4126 | - if ($globalDBdriver == 'mysql') { |
|
| 4125 | + if ($olderthanmonths > 0) { |
|
| 4126 | + if ($globalDBdriver == 'mysql') { |
|
| 4127 | 4127 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4128 | 4128 | } else { |
| 4129 | 4129 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4130 | 4130 | } |
| 4131 | 4131 | } |
| 4132 | - if ($sincedate != '') { |
|
| 4133 | - if ($globalDBdriver == 'mysql') { |
|
| 4132 | + if ($sincedate != '') { |
|
| 4133 | + if ($globalDBdriver == 'mysql') { |
|
| 4134 | 4134 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4135 | 4135 | } else { |
| 4136 | 4136 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4159,26 +4159,26 @@ discard block |
||
| 4159 | 4159 | } |
| 4160 | 4160 | |
| 4161 | 4161 | /** |
| 4162 | - * Gets all owner that have flown over |
|
| 4163 | - * |
|
| 4164 | - * @return Array the pilots list |
|
| 4165 | - * |
|
| 4166 | - */ |
|
| 4162 | + * Gets all owner that have flown over |
|
| 4163 | + * |
|
| 4164 | + * @return Array the pilots list |
|
| 4165 | + * |
|
| 4166 | + */ |
|
| 4167 | 4167 | public function countAllOwners($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 4168 | 4168 | { |
| 4169 | 4169 | global $globalDBdriver; |
| 4170 | 4170 | $filter_query = $this->getFilter($filters,true,true); |
| 4171 | 4171 | $query = "SELECT DISTINCT spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4172 | 4172 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL"; |
| 4173 | - if ($olderthanmonths > 0) { |
|
| 4174 | - if ($globalDBdriver == 'mysql') { |
|
| 4173 | + if ($olderthanmonths > 0) { |
|
| 4174 | + if ($globalDBdriver == 'mysql') { |
|
| 4175 | 4175 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 4176 | 4176 | } else { |
| 4177 | 4177 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 4178 | 4178 | } |
| 4179 | 4179 | } |
| 4180 | - if ($sincedate != '') { |
|
| 4181 | - if ($globalDBdriver == 'mysql') { |
|
| 4180 | + if ($sincedate != '') { |
|
| 4181 | + if ($globalDBdriver == 'mysql') { |
|
| 4182 | 4182 | $query .= " AND spotter_output.date > '".$sincedate."' "; |
| 4183 | 4183 | } else { |
| 4184 | 4184 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4229,26 +4229,26 @@ discard block |
||
| 4229 | 4229 | } |
| 4230 | 4230 | |
| 4231 | 4231 | /** |
| 4232 | - * Gets all owner that have flown over |
|
| 4233 | - * |
|
| 4234 | - * @return Array the pilots list |
|
| 4235 | - * |
|
| 4236 | - */ |
|
| 4232 | + * Gets all owner that have flown over |
|
| 4233 | + * |
|
| 4234 | + * @return Array the pilots list |
|
| 4235 | + * |
|
| 4236 | + */ |
|
| 4237 | 4237 | public function countAllOwnersByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 4238 | 4238 | { |
| 4239 | 4239 | global $globalDBdriver; |
| 4240 | 4240 | $filter_query = $this->getFilter($filters,true,true); |
| 4241 | 4241 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.owner_name, COUNT(spotter_output.owner_name) AS owner_count |
| 4242 | 4242 | FROM spotter_output".$filter_query." spotter_output.owner_name <> '' AND spotter_output.owner_name IS NOT NULL "; |
| 4243 | - if ($olderthanmonths > 0) { |
|
| 4244 | - if ($globalDBdriver == 'mysql') { |
|
| 4243 | + if ($olderthanmonths > 0) { |
|
| 4244 | + if ($globalDBdriver == 'mysql') { |
|
| 4245 | 4245 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 4246 | 4246 | } else { |
| 4247 | 4247 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 4248 | 4248 | } |
| 4249 | 4249 | } |
| 4250 | - if ($sincedate != '') { |
|
| 4251 | - if ($globalDBdriver == 'mysql') { |
|
| 4250 | + if ($sincedate != '') { |
|
| 4251 | + if ($globalDBdriver == 'mysql') { |
|
| 4252 | 4252 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 4253 | 4253 | } else { |
| 4254 | 4254 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -4275,11 +4275,11 @@ discard block |
||
| 4275 | 4275 | } |
| 4276 | 4276 | |
| 4277 | 4277 | /** |
| 4278 | - * Gets all airlines that have flown over by aircraft |
|
| 4279 | - * |
|
| 4280 | - * @return Array the airline list |
|
| 4281 | - * |
|
| 4282 | - */ |
|
| 4278 | + * Gets all airlines that have flown over by aircraft |
|
| 4279 | + * |
|
| 4280 | + * @return Array the airline list |
|
| 4281 | + * |
|
| 4282 | + */ |
|
| 4283 | 4283 | public function countAllAirlinesByAircraft($aircraft_icao,$filters = array()) |
| 4284 | 4284 | { |
| 4285 | 4285 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4311,11 +4311,11 @@ discard block |
||
| 4311 | 4311 | |
| 4312 | 4312 | |
| 4313 | 4313 | /** |
| 4314 | - * Gets all airline countries that have flown over by aircraft |
|
| 4315 | - * |
|
| 4316 | - * @return Array the airline country list |
|
| 4317 | - * |
|
| 4318 | - */ |
|
| 4314 | + * Gets all airline countries that have flown over by aircraft |
|
| 4315 | + * |
|
| 4316 | + * @return Array the airline country list |
|
| 4317 | + * |
|
| 4318 | + */ |
|
| 4319 | 4319 | public function countAllAirlineCountriesByAircraft($aircraft_icao,$filters = array()) |
| 4320 | 4320 | { |
| 4321 | 4321 | $aircraft_icao = filter_var($aircraft_icao,FILTER_SANITIZE_STRING); |
@@ -4347,11 +4347,11 @@ discard block |
||
| 4347 | 4347 | |
| 4348 | 4348 | |
| 4349 | 4349 | /** |
| 4350 | - * Gets all airlines that have flown over by airport |
|
| 4351 | - * |
|
| 4352 | - * @return Array the airline list |
|
| 4353 | - * |
|
| 4354 | - */ |
|
| 4350 | + * Gets all airlines that have flown over by airport |
|
| 4351 | + * |
|
| 4352 | + * @return Array the airline list |
|
| 4353 | + * |
|
| 4354 | + */ |
|
| 4355 | 4355 | public function countAllAirlinesByAirport($airport_icao,$filters = array()) |
| 4356 | 4356 | { |
| 4357 | 4357 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4382,11 +4382,11 @@ discard block |
||
| 4382 | 4382 | |
| 4383 | 4383 | |
| 4384 | 4384 | /** |
| 4385 | - * Gets all airline countries that have flown over by airport icao |
|
| 4386 | - * |
|
| 4387 | - * @return Array the airline country list |
|
| 4388 | - * |
|
| 4389 | - */ |
|
| 4385 | + * Gets all airline countries that have flown over by airport icao |
|
| 4386 | + * |
|
| 4387 | + * @return Array the airline country list |
|
| 4388 | + * |
|
| 4389 | + */ |
|
| 4390 | 4390 | public function countAllAirlineCountriesByAirport($airport_icao,$filters = array()) |
| 4391 | 4391 | { |
| 4392 | 4392 | $airport_icao = filter_var($airport_icao,FILTER_SANITIZE_STRING); |
@@ -4416,11 +4416,11 @@ discard block |
||
| 4416 | 4416 | |
| 4417 | 4417 | |
| 4418 | 4418 | /** |
| 4419 | - * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4420 | - * |
|
| 4421 | - * @return Array the airline list |
|
| 4422 | - * |
|
| 4423 | - */ |
|
| 4419 | + * Gets all airlines that have flown over by aircraft manufacturer |
|
| 4420 | + * |
|
| 4421 | + * @return Array the airline list |
|
| 4422 | + * |
|
| 4423 | + */ |
|
| 4424 | 4424 | public function countAllAirlinesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4425 | 4425 | { |
| 4426 | 4426 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4451,11 +4451,11 @@ discard block |
||
| 4451 | 4451 | |
| 4452 | 4452 | |
| 4453 | 4453 | /** |
| 4454 | - * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4455 | - * |
|
| 4456 | - * @return Array the airline country list |
|
| 4457 | - * |
|
| 4458 | - */ |
|
| 4454 | + * Gets all airline countries that have flown over by aircraft manufacturer |
|
| 4455 | + * |
|
| 4456 | + * @return Array the airline country list |
|
| 4457 | + * |
|
| 4458 | + */ |
|
| 4459 | 4459 | public function countAllAirlineCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 4460 | 4460 | { |
| 4461 | 4461 | $aircraft_manufacturer = filter_var($aircraft_manufacturer,FILTER_SANITIZE_STRING); |
@@ -4484,11 +4484,11 @@ discard block |
||
| 4484 | 4484 | |
| 4485 | 4485 | |
| 4486 | 4486 | /** |
| 4487 | - * Gets all airlines that have flown over by date |
|
| 4488 | - * |
|
| 4489 | - * @return Array the airline list |
|
| 4490 | - * |
|
| 4491 | - */ |
|
| 4487 | + * Gets all airlines that have flown over by date |
|
| 4488 | + * |
|
| 4489 | + * @return Array the airline list |
|
| 4490 | + * |
|
| 4491 | + */ |
|
| 4492 | 4492 | public function countAllAirlinesByDate($date,$filters = array()) |
| 4493 | 4493 | { |
| 4494 | 4494 | global $globalTimezone, $globalDBdriver; |
@@ -4532,11 +4532,11 @@ discard block |
||
| 4532 | 4532 | |
| 4533 | 4533 | |
| 4534 | 4534 | /** |
| 4535 | - * Gets all airline countries that have flown over by date |
|
| 4536 | - * |
|
| 4537 | - * @return Array the airline country list |
|
| 4538 | - * |
|
| 4539 | - */ |
|
| 4535 | + * Gets all airline countries that have flown over by date |
|
| 4536 | + * |
|
| 4537 | + * @return Array the airline country list |
|
| 4538 | + * |
|
| 4539 | + */ |
|
| 4540 | 4540 | public function countAllAirlineCountriesByDate($date,$filters = array()) |
| 4541 | 4541 | { |
| 4542 | 4542 | global $globalTimezone, $globalDBdriver; |
@@ -4579,11 +4579,11 @@ discard block |
||
| 4579 | 4579 | |
| 4580 | 4580 | |
| 4581 | 4581 | /** |
| 4582 | - * Gets all airlines that have flown over by ident/callsign |
|
| 4583 | - * |
|
| 4584 | - * @return Array the airline list |
|
| 4585 | - * |
|
| 4586 | - */ |
|
| 4582 | + * Gets all airlines that have flown over by ident/callsign |
|
| 4583 | + * |
|
| 4584 | + * @return Array the airline list |
|
| 4585 | + * |
|
| 4586 | + */ |
|
| 4587 | 4587 | public function countAllAirlinesByIdent($ident,$filters = array()) |
| 4588 | 4588 | { |
| 4589 | 4589 | $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
@@ -4600,11 +4600,11 @@ discard block |
||
| 4600 | 4600 | } |
| 4601 | 4601 | |
| 4602 | 4602 | /** |
| 4603 | - * Gets all airlines by owner |
|
| 4604 | - * |
|
| 4605 | - * @return Array the airline list |
|
| 4606 | - * |
|
| 4607 | - */ |
|
| 4603 | + * Gets all airlines by owner |
|
| 4604 | + * |
|
| 4605 | + * @return Array the airline list |
|
| 4606 | + * |
|
| 4607 | + */ |
|
| 4608 | 4608 | public function countAllAirlinesByOwner($owner,$filters = array()) |
| 4609 | 4609 | { |
| 4610 | 4610 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4621,11 +4621,11 @@ discard block |
||
| 4621 | 4621 | } |
| 4622 | 4622 | |
| 4623 | 4623 | /** |
| 4624 | - * Gets flight duration by owner |
|
| 4625 | - * |
|
| 4626 | - * @return String Duration of all flights |
|
| 4627 | - * |
|
| 4628 | - */ |
|
| 4624 | + * Gets flight duration by owner |
|
| 4625 | + * |
|
| 4626 | + * @return String Duration of all flights |
|
| 4627 | + * |
|
| 4628 | + */ |
|
| 4629 | 4629 | public function getFlightDurationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 4630 | 4630 | { |
| 4631 | 4631 | global $globalDBdriver; |
@@ -4670,11 +4670,11 @@ discard block |
||
| 4670 | 4670 | } |
| 4671 | 4671 | |
| 4672 | 4672 | /** |
| 4673 | - * Count flights by owner |
|
| 4674 | - * |
|
| 4675 | - * @return String Duration of all flights |
|
| 4676 | - * |
|
| 4677 | - */ |
|
| 4673 | + * Count flights by owner |
|
| 4674 | + * |
|
| 4675 | + * @return String Duration of all flights |
|
| 4676 | + * |
|
| 4677 | + */ |
|
| 4678 | 4678 | public function countFlightsByOwner($owner,$filters = array()) |
| 4679 | 4679 | { |
| 4680 | 4680 | $owner = filter_var($owner,FILTER_SANITIZE_STRING); |
@@ -4690,11 +4690,11 @@ discard block |
||
| 4690 | 4690 | } |
| 4691 | 4691 | |
| 4692 | 4692 | /** |
| 4693 | - * Count flights by pilot |
|
| 4694 | - * |
|
| 4695 | - * @return String Duration of all flights |
|
| 4696 | - * |
|
| 4697 | - */ |
|
| 4693 | + * Count flights by pilot |
|
| 4694 | + * |
|
| 4695 | + * @return String Duration of all flights |
|
| 4696 | + * |
|
| 4697 | + */ |
|
| 4698 | 4698 | public function countFlightsByPilot($pilot,$filters = array()) |
| 4699 | 4699 | { |
| 4700 | 4700 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4710,11 +4710,11 @@ discard block |
||
| 4710 | 4710 | } |
| 4711 | 4711 | |
| 4712 | 4712 | /** |
| 4713 | - * Gets flight duration by pilot |
|
| 4714 | - * |
|
| 4715 | - * @return String Duration of all flights |
|
| 4716 | - * |
|
| 4717 | - */ |
|
| 4713 | + * Gets flight duration by pilot |
|
| 4714 | + * |
|
| 4715 | + * @return String Duration of all flights |
|
| 4716 | + * |
|
| 4717 | + */ |
|
| 4718 | 4718 | public function getFlightDurationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 4719 | 4719 | { |
| 4720 | 4720 | global $globalDBdriver; |
@@ -4759,11 +4759,11 @@ discard block |
||
| 4759 | 4759 | } |
| 4760 | 4760 | |
| 4761 | 4761 | /** |
| 4762 | - * Gets all airlines used by pilot |
|
| 4763 | - * |
|
| 4764 | - * @return Array the airline list |
|
| 4765 | - * |
|
| 4766 | - */ |
|
| 4762 | + * Gets all airlines used by pilot |
|
| 4763 | + * |
|
| 4764 | + * @return Array the airline list |
|
| 4765 | + * |
|
| 4766 | + */ |
|
| 4767 | 4767 | public function countAllAirlinesByPilot($pilot,$filters = array()) |
| 4768 | 4768 | { |
| 4769 | 4769 | $pilot = filter_var($pilot,FILTER_SANITIZE_STRING); |
@@ -4780,11 +4780,11 @@ discard block |
||
| 4780 | 4780 | } |
| 4781 | 4781 | |
| 4782 | 4782 | /** |
| 4783 | - * Gets all airlines that have flown over by route |
|
| 4784 | - * |
|
| 4785 | - * @return Array the airline list |
|
| 4786 | - * |
|
| 4787 | - */ |
|
| 4783 | + * Gets all airlines that have flown over by route |
|
| 4784 | + * |
|
| 4785 | + * @return Array the airline list |
|
| 4786 | + * |
|
| 4787 | + */ |
|
| 4788 | 4788 | public function countAllAirlinesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 4789 | 4789 | { |
| 4790 | 4790 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4816,11 +4816,11 @@ discard block |
||
| 4816 | 4816 | } |
| 4817 | 4817 | |
| 4818 | 4818 | /** |
| 4819 | - * Gets all airline countries that have flown over by route |
|
| 4820 | - * |
|
| 4821 | - * @return Array the airline country list |
|
| 4822 | - * |
|
| 4823 | - */ |
|
| 4819 | + * Gets all airline countries that have flown over by route |
|
| 4820 | + * |
|
| 4821 | + * @return Array the airline country list |
|
| 4822 | + * |
|
| 4823 | + */ |
|
| 4824 | 4824 | public function countAllAirlineCountriesByRoute($departure_airport_icao, $arrival_airport_icao,$filters= array()) |
| 4825 | 4825 | { |
| 4826 | 4826 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4852,11 +4852,11 @@ discard block |
||
| 4852 | 4852 | |
| 4853 | 4853 | |
| 4854 | 4854 | /** |
| 4855 | - * Gets all airlines that have flown over by country |
|
| 4856 | - * |
|
| 4857 | - * @return Array the airline list |
|
| 4858 | - * |
|
| 4859 | - */ |
|
| 4855 | + * Gets all airlines that have flown over by country |
|
| 4856 | + * |
|
| 4857 | + * @return Array the airline list |
|
| 4858 | + * |
|
| 4859 | + */ |
|
| 4860 | 4860 | public function countAllAirlinesByCountry($country,$filters = array()) |
| 4861 | 4861 | { |
| 4862 | 4862 | $country = filter_var($country,FILTER_SANITIZE_STRING); |
@@ -4886,11 +4886,11 @@ discard block |
||
| 4886 | 4886 | |
| 4887 | 4887 | |
| 4888 | 4888 | /** |
| 4889 | - * Gets all airline countries that have flown over by country |
|
| 4890 | - * |
|
| 4891 | - * @return Array the airline country list |
|
| 4892 | - * |
|
| 4893 | - */ |
|
| 4889 | + * Gets all airline countries that have flown over by country |
|
| 4890 | + * |
|
| 4891 | + * @return Array the airline country list |
|
| 4892 | + * |
|
| 4893 | + */ |
|
| 4894 | 4894 | public function countAllAirlineCountriesByCountry($country,$filters = array()) |
| 4895 | 4895 | { |
| 4896 | 4896 | $filter_query = $this->getFilter($filters,true,true); |
@@ -4919,11 +4919,11 @@ discard block |
||
| 4919 | 4919 | |
| 4920 | 4920 | |
| 4921 | 4921 | /** |
| 4922 | - * Gets all airlines countries |
|
| 4923 | - * |
|
| 4924 | - * @return Array the airline country list |
|
| 4925 | - * |
|
| 4926 | - */ |
|
| 4922 | + * Gets all airlines countries |
|
| 4923 | + * |
|
| 4924 | + * @return Array the airline country list |
|
| 4925 | + * |
|
| 4926 | + */ |
|
| 4927 | 4927 | public function countAllAirlineCountries($limit = true, $filters = array(), $year = '', $month = '', $day = '') |
| 4928 | 4928 | { |
| 4929 | 4929 | global $globalDBdriver; |
@@ -4978,11 +4978,11 @@ discard block |
||
| 4978 | 4978 | } |
| 4979 | 4979 | |
| 4980 | 4980 | /** |
| 4981 | - * Gets all number of flight over countries |
|
| 4982 | - * |
|
| 4983 | - * @return Array the airline country list |
|
| 4984 | - * |
|
| 4985 | - */ |
|
| 4981 | + * Gets all number of flight over countries |
|
| 4982 | + * |
|
| 4983 | + * @return Array the airline country list |
|
| 4984 | + * |
|
| 4985 | + */ |
|
| 4986 | 4986 | public function countAllFlightOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 4987 | 4987 | { |
| 4988 | 4988 | global $globalDBdriver; |
@@ -5004,15 +5004,15 @@ discard block |
||
| 5004 | 5004 | $SpotterLive = new SpotterLive(); |
| 5005 | 5005 | $filter_query = $SpotterLive->getFilter($filters,true,true); |
| 5006 | 5006 | $filter_query .= ' over_country IS NOT NULL'; |
| 5007 | - if ($olderthanmonths > 0) { |
|
| 5007 | + if ($olderthanmonths > 0) { |
|
| 5008 | 5008 | if ($globalDBdriver == 'mysql') { |
| 5009 | 5009 | $filter_query .= ' AND spotter_live.date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 5010 | 5010 | } else { |
| 5011 | 5011 | $filter_query .= " AND spotter_live.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 5012 | 5012 | } |
| 5013 | 5013 | } |
| 5014 | - if ($sincedate != '') { |
|
| 5015 | - if ($globalDBdriver == 'mysql') { |
|
| 5014 | + if ($sincedate != '') { |
|
| 5015 | + if ($globalDBdriver == 'mysql') { |
|
| 5016 | 5016 | $filter_query .= " AND spotter_live.date > '".$sincedate."' "; |
| 5017 | 5017 | } else { |
| 5018 | 5018 | $filter_query .= " AND spotter_live.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -5042,11 +5042,11 @@ discard block |
||
| 5042 | 5042 | |
| 5043 | 5043 | |
| 5044 | 5044 | /** |
| 5045 | - * Gets all aircraft types that have flown over |
|
| 5046 | - * |
|
| 5047 | - * @return Array the aircraft list |
|
| 5048 | - * |
|
| 5049 | - */ |
|
| 5045 | + * Gets all aircraft types that have flown over |
|
| 5046 | + * |
|
| 5047 | + * @return Array the aircraft list |
|
| 5048 | + * |
|
| 5049 | + */ |
|
| 5050 | 5050 | public function countAllAircraftTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 5051 | 5051 | { |
| 5052 | 5052 | global $globalDBdriver; |
@@ -5116,11 +5116,11 @@ discard block |
||
| 5116 | 5116 | } |
| 5117 | 5117 | |
| 5118 | 5118 | /** |
| 5119 | - * Gets all aircraft types that have flown over by airline |
|
| 5120 | - * |
|
| 5121 | - * @return Array the aircraft list |
|
| 5122 | - * |
|
| 5123 | - */ |
|
| 5119 | + * Gets all aircraft types that have flown over by airline |
|
| 5120 | + * |
|
| 5121 | + * @return Array the aircraft list |
|
| 5122 | + * |
|
| 5123 | + */ |
|
| 5124 | 5124 | public function countAllAircraftTypesByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '', $day = '') |
| 5125 | 5125 | { |
| 5126 | 5126 | global $globalDBdriver; |
@@ -5191,11 +5191,11 @@ discard block |
||
| 5191 | 5191 | } |
| 5192 | 5192 | |
| 5193 | 5193 | /** |
| 5194 | - * Gets all aircraft types that have flown over by months |
|
| 5195 | - * |
|
| 5196 | - * @return Array the aircraft list |
|
| 5197 | - * |
|
| 5198 | - */ |
|
| 5194 | + * Gets all aircraft types that have flown over by months |
|
| 5195 | + * |
|
| 5196 | + * @return Array the aircraft list |
|
| 5197 | + * |
|
| 5198 | + */ |
|
| 5199 | 5199 | public function countAllAircraftTypesByMonths($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 5200 | 5200 | { |
| 5201 | 5201 | global $globalDBdriver; |
@@ -5239,11 +5239,11 @@ discard block |
||
| 5239 | 5239 | |
| 5240 | 5240 | |
| 5241 | 5241 | /** |
| 5242 | - * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5243 | - * |
|
| 5244 | - * @return Array the aircraft list |
|
| 5245 | - * |
|
| 5246 | - */ |
|
| 5242 | + * Gets all aircraft registration that have flown over by aircaft icao |
|
| 5243 | + * |
|
| 5244 | + * @return Array the aircraft list |
|
| 5245 | + * |
|
| 5246 | + */ |
|
| 5247 | 5247 | public function countAllAircraftRegistrationByAircraft($aircraft_icao,$filters = array()) |
| 5248 | 5248 | { |
| 5249 | 5249 | $Image = new Image($this->db); |
@@ -5282,11 +5282,11 @@ discard block |
||
| 5282 | 5282 | |
| 5283 | 5283 | |
| 5284 | 5284 | /** |
| 5285 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5286 | - * |
|
| 5287 | - * @return Array the aircraft list |
|
| 5288 | - * |
|
| 5289 | - */ |
|
| 5285 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5286 | + * |
|
| 5287 | + * @return Array the aircraft list |
|
| 5288 | + * |
|
| 5289 | + */ |
|
| 5290 | 5290 | public function countAllAircraftTypesByAirline($airline_icao,$filters = array()) |
| 5291 | 5291 | { |
| 5292 | 5292 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5315,11 +5315,11 @@ discard block |
||
| 5315 | 5315 | |
| 5316 | 5316 | |
| 5317 | 5317 | /** |
| 5318 | - * Gets all aircraft registration that have flown over by airline icao |
|
| 5319 | - * |
|
| 5320 | - * @return Array the aircraft list |
|
| 5321 | - * |
|
| 5322 | - */ |
|
| 5318 | + * Gets all aircraft registration that have flown over by airline icao |
|
| 5319 | + * |
|
| 5320 | + * @return Array the aircraft list |
|
| 5321 | + * |
|
| 5322 | + */ |
|
| 5323 | 5323 | public function countAllAircraftRegistrationByAirline($airline_icao,$filters = array()) |
| 5324 | 5324 | { |
| 5325 | 5325 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5357,11 +5357,11 @@ discard block |
||
| 5357 | 5357 | |
| 5358 | 5358 | |
| 5359 | 5359 | /** |
| 5360 | - * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5361 | - * |
|
| 5362 | - * @return Array the aircraft list |
|
| 5363 | - * |
|
| 5364 | - */ |
|
| 5360 | + * Gets all aircraft manufacturer that have flown over by airline icao |
|
| 5361 | + * |
|
| 5362 | + * @return Array the aircraft list |
|
| 5363 | + * |
|
| 5364 | + */ |
|
| 5365 | 5365 | public function countAllAircraftManufacturerByAirline($airline_icao,$filters = array()) |
| 5366 | 5366 | { |
| 5367 | 5367 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5389,11 +5389,11 @@ discard block |
||
| 5389 | 5389 | |
| 5390 | 5390 | |
| 5391 | 5391 | /** |
| 5392 | - * Gets all aircraft types that have flown over by airline icao |
|
| 5393 | - * |
|
| 5394 | - * @return Array the aircraft list |
|
| 5395 | - * |
|
| 5396 | - */ |
|
| 5392 | + * Gets all aircraft types that have flown over by airline icao |
|
| 5393 | + * |
|
| 5394 | + * @return Array the aircraft list |
|
| 5395 | + * |
|
| 5396 | + */ |
|
| 5397 | 5397 | public function countAllAircraftTypesByAirport($airport_icao,$filters = array()) |
| 5398 | 5398 | { |
| 5399 | 5399 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5422,11 +5422,11 @@ discard block |
||
| 5422 | 5422 | |
| 5423 | 5423 | |
| 5424 | 5424 | /** |
| 5425 | - * Gets all aircraft registration that have flown over by airport icao |
|
| 5426 | - * |
|
| 5427 | - * @return Array the aircraft list |
|
| 5428 | - * |
|
| 5429 | - */ |
|
| 5425 | + * Gets all aircraft registration that have flown over by airport icao |
|
| 5426 | + * |
|
| 5427 | + * @return Array the aircraft list |
|
| 5428 | + * |
|
| 5429 | + */ |
|
| 5430 | 5430 | public function countAllAircraftRegistrationByAirport($airport_icao,$filters = array()) |
| 5431 | 5431 | { |
| 5432 | 5432 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5463,11 +5463,11 @@ discard block |
||
| 5463 | 5463 | |
| 5464 | 5464 | |
| 5465 | 5465 | /** |
| 5466 | - * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5467 | - * |
|
| 5468 | - * @return Array the aircraft list |
|
| 5469 | - * |
|
| 5470 | - */ |
|
| 5466 | + * Gets all aircraft manufacturer that have flown over by airport icao |
|
| 5467 | + * |
|
| 5468 | + * @return Array the aircraft list |
|
| 5469 | + * |
|
| 5470 | + */ |
|
| 5471 | 5471 | public function countAllAircraftManufacturerByAirport($airport_icao,$filters = array()) |
| 5472 | 5472 | { |
| 5473 | 5473 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5493,11 +5493,11 @@ discard block |
||
| 5493 | 5493 | } |
| 5494 | 5494 | |
| 5495 | 5495 | /** |
| 5496 | - * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5497 | - * |
|
| 5498 | - * @return Array the aircraft list |
|
| 5499 | - * |
|
| 5500 | - */ |
|
| 5496 | + * Gets all aircraft types that have flown over by aircraft manufacturer |
|
| 5497 | + * |
|
| 5498 | + * @return Array the aircraft list |
|
| 5499 | + * |
|
| 5500 | + */ |
|
| 5501 | 5501 | public function countAllAircraftTypesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 5502 | 5502 | { |
| 5503 | 5503 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5524,11 +5524,11 @@ discard block |
||
| 5524 | 5524 | |
| 5525 | 5525 | |
| 5526 | 5526 | /** |
| 5527 | - * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5528 | - * |
|
| 5529 | - * @return Array the aircraft list |
|
| 5530 | - * |
|
| 5531 | - */ |
|
| 5527 | + * Gets all aircraft registration that have flown over by aircaft manufacturer |
|
| 5528 | + * |
|
| 5529 | + * @return Array the aircraft list |
|
| 5530 | + * |
|
| 5531 | + */ |
|
| 5532 | 5532 | public function countAllAircraftRegistrationByManufacturer($aircraft_manufacturer, $filters = array()) |
| 5533 | 5533 | { |
| 5534 | 5534 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5564,11 +5564,11 @@ discard block |
||
| 5564 | 5564 | } |
| 5565 | 5565 | |
| 5566 | 5566 | /** |
| 5567 | - * Gets all aircraft types that have flown over by date |
|
| 5568 | - * |
|
| 5569 | - * @return Array the aircraft list |
|
| 5570 | - * |
|
| 5571 | - */ |
|
| 5567 | + * Gets all aircraft types that have flown over by date |
|
| 5568 | + * |
|
| 5569 | + * @return Array the aircraft list |
|
| 5570 | + * |
|
| 5571 | + */ |
|
| 5572 | 5572 | public function countAllAircraftTypesByDate($date,$filters = array()) |
| 5573 | 5573 | { |
| 5574 | 5574 | global $globalTimezone, $globalDBdriver; |
@@ -5610,11 +5610,11 @@ discard block |
||
| 5610 | 5610 | |
| 5611 | 5611 | |
| 5612 | 5612 | /** |
| 5613 | - * Gets all aircraft registration that have flown over by date |
|
| 5614 | - * |
|
| 5615 | - * @return Array the aircraft list |
|
| 5616 | - * |
|
| 5617 | - */ |
|
| 5613 | + * Gets all aircraft registration that have flown over by date |
|
| 5614 | + * |
|
| 5615 | + * @return Array the aircraft list |
|
| 5616 | + * |
|
| 5617 | + */ |
|
| 5618 | 5618 | public function countAllAircraftRegistrationByDate($date,$filters = array()) |
| 5619 | 5619 | { |
| 5620 | 5620 | global $globalTimezone, $globalDBdriver; |
@@ -5665,11 +5665,11 @@ discard block |
||
| 5665 | 5665 | |
| 5666 | 5666 | |
| 5667 | 5667 | /** |
| 5668 | - * Gets all aircraft manufacturer that have flown over by date |
|
| 5669 | - * |
|
| 5670 | - * @return Array the aircraft manufacturer list |
|
| 5671 | - * |
|
| 5672 | - */ |
|
| 5668 | + * Gets all aircraft manufacturer that have flown over by date |
|
| 5669 | + * |
|
| 5670 | + * @return Array the aircraft manufacturer list |
|
| 5671 | + * |
|
| 5672 | + */ |
|
| 5673 | 5673 | public function countAllAircraftManufacturerByDate($date,$filters = array()) |
| 5674 | 5674 | { |
| 5675 | 5675 | global $globalTimezone, $globalDBdriver; |
@@ -5711,11 +5711,11 @@ discard block |
||
| 5711 | 5711 | |
| 5712 | 5712 | |
| 5713 | 5713 | /** |
| 5714 | - * Gets all aircraft types that have flown over by ident/callsign |
|
| 5715 | - * |
|
| 5716 | - * @return Array the aircraft list |
|
| 5717 | - * |
|
| 5718 | - */ |
|
| 5714 | + * Gets all aircraft types that have flown over by ident/callsign |
|
| 5715 | + * |
|
| 5716 | + * @return Array the aircraft list |
|
| 5717 | + * |
|
| 5718 | + */ |
|
| 5719 | 5719 | public function countAllAircraftTypesByIdent($ident,$filters = array()) |
| 5720 | 5720 | { |
| 5721 | 5721 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5743,11 +5743,11 @@ discard block |
||
| 5743 | 5743 | } |
| 5744 | 5744 | |
| 5745 | 5745 | /** |
| 5746 | - * Gets all aircraft types that have flown over by pilot |
|
| 5747 | - * |
|
| 5748 | - * @return Array the aircraft list |
|
| 5749 | - * |
|
| 5750 | - */ |
|
| 5746 | + * Gets all aircraft types that have flown over by pilot |
|
| 5747 | + * |
|
| 5748 | + * @return Array the aircraft list |
|
| 5749 | + * |
|
| 5750 | + */ |
|
| 5751 | 5751 | public function countAllAircraftTypesByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 5752 | 5752 | { |
| 5753 | 5753 | global $globalDBdriver; |
@@ -5793,11 +5793,11 @@ discard block |
||
| 5793 | 5793 | } |
| 5794 | 5794 | |
| 5795 | 5795 | /** |
| 5796 | - * Gets all aircraft types that have flown over by owner |
|
| 5797 | - * |
|
| 5798 | - * @return Array the aircraft list |
|
| 5799 | - * |
|
| 5800 | - */ |
|
| 5796 | + * Gets all aircraft types that have flown over by owner |
|
| 5797 | + * |
|
| 5798 | + * @return Array the aircraft list |
|
| 5799 | + * |
|
| 5800 | + */ |
|
| 5801 | 5801 | public function countAllAircraftTypesByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5802 | 5802 | { |
| 5803 | 5803 | global $globalDBdriver; |
@@ -5842,11 +5842,11 @@ discard block |
||
| 5842 | 5842 | } |
| 5843 | 5843 | |
| 5844 | 5844 | /** |
| 5845 | - * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5846 | - * |
|
| 5847 | - * @return Array the aircraft list |
|
| 5848 | - * |
|
| 5849 | - */ |
|
| 5845 | + * Gets all aircraft registration that have flown over by ident/callsign |
|
| 5846 | + * |
|
| 5847 | + * @return Array the aircraft list |
|
| 5848 | + * |
|
| 5849 | + */ |
|
| 5850 | 5850 | public function countAllAircraftRegistrationByIdent($ident,$filters = array()) |
| 5851 | 5851 | { |
| 5852 | 5852 | $filter_query = $this->getFilter($filters,true,true); |
@@ -5885,11 +5885,11 @@ discard block |
||
| 5885 | 5885 | } |
| 5886 | 5886 | |
| 5887 | 5887 | /** |
| 5888 | - * Gets all aircraft registration that have flown over by owner |
|
| 5889 | - * |
|
| 5890 | - * @return Array the aircraft list |
|
| 5891 | - * |
|
| 5892 | - */ |
|
| 5888 | + * Gets all aircraft registration that have flown over by owner |
|
| 5889 | + * |
|
| 5890 | + * @return Array the aircraft list |
|
| 5891 | + * |
|
| 5892 | + */ |
|
| 5893 | 5893 | public function countAllAircraftRegistrationByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 5894 | 5894 | { |
| 5895 | 5895 | global $globalDBdriver; |
@@ -5960,11 +5960,11 @@ discard block |
||
| 5960 | 5960 | } |
| 5961 | 5961 | |
| 5962 | 5962 | /** |
| 5963 | - * Gets all aircraft registration that have flown over by pilot |
|
| 5964 | - * |
|
| 5965 | - * @return Array the aircraft list |
|
| 5966 | - * |
|
| 5967 | - */ |
|
| 5963 | + * Gets all aircraft registration that have flown over by pilot |
|
| 5964 | + * |
|
| 5965 | + * @return Array the aircraft list |
|
| 5966 | + * |
|
| 5967 | + */ |
|
| 5968 | 5968 | public function countAllAircraftRegistrationByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 5969 | 5969 | { |
| 5970 | 5970 | global $globalDBdriver; |
@@ -6036,11 +6036,11 @@ discard block |
||
| 6036 | 6036 | |
| 6037 | 6037 | |
| 6038 | 6038 | /** |
| 6039 | - * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6040 | - * |
|
| 6041 | - * @return Array the aircraft manufacturer list |
|
| 6042 | - * |
|
| 6043 | - */ |
|
| 6039 | + * Gets all aircraft manufacturer that have flown over by ident/callsign |
|
| 6040 | + * |
|
| 6041 | + * @return Array the aircraft manufacturer list |
|
| 6042 | + * |
|
| 6043 | + */ |
|
| 6044 | 6044 | public function countAllAircraftManufacturerByIdent($ident,$filters = array()) |
| 6045 | 6045 | { |
| 6046 | 6046 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6065,11 +6065,11 @@ discard block |
||
| 6065 | 6065 | } |
| 6066 | 6066 | |
| 6067 | 6067 | /** |
| 6068 | - * Gets all aircraft manufacturer that have flown over by owner |
|
| 6069 | - * |
|
| 6070 | - * @return Array the aircraft manufacturer list |
|
| 6071 | - * |
|
| 6072 | - */ |
|
| 6068 | + * Gets all aircraft manufacturer that have flown over by owner |
|
| 6069 | + * |
|
| 6070 | + * @return Array the aircraft manufacturer list |
|
| 6071 | + * |
|
| 6072 | + */ |
|
| 6073 | 6073 | public function countAllAircraftManufacturerByOwner($owner,$filters = array(),$year = '',$month = '',$day = '') |
| 6074 | 6074 | { |
| 6075 | 6075 | global $globalDBdriver; |
@@ -6117,11 +6117,11 @@ discard block |
||
| 6117 | 6117 | } |
| 6118 | 6118 | |
| 6119 | 6119 | /** |
| 6120 | - * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6121 | - * |
|
| 6122 | - * @return Array the aircraft manufacturer list |
|
| 6123 | - * |
|
| 6124 | - */ |
|
| 6120 | + * Gets all aircraft manufacturer that have flown over by pilot |
|
| 6121 | + * |
|
| 6122 | + * @return Array the aircraft manufacturer list |
|
| 6123 | + * |
|
| 6124 | + */ |
|
| 6125 | 6125 | public function countAllAircraftManufacturerByPilot($pilot,$filters = array(),$year = '',$month = '',$day = '') |
| 6126 | 6126 | { |
| 6127 | 6127 | global $globalDBdriver; |
@@ -6170,11 +6170,11 @@ discard block |
||
| 6170 | 6170 | |
| 6171 | 6171 | |
| 6172 | 6172 | /** |
| 6173 | - * Gets all aircraft types that have flown over by route |
|
| 6174 | - * |
|
| 6175 | - * @return Array the aircraft list |
|
| 6176 | - * |
|
| 6177 | - */ |
|
| 6173 | + * Gets all aircraft types that have flown over by route |
|
| 6174 | + * |
|
| 6175 | + * @return Array the aircraft list |
|
| 6176 | + * |
|
| 6177 | + */ |
|
| 6178 | 6178 | public function countAllAircraftTypesByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6179 | 6179 | { |
| 6180 | 6180 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6203,11 +6203,11 @@ discard block |
||
| 6203 | 6203 | } |
| 6204 | 6204 | |
| 6205 | 6205 | /** |
| 6206 | - * Gets all aircraft registration that have flown over by route |
|
| 6207 | - * |
|
| 6208 | - * @return Array the aircraft list |
|
| 6209 | - * |
|
| 6210 | - */ |
|
| 6206 | + * Gets all aircraft registration that have flown over by route |
|
| 6207 | + * |
|
| 6208 | + * @return Array the aircraft list |
|
| 6209 | + * |
|
| 6210 | + */ |
|
| 6211 | 6211 | public function countAllAircraftRegistrationByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6212 | 6212 | { |
| 6213 | 6213 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6249,11 +6249,11 @@ discard block |
||
| 6249 | 6249 | |
| 6250 | 6250 | |
| 6251 | 6251 | /** |
| 6252 | - * Gets all aircraft manufacturer that have flown over by route |
|
| 6253 | - * |
|
| 6254 | - * @return Array the aircraft manufacturer list |
|
| 6255 | - * |
|
| 6256 | - */ |
|
| 6252 | + * Gets all aircraft manufacturer that have flown over by route |
|
| 6253 | + * |
|
| 6254 | + * @return Array the aircraft manufacturer list |
|
| 6255 | + * |
|
| 6256 | + */ |
|
| 6257 | 6257 | public function countAllAircraftManufacturerByRoute($departure_airport_icao, $arrival_airport_icao,$filters = array()) |
| 6258 | 6258 | { |
| 6259 | 6259 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6287,11 +6287,11 @@ discard block |
||
| 6287 | 6287 | |
| 6288 | 6288 | |
| 6289 | 6289 | /** |
| 6290 | - * Gets all aircraft types that have flown over by country |
|
| 6291 | - * |
|
| 6292 | - * @return Array the aircraft list |
|
| 6293 | - * |
|
| 6294 | - */ |
|
| 6290 | + * Gets all aircraft types that have flown over by country |
|
| 6291 | + * |
|
| 6292 | + * @return Array the aircraft list |
|
| 6293 | + * |
|
| 6294 | + */ |
|
| 6295 | 6295 | public function countAllAircraftTypesByCountry($country,$filters = array()) |
| 6296 | 6296 | { |
| 6297 | 6297 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6322,11 +6322,11 @@ discard block |
||
| 6322 | 6322 | |
| 6323 | 6323 | |
| 6324 | 6324 | /** |
| 6325 | - * Gets all aircraft registration that have flown over by country |
|
| 6326 | - * |
|
| 6327 | - * @return Array the aircraft list |
|
| 6328 | - * |
|
| 6329 | - */ |
|
| 6325 | + * Gets all aircraft registration that have flown over by country |
|
| 6326 | + * |
|
| 6327 | + * @return Array the aircraft list |
|
| 6328 | + * |
|
| 6329 | + */ |
|
| 6330 | 6330 | public function countAllAircraftRegistrationByCountry($country,$filters = array()) |
| 6331 | 6331 | { |
| 6332 | 6332 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6366,11 +6366,11 @@ discard block |
||
| 6366 | 6366 | |
| 6367 | 6367 | |
| 6368 | 6368 | /** |
| 6369 | - * Gets all aircraft manufacturer that have flown over by country |
|
| 6370 | - * |
|
| 6371 | - * @return Array the aircraft manufacturer list |
|
| 6372 | - * |
|
| 6373 | - */ |
|
| 6369 | + * Gets all aircraft manufacturer that have flown over by country |
|
| 6370 | + * |
|
| 6371 | + * @return Array the aircraft manufacturer list |
|
| 6372 | + * |
|
| 6373 | + */ |
|
| 6374 | 6374 | public function countAllAircraftManufacturerByCountry($country,$filters = array()) |
| 6375 | 6375 | { |
| 6376 | 6376 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6401,18 +6401,18 @@ discard block |
||
| 6401 | 6401 | |
| 6402 | 6402 | |
| 6403 | 6403 | /** |
| 6404 | - * Gets all aircraft manufacturers that have flown over |
|
| 6405 | - * |
|
| 6406 | - * @return Array the aircraft list |
|
| 6407 | - * |
|
| 6408 | - */ |
|
| 6404 | + * Gets all aircraft manufacturers that have flown over |
|
| 6405 | + * |
|
| 6406 | + * @return Array the aircraft list |
|
| 6407 | + * |
|
| 6408 | + */ |
|
| 6409 | 6409 | public function countAllAircraftManufacturers($filters = array(),$year = '',$month = '',$day = '') |
| 6410 | 6410 | { |
| 6411 | 6411 | global $globalDBdriver; |
| 6412 | 6412 | $filter_query = $this->getFilter($filters,true,true); |
| 6413 | 6413 | $query = "SELECT DISTINCT spotter_output.aircraft_manufacturer, COUNT(spotter_output.aircraft_manufacturer) AS aircraft_manufacturer_count |
| 6414 | 6414 | FROM spotter_output ".$filter_query." spotter_output.aircraft_manufacturer <> '' AND spotter_output.aircraft_manufacturer <> 'Not Available'"; |
| 6415 | - $query_values = array(); |
|
| 6415 | + $query_values = array(); |
|
| 6416 | 6416 | if ($year != '') { |
| 6417 | 6417 | if ($globalDBdriver == 'mysql') { |
| 6418 | 6418 | $query .= " AND YEAR(spotter_output.date) = :year"; |
@@ -6465,11 +6465,11 @@ discard block |
||
| 6465 | 6465 | |
| 6466 | 6466 | |
| 6467 | 6467 | /** |
| 6468 | - * Gets all aircraft registrations that have flown over |
|
| 6469 | - * |
|
| 6470 | - * @return Array the aircraft list |
|
| 6471 | - * |
|
| 6472 | - */ |
|
| 6468 | + * Gets all aircraft registrations that have flown over |
|
| 6469 | + * |
|
| 6470 | + * @return Array the aircraft list |
|
| 6471 | + * |
|
| 6472 | + */ |
|
| 6473 | 6473 | public function countAllAircraftRegistrations($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 6474 | 6474 | { |
| 6475 | 6475 | global $globalDBdriver; |
@@ -6477,15 +6477,15 @@ discard block |
||
| 6477 | 6477 | $filter_query = $this->getFilter($filters,true,true); |
| 6478 | 6478 | $query = "SELECT DISTINCT spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6479 | 6479 | FROM spotter_output ".$filter_query." spotter_output.registration <> '' AND spotter_output.registration <> 'NA'"; |
| 6480 | - if ($olderthanmonths > 0) { |
|
| 6481 | - if ($globalDBdriver == 'mysql') { |
|
| 6480 | + if ($olderthanmonths > 0) { |
|
| 6481 | + if ($globalDBdriver == 'mysql') { |
|
| 6482 | 6482 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6483 | 6483 | } else { |
| 6484 | 6484 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6485 | 6485 | } |
| 6486 | 6486 | } |
| 6487 | - if ($sincedate != '') { |
|
| 6488 | - if ($globalDBdriver == 'mysql') { |
|
| 6487 | + if ($sincedate != '') { |
|
| 6488 | + if ($globalDBdriver == 'mysql') { |
|
| 6489 | 6489 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6490 | 6490 | } else { |
| 6491 | 6491 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6550,11 +6550,11 @@ discard block |
||
| 6550 | 6550 | |
| 6551 | 6551 | |
| 6552 | 6552 | /** |
| 6553 | - * Gets all aircraft registrations that have flown over |
|
| 6554 | - * |
|
| 6555 | - * @return Array the aircraft list |
|
| 6556 | - * |
|
| 6557 | - */ |
|
| 6553 | + * Gets all aircraft registrations that have flown over |
|
| 6554 | + * |
|
| 6555 | + * @return Array the aircraft list |
|
| 6556 | + * |
|
| 6557 | + */ |
|
| 6558 | 6558 | public function countAllAircraftRegistrationsByAirlines($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 6559 | 6559 | { |
| 6560 | 6560 | global $globalDBdriver; |
@@ -6562,15 +6562,15 @@ discard block |
||
| 6562 | 6562 | $Image = new Image($this->db); |
| 6563 | 6563 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.registration, COUNT(spotter_output.registration) AS aircraft_registration_count, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name |
| 6564 | 6564 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.registration <> '' AND spotter_output.registration <> 'NA' "; |
| 6565 | - if ($olderthanmonths > 0) { |
|
| 6566 | - if ($globalDBdriver == 'mysql') { |
|
| 6565 | + if ($olderthanmonths > 0) { |
|
| 6566 | + if ($globalDBdriver == 'mysql') { |
|
| 6567 | 6567 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6568 | 6568 | } else { |
| 6569 | 6569 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6570 | 6570 | } |
| 6571 | 6571 | } |
| 6572 | - if ($sincedate != '') { |
|
| 6573 | - if ($globalDBdriver == 'mysql') { |
|
| 6572 | + if ($sincedate != '') { |
|
| 6573 | + if ($globalDBdriver == 'mysql') { |
|
| 6574 | 6574 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6575 | 6575 | } else { |
| 6576 | 6576 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6579,7 +6579,7 @@ discard block |
||
| 6579 | 6579 | |
| 6580 | 6580 | // if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6581 | 6581 | //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
| 6582 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6582 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.registration, spotter_output.aircraft_icao, spotter_output.aircraft_name, spotter_output.airline_name ORDER BY aircraft_registration_count DESC"; |
|
| 6583 | 6583 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6584 | 6584 | |
| 6585 | 6585 | $sth = $this->db->prepare($query); |
@@ -6611,26 +6611,26 @@ discard block |
||
| 6611 | 6611 | |
| 6612 | 6612 | |
| 6613 | 6613 | /** |
| 6614 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6615 | - * |
|
| 6616 | - * @return Array the airport list |
|
| 6617 | - * |
|
| 6618 | - */ |
|
| 6614 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6615 | + * |
|
| 6616 | + * @return Array the airport list |
|
| 6617 | + * |
|
| 6618 | + */ |
|
| 6619 | 6619 | public function countAllDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6620 | 6620 | { |
| 6621 | 6621 | global $globalDBdriver; |
| 6622 | 6622 | $filter_query = $this->getFilter($filters,true,true); |
| 6623 | 6623 | $query = "SELECT DISTINCT spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6624 | 6624 | FROM spotter_output".$filter_query." spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> ''"; |
| 6625 | - if ($olderthanmonths > 0) { |
|
| 6626 | - if ($globalDBdriver == 'mysql') { |
|
| 6625 | + if ($olderthanmonths > 0) { |
|
| 6626 | + if ($globalDBdriver == 'mysql') { |
|
| 6627 | 6627 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6628 | 6628 | } else { |
| 6629 | 6629 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6630 | 6630 | } |
| 6631 | - } |
|
| 6632 | - if ($sincedate != '') { |
|
| 6633 | - if ($globalDBdriver == 'mysql') { |
|
| 6631 | + } |
|
| 6632 | + if ($sincedate != '') { |
|
| 6633 | + if ($globalDBdriver == 'mysql') { |
|
| 6634 | 6634 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6635 | 6635 | } else { |
| 6636 | 6636 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6664,7 +6664,7 @@ discard block |
||
| 6664 | 6664 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6665 | 6665 | } |
| 6666 | 6666 | } |
| 6667 | - $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6667 | + $query .= " GROUP BY spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6668 | 6668 | ORDER BY airport_departure_icao_count DESC"; |
| 6669 | 6669 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6670 | 6670 | |
@@ -6687,35 +6687,35 @@ discard block |
||
| 6687 | 6687 | } |
| 6688 | 6688 | |
| 6689 | 6689 | /** |
| 6690 | - * Gets all departure airports of the airplanes that have flown over |
|
| 6691 | - * |
|
| 6692 | - * @return Array the airport list |
|
| 6693 | - * |
|
| 6694 | - */ |
|
| 6690 | + * Gets all departure airports of the airplanes that have flown over |
|
| 6691 | + * |
|
| 6692 | + * @return Array the airport list |
|
| 6693 | + * |
|
| 6694 | + */ |
|
| 6695 | 6695 | public function countAllDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6696 | 6696 | { |
| 6697 | 6697 | global $globalDBdriver; |
| 6698 | 6698 | $filter_query = $this->getFilter($filters,true,true); |
| 6699 | 6699 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.departure_airport_icao, COUNT(spotter_output.departure_airport_icao) AS airport_departure_icao_count, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
| 6700 | 6700 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.departure_airport_name <> '' AND spotter_output.departure_airport_icao <> 'NA' AND spotter_output.departure_airport_icao <> '' "; |
| 6701 | - if ($olderthanmonths > 0) { |
|
| 6702 | - if ($globalDBdriver == 'mysql') { |
|
| 6701 | + if ($olderthanmonths > 0) { |
|
| 6702 | + if ($globalDBdriver == 'mysql') { |
|
| 6703 | 6703 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6704 | 6704 | } else { |
| 6705 | 6705 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6706 | 6706 | } |
| 6707 | - } |
|
| 6708 | - if ($sincedate != '') { |
|
| 6709 | - if ($globalDBdriver == 'mysql') { |
|
| 6707 | + } |
|
| 6708 | + if ($sincedate != '') { |
|
| 6709 | + if ($globalDBdriver == 'mysql') { |
|
| 6710 | 6710 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6711 | 6711 | } else { |
| 6712 | 6712 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 6713 | 6713 | } |
| 6714 | 6714 | } |
| 6715 | 6715 | |
| 6716 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6717 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6718 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6716 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6717 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6718 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.departure_airport_icao, spotter_output.departure_airport_name, spotter_output.departure_airport_city, spotter_output.departure_airport_country |
|
| 6719 | 6719 | ORDER BY airport_departure_icao_count DESC"; |
| 6720 | 6720 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6721 | 6721 | |
@@ -6740,26 +6740,26 @@ discard block |
||
| 6740 | 6740 | } |
| 6741 | 6741 | |
| 6742 | 6742 | /** |
| 6743 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6744 | - * |
|
| 6745 | - * @return Array the airport list |
|
| 6746 | - * |
|
| 6747 | - */ |
|
| 6743 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6744 | + * |
|
| 6745 | + * @return Array the airport list |
|
| 6746 | + * |
|
| 6747 | + */ |
|
| 6748 | 6748 | public function countAllDetectedDepartureAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 6749 | 6749 | { |
| 6750 | 6750 | global $globalDBdriver; |
| 6751 | 6751 | $filter_query = $this->getFilter($filters,true,true); |
| 6752 | 6752 | $query = "SELECT DISTINCT spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6753 | 6753 | FROM airport, spotter_output".$filter_query." spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao"; |
| 6754 | - if ($olderthanmonths > 0) { |
|
| 6755 | - if ($globalDBdriver == 'mysql') { |
|
| 6754 | + if ($olderthanmonths > 0) { |
|
| 6755 | + if ($globalDBdriver == 'mysql') { |
|
| 6756 | 6756 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 6757 | 6757 | } else { |
| 6758 | 6758 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 6759 | 6759 | } |
| 6760 | - } |
|
| 6761 | - if ($sincedate != '') { |
|
| 6762 | - if ($globalDBdriver == 'mysql') { |
|
| 6760 | + } |
|
| 6761 | + if ($sincedate != '') { |
|
| 6762 | + if ($globalDBdriver == 'mysql') { |
|
| 6763 | 6763 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 6764 | 6764 | } else { |
| 6765 | 6765 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -6793,10 +6793,10 @@ discard block |
||
| 6793 | 6793 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 6794 | 6794 | } |
| 6795 | 6795 | } |
| 6796 | - $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6796 | + $query .= " GROUP BY spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6797 | 6797 | ORDER BY airport_departure_icao_count DESC"; |
| 6798 | 6798 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6799 | - //echo $query; |
|
| 6799 | + //echo $query; |
|
| 6800 | 6800 | $sth = $this->db->prepare($query); |
| 6801 | 6801 | $sth->execute($query_values); |
| 6802 | 6802 | |
@@ -6817,35 +6817,35 @@ discard block |
||
| 6817 | 6817 | } |
| 6818 | 6818 | |
| 6819 | 6819 | /** |
| 6820 | - * Gets all detected departure airports of the airplanes that have flown over |
|
| 6821 | - * |
|
| 6822 | - * @return Array the airport list |
|
| 6823 | - * |
|
| 6824 | - */ |
|
| 6820 | + * Gets all detected departure airports of the airplanes that have flown over |
|
| 6821 | + * |
|
| 6822 | + * @return Array the airport list |
|
| 6823 | + * |
|
| 6824 | + */ |
|
| 6825 | 6825 | public function countAllDetectedDepartureAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array()) |
| 6826 | 6826 | { |
| 6827 | 6827 | global $globalDBdriver; |
| 6828 | 6828 | $filter_query = $this->getFilter($filters,true,true); |
| 6829 | 6829 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_departure_airport_icao AS departure_airport_icao, COUNT(spotter_output.real_departure_airport_icao) AS airport_departure_icao_count, airport.name as departure_airport_name, airport.city as departure_airport_city, airport.country as departure_airport_country |
| 6830 | 6830 | FROM airport, spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_departure_airport_icao <> '' AND spotter_output.real_departure_airport_icao <> 'NA' AND airport.icao = spotter_output.real_departure_airport_icao "; |
| 6831 | - if ($olderthanmonths > 0) { |
|
| 6832 | - if ($globalDBdriver == 'mysql') { |
|
| 6831 | + if ($olderthanmonths > 0) { |
|
| 6832 | + if ($globalDBdriver == 'mysql') { |
|
| 6833 | 6833 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 6834 | 6834 | } else { |
| 6835 | 6835 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 6836 | 6836 | } |
| 6837 | - } |
|
| 6838 | - if ($sincedate != '') { |
|
| 6839 | - if ($globalDBdriver == 'mysql') { |
|
| 6837 | + } |
|
| 6838 | + if ($sincedate != '') { |
|
| 6839 | + if ($globalDBdriver == 'mysql') { |
|
| 6840 | 6840 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 6841 | 6841 | } else { |
| 6842 | 6842 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP) "; |
| 6843 | 6843 | } |
| 6844 | 6844 | } |
| 6845 | 6845 | |
| 6846 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6847 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6848 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6846 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 6847 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 6848 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_departure_airport_icao, airport.name, airport.city, airport.country |
|
| 6849 | 6849 | ORDER BY airport_departure_icao_count DESC"; |
| 6850 | 6850 | if ($limit) $query .= " LIMIT 10 OFFSET 0"; |
| 6851 | 6851 | |
@@ -6870,11 +6870,11 @@ discard block |
||
| 6870 | 6870 | } |
| 6871 | 6871 | |
| 6872 | 6872 | /** |
| 6873 | - * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6874 | - * |
|
| 6875 | - * @return Array the airport list |
|
| 6876 | - * |
|
| 6877 | - */ |
|
| 6873 | + * Gets all departure airports of the airplanes that have flown over based on an airline icao |
|
| 6874 | + * |
|
| 6875 | + * @return Array the airport list |
|
| 6876 | + * |
|
| 6877 | + */ |
|
| 6878 | 6878 | public function countAllDepartureAirportsByAirline($airline_icao,$filters = array()) |
| 6879 | 6879 | { |
| 6880 | 6880 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6908,11 +6908,11 @@ discard block |
||
| 6908 | 6908 | |
| 6909 | 6909 | |
| 6910 | 6910 | /** |
| 6911 | - * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6912 | - * |
|
| 6913 | - * @return Array the airport list |
|
| 6914 | - * |
|
| 6915 | - */ |
|
| 6911 | + * Gets all departure airports by country of the airplanes that have flown over based on an airline icao |
|
| 6912 | + * |
|
| 6913 | + * @return Array the airport list |
|
| 6914 | + * |
|
| 6915 | + */ |
|
| 6916 | 6916 | public function countAllDepartureAirportCountriesByAirline($airline_icao,$filters = array()) |
| 6917 | 6917 | { |
| 6918 | 6918 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6943,11 +6943,11 @@ discard block |
||
| 6943 | 6943 | |
| 6944 | 6944 | |
| 6945 | 6945 | /** |
| 6946 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6947 | - * |
|
| 6948 | - * @return Array the airport list |
|
| 6949 | - * |
|
| 6950 | - */ |
|
| 6946 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft icao |
|
| 6947 | + * |
|
| 6948 | + * @return Array the airport list |
|
| 6949 | + * |
|
| 6950 | + */ |
|
| 6951 | 6951 | public function countAllDepartureAirportsByAircraft($aircraft_icao,$filters = array()) |
| 6952 | 6952 | { |
| 6953 | 6953 | $filter_query = $this->getFilter($filters,true,true); |
@@ -6980,11 +6980,11 @@ discard block |
||
| 6980 | 6980 | |
| 6981 | 6981 | |
| 6982 | 6982 | /** |
| 6983 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6984 | - * |
|
| 6985 | - * @return Array the airport list |
|
| 6986 | - * |
|
| 6987 | - */ |
|
| 6983 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 6984 | + * |
|
| 6985 | + * @return Array the airport list |
|
| 6986 | + * |
|
| 6987 | + */ |
|
| 6988 | 6988 | public function countAllDepartureAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 6989 | 6989 | { |
| 6990 | 6990 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7014,11 +7014,11 @@ discard block |
||
| 7014 | 7014 | |
| 7015 | 7015 | |
| 7016 | 7016 | /** |
| 7017 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7018 | - * |
|
| 7019 | - * @return Array the airport list |
|
| 7020 | - * |
|
| 7021 | - */ |
|
| 7017 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft registration |
|
| 7018 | + * |
|
| 7019 | + * @return Array the airport list |
|
| 7020 | + * |
|
| 7021 | + */ |
|
| 7022 | 7022 | public function countAllDepartureAirportsByRegistration($registration,$filters = array()) |
| 7023 | 7023 | { |
| 7024 | 7024 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7051,11 +7051,11 @@ discard block |
||
| 7051 | 7051 | |
| 7052 | 7052 | |
| 7053 | 7053 | /** |
| 7054 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7055 | - * |
|
| 7056 | - * @return Array the airport list |
|
| 7057 | - * |
|
| 7058 | - */ |
|
| 7054 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 7055 | + * |
|
| 7056 | + * @return Array the airport list |
|
| 7057 | + * |
|
| 7058 | + */ |
|
| 7059 | 7059 | public function countAllDepartureAirportCountriesByRegistration($registration,$filters = array()) |
| 7060 | 7060 | { |
| 7061 | 7061 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7085,11 +7085,11 @@ discard block |
||
| 7085 | 7085 | |
| 7086 | 7086 | |
| 7087 | 7087 | /** |
| 7088 | - * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7089 | - * |
|
| 7090 | - * @return Array the airport list |
|
| 7091 | - * |
|
| 7092 | - */ |
|
| 7088 | + * Gets all departure airports of the airplanes that have flown over based on an arrivl airport icao |
|
| 7089 | + * |
|
| 7090 | + * @return Array the airport list |
|
| 7091 | + * |
|
| 7092 | + */ |
|
| 7093 | 7093 | public function countAllDepartureAirportsByAirport($airport_icao,$filters = array()) |
| 7094 | 7094 | { |
| 7095 | 7095 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7122,11 +7122,11 @@ discard block |
||
| 7122 | 7122 | |
| 7123 | 7123 | |
| 7124 | 7124 | /** |
| 7125 | - * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7126 | - * |
|
| 7127 | - * @return Array the airport list |
|
| 7128 | - * |
|
| 7129 | - */ |
|
| 7125 | + * Gets all departure airports by country of the airplanes that have flown over based on an airport icao |
|
| 7126 | + * |
|
| 7127 | + * @return Array the airport list |
|
| 7128 | + * |
|
| 7129 | + */ |
|
| 7130 | 7130 | public function countAllDepartureAirportCountriesByAirport($airport_icao,$filters = array()) |
| 7131 | 7131 | { |
| 7132 | 7132 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7157,11 +7157,11 @@ discard block |
||
| 7157 | 7157 | |
| 7158 | 7158 | |
| 7159 | 7159 | /** |
| 7160 | - * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7161 | - * |
|
| 7162 | - * @return Array the airport list |
|
| 7163 | - * |
|
| 7164 | - */ |
|
| 7160 | + * Gets all departure airports of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7161 | + * |
|
| 7162 | + * @return Array the airport list |
|
| 7163 | + * |
|
| 7164 | + */ |
|
| 7165 | 7165 | public function countAllDepartureAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7166 | 7166 | { |
| 7167 | 7167 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7194,11 +7194,11 @@ discard block |
||
| 7194 | 7194 | |
| 7195 | 7195 | |
| 7196 | 7196 | /** |
| 7197 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7198 | - * |
|
| 7199 | - * @return Array the airport list |
|
| 7200 | - * |
|
| 7201 | - */ |
|
| 7197 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft manufacturer |
|
| 7198 | + * |
|
| 7199 | + * @return Array the airport list |
|
| 7200 | + * |
|
| 7201 | + */ |
|
| 7202 | 7202 | public function countAllDepartureAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 7203 | 7203 | { |
| 7204 | 7204 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7228,11 +7228,11 @@ discard block |
||
| 7228 | 7228 | |
| 7229 | 7229 | |
| 7230 | 7230 | /** |
| 7231 | - * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7232 | - * |
|
| 7233 | - * @return Array the airport list |
|
| 7234 | - * |
|
| 7235 | - */ |
|
| 7231 | + * Gets all departure airports of the airplanes that have flown over based on a date |
|
| 7232 | + * |
|
| 7233 | + * @return Array the airport list |
|
| 7234 | + * |
|
| 7235 | + */ |
|
| 7236 | 7236 | public function countAllDepartureAirportsByDate($date,$filters = array()) |
| 7237 | 7237 | { |
| 7238 | 7238 | global $globalTimezone, $globalDBdriver; |
@@ -7278,11 +7278,11 @@ discard block |
||
| 7278 | 7278 | |
| 7279 | 7279 | |
| 7280 | 7280 | /** |
| 7281 | - * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7282 | - * |
|
| 7283 | - * @return Array the airport list |
|
| 7284 | - * |
|
| 7285 | - */ |
|
| 7281 | + * Gets all departure airports by country of the airplanes that have flown over based on a date |
|
| 7282 | + * |
|
| 7283 | + * @return Array the airport list |
|
| 7284 | + * |
|
| 7285 | + */ |
|
| 7286 | 7286 | public function countAllDepartureAirportCountriesByDate($date,$filters = array()) |
| 7287 | 7287 | { |
| 7288 | 7288 | global $globalTimezone, $globalDBdriver; |
@@ -7325,11 +7325,11 @@ discard block |
||
| 7325 | 7325 | |
| 7326 | 7326 | |
| 7327 | 7327 | /** |
| 7328 | - * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7329 | - * |
|
| 7330 | - * @return Array the airport list |
|
| 7331 | - * |
|
| 7332 | - */ |
|
| 7328 | + * Gets all departure airports of the airplanes that have flown over based on a ident/callsign |
|
| 7329 | + * |
|
| 7330 | + * @return Array the airport list |
|
| 7331 | + * |
|
| 7332 | + */ |
|
| 7333 | 7333 | public function countAllDepartureAirportsByIdent($ident,$filters = array()) |
| 7334 | 7334 | { |
| 7335 | 7335 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7361,11 +7361,11 @@ discard block |
||
| 7361 | 7361 | } |
| 7362 | 7362 | |
| 7363 | 7363 | /** |
| 7364 | - * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7365 | - * |
|
| 7366 | - * @return Array the airport list |
|
| 7367 | - * |
|
| 7368 | - */ |
|
| 7364 | + * Gets all departure airports of the airplanes that have flown over based on a owner |
|
| 7365 | + * |
|
| 7366 | + * @return Array the airport list |
|
| 7367 | + * |
|
| 7368 | + */ |
|
| 7369 | 7369 | public function countAllDepartureAirportsByOwner($owner,$filters = array()) |
| 7370 | 7370 | { |
| 7371 | 7371 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7397,11 +7397,11 @@ discard block |
||
| 7397 | 7397 | } |
| 7398 | 7398 | |
| 7399 | 7399 | /** |
| 7400 | - * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7401 | - * |
|
| 7402 | - * @return Array the airport list |
|
| 7403 | - * |
|
| 7404 | - */ |
|
| 7400 | + * Gets all departure airports of the airplanes that have flown over based on a pilot |
|
| 7401 | + * |
|
| 7402 | + * @return Array the airport list |
|
| 7403 | + * |
|
| 7404 | + */ |
|
| 7405 | 7405 | public function countAllDepartureAirportsByPilot($pilot,$filters = array()) |
| 7406 | 7406 | { |
| 7407 | 7407 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7434,11 +7434,11 @@ discard block |
||
| 7434 | 7434 | |
| 7435 | 7435 | |
| 7436 | 7436 | /** |
| 7437 | - * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7438 | - * |
|
| 7439 | - * @return Array the airport list |
|
| 7440 | - * |
|
| 7441 | - */ |
|
| 7437 | + * Gets all departure airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 7438 | + * |
|
| 7439 | + * @return Array the airport list |
|
| 7440 | + * |
|
| 7441 | + */ |
|
| 7442 | 7442 | public function countAllDepartureAirportCountriesByIdent($ident,$filters = array()) |
| 7443 | 7443 | { |
| 7444 | 7444 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7467,11 +7467,11 @@ discard block |
||
| 7467 | 7467 | } |
| 7468 | 7468 | |
| 7469 | 7469 | /** |
| 7470 | - * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7471 | - * |
|
| 7472 | - * @return Array the airport list |
|
| 7473 | - * |
|
| 7474 | - */ |
|
| 7470 | + * Gets all departure airports by country of the airplanes that have flown over based on owner |
|
| 7471 | + * |
|
| 7472 | + * @return Array the airport list |
|
| 7473 | + * |
|
| 7474 | + */ |
|
| 7475 | 7475 | public function countAllDepartureAirportCountriesByOwner($owner,$filters = array()) |
| 7476 | 7476 | { |
| 7477 | 7477 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7487,11 +7487,11 @@ discard block |
||
| 7487 | 7487 | } |
| 7488 | 7488 | |
| 7489 | 7489 | /** |
| 7490 | - * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7491 | - * |
|
| 7492 | - * @return Array the airport list |
|
| 7493 | - * |
|
| 7494 | - */ |
|
| 7490 | + * Gets all departure airports by country of the airplanes that have flown over based on pilot |
|
| 7491 | + * |
|
| 7492 | + * @return Array the airport list |
|
| 7493 | + * |
|
| 7494 | + */ |
|
| 7495 | 7495 | public function countAllDepartureAirportCountriesByPilot($pilot,$filters = array()) |
| 7496 | 7496 | { |
| 7497 | 7497 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7509,11 +7509,11 @@ discard block |
||
| 7509 | 7509 | |
| 7510 | 7510 | |
| 7511 | 7511 | /** |
| 7512 | - * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7513 | - * |
|
| 7514 | - * @return Array the airport list |
|
| 7515 | - * |
|
| 7516 | - */ |
|
| 7512 | + * Gets all departure airports of the airplanes that have flown over based on a country |
|
| 7513 | + * |
|
| 7514 | + * @return Array the airport list |
|
| 7515 | + * |
|
| 7516 | + */ |
|
| 7517 | 7517 | public function countAllDepartureAirportsByCountry($country,$filters = array()) |
| 7518 | 7518 | { |
| 7519 | 7519 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7547,11 +7547,11 @@ discard block |
||
| 7547 | 7547 | |
| 7548 | 7548 | |
| 7549 | 7549 | /** |
| 7550 | - * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7551 | - * |
|
| 7552 | - * @return Array the airport list |
|
| 7553 | - * |
|
| 7554 | - */ |
|
| 7550 | + * Gets all departure airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7551 | + * |
|
| 7552 | + * @return Array the airport list |
|
| 7553 | + * |
|
| 7554 | + */ |
|
| 7555 | 7555 | public function countAllDepartureAirportCountriesByCountry($country,$filters = array()) |
| 7556 | 7556 | { |
| 7557 | 7557 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7581,31 +7581,31 @@ discard block |
||
| 7581 | 7581 | |
| 7582 | 7582 | |
| 7583 | 7583 | /** |
| 7584 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7585 | - * |
|
| 7586 | - * @param Boolean $limit Limit result to 10 or not |
|
| 7587 | - * @param Integer $olderthanmonths Only show result older than x months |
|
| 7588 | - * @param String $sincedate Only show result since x date |
|
| 7589 | - * @param Boolean $icaoaskey Show result by ICAO |
|
| 7590 | - * @param Array $filters Filter used here |
|
| 7591 | - * @return Array the airport list |
|
| 7592 | - * |
|
| 7593 | - */ |
|
| 7584 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7585 | + * |
|
| 7586 | + * @param Boolean $limit Limit result to 10 or not |
|
| 7587 | + * @param Integer $olderthanmonths Only show result older than x months |
|
| 7588 | + * @param String $sincedate Only show result since x date |
|
| 7589 | + * @param Boolean $icaoaskey Show result by ICAO |
|
| 7590 | + * @param Array $filters Filter used here |
|
| 7591 | + * @return Array the airport list |
|
| 7592 | + * |
|
| 7593 | + */ |
|
| 7594 | 7594 | public function countAllArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7595 | 7595 | { |
| 7596 | 7596 | global $globalDBdriver; |
| 7597 | 7597 | $filter_query = $this->getFilter($filters,true,true); |
| 7598 | 7598 | $query = "SELECT DISTINCT spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7599 | 7599 | FROM spotter_output".$filter_query." spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> ''"; |
| 7600 | - if ($olderthanmonths > 0) { |
|
| 7601 | - if ($globalDBdriver == 'mysql') { |
|
| 7600 | + if ($olderthanmonths > 0) { |
|
| 7601 | + if ($globalDBdriver == 'mysql') { |
|
| 7602 | 7602 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7603 | 7603 | } else { |
| 7604 | 7604 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7605 | 7605 | } |
| 7606 | 7606 | } |
| 7607 | - if ($sincedate != '') { |
|
| 7608 | - if ($globalDBdriver == 'mysql') { |
|
| 7607 | + if ($sincedate != '') { |
|
| 7608 | + if ($globalDBdriver == 'mysql') { |
|
| 7609 | 7609 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7610 | 7610 | } else { |
| 7611 | 7611 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7639,7 +7639,7 @@ discard block |
||
| 7639 | 7639 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7640 | 7640 | } |
| 7641 | 7641 | } |
| 7642 | - $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7642 | + $query .= " GROUP BY spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7643 | 7643 | ORDER BY airport_arrival_icao_count DESC"; |
| 7644 | 7644 | if ($limit) $query .= " LIMIT 10"; |
| 7645 | 7645 | |
@@ -7668,35 +7668,35 @@ discard block |
||
| 7668 | 7668 | } |
| 7669 | 7669 | |
| 7670 | 7670 | /** |
| 7671 | - * Gets all arrival airports of the airplanes that have flown over |
|
| 7672 | - * |
|
| 7673 | - * @return Array the airport list |
|
| 7674 | - * |
|
| 7675 | - */ |
|
| 7671 | + * Gets all arrival airports of the airplanes that have flown over |
|
| 7672 | + * |
|
| 7673 | + * @return Array the airport list |
|
| 7674 | + * |
|
| 7675 | + */ |
|
| 7676 | 7676 | public function countAllArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $icaoaskey = false,$filters = array()) |
| 7677 | 7677 | { |
| 7678 | 7678 | global $globalDBdriver; |
| 7679 | 7679 | $filter_query = $this->getFilter($filters,true,true); |
| 7680 | 7680 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.arrival_airport_icao, COUNT(spotter_output.arrival_airport_icao) AS airport_arrival_icao_count, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
| 7681 | 7681 | FROM spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.arrival_airport_name <> '' AND spotter_output.arrival_airport_icao <> 'NA' AND spotter_output.arrival_airport_icao <> '' "; |
| 7682 | - if ($olderthanmonths > 0) { |
|
| 7683 | - if ($globalDBdriver == 'mysql') { |
|
| 7682 | + if ($olderthanmonths > 0) { |
|
| 7683 | + if ($globalDBdriver == 'mysql') { |
|
| 7684 | 7684 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7685 | 7685 | } else { |
| 7686 | 7686 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7687 | 7687 | } |
| 7688 | 7688 | } |
| 7689 | - if ($sincedate != '') { |
|
| 7690 | - if ($globalDBdriver == 'mysql') { |
|
| 7689 | + if ($sincedate != '') { |
|
| 7690 | + if ($globalDBdriver == 'mysql') { |
|
| 7691 | 7691 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7692 | 7692 | } else { |
| 7693 | 7693 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7694 | 7694 | } |
| 7695 | 7695 | } |
| 7696 | 7696 | |
| 7697 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7698 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7699 | - $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7697 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7698 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7699 | + $query .= "GROUP BY spotter_output.airline_icao,spotter_output.arrival_airport_icao, spotter_output.arrival_airport_name, spotter_output.arrival_airport_city, spotter_output.arrival_airport_country |
|
| 7700 | 7700 | ORDER BY airport_arrival_icao_count DESC"; |
| 7701 | 7701 | if ($limit) $query .= " LIMIT 10"; |
| 7702 | 7702 | |
@@ -7727,26 +7727,26 @@ discard block |
||
| 7727 | 7727 | |
| 7728 | 7728 | |
| 7729 | 7729 | /** |
| 7730 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7731 | - * |
|
| 7732 | - * @return Array the airport list |
|
| 7733 | - * |
|
| 7734 | - */ |
|
| 7730 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7731 | + * |
|
| 7732 | + * @return Array the airport list |
|
| 7733 | + * |
|
| 7734 | + */ |
|
| 7735 | 7735 | public function countAllDetectedArrivalAirports($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array(),$year = '',$month = '',$day = '') |
| 7736 | 7736 | { |
| 7737 | 7737 | global $globalDBdriver; |
| 7738 | 7738 | $filter_query = $this->getFilter($filters,true,true); |
| 7739 | 7739 | $query = "SELECT DISTINCT spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7740 | 7740 | FROM airport,spotter_output".$filter_query." spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao"; |
| 7741 | - if ($olderthanmonths > 0) { |
|
| 7742 | - if ($globalDBdriver == 'mysql') { |
|
| 7741 | + if ($olderthanmonths > 0) { |
|
| 7742 | + if ($globalDBdriver == 'mysql') { |
|
| 7743 | 7743 | $query .= ' AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH)'; |
| 7744 | 7744 | } else { |
| 7745 | 7745 | $query .= " AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 7746 | 7746 | } |
| 7747 | 7747 | } |
| 7748 | - if ($sincedate != '') { |
|
| 7749 | - if ($globalDBdriver == 'mysql') { |
|
| 7748 | + if ($sincedate != '') { |
|
| 7749 | + if ($globalDBdriver == 'mysql') { |
|
| 7750 | 7750 | $query .= " AND spotter_output.date > '".$sincedate."'"; |
| 7751 | 7751 | } else { |
| 7752 | 7752 | $query .= " AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
@@ -7780,7 +7780,7 @@ discard block |
||
| 7780 | 7780 | $query_values = array_merge($query_values,array(':day' => $day)); |
| 7781 | 7781 | } |
| 7782 | 7782 | } |
| 7783 | - $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7783 | + $query .= " GROUP BY spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7784 | 7784 | ORDER BY airport_arrival_icao_count DESC"; |
| 7785 | 7785 | if ($limit) $query .= " LIMIT 10"; |
| 7786 | 7786 | |
@@ -7808,35 +7808,35 @@ discard block |
||
| 7808 | 7808 | } |
| 7809 | 7809 | |
| 7810 | 7810 | /** |
| 7811 | - * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7812 | - * |
|
| 7813 | - * @return Array the airport list |
|
| 7814 | - * |
|
| 7815 | - */ |
|
| 7811 | + * Gets all detected arrival airports of the airplanes that have flown over |
|
| 7812 | + * |
|
| 7813 | + * @return Array the airport list |
|
| 7814 | + * |
|
| 7815 | + */ |
|
| 7816 | 7816 | public function countAllDetectedArrivalAirportsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '',$icaoaskey = false,$filters = array()) |
| 7817 | 7817 | { |
| 7818 | 7818 | global $globalDBdriver; |
| 7819 | 7819 | $filter_query = $this->getFilter($filters,true,true); |
| 7820 | 7820 | $query = "SELECT DISTINCT spotter_output.airline_icao, spotter_output.real_arrival_airport_icao as arrival_airport_icao, COUNT(spotter_output.real_arrival_airport_icao) AS airport_arrival_icao_count, airport.name AS arrival_airport_name, airport.city AS arrival_airport_city, airport.country AS arrival_airport_country |
| 7821 | 7821 | FROM airport,spotter_output".$filter_query." spotter_output.airline_icao <> '' AND spotter_output.real_arrival_airport_icao <> '' AND spotter_output.real_arrival_airport_icao <> 'NA' AND airport.icao = spotter_output.real_arrival_airport_icao "; |
| 7822 | - if ($olderthanmonths > 0) { |
|
| 7823 | - if ($globalDBdriver == 'mysql') { |
|
| 7822 | + if ($olderthanmonths > 0) { |
|
| 7823 | + if ($globalDBdriver == 'mysql') { |
|
| 7824 | 7824 | $query .= 'AND spotter_output.date < DATE_SUB(UTC_TIMESTAMP(), INTERVAL '.$olderthanmonths.' MONTH) '; |
| 7825 | 7825 | } else { |
| 7826 | 7826 | $query .= "AND spotter_output.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS' "; |
| 7827 | 7827 | } |
| 7828 | 7828 | } |
| 7829 | - if ($sincedate != '') { |
|
| 7830 | - if ($globalDBdriver == 'mysql') { |
|
| 7829 | + if ($sincedate != '') { |
|
| 7830 | + if ($globalDBdriver == 'mysql') { |
|
| 7831 | 7831 | $query .= "AND spotter_output.date > '".$sincedate."' "; |
| 7832 | 7832 | } else { |
| 7833 | 7833 | $query .= "AND spotter_output.date > CAST('".$sincedate."' AS TIMESTAMP)"; |
| 7834 | 7834 | } |
| 7835 | 7835 | } |
| 7836 | 7836 | |
| 7837 | - //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7838 | - //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7839 | - $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7837 | + //if ($olderthanmonths > 0) $query .= 'AND date < DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$olderthanmonths.' MONTH) '; |
|
| 7838 | + //if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 7839 | + $query .= "GROUP BY spotter_output.airline_icao, spotter_output.real_arrival_airport_icao, airport.name, airport.city, airport.country |
|
| 7840 | 7840 | ORDER BY airport_arrival_icao_count DESC"; |
| 7841 | 7841 | if ($limit) $query .= " LIMIT 10"; |
| 7842 | 7842 | |
@@ -7866,11 +7866,11 @@ discard block |
||
| 7866 | 7866 | } |
| 7867 | 7867 | |
| 7868 | 7868 | /** |
| 7869 | - * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7870 | - * |
|
| 7871 | - * @return Array the airport list |
|
| 7872 | - * |
|
| 7873 | - */ |
|
| 7869 | + * Gets all arrival airports of the airplanes that have flown over based on an airline icao |
|
| 7870 | + * |
|
| 7871 | + * @return Array the airport list |
|
| 7872 | + * |
|
| 7873 | + */ |
|
| 7874 | 7874 | public function countAllArrivalAirportsByAirline($airline_icao, $filters = array()) |
| 7875 | 7875 | { |
| 7876 | 7876 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7902,11 +7902,11 @@ discard block |
||
| 7902 | 7902 | |
| 7903 | 7903 | |
| 7904 | 7904 | /** |
| 7905 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7906 | - * |
|
| 7907 | - * @return Array the airport list |
|
| 7908 | - * |
|
| 7909 | - */ |
|
| 7905 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airline icao |
|
| 7906 | + * |
|
| 7907 | + * @return Array the airport list |
|
| 7908 | + * |
|
| 7909 | + */ |
|
| 7910 | 7910 | public function countAllArrivalAirportCountriesByAirline($airline_icao,$filters = array()) |
| 7911 | 7911 | { |
| 7912 | 7912 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7937,11 +7937,11 @@ discard block |
||
| 7937 | 7937 | |
| 7938 | 7938 | |
| 7939 | 7939 | /** |
| 7940 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7941 | - * |
|
| 7942 | - * @return Array the airport list |
|
| 7943 | - * |
|
| 7944 | - */ |
|
| 7940 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft icao |
|
| 7941 | + * |
|
| 7942 | + * @return Array the airport list |
|
| 7943 | + * |
|
| 7944 | + */ |
|
| 7945 | 7945 | public function countAllArrivalAirportsByAircraft($aircraft_icao,$filters = array()) |
| 7946 | 7946 | { |
| 7947 | 7947 | $filter_query = $this->getFilter($filters,true,true); |
@@ -7975,11 +7975,11 @@ discard block |
||
| 7975 | 7975 | |
| 7976 | 7976 | |
| 7977 | 7977 | /** |
| 7978 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7979 | - * |
|
| 7980 | - * @return Array the airport list |
|
| 7981 | - * |
|
| 7982 | - */ |
|
| 7978 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft icao |
|
| 7979 | + * |
|
| 7980 | + * @return Array the airport list |
|
| 7981 | + * |
|
| 7982 | + */ |
|
| 7983 | 7983 | public function countAllArrivalAirportCountriesByAircraft($aircraft_icao,$filters = array()) |
| 7984 | 7984 | { |
| 7985 | 7985 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8009,11 +8009,11 @@ discard block |
||
| 8009 | 8009 | |
| 8010 | 8010 | |
| 8011 | 8011 | /** |
| 8012 | - * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8013 | - * |
|
| 8014 | - * @return Array the airport list |
|
| 8015 | - * |
|
| 8016 | - */ |
|
| 8012 | + * Gets all arrival airports of the airplanes that have flown over based on an aircraft registration |
|
| 8013 | + * |
|
| 8014 | + * @return Array the airport list |
|
| 8015 | + * |
|
| 8016 | + */ |
|
| 8017 | 8017 | public function countAllArrivalAirportsByRegistration($registration,$filters = array()) |
| 8018 | 8018 | { |
| 8019 | 8019 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8047,11 +8047,11 @@ discard block |
||
| 8047 | 8047 | |
| 8048 | 8048 | |
| 8049 | 8049 | /** |
| 8050 | - * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8051 | - * |
|
| 8052 | - * @return Array the airport list |
|
| 8053 | - * |
|
| 8054 | - */ |
|
| 8050 | + * Gets all arrival airports by country of the airplanes that have flown over based on an aircraft registration |
|
| 8051 | + * |
|
| 8052 | + * @return Array the airport list |
|
| 8053 | + * |
|
| 8054 | + */ |
|
| 8055 | 8055 | public function countAllArrivalAirportCountriesByRegistration($registration,$filters = array()) |
| 8056 | 8056 | { |
| 8057 | 8057 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8082,11 +8082,11 @@ discard block |
||
| 8082 | 8082 | |
| 8083 | 8083 | |
| 8084 | 8084 | /** |
| 8085 | - * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8086 | - * |
|
| 8087 | - * @return Array the airport list |
|
| 8088 | - * |
|
| 8089 | - */ |
|
| 8085 | + * Gets all arrival airports of the airplanes that have flown over based on an departure airport |
|
| 8086 | + * |
|
| 8087 | + * @return Array the airport list |
|
| 8088 | + * |
|
| 8089 | + */ |
|
| 8090 | 8090 | public function countAllArrivalAirportsByAirport($airport_icao,$filters = array()) |
| 8091 | 8091 | { |
| 8092 | 8092 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8119,11 +8119,11 @@ discard block |
||
| 8119 | 8119 | |
| 8120 | 8120 | |
| 8121 | 8121 | /** |
| 8122 | - * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8123 | - * |
|
| 8124 | - * @return Array the airport list |
|
| 8125 | - * |
|
| 8126 | - */ |
|
| 8122 | + * Gets all arrival airports by country of the airplanes that have flown over based on an airport icao |
|
| 8123 | + * |
|
| 8124 | + * @return Array the airport list |
|
| 8125 | + * |
|
| 8126 | + */ |
|
| 8127 | 8127 | public function countAllArrivalAirportCountriesByAirport($airport_icao,$filters = array()) |
| 8128 | 8128 | { |
| 8129 | 8129 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8153,11 +8153,11 @@ discard block |
||
| 8153 | 8153 | |
| 8154 | 8154 | |
| 8155 | 8155 | /** |
| 8156 | - * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8157 | - * |
|
| 8158 | - * @return Array the airport list |
|
| 8159 | - * |
|
| 8160 | - */ |
|
| 8156 | + * Gets all arrival airports of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8157 | + * |
|
| 8158 | + * @return Array the airport list |
|
| 8159 | + * |
|
| 8160 | + */ |
|
| 8161 | 8161 | public function countAllArrivalAirportsByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8162 | 8162 | { |
| 8163 | 8163 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8191,11 +8191,11 @@ discard block |
||
| 8191 | 8191 | |
| 8192 | 8192 | |
| 8193 | 8193 | /** |
| 8194 | - * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8195 | - * |
|
| 8196 | - * @return Array the airport list |
|
| 8197 | - * |
|
| 8198 | - */ |
|
| 8194 | + * Gets all arrival airports by country of the airplanes that have flown over based on a aircraft manufacturer |
|
| 8195 | + * |
|
| 8196 | + * @return Array the airport list |
|
| 8197 | + * |
|
| 8198 | + */ |
|
| 8199 | 8199 | public function countAllArrivalAirportCountriesByManufacturer($aircraft_manufacturer,$filters = array()) |
| 8200 | 8200 | { |
| 8201 | 8201 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8226,11 +8226,11 @@ discard block |
||
| 8226 | 8226 | |
| 8227 | 8227 | |
| 8228 | 8228 | /** |
| 8229 | - * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8230 | - * |
|
| 8231 | - * @return Array the airport list |
|
| 8232 | - * |
|
| 8233 | - */ |
|
| 8229 | + * Gets all arrival airports of the airplanes that have flown over based on a date |
|
| 8230 | + * |
|
| 8231 | + * @return Array the airport list |
|
| 8232 | + * |
|
| 8233 | + */ |
|
| 8234 | 8234 | public function countAllArrivalAirportsByDate($date,$filters = array()) |
| 8235 | 8235 | { |
| 8236 | 8236 | global $globalTimezone, $globalDBdriver; |
@@ -8276,11 +8276,11 @@ discard block |
||
| 8276 | 8276 | |
| 8277 | 8277 | |
| 8278 | 8278 | /** |
| 8279 | - * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8280 | - * |
|
| 8281 | - * @return Array the airport list |
|
| 8282 | - * |
|
| 8283 | - */ |
|
| 8279 | + * Gets all arrival airports by country of the airplanes that have flown over based on a date |
|
| 8280 | + * |
|
| 8281 | + * @return Array the airport list |
|
| 8282 | + * |
|
| 8283 | + */ |
|
| 8284 | 8284 | public function countAllArrivalAirportCountriesByDate($date, $filters = array()) |
| 8285 | 8285 | { |
| 8286 | 8286 | global $globalTimezone, $globalDBdriver; |
@@ -8323,11 +8323,11 @@ discard block |
||
| 8323 | 8323 | |
| 8324 | 8324 | |
| 8325 | 8325 | /** |
| 8326 | - * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8327 | - * |
|
| 8328 | - * @return Array the airport list |
|
| 8329 | - * |
|
| 8330 | - */ |
|
| 8326 | + * Gets all arrival airports of the airplanes that have flown over based on a ident/callsign |
|
| 8327 | + * |
|
| 8328 | + * @return Array the airport list |
|
| 8329 | + * |
|
| 8330 | + */ |
|
| 8331 | 8331 | public function countAllArrivalAirportsByIdent($ident,$filters = array()) |
| 8332 | 8332 | { |
| 8333 | 8333 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8359,11 +8359,11 @@ discard block |
||
| 8359 | 8359 | } |
| 8360 | 8360 | |
| 8361 | 8361 | /** |
| 8362 | - * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8363 | - * |
|
| 8364 | - * @return Array the airport list |
|
| 8365 | - * |
|
| 8366 | - */ |
|
| 8362 | + * Gets all arrival airports of the airplanes that have flown over based on a owner |
|
| 8363 | + * |
|
| 8364 | + * @return Array the airport list |
|
| 8365 | + * |
|
| 8366 | + */ |
|
| 8367 | 8367 | public function countAllArrivalAirportsByOwner($owner,$filters = array()) |
| 8368 | 8368 | { |
| 8369 | 8369 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8394,11 +8394,11 @@ discard block |
||
| 8394 | 8394 | } |
| 8395 | 8395 | |
| 8396 | 8396 | /** |
| 8397 | - * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8398 | - * |
|
| 8399 | - * @return Array the airport list |
|
| 8400 | - * |
|
| 8401 | - */ |
|
| 8397 | + * Gets all arrival airports of the airplanes that have flown over based on a pilot |
|
| 8398 | + * |
|
| 8399 | + * @return Array the airport list |
|
| 8400 | + * |
|
| 8401 | + */ |
|
| 8402 | 8402 | public function countAllArrivalAirportsByPilot($pilot,$filters = array()) |
| 8403 | 8403 | { |
| 8404 | 8404 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8429,11 +8429,11 @@ discard block |
||
| 8429 | 8429 | } |
| 8430 | 8430 | |
| 8431 | 8431 | /** |
| 8432 | - * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8433 | - * |
|
| 8434 | - * @return Array the airport list |
|
| 8435 | - * |
|
| 8436 | - */ |
|
| 8432 | + * Gets all arrival airports by country of the airplanes that have flown over based on a callsign/ident |
|
| 8433 | + * |
|
| 8434 | + * @return Array the airport list |
|
| 8435 | + * |
|
| 8436 | + */ |
|
| 8437 | 8437 | public function countAllArrivalAirportCountriesByIdent($ident, $filters = array()) |
| 8438 | 8438 | { |
| 8439 | 8439 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8462,11 +8462,11 @@ discard block |
||
| 8462 | 8462 | } |
| 8463 | 8463 | |
| 8464 | 8464 | /** |
| 8465 | - * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8466 | - * |
|
| 8467 | - * @return Array the airport list |
|
| 8468 | - * |
|
| 8469 | - */ |
|
| 8465 | + * Gets all arrival airports by country of the airplanes that have flown over based on a owner |
|
| 8466 | + * |
|
| 8467 | + * @return Array the airport list |
|
| 8468 | + * |
|
| 8469 | + */ |
|
| 8470 | 8470 | public function countAllArrivalAirportCountriesByOwner($owner, $filters = array()) |
| 8471 | 8471 | { |
| 8472 | 8472 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8482,11 +8482,11 @@ discard block |
||
| 8482 | 8482 | } |
| 8483 | 8483 | |
| 8484 | 8484 | /** |
| 8485 | - * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8486 | - * |
|
| 8487 | - * @return Array the airport list |
|
| 8488 | - * |
|
| 8489 | - */ |
|
| 8485 | + * Gets all arrival airports by country of the airplanes that have flown over based on a pilot |
|
| 8486 | + * |
|
| 8487 | + * @return Array the airport list |
|
| 8488 | + * |
|
| 8489 | + */ |
|
| 8490 | 8490 | public function countAllArrivalAirportCountriesByPilot($pilot, $filters = array()) |
| 8491 | 8491 | { |
| 8492 | 8492 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8504,11 +8504,11 @@ discard block |
||
| 8504 | 8504 | |
| 8505 | 8505 | |
| 8506 | 8506 | /** |
| 8507 | - * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8508 | - * |
|
| 8509 | - * @return Array the airport list |
|
| 8510 | - * |
|
| 8511 | - */ |
|
| 8507 | + * Gets all arrival airports of the airplanes that have flown over based on a country |
|
| 8508 | + * |
|
| 8509 | + * @return Array the airport list |
|
| 8510 | + * |
|
| 8511 | + */ |
|
| 8512 | 8512 | public function countAllArrivalAirportsByCountry($country,$filters = array()) |
| 8513 | 8513 | { |
| 8514 | 8514 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8541,11 +8541,11 @@ discard block |
||
| 8541 | 8541 | |
| 8542 | 8542 | |
| 8543 | 8543 | /** |
| 8544 | - * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8545 | - * |
|
| 8546 | - * @return Array the airport list |
|
| 8547 | - * |
|
| 8548 | - */ |
|
| 8544 | + * Gets all arrival airports by country of the airplanes that have flown over based on a country |
|
| 8545 | + * |
|
| 8546 | + * @return Array the airport list |
|
| 8547 | + * |
|
| 8548 | + */ |
|
| 8549 | 8549 | public function countAllArrivalAirportCountriesByCountry($country,$filters = array()) |
| 8550 | 8550 | { |
| 8551 | 8551 | global $globalDBdriver; |
@@ -8577,11 +8577,11 @@ discard block |
||
| 8577 | 8577 | |
| 8578 | 8578 | |
| 8579 | 8579 | /** |
| 8580 | - * Counts all airport departure countries |
|
| 8581 | - * |
|
| 8582 | - * @return Array the airport departure list |
|
| 8583 | - * |
|
| 8584 | - */ |
|
| 8580 | + * Counts all airport departure countries |
|
| 8581 | + * |
|
| 8582 | + * @return Array the airport departure list |
|
| 8583 | + * |
|
| 8584 | + */ |
|
| 8585 | 8585 | public function countAllDepartureCountries($filters = array(),$year = '',$month = '', $day = '') |
| 8586 | 8586 | { |
| 8587 | 8587 | global $globalDBdriver; |
@@ -8640,11 +8640,11 @@ discard block |
||
| 8640 | 8640 | |
| 8641 | 8641 | |
| 8642 | 8642 | /** |
| 8643 | - * Counts all airport arrival countries |
|
| 8644 | - * |
|
| 8645 | - * @return Array the airport arrival list |
|
| 8646 | - * |
|
| 8647 | - */ |
|
| 8643 | + * Counts all airport arrival countries |
|
| 8644 | + * |
|
| 8645 | + * @return Array the airport arrival list |
|
| 8646 | + * |
|
| 8647 | + */ |
|
| 8648 | 8648 | public function countAllArrivalCountries($limit = true,$filters = array(),$year = '',$month = '',$day = '') |
| 8649 | 8649 | { |
| 8650 | 8650 | global $globalDBdriver; |
@@ -8706,11 +8706,11 @@ discard block |
||
| 8706 | 8706 | |
| 8707 | 8707 | |
| 8708 | 8708 | /** |
| 8709 | - * Gets all route combinations |
|
| 8710 | - * |
|
| 8711 | - * @return Array the route list |
|
| 8712 | - * |
|
| 8713 | - */ |
|
| 8709 | + * Gets all route combinations |
|
| 8710 | + * |
|
| 8711 | + * @return Array the route list |
|
| 8712 | + * |
|
| 8713 | + */ |
|
| 8714 | 8714 | public function countAllRoutes($filters = array()) |
| 8715 | 8715 | { |
| 8716 | 8716 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8749,11 +8749,11 @@ discard block |
||
| 8749 | 8749 | |
| 8750 | 8750 | |
| 8751 | 8751 | /** |
| 8752 | - * Gets all route combinations based on an aircraft |
|
| 8753 | - * |
|
| 8754 | - * @return Array the route list |
|
| 8755 | - * |
|
| 8756 | - */ |
|
| 8752 | + * Gets all route combinations based on an aircraft |
|
| 8753 | + * |
|
| 8754 | + * @return Array the route list |
|
| 8755 | + * |
|
| 8756 | + */ |
|
| 8757 | 8757 | public function countAllRoutesByAircraft($aircraft_icao,$filters = array()) |
| 8758 | 8758 | { |
| 8759 | 8759 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8789,11 +8789,11 @@ discard block |
||
| 8789 | 8789 | |
| 8790 | 8790 | |
| 8791 | 8791 | /** |
| 8792 | - * Gets all route combinations based on an aircraft registration |
|
| 8793 | - * |
|
| 8794 | - * @return Array the route list |
|
| 8795 | - * |
|
| 8796 | - */ |
|
| 8792 | + * Gets all route combinations based on an aircraft registration |
|
| 8793 | + * |
|
| 8794 | + * @return Array the route list |
|
| 8795 | + * |
|
| 8796 | + */ |
|
| 8797 | 8797 | public function countAllRoutesByRegistration($registration, $filters = array()) |
| 8798 | 8798 | { |
| 8799 | 8799 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8831,11 +8831,11 @@ discard block |
||
| 8831 | 8831 | |
| 8832 | 8832 | |
| 8833 | 8833 | /** |
| 8834 | - * Gets all route combinations based on an airline |
|
| 8835 | - * |
|
| 8836 | - * @return Array the route list |
|
| 8837 | - * |
|
| 8838 | - */ |
|
| 8834 | + * Gets all route combinations based on an airline |
|
| 8835 | + * |
|
| 8836 | + * @return Array the route list |
|
| 8837 | + * |
|
| 8838 | + */ |
|
| 8839 | 8839 | public function countAllRoutesByAirline($airline_icao, $filters = array()) |
| 8840 | 8840 | { |
| 8841 | 8841 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8873,11 +8873,11 @@ discard block |
||
| 8873 | 8873 | |
| 8874 | 8874 | |
| 8875 | 8875 | /** |
| 8876 | - * Gets all route combinations based on an airport |
|
| 8877 | - * |
|
| 8878 | - * @return Array the route list |
|
| 8879 | - * |
|
| 8880 | - */ |
|
| 8876 | + * Gets all route combinations based on an airport |
|
| 8877 | + * |
|
| 8878 | + * @return Array the route list |
|
| 8879 | + * |
|
| 8880 | + */ |
|
| 8881 | 8881 | public function countAllRoutesByAirport($airport_icao, $filters = array()) |
| 8882 | 8882 | { |
| 8883 | 8883 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8914,11 +8914,11 @@ discard block |
||
| 8914 | 8914 | |
| 8915 | 8915 | |
| 8916 | 8916 | /** |
| 8917 | - * Gets all route combinations based on an country |
|
| 8918 | - * |
|
| 8919 | - * @return Array the route list |
|
| 8920 | - * |
|
| 8921 | - */ |
|
| 8917 | + * Gets all route combinations based on an country |
|
| 8918 | + * |
|
| 8919 | + * @return Array the route list |
|
| 8920 | + * |
|
| 8921 | + */ |
|
| 8922 | 8922 | public function countAllRoutesByCountry($country, $filters = array()) |
| 8923 | 8923 | { |
| 8924 | 8924 | $filter_query = $this->getFilter($filters,true,true); |
@@ -8954,11 +8954,11 @@ discard block |
||
| 8954 | 8954 | |
| 8955 | 8955 | |
| 8956 | 8956 | /** |
| 8957 | - * Gets all route combinations based on an date |
|
| 8958 | - * |
|
| 8959 | - * @return Array the route list |
|
| 8960 | - * |
|
| 8961 | - */ |
|
| 8957 | + * Gets all route combinations based on an date |
|
| 8958 | + * |
|
| 8959 | + * @return Array the route list |
|
| 8960 | + * |
|
| 8961 | + */ |
|
| 8962 | 8962 | public function countAllRoutesByDate($date, $filters = array()) |
| 8963 | 8963 | { |
| 8964 | 8964 | global $globalTimezone, $globalDBdriver; |
@@ -9008,11 +9008,11 @@ discard block |
||
| 9008 | 9008 | |
| 9009 | 9009 | |
| 9010 | 9010 | /** |
| 9011 | - * Gets all route combinations based on an ident/callsign |
|
| 9012 | - * |
|
| 9013 | - * @return Array the route list |
|
| 9014 | - * |
|
| 9015 | - */ |
|
| 9011 | + * Gets all route combinations based on an ident/callsign |
|
| 9012 | + * |
|
| 9013 | + * @return Array the route list |
|
| 9014 | + * |
|
| 9015 | + */ |
|
| 9016 | 9016 | public function countAllRoutesByIdent($ident, $filters = array()) |
| 9017 | 9017 | { |
| 9018 | 9018 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9048,11 +9048,11 @@ discard block |
||
| 9048 | 9048 | } |
| 9049 | 9049 | |
| 9050 | 9050 | /** |
| 9051 | - * Gets all route combinations based on an owner |
|
| 9052 | - * |
|
| 9053 | - * @return Array the route list |
|
| 9054 | - * |
|
| 9055 | - */ |
|
| 9051 | + * Gets all route combinations based on an owner |
|
| 9052 | + * |
|
| 9053 | + * @return Array the route list |
|
| 9054 | + * |
|
| 9055 | + */ |
|
| 9056 | 9056 | public function countAllRoutesByOwner($owner,$filters = array()) |
| 9057 | 9057 | { |
| 9058 | 9058 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9088,11 +9088,11 @@ discard block |
||
| 9088 | 9088 | } |
| 9089 | 9089 | |
| 9090 | 9090 | /** |
| 9091 | - * Gets all route combinations based on a pilot |
|
| 9092 | - * |
|
| 9093 | - * @return Array the route list |
|
| 9094 | - * |
|
| 9095 | - */ |
|
| 9091 | + * Gets all route combinations based on a pilot |
|
| 9092 | + * |
|
| 9093 | + * @return Array the route list |
|
| 9094 | + * |
|
| 9095 | + */ |
|
| 9096 | 9096 | public function countAllRoutesByPilot($pilot,$filters = array()) |
| 9097 | 9097 | { |
| 9098 | 9098 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9129,11 +9129,11 @@ discard block |
||
| 9129 | 9129 | |
| 9130 | 9130 | |
| 9131 | 9131 | /** |
| 9132 | - * Gets all route combinations based on an manufacturer |
|
| 9133 | - * |
|
| 9134 | - * @return Array the route list |
|
| 9135 | - * |
|
| 9136 | - */ |
|
| 9132 | + * Gets all route combinations based on an manufacturer |
|
| 9133 | + * |
|
| 9134 | + * @return Array the route list |
|
| 9135 | + * |
|
| 9136 | + */ |
|
| 9137 | 9137 | public function countAllRoutesByManufacturer($aircraft_manufacturer, $filters = array()) |
| 9138 | 9138 | { |
| 9139 | 9139 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9171,11 +9171,11 @@ discard block |
||
| 9171 | 9171 | |
| 9172 | 9172 | |
| 9173 | 9173 | /** |
| 9174 | - * Gets all route combinations with waypoints |
|
| 9175 | - * |
|
| 9176 | - * @return Array the route list |
|
| 9177 | - * |
|
| 9178 | - */ |
|
| 9174 | + * Gets all route combinations with waypoints |
|
| 9175 | + * |
|
| 9176 | + * @return Array the route list |
|
| 9177 | + * |
|
| 9178 | + */ |
|
| 9179 | 9179 | public function countAllRoutesWithWaypoints($filters = array()) |
| 9180 | 9180 | { |
| 9181 | 9181 | $filter_query = $this->getFilter($filters,true,true); |
@@ -9212,11 +9212,11 @@ discard block |
||
| 9212 | 9212 | } |
| 9213 | 9213 | |
| 9214 | 9214 | /** |
| 9215 | - * Gets all callsigns that have flown over |
|
| 9216 | - * |
|
| 9217 | - * @return Array the callsign list |
|
| 9218 | - * |
|
| 9219 | - */ |
|
| 9215 | + * Gets all callsigns that have flown over |
|
| 9216 | + * |
|
| 9217 | + * @return Array the callsign list |
|
| 9218 | + * |
|
| 9219 | + */ |
|
| 9220 | 9220 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 9221 | 9221 | { |
| 9222 | 9222 | global $globalDBdriver; |
@@ -9282,11 +9282,11 @@ discard block |
||
| 9282 | 9282 | } |
| 9283 | 9283 | |
| 9284 | 9284 | /** |
| 9285 | - * Gets all callsigns that have flown over |
|
| 9286 | - * |
|
| 9287 | - * @return Array the callsign list |
|
| 9288 | - * |
|
| 9289 | - */ |
|
| 9285 | + * Gets all callsigns that have flown over |
|
| 9286 | + * |
|
| 9287 | + * @return Array the callsign list |
|
| 9288 | + * |
|
| 9289 | + */ |
|
| 9290 | 9290 | public function countAllCallsignsByAirlines($limit = true, $olderthanmonths = 0, $sincedate = '', $filters = array()) |
| 9291 | 9291 | { |
| 9292 | 9292 | global $globalDBdriver; |
@@ -9327,11 +9327,11 @@ discard block |
||
| 9327 | 9327 | |
| 9328 | 9328 | |
| 9329 | 9329 | /** |
| 9330 | - * Counts all dates |
|
| 9331 | - * |
|
| 9332 | - * @return Array the date list |
|
| 9333 | - * |
|
| 9334 | - */ |
|
| 9330 | + * Counts all dates |
|
| 9331 | + * |
|
| 9332 | + * @return Array the date list |
|
| 9333 | + * |
|
| 9334 | + */ |
|
| 9335 | 9335 | public function countAllDates($filters = array()) |
| 9336 | 9336 | { |
| 9337 | 9337 | global $globalTimezone, $globalDBdriver; |
@@ -9376,11 +9376,11 @@ discard block |
||
| 9376 | 9376 | } |
| 9377 | 9377 | |
| 9378 | 9378 | /** |
| 9379 | - * Counts all dates |
|
| 9380 | - * |
|
| 9381 | - * @return Array the date list |
|
| 9382 | - * |
|
| 9383 | - */ |
|
| 9379 | + * Counts all dates |
|
| 9380 | + * |
|
| 9381 | + * @return Array the date list |
|
| 9382 | + * |
|
| 9383 | + */ |
|
| 9384 | 9384 | public function countAllDatesByAirlines($filters = array()) |
| 9385 | 9385 | { |
| 9386 | 9386 | global $globalTimezone, $globalDBdriver; |
@@ -9425,11 +9425,11 @@ discard block |
||
| 9425 | 9425 | } |
| 9426 | 9426 | |
| 9427 | 9427 | /** |
| 9428 | - * Counts all dates during the last 7 days |
|
| 9429 | - * |
|
| 9430 | - * @return Array the date list |
|
| 9431 | - * |
|
| 9432 | - */ |
|
| 9428 | + * Counts all dates during the last 7 days |
|
| 9429 | + * |
|
| 9430 | + * @return Array the date list |
|
| 9431 | + * |
|
| 9432 | + */ |
|
| 9433 | 9433 | public function countAllDatesLast7Days($filters = array()) |
| 9434 | 9434 | { |
| 9435 | 9435 | global $globalTimezone, $globalDBdriver; |
@@ -9451,7 +9451,7 @@ discard block |
||
| 9451 | 9451 | $query .= " GROUP BY date_name |
| 9452 | 9452 | ORDER BY date_name ASC"; |
| 9453 | 9453 | $query_data = array(':offset' => $offset); |
| 9454 | - } |
|
| 9454 | + } |
|
| 9455 | 9455 | |
| 9456 | 9456 | $sth = $this->db->prepare($query); |
| 9457 | 9457 | $sth->execute($query_data); |
@@ -9471,11 +9471,11 @@ discard block |
||
| 9471 | 9471 | } |
| 9472 | 9472 | |
| 9473 | 9473 | /** |
| 9474 | - * Counts all dates during the last month |
|
| 9475 | - * |
|
| 9476 | - * @return Array the date list |
|
| 9477 | - * |
|
| 9478 | - */ |
|
| 9474 | + * Counts all dates during the last month |
|
| 9475 | + * |
|
| 9476 | + * @return Array the date list |
|
| 9477 | + * |
|
| 9478 | + */ |
|
| 9479 | 9479 | public function countAllDatesLastMonth($filters = array()) |
| 9480 | 9480 | { |
| 9481 | 9481 | global $globalTimezone, $globalDBdriver; |
@@ -9497,7 +9497,7 @@ discard block |
||
| 9497 | 9497 | $query .= " GROUP BY date_name |
| 9498 | 9498 | ORDER BY date_name ASC"; |
| 9499 | 9499 | $query_data = array(':offset' => $offset); |
| 9500 | - } |
|
| 9500 | + } |
|
| 9501 | 9501 | |
| 9502 | 9502 | $sth = $this->db->prepare($query); |
| 9503 | 9503 | $sth->execute($query_data); |
@@ -9518,11 +9518,11 @@ discard block |
||
| 9518 | 9518 | |
| 9519 | 9519 | |
| 9520 | 9520 | /** |
| 9521 | - * Counts all dates during the last month |
|
| 9522 | - * |
|
| 9523 | - * @return Array the date list |
|
| 9524 | - * |
|
| 9525 | - */ |
|
| 9521 | + * Counts all dates during the last month |
|
| 9522 | + * |
|
| 9523 | + * @return Array the date list |
|
| 9524 | + * |
|
| 9525 | + */ |
|
| 9526 | 9526 | public function countAllDatesLastMonthByAirlines($filters = array()) |
| 9527 | 9527 | { |
| 9528 | 9528 | global $globalTimezone, $globalDBdriver; |
@@ -9545,7 +9545,7 @@ discard block |
||
| 9545 | 9545 | GROUP BY spotter_output.airline_icao, date_name |
| 9546 | 9546 | ORDER BY date_name ASC"; |
| 9547 | 9547 | $query_data = array(':offset' => $offset); |
| 9548 | - } |
|
| 9548 | + } |
|
| 9549 | 9549 | |
| 9550 | 9550 | $sth = $this->db->prepare($query); |
| 9551 | 9551 | $sth->execute($query_data); |
@@ -9567,11 +9567,11 @@ discard block |
||
| 9567 | 9567 | |
| 9568 | 9568 | |
| 9569 | 9569 | /** |
| 9570 | - * Counts all month |
|
| 9571 | - * |
|
| 9572 | - * @return Array the month list |
|
| 9573 | - * |
|
| 9574 | - */ |
|
| 9570 | + * Counts all month |
|
| 9571 | + * |
|
| 9572 | + * @return Array the month list |
|
| 9573 | + * |
|
| 9574 | + */ |
|
| 9575 | 9575 | public function countAllMonths($filters = array()) |
| 9576 | 9576 | { |
| 9577 | 9577 | global $globalTimezone, $globalDBdriver; |
@@ -9613,11 +9613,11 @@ discard block |
||
| 9613 | 9613 | } |
| 9614 | 9614 | |
| 9615 | 9615 | /** |
| 9616 | - * Counts all month |
|
| 9617 | - * |
|
| 9618 | - * @return Array the month list |
|
| 9619 | - * |
|
| 9620 | - */ |
|
| 9616 | + * Counts all month |
|
| 9617 | + * |
|
| 9618 | + * @return Array the month list |
|
| 9619 | + * |
|
| 9620 | + */ |
|
| 9621 | 9621 | public function countAllMonthsByAirlines($filters = array()) |
| 9622 | 9622 | { |
| 9623 | 9623 | global $globalTimezone, $globalDBdriver; |
@@ -9662,11 +9662,11 @@ discard block |
||
| 9662 | 9662 | } |
| 9663 | 9663 | |
| 9664 | 9664 | /** |
| 9665 | - * Counts all military month |
|
| 9666 | - * |
|
| 9667 | - * @return Array the month list |
|
| 9668 | - * |
|
| 9669 | - */ |
|
| 9665 | + * Counts all military month |
|
| 9666 | + * |
|
| 9667 | + * @return Array the month list |
|
| 9668 | + * |
|
| 9669 | + */ |
|
| 9670 | 9670 | public function countAllMilitaryMonths($filters = array()) |
| 9671 | 9671 | { |
| 9672 | 9672 | global $globalTimezone, $globalDBdriver; |
@@ -9707,11 +9707,11 @@ discard block |
||
| 9707 | 9707 | } |
| 9708 | 9708 | |
| 9709 | 9709 | /** |
| 9710 | - * Counts all month owners |
|
| 9711 | - * |
|
| 9712 | - * @return Array the month list |
|
| 9713 | - * |
|
| 9714 | - */ |
|
| 9710 | + * Counts all month owners |
|
| 9711 | + * |
|
| 9712 | + * @return Array the month list |
|
| 9713 | + * |
|
| 9714 | + */ |
|
| 9715 | 9715 | public function countAllMonthsOwners($filters = array()) |
| 9716 | 9716 | { |
| 9717 | 9717 | global $globalTimezone, $globalDBdriver; |
@@ -9753,11 +9753,11 @@ discard block |
||
| 9753 | 9753 | } |
| 9754 | 9754 | |
| 9755 | 9755 | /** |
| 9756 | - * Counts all month owners |
|
| 9757 | - * |
|
| 9758 | - * @return Array the month list |
|
| 9759 | - * |
|
| 9760 | - */ |
|
| 9756 | + * Counts all month owners |
|
| 9757 | + * |
|
| 9758 | + * @return Array the month list |
|
| 9759 | + * |
|
| 9760 | + */ |
|
| 9761 | 9761 | public function countAllMonthsOwnersByAirlines($filters = array()) |
| 9762 | 9762 | { |
| 9763 | 9763 | global $globalTimezone, $globalDBdriver; |
@@ -9800,11 +9800,11 @@ discard block |
||
| 9800 | 9800 | } |
| 9801 | 9801 | |
| 9802 | 9802 | /** |
| 9803 | - * Counts all month pilot |
|
| 9804 | - * |
|
| 9805 | - * @return Array the month list |
|
| 9806 | - * |
|
| 9807 | - */ |
|
| 9803 | + * Counts all month pilot |
|
| 9804 | + * |
|
| 9805 | + * @return Array the month list |
|
| 9806 | + * |
|
| 9807 | + */ |
|
| 9808 | 9808 | public function countAllMonthsPilots($filters = array()) |
| 9809 | 9809 | { |
| 9810 | 9810 | global $globalTimezone, $globalDBdriver; |
@@ -9846,11 +9846,11 @@ discard block |
||
| 9846 | 9846 | } |
| 9847 | 9847 | |
| 9848 | 9848 | /** |
| 9849 | - * Counts all month pilot |
|
| 9850 | - * |
|
| 9851 | - * @return Array the month list |
|
| 9852 | - * |
|
| 9853 | - */ |
|
| 9849 | + * Counts all month pilot |
|
| 9850 | + * |
|
| 9851 | + * @return Array the month list |
|
| 9852 | + * |
|
| 9853 | + */ |
|
| 9854 | 9854 | public function countAllMonthsPilotsByAirlines($filters = array()) |
| 9855 | 9855 | { |
| 9856 | 9856 | global $globalTimezone, $globalDBdriver; |
@@ -9893,11 +9893,11 @@ discard block |
||
| 9893 | 9893 | } |
| 9894 | 9894 | |
| 9895 | 9895 | /** |
| 9896 | - * Counts all month airline |
|
| 9897 | - * |
|
| 9898 | - * @return Array the month list |
|
| 9899 | - * |
|
| 9900 | - */ |
|
| 9896 | + * Counts all month airline |
|
| 9897 | + * |
|
| 9898 | + * @return Array the month list |
|
| 9899 | + * |
|
| 9900 | + */ |
|
| 9901 | 9901 | public function countAllMonthsAirlines($filters = array()) |
| 9902 | 9902 | { |
| 9903 | 9903 | global $globalTimezone, $globalDBdriver; |
@@ -9939,11 +9939,11 @@ discard block |
||
| 9939 | 9939 | } |
| 9940 | 9940 | |
| 9941 | 9941 | /** |
| 9942 | - * Counts all month aircraft |
|
| 9943 | - * |
|
| 9944 | - * @return Array the month list |
|
| 9945 | - * |
|
| 9946 | - */ |
|
| 9942 | + * Counts all month aircraft |
|
| 9943 | + * |
|
| 9944 | + * @return Array the month list |
|
| 9945 | + * |
|
| 9946 | + */ |
|
| 9947 | 9947 | public function countAllMonthsAircrafts($filters = array()) |
| 9948 | 9948 | { |
| 9949 | 9949 | global $globalTimezone, $globalDBdriver; |
@@ -9986,11 +9986,11 @@ discard block |
||
| 9986 | 9986 | |
| 9987 | 9987 | |
| 9988 | 9988 | /** |
| 9989 | - * Counts all month aircraft |
|
| 9990 | - * |
|
| 9991 | - * @return Array the month list |
|
| 9992 | - * |
|
| 9993 | - */ |
|
| 9989 | + * Counts all month aircraft |
|
| 9990 | + * |
|
| 9991 | + * @return Array the month list |
|
| 9992 | + * |
|
| 9993 | + */ |
|
| 9994 | 9994 | public function countAllMonthsAircraftsByAirlines($filters = array()) |
| 9995 | 9995 | { |
| 9996 | 9996 | global $globalTimezone, $globalDBdriver; |
@@ -10033,11 +10033,11 @@ discard block |
||
| 10033 | 10033 | } |
| 10034 | 10034 | |
| 10035 | 10035 | /** |
| 10036 | - * Counts all month real arrival |
|
| 10037 | - * |
|
| 10038 | - * @return Array the month list |
|
| 10039 | - * |
|
| 10040 | - */ |
|
| 10036 | + * Counts all month real arrival |
|
| 10037 | + * |
|
| 10038 | + * @return Array the month list |
|
| 10039 | + * |
|
| 10040 | + */ |
|
| 10041 | 10041 | public function countAllMonthsRealArrivals($filters = array()) |
| 10042 | 10042 | { |
| 10043 | 10043 | global $globalTimezone, $globalDBdriver; |
@@ -10080,11 +10080,11 @@ discard block |
||
| 10080 | 10080 | |
| 10081 | 10081 | |
| 10082 | 10082 | /** |
| 10083 | - * Counts all month real arrival |
|
| 10084 | - * |
|
| 10085 | - * @return Array the month list |
|
| 10086 | - * |
|
| 10087 | - */ |
|
| 10083 | + * Counts all month real arrival |
|
| 10084 | + * |
|
| 10085 | + * @return Array the month list |
|
| 10086 | + * |
|
| 10087 | + */ |
|
| 10088 | 10088 | public function countAllMonthsRealArrivalsByAirlines($filters = array()) |
| 10089 | 10089 | { |
| 10090 | 10090 | global $globalTimezone, $globalDBdriver; |
@@ -10128,11 +10128,11 @@ discard block |
||
| 10128 | 10128 | |
| 10129 | 10129 | |
| 10130 | 10130 | /** |
| 10131 | - * Counts all dates during the last year |
|
| 10132 | - * |
|
| 10133 | - * @return Array the date list |
|
| 10134 | - * |
|
| 10135 | - */ |
|
| 10131 | + * Counts all dates during the last year |
|
| 10132 | + * |
|
| 10133 | + * @return Array the date list |
|
| 10134 | + * |
|
| 10135 | + */ |
|
| 10136 | 10136 | public function countAllMonthsLastYear($filters) |
| 10137 | 10137 | { |
| 10138 | 10138 | global $globalTimezone, $globalDBdriver; |
@@ -10154,7 +10154,7 @@ discard block |
||
| 10154 | 10154 | $query .= " GROUP BY year_name, month_name |
| 10155 | 10155 | ORDER BY year_name, month_name ASC"; |
| 10156 | 10156 | $query_data = array(':offset' => $offset); |
| 10157 | - } |
|
| 10157 | + } |
|
| 10158 | 10158 | |
| 10159 | 10159 | $sth = $this->db->prepare($query); |
| 10160 | 10160 | $sth->execute($query_data); |
@@ -10177,11 +10177,11 @@ discard block |
||
| 10177 | 10177 | |
| 10178 | 10178 | |
| 10179 | 10179 | /** |
| 10180 | - * Counts all hours |
|
| 10181 | - * |
|
| 10182 | - * @return Array the hour list |
|
| 10183 | - * |
|
| 10184 | - */ |
|
| 10180 | + * Counts all hours |
|
| 10181 | + * |
|
| 10182 | + * @return Array the hour list |
|
| 10183 | + * |
|
| 10184 | + */ |
|
| 10185 | 10185 | public function countAllHours($orderby,$filters = array()) |
| 10186 | 10186 | { |
| 10187 | 10187 | global $globalTimezone, $globalDBdriver; |
@@ -10242,11 +10242,11 @@ discard block |
||
| 10242 | 10242 | } |
| 10243 | 10243 | |
| 10244 | 10244 | /** |
| 10245 | - * Counts all hours |
|
| 10246 | - * |
|
| 10247 | - * @return Array the hour list |
|
| 10248 | - * |
|
| 10249 | - */ |
|
| 10245 | + * Counts all hours |
|
| 10246 | + * |
|
| 10247 | + * @return Array the hour list |
|
| 10248 | + * |
|
| 10249 | + */ |
|
| 10250 | 10250 | public function countAllHoursByAirlines($orderby, $filters = array()) |
| 10251 | 10251 | { |
| 10252 | 10252 | global $globalTimezone, $globalDBdriver; |
@@ -10309,11 +10309,11 @@ discard block |
||
| 10309 | 10309 | |
| 10310 | 10310 | |
| 10311 | 10311 | /** |
| 10312 | - * Counts all hours by airline |
|
| 10313 | - * |
|
| 10314 | - * @return Array the hour list |
|
| 10315 | - * |
|
| 10316 | - */ |
|
| 10312 | + * Counts all hours by airline |
|
| 10313 | + * |
|
| 10314 | + * @return Array the hour list |
|
| 10315 | + * |
|
| 10316 | + */ |
|
| 10317 | 10317 | public function countAllHoursByAirline($airline_icao, $filters = array()) |
| 10318 | 10318 | { |
| 10319 | 10319 | global $globalTimezone, $globalDBdriver; |
@@ -10359,11 +10359,11 @@ discard block |
||
| 10359 | 10359 | |
| 10360 | 10360 | |
| 10361 | 10361 | /** |
| 10362 | - * Counts all hours by aircraft |
|
| 10363 | - * |
|
| 10364 | - * @return Array the hour list |
|
| 10365 | - * |
|
| 10366 | - */ |
|
| 10362 | + * Counts all hours by aircraft |
|
| 10363 | + * |
|
| 10364 | + * @return Array the hour list |
|
| 10365 | + * |
|
| 10366 | + */ |
|
| 10367 | 10367 | public function countAllHoursByAircraft($aircraft_icao, $filters = array()) |
| 10368 | 10368 | { |
| 10369 | 10369 | global $globalTimezone, $globalDBdriver; |
@@ -10406,11 +10406,11 @@ discard block |
||
| 10406 | 10406 | |
| 10407 | 10407 | |
| 10408 | 10408 | /** |
| 10409 | - * Counts all hours by aircraft registration |
|
| 10410 | - * |
|
| 10411 | - * @return Array the hour list |
|
| 10412 | - * |
|
| 10413 | - */ |
|
| 10409 | + * Counts all hours by aircraft registration |
|
| 10410 | + * |
|
| 10411 | + * @return Array the hour list |
|
| 10412 | + * |
|
| 10413 | + */ |
|
| 10414 | 10414 | public function countAllHoursByRegistration($registration, $filters = array()) |
| 10415 | 10415 | { |
| 10416 | 10416 | global $globalTimezone, $globalDBdriver; |
@@ -10453,11 +10453,11 @@ discard block |
||
| 10453 | 10453 | |
| 10454 | 10454 | |
| 10455 | 10455 | /** |
| 10456 | - * Counts all hours by airport |
|
| 10457 | - * |
|
| 10458 | - * @return Array the hour list |
|
| 10459 | - * |
|
| 10460 | - */ |
|
| 10456 | + * Counts all hours by airport |
|
| 10457 | + * |
|
| 10458 | + * @return Array the hour list |
|
| 10459 | + * |
|
| 10460 | + */ |
|
| 10461 | 10461 | public function countAllHoursByAirport($airport_icao, $filters = array()) |
| 10462 | 10462 | { |
| 10463 | 10463 | global $globalTimezone, $globalDBdriver; |
@@ -10501,11 +10501,11 @@ discard block |
||
| 10501 | 10501 | |
| 10502 | 10502 | |
| 10503 | 10503 | /** |
| 10504 | - * Counts all hours by manufacturer |
|
| 10505 | - * |
|
| 10506 | - * @return Array the hour list |
|
| 10507 | - * |
|
| 10508 | - */ |
|
| 10504 | + * Counts all hours by manufacturer |
|
| 10505 | + * |
|
| 10506 | + * @return Array the hour list |
|
| 10507 | + * |
|
| 10508 | + */ |
|
| 10509 | 10509 | public function countAllHoursByManufacturer($aircraft_manufacturer,$filters =array()) |
| 10510 | 10510 | { |
| 10511 | 10511 | global $globalTimezone, $globalDBdriver; |
@@ -10549,11 +10549,11 @@ discard block |
||
| 10549 | 10549 | |
| 10550 | 10550 | |
| 10551 | 10551 | /** |
| 10552 | - * Counts all hours by date |
|
| 10553 | - * |
|
| 10554 | - * @return Array the hour list |
|
| 10555 | - * |
|
| 10556 | - */ |
|
| 10552 | + * Counts all hours by date |
|
| 10553 | + * |
|
| 10554 | + * @return Array the hour list |
|
| 10555 | + * |
|
| 10556 | + */ |
|
| 10557 | 10557 | public function countAllHoursByDate($date, $filters = array()) |
| 10558 | 10558 | { |
| 10559 | 10559 | global $globalTimezone, $globalDBdriver; |
@@ -10597,11 +10597,11 @@ discard block |
||
| 10597 | 10597 | |
| 10598 | 10598 | |
| 10599 | 10599 | /** |
| 10600 | - * Counts all hours by a ident/callsign |
|
| 10601 | - * |
|
| 10602 | - * @return Array the hour list |
|
| 10603 | - * |
|
| 10604 | - */ |
|
| 10600 | + * Counts all hours by a ident/callsign |
|
| 10601 | + * |
|
| 10602 | + * @return Array the hour list |
|
| 10603 | + * |
|
| 10604 | + */ |
|
| 10605 | 10605 | public function countAllHoursByIdent($ident, $filters = array()) |
| 10606 | 10606 | { |
| 10607 | 10607 | global $globalTimezone, $globalDBdriver; |
@@ -10644,11 +10644,11 @@ discard block |
||
| 10644 | 10644 | } |
| 10645 | 10645 | |
| 10646 | 10646 | /** |
| 10647 | - * Counts all hours by a owner |
|
| 10648 | - * |
|
| 10649 | - * @return Array the hour list |
|
| 10650 | - * |
|
| 10651 | - */ |
|
| 10647 | + * Counts all hours by a owner |
|
| 10648 | + * |
|
| 10649 | + * @return Array the hour list |
|
| 10650 | + * |
|
| 10651 | + */ |
|
| 10652 | 10652 | public function countAllHoursByOwner($owner, $filters = array()) |
| 10653 | 10653 | { |
| 10654 | 10654 | global $globalTimezone, $globalDBdriver; |
@@ -10691,11 +10691,11 @@ discard block |
||
| 10691 | 10691 | } |
| 10692 | 10692 | |
| 10693 | 10693 | /** |
| 10694 | - * Counts all hours by a pilot |
|
| 10695 | - * |
|
| 10696 | - * @return Array the hour list |
|
| 10697 | - * |
|
| 10698 | - */ |
|
| 10694 | + * Counts all hours by a pilot |
|
| 10695 | + * |
|
| 10696 | + * @return Array the hour list |
|
| 10697 | + * |
|
| 10698 | + */ |
|
| 10699 | 10699 | public function countAllHoursByPilot($pilot, $filters = array()) |
| 10700 | 10700 | { |
| 10701 | 10701 | global $globalTimezone, $globalDBdriver; |
@@ -10740,11 +10740,11 @@ discard block |
||
| 10740 | 10740 | |
| 10741 | 10741 | |
| 10742 | 10742 | /** |
| 10743 | - * Counts all hours by route |
|
| 10744 | - * |
|
| 10745 | - * @return Array the hour list |
|
| 10746 | - * |
|
| 10747 | - */ |
|
| 10743 | + * Counts all hours by route |
|
| 10744 | + * |
|
| 10745 | + * @return Array the hour list |
|
| 10746 | + * |
|
| 10747 | + */ |
|
| 10748 | 10748 | public function countAllHoursByRoute($departure_airport_icao, $arrival_airport_icao, $filters =array()) |
| 10749 | 10749 | { |
| 10750 | 10750 | global $globalTimezone, $globalDBdriver; |
@@ -10788,11 +10788,11 @@ discard block |
||
| 10788 | 10788 | |
| 10789 | 10789 | |
| 10790 | 10790 | /** |
| 10791 | - * Counts all hours by country |
|
| 10792 | - * |
|
| 10793 | - * @return Array the hour list |
|
| 10794 | - * |
|
| 10795 | - */ |
|
| 10791 | + * Counts all hours by country |
|
| 10792 | + * |
|
| 10793 | + * @return Array the hour list |
|
| 10794 | + * |
|
| 10795 | + */ |
|
| 10796 | 10796 | public function countAllHoursByCountry($country, $filters = array()) |
| 10797 | 10797 | { |
| 10798 | 10798 | global $globalTimezone, $globalDBdriver; |
@@ -10837,11 +10837,11 @@ discard block |
||
| 10837 | 10837 | |
| 10838 | 10838 | |
| 10839 | 10839 | /** |
| 10840 | - * Counts all aircraft that have flown over |
|
| 10841 | - * |
|
| 10842 | - * @return Integer the number of aircrafts |
|
| 10843 | - * |
|
| 10844 | - */ |
|
| 10840 | + * Counts all aircraft that have flown over |
|
| 10841 | + * |
|
| 10842 | + * @return Integer the number of aircrafts |
|
| 10843 | + * |
|
| 10844 | + */ |
|
| 10845 | 10845 | public function countOverallAircrafts($filters = array(),$year = '',$month = '') |
| 10846 | 10846 | { |
| 10847 | 10847 | global $globalDBdriver; |
@@ -10874,11 +10874,11 @@ discard block |
||
| 10874 | 10874 | } |
| 10875 | 10875 | |
| 10876 | 10876 | /** |
| 10877 | - * Counts all flight that really arrival |
|
| 10878 | - * |
|
| 10879 | - * @return Integer the number of aircrafts |
|
| 10880 | - * |
|
| 10881 | - */ |
|
| 10877 | + * Counts all flight that really arrival |
|
| 10878 | + * |
|
| 10879 | + * @return Integer the number of aircrafts |
|
| 10880 | + * |
|
| 10881 | + */ |
|
| 10882 | 10882 | public function countOverallArrival($filters = array(),$year = '',$month = '') |
| 10883 | 10883 | { |
| 10884 | 10884 | global $globalDBdriver; |
@@ -10911,11 +10911,11 @@ discard block |
||
| 10911 | 10911 | } |
| 10912 | 10912 | |
| 10913 | 10913 | /** |
| 10914 | - * Counts all pilots that have flown over |
|
| 10915 | - * |
|
| 10916 | - * @return Integer the number of pilots |
|
| 10917 | - * |
|
| 10918 | - */ |
|
| 10914 | + * Counts all pilots that have flown over |
|
| 10915 | + * |
|
| 10916 | + * @return Integer the number of pilots |
|
| 10917 | + * |
|
| 10918 | + */ |
|
| 10919 | 10919 | public function countOverallPilots($filters = array(),$year = '',$month = '') |
| 10920 | 10920 | { |
| 10921 | 10921 | global $globalDBdriver; |
@@ -10947,11 +10947,11 @@ discard block |
||
| 10947 | 10947 | } |
| 10948 | 10948 | |
| 10949 | 10949 | /** |
| 10950 | - * Counts all owners that have flown over |
|
| 10951 | - * |
|
| 10952 | - * @return Integer the number of owners |
|
| 10953 | - * |
|
| 10954 | - */ |
|
| 10950 | + * Counts all owners that have flown over |
|
| 10951 | + * |
|
| 10952 | + * @return Integer the number of owners |
|
| 10953 | + * |
|
| 10954 | + */ |
|
| 10955 | 10955 | public function countOverallOwners($filters = array(),$year = '',$month = '') |
| 10956 | 10956 | { |
| 10957 | 10957 | global $globalDBdriver; |
@@ -10984,11 +10984,11 @@ discard block |
||
| 10984 | 10984 | |
| 10985 | 10985 | |
| 10986 | 10986 | /** |
| 10987 | - * Counts all flights that have flown over |
|
| 10988 | - * |
|
| 10989 | - * @return Integer the number of flights |
|
| 10990 | - * |
|
| 10991 | - */ |
|
| 10987 | + * Counts all flights that have flown over |
|
| 10988 | + * |
|
| 10989 | + * @return Integer the number of flights |
|
| 10990 | + * |
|
| 10991 | + */ |
|
| 10992 | 10992 | public function countOverallFlights($filters = array(),$year = '',$month = '') |
| 10993 | 10993 | { |
| 10994 | 10994 | global $globalDBdriver; |
@@ -11022,11 +11022,11 @@ discard block |
||
| 11022 | 11022 | } |
| 11023 | 11023 | |
| 11024 | 11024 | /** |
| 11025 | - * Counts all military flights that have flown over |
|
| 11026 | - * |
|
| 11027 | - * @return Integer the number of flights |
|
| 11028 | - * |
|
| 11029 | - */ |
|
| 11025 | + * Counts all military flights that have flown over |
|
| 11026 | + * |
|
| 11027 | + * @return Integer the number of flights |
|
| 11028 | + * |
|
| 11029 | + */ |
|
| 11030 | 11030 | public function countOverallMilitaryFlights($filters = array(),$year = '',$month = '') |
| 11031 | 11031 | { |
| 11032 | 11032 | global $globalDBdriver; |
@@ -11061,11 +11061,11 @@ discard block |
||
| 11061 | 11061 | |
| 11062 | 11062 | |
| 11063 | 11063 | /** |
| 11064 | - * Counts all airlines that have flown over |
|
| 11065 | - * |
|
| 11066 | - * @return Integer the number of airlines |
|
| 11067 | - * |
|
| 11068 | - */ |
|
| 11064 | + * Counts all airlines that have flown over |
|
| 11065 | + * |
|
| 11066 | + * @return Integer the number of airlines |
|
| 11067 | + * |
|
| 11068 | + */ |
|
| 11069 | 11069 | public function countOverallAirlines($filters = array(),$year = '',$month = '') |
| 11070 | 11070 | { |
| 11071 | 11071 | global $globalDBdriver; |
@@ -11092,8 +11092,8 @@ discard block |
||
| 11092 | 11092 | $query_values = array_merge($query_values,array(':month' => $month)); |
| 11093 | 11093 | } |
| 11094 | 11094 | } |
| 11095 | - if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11096 | - else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11095 | + if ($query == '') $queryi .= $this->getFilter($filters); |
|
| 11096 | + else $queryi .= $this->getFilter($filters,true,true).substr($query,4); |
|
| 11097 | 11097 | |
| 11098 | 11098 | |
| 11099 | 11099 | $sth = $this->db->prepare($queryi); |
@@ -11103,11 +11103,11 @@ discard block |
||
| 11103 | 11103 | |
| 11104 | 11104 | |
| 11105 | 11105 | /** |
| 11106 | - * Counts all hours of today |
|
| 11107 | - * |
|
| 11108 | - * @return Array the hour list |
|
| 11109 | - * |
|
| 11110 | - */ |
|
| 11106 | + * Counts all hours of today |
|
| 11107 | + * |
|
| 11108 | + * @return Array the hour list |
|
| 11109 | + * |
|
| 11110 | + */ |
|
| 11111 | 11111 | public function countAllHoursFromToday($filters = array()) |
| 11112 | 11112 | { |
| 11113 | 11113 | global $globalTimezone, $globalDBdriver; |
@@ -11147,11 +11147,11 @@ discard block |
||
| 11147 | 11147 | } |
| 11148 | 11148 | |
| 11149 | 11149 | /** |
| 11150 | - * Gets all the spotter information based on calculated upcoming flights |
|
| 11151 | - * |
|
| 11152 | - * @return Array the spotter information |
|
| 11153 | - * |
|
| 11154 | - */ |
|
| 11150 | + * Gets all the spotter information based on calculated upcoming flights |
|
| 11151 | + * |
|
| 11152 | + * @return Array the spotter information |
|
| 11153 | + * |
|
| 11154 | + */ |
|
| 11155 | 11155 | public function getUpcomingFlights($limit = '', $sort = '', $filters = array()) |
| 11156 | 11156 | { |
| 11157 | 11157 | global $global_query, $globalDBdriver, $globalTimezone; |
@@ -11226,12 +11226,12 @@ discard block |
||
| 11226 | 11226 | } |
| 11227 | 11227 | |
| 11228 | 11228 | |
| 11229 | - /** |
|
| 11230 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11231 | - * |
|
| 11232 | - * @return Integer the Barrie Spotter ID |
|
| 11229 | + /** |
|
| 11230 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 11231 | + * |
|
| 11232 | + * @return Integer the Barrie Spotter ID |
|
| 11233 | 11233 | q * |
| 11234 | - */ |
|
| 11234 | + */ |
|
| 11235 | 11235 | public function getSpotterIDBasedOnFlightAwareID($flightaware_id) |
| 11236 | 11236 | { |
| 11237 | 11237 | $flightaware_id = filter_var($flightaware_id,FILTER_SANITIZE_STRING); |
@@ -11252,13 +11252,13 @@ discard block |
||
| 11252 | 11252 | |
| 11253 | 11253 | |
| 11254 | 11254 | /** |
| 11255 | - * Parses a date string |
|
| 11256 | - * |
|
| 11257 | - * @param String $dateString the date string |
|
| 11258 | - * @param String $timezone the timezone of a user |
|
| 11259 | - * @return Array the time information |
|
| 11260 | - * |
|
| 11261 | - */ |
|
| 11255 | + * Parses a date string |
|
| 11256 | + * |
|
| 11257 | + * @param String $dateString the date string |
|
| 11258 | + * @param String $timezone the timezone of a user |
|
| 11259 | + * @return Array the time information |
|
| 11260 | + * |
|
| 11261 | + */ |
|
| 11262 | 11262 | public function parseDateString($dateString, $timezone = '') |
| 11263 | 11263 | { |
| 11264 | 11264 | $time_array = array(); |
@@ -11294,12 +11294,12 @@ discard block |
||
| 11294 | 11294 | |
| 11295 | 11295 | |
| 11296 | 11296 | /** |
| 11297 | - * Parses the direction degrees to working |
|
| 11298 | - * |
|
| 11299 | - * @param Float $direction the direction in degrees |
|
| 11300 | - * @return Array the direction information |
|
| 11301 | - * |
|
| 11302 | - */ |
|
| 11297 | + * Parses the direction degrees to working |
|
| 11298 | + * |
|
| 11299 | + * @param Float $direction the direction in degrees |
|
| 11300 | + * @return Array the direction information |
|
| 11301 | + * |
|
| 11302 | + */ |
|
| 11303 | 11303 | public function parseDirection($direction = 0) |
| 11304 | 11304 | { |
| 11305 | 11305 | if ($direction == '') $direction = 0; |
@@ -11378,12 +11378,12 @@ discard block |
||
| 11378 | 11378 | |
| 11379 | 11379 | |
| 11380 | 11380 | /** |
| 11381 | - * Gets the aircraft registration |
|
| 11382 | - * |
|
| 11383 | - * @param String $flightaware_id the flight aware id |
|
| 11384 | - * @return String the aircraft registration |
|
| 11385 | - * |
|
| 11386 | - */ |
|
| 11381 | + * Gets the aircraft registration |
|
| 11382 | + * |
|
| 11383 | + * @param String $flightaware_id the flight aware id |
|
| 11384 | + * @return String the aircraft registration |
|
| 11385 | + * |
|
| 11386 | + */ |
|
| 11387 | 11387 | |
| 11388 | 11388 | public function getAircraftRegistration($flightaware_id) |
| 11389 | 11389 | { |
@@ -11412,12 +11412,12 @@ discard block |
||
| 11412 | 11412 | |
| 11413 | 11413 | |
| 11414 | 11414 | /** |
| 11415 | - * Gets the aircraft registration from ModeS |
|
| 11416 | - * |
|
| 11417 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11418 | - * @return String the aircraft registration |
|
| 11419 | - * |
|
| 11420 | - */ |
|
| 11415 | + * Gets the aircraft registration from ModeS |
|
| 11416 | + * |
|
| 11417 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11418 | + * @return String the aircraft registration |
|
| 11419 | + * |
|
| 11420 | + */ |
|
| 11421 | 11421 | public function getAircraftRegistrationBymodeS($aircraft_modes) |
| 11422 | 11422 | { |
| 11423 | 11423 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11430,19 +11430,19 @@ discard block |
||
| 11430 | 11430 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11431 | 11431 | $sth->closeCursor(); |
| 11432 | 11432 | if (count($row) > 0) { |
| 11433 | - //return $row['Registration']; |
|
| 11434 | - return $row['registration']; |
|
| 11433 | + //return $row['Registration']; |
|
| 11434 | + return $row['registration']; |
|
| 11435 | 11435 | } else return ''; |
| 11436 | 11436 | |
| 11437 | 11437 | } |
| 11438 | 11438 | |
| 11439 | 11439 | /** |
| 11440 | - * Gets the aircraft type from ModeS |
|
| 11441 | - * |
|
| 11442 | - * @param String $aircraft_modes the flight ModeS in hex |
|
| 11443 | - * @return String the aircraft type |
|
| 11444 | - * |
|
| 11445 | - */ |
|
| 11440 | + * Gets the aircraft type from ModeS |
|
| 11441 | + * |
|
| 11442 | + * @param String $aircraft_modes the flight ModeS in hex |
|
| 11443 | + * @return String the aircraft type |
|
| 11444 | + * |
|
| 11445 | + */ |
|
| 11446 | 11446 | public function getAircraftTypeBymodeS($aircraft_modes) |
| 11447 | 11447 | { |
| 11448 | 11448 | $aircraft_modes = filter_var($aircraft_modes,FILTER_SANITIZE_STRING); |
@@ -11455,19 +11455,19 @@ discard block |
||
| 11455 | 11455 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 11456 | 11456 | $sth->closeCursor(); |
| 11457 | 11457 | if (count($row) > 0) { |
| 11458 | - if ($row['type_flight'] == null) return ''; |
|
| 11459 | - else return $row['type_flight']; |
|
| 11458 | + if ($row['type_flight'] == null) return ''; |
|
| 11459 | + else return $row['type_flight']; |
|
| 11460 | 11460 | } else return ''; |
| 11461 | 11461 | |
| 11462 | 11462 | } |
| 11463 | 11463 | |
| 11464 | 11464 | /** |
| 11465 | - * Gets Country from latitude/longitude |
|
| 11466 | - * |
|
| 11467 | - * @param Float $latitude latitute of the flight |
|
| 11468 | - * @param Float $longitude longitute of the flight |
|
| 11469 | - * @return String the countrie |
|
| 11470 | - */ |
|
| 11465 | + * Gets Country from latitude/longitude |
|
| 11466 | + * |
|
| 11467 | + * @param Float $latitude latitute of the flight |
|
| 11468 | + * @param Float $longitude longitute of the flight |
|
| 11469 | + * @return String the countrie |
|
| 11470 | + */ |
|
| 11471 | 11471 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 11472 | 11472 | { |
| 11473 | 11473 | global $globalDBdriver, $globalDebug; |
@@ -11504,11 +11504,11 @@ discard block |
||
| 11504 | 11504 | } |
| 11505 | 11505 | |
| 11506 | 11506 | /** |
| 11507 | - * Gets Country from iso2 |
|
| 11508 | - * |
|
| 11509 | - * @param String $iso2 ISO2 country code |
|
| 11510 | - * @return String the countrie |
|
| 11511 | - */ |
|
| 11507 | + * Gets Country from iso2 |
|
| 11508 | + * |
|
| 11509 | + * @param String $iso2 ISO2 country code |
|
| 11510 | + * @return String the countrie |
|
| 11511 | + */ |
|
| 11512 | 11512 | public function getCountryFromISO2($iso2) |
| 11513 | 11513 | { |
| 11514 | 11514 | global $globalDBdriver, $globalDebug; |
@@ -11536,12 +11536,12 @@ discard block |
||
| 11536 | 11536 | } |
| 11537 | 11537 | |
| 11538 | 11538 | /** |
| 11539 | - * converts the registration code using the country prefix |
|
| 11540 | - * |
|
| 11541 | - * @param String $registration the aircraft registration |
|
| 11542 | - * @return String the aircraft registration |
|
| 11543 | - * |
|
| 11544 | - */ |
|
| 11539 | + * converts the registration code using the country prefix |
|
| 11540 | + * |
|
| 11541 | + * @param String $registration the aircraft registration |
|
| 11542 | + * @return String the aircraft registration |
|
| 11543 | + * |
|
| 11544 | + */ |
|
| 11545 | 11545 | public function convertAircraftRegistration($registration) |
| 11546 | 11546 | { |
| 11547 | 11547 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11593,12 +11593,12 @@ discard block |
||
| 11593 | 11593 | } |
| 11594 | 11594 | |
| 11595 | 11595 | /** |
| 11596 | - * Country from the registration code |
|
| 11597 | - * |
|
| 11598 | - * @param String $registration the aircraft registration |
|
| 11599 | - * @return String the country |
|
| 11600 | - * |
|
| 11601 | - */ |
|
| 11596 | + * Country from the registration code |
|
| 11597 | + * |
|
| 11598 | + * @param String $registration the aircraft registration |
|
| 11599 | + * @return String the country |
|
| 11600 | + * |
|
| 11601 | + */ |
|
| 11602 | 11602 | public function countryFromAircraftRegistration($registration) |
| 11603 | 11603 | { |
| 11604 | 11604 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11617,8 +11617,8 @@ discard block |
||
| 11617 | 11617 | $country = $row['country']; |
| 11618 | 11618 | } |
| 11619 | 11619 | } else { |
| 11620 | - $registration_1 = substr($registration, 0, 1); |
|
| 11621 | - $registration_2 = substr($registration, 0, 2); |
|
| 11620 | + $registration_1 = substr($registration, 0, 1); |
|
| 11621 | + $registration_2 = substr($registration, 0, 2); |
|
| 11622 | 11622 | |
| 11623 | 11623 | $country = ''; |
| 11624 | 11624 | //first get the prefix based on two characters |
@@ -11654,12 +11654,12 @@ discard block |
||
| 11654 | 11654 | } |
| 11655 | 11655 | |
| 11656 | 11656 | /** |
| 11657 | - * Registration prefix from the registration code |
|
| 11658 | - * |
|
| 11659 | - * @param String $registration the aircraft registration |
|
| 11660 | - * @return String the registration prefix |
|
| 11661 | - * |
|
| 11662 | - */ |
|
| 11657 | + * Registration prefix from the registration code |
|
| 11658 | + * |
|
| 11659 | + * @param String $registration the aircraft registration |
|
| 11660 | + * @return String the registration prefix |
|
| 11661 | + * |
|
| 11662 | + */ |
|
| 11663 | 11663 | public function registrationPrefixFromAircraftRegistration($registration) |
| 11664 | 11664 | { |
| 11665 | 11665 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11678,8 +11678,8 @@ discard block |
||
| 11678 | 11678 | //$country = $row['country']; |
| 11679 | 11679 | } |
| 11680 | 11680 | } else { |
| 11681 | - $registration_1 = substr($registration, 0, 1); |
|
| 11682 | - $registration_2 = substr($registration, 0, 2); |
|
| 11681 | + $registration_1 = substr($registration, 0, 1); |
|
| 11682 | + $registration_2 = substr($registration, 0, 2); |
|
| 11683 | 11683 | |
| 11684 | 11684 | //first get the prefix based on two characters |
| 11685 | 11685 | $query = "SELECT aircraft_registration.registration_prefix, aircraft_registration.country FROM aircraft_registration WHERE registration_prefix = :registration_2 LIMIT 1"; |
@@ -11715,12 +11715,12 @@ discard block |
||
| 11715 | 11715 | |
| 11716 | 11716 | |
| 11717 | 11717 | /** |
| 11718 | - * Country from the registration code |
|
| 11719 | - * |
|
| 11720 | - * @param String $registration the aircraft registration |
|
| 11721 | - * @return String the country |
|
| 11722 | - * |
|
| 11723 | - */ |
|
| 11718 | + * Country from the registration code |
|
| 11719 | + * |
|
| 11720 | + * @param String $registration the aircraft registration |
|
| 11721 | + * @return String the country |
|
| 11722 | + * |
|
| 11723 | + */ |
|
| 11724 | 11724 | public function countryFromAircraftRegistrationCode($registration) |
| 11725 | 11725 | { |
| 11726 | 11726 | $registration = filter_var($registration,FILTER_SANITIZE_STRING); |
@@ -11737,11 +11737,11 @@ discard block |
||
| 11737 | 11737 | } |
| 11738 | 11738 | |
| 11739 | 11739 | /** |
| 11740 | - * Set a new highlight value for a flight |
|
| 11741 | - * |
|
| 11742 | - * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11743 | - * @param String $highlight New highlight value |
|
| 11744 | - */ |
|
| 11740 | + * Set a new highlight value for a flight |
|
| 11741 | + * |
|
| 11742 | + * @param String $flightaware_id flightaware_id from spotter_output table |
|
| 11743 | + * @param String $highlight New highlight value |
|
| 11744 | + */ |
|
| 11745 | 11745 | public function setHighlightFlight($flightaware_id,$highlight) { |
| 11746 | 11746 | |
| 11747 | 11747 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE flightaware_id = :flightaware_id"; |
@@ -11750,12 +11750,12 @@ discard block |
||
| 11750 | 11750 | } |
| 11751 | 11751 | |
| 11752 | 11752 | /** |
| 11753 | - * Set a new highlight value for a flight by Registration |
|
| 11754 | - * |
|
| 11755 | - * @param String $registration Registration of the aircraft |
|
| 11756 | - * @param String $date Date of spotted aircraft |
|
| 11757 | - * @param String $highlight New highlight value |
|
| 11758 | - */ |
|
| 11753 | + * Set a new highlight value for a flight by Registration |
|
| 11754 | + * |
|
| 11755 | + * @param String $registration Registration of the aircraft |
|
| 11756 | + * @param String $date Date of spotted aircraft |
|
| 11757 | + * @param String $highlight New highlight value |
|
| 11758 | + */ |
|
| 11759 | 11759 | public function setHighlightFlightByRegistration($registration,$highlight, $date = '') { |
| 11760 | 11760 | if ($date == '') { |
| 11761 | 11761 | $query = "UPDATE spotter_output SET highlight = :highlight WHERE spotter_id IN (SELECT MAX(spotter_id) FROM spotter_output WHERE registration = :registration)"; |
@@ -11769,12 +11769,12 @@ discard block |
||
| 11769 | 11769 | } |
| 11770 | 11770 | |
| 11771 | 11771 | /** |
| 11772 | - * Gets the short url from bit.ly |
|
| 11773 | - * |
|
| 11774 | - * @param String $url the full url |
|
| 11775 | - * @return String the bit.ly url |
|
| 11776 | - * |
|
| 11777 | - */ |
|
| 11772 | + * Gets the short url from bit.ly |
|
| 11773 | + * |
|
| 11774 | + * @param String $url the full url |
|
| 11775 | + * @return String the bit.ly url |
|
| 11776 | + * |
|
| 11777 | + */ |
|
| 11778 | 11778 | public function getBitlyURL($url) |
| 11779 | 11779 | { |
| 11780 | 11780 | global $globalBitlyAccessToken; |
@@ -12063,11 +12063,11 @@ discard block |
||
| 12063 | 12063 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2))) as distance |
| 12064 | 12064 | FROM airport WHERE longitude between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat)*69)) and latitude between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 12065 | 12065 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - latitude)*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(latitude*pi()/180)*POWER(SIN(($origLon-longitude)*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 12066 | - } else { |
|
| 12066 | + } else { |
|
| 12067 | 12067 | $query="SELECT name, icao, latitude, longitude, altitude, 3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2))) as distance |
| 12068 | 12068 | FROM airport WHERE CAST(longitude as double precision) between ($origLon-$dist/cos(radians($origLat))*69) and ($origLon+$dist/cos(radians($origLat))*69) and CAST(latitude as double precision) between ($origLat-($dist/69)) and ($origLat+($dist/69)) |
| 12069 | 12069 | AND (3956 * 2 * ASIN(SQRT( POWER(SIN(($origLat - CAST(latitude as double precision))*pi()/180/2),2)+COS( $origLat *pi()/180)*COS(CAST(latitude as double precision)*pi()/180)*POWER(SIN(($origLon-CAST(longitude as double precision))*pi()/180/2),2)))) < $dist ORDER BY distance limit 100;"; |
| 12070 | - } |
|
| 12070 | + } |
|
| 12071 | 12071 | $sth = $this->db->prepare($query); |
| 12072 | 12072 | $sth->execute(); |
| 12073 | 12073 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 21 | 21 | $filters = array(); |
@@ -111,11 +111,11 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
| 114 | - * Gets all the spotter information based on the latest data entry |
|
| 115 | - * |
|
| 116 | - * @return Array the spotter information |
|
| 117 | - * |
|
| 118 | - */ |
|
| 114 | + * Gets all the spotter information based on the latest data entry |
|
| 115 | + * |
|
| 116 | + * @return Array the spotter information |
|
| 117 | + * |
|
| 118 | + */ |
|
| 119 | 119 | public function getLiveSpotterData($limit = '', $sort = '', $filter = array()) |
| 120 | 120 | { |
| 121 | 121 | global $globalDBdriver, $globalLiveInterval; |
@@ -157,11 +157,11 @@ discard block |
||
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
| 160 | - * Gets Minimal Live Spotter data |
|
| 161 | - * |
|
| 162 | - * @return Array the spotter information |
|
| 163 | - * |
|
| 164 | - */ |
|
| 160 | + * Gets Minimal Live Spotter data |
|
| 161 | + * |
|
| 162 | + * @return Array the spotter information |
|
| 163 | + * |
|
| 164 | + */ |
|
| 165 | 165 | public function getMinLiveSpotterData($filter = array()) |
| 166 | 166 | { |
| 167 | 167 | global $globalDBdriver, $globalLiveInterval; |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | /** |
| 217 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 218 | - * |
|
| 219 | - * @return Array the spotter information |
|
| 220 | - * |
|
| 221 | - */ |
|
| 217 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 218 | + * |
|
| 219 | + * @return Array the spotter information |
|
| 220 | + * |
|
| 221 | + */ |
|
| 222 | 222 | public function getMinLastLiveSpotterData($filter = array()) |
| 223 | 223 | { |
| 224 | 224 | global $globalDBdriver, $globalLiveInterval; |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | $query = 'SELECT spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 237 | 237 | FROM spotter_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
| 238 | 238 | ORDER BY spotter_live.flightaware_id, spotter_live.date"; |
| 239 | - } else { |
|
| 239 | + } else { |
|
| 240 | 240 | /* |
| 241 | 241 | $query = "SELECT a.aircraft_shadow, a.engine_type, a.engine_count, a.wake_category, spotter_live.ident, spotter_live.flightaware_id, spotter_live.aircraft_icao, spotter_live.departure_airport_icao as departure_airport, spotter_live.arrival_airport_icao as arrival_airport, spotter_live.latitude, spotter_live.longitude, spotter_live.altitude, spotter_live.heading, spotter_live.ground_speed, spotter_live.squawk, spotter_live.date, spotter_live.format_source |
| 242 | 242 | FROM spotter_live LEFT JOIN (SELECT aircraft_shadow,engine_type, engine_count, wake_category, icao FROM aircraft) a ON spotter_live.aircraft_icao = a.icao".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= spotter_live.date AND spotter_live.latitude <> '0' AND spotter_live.longitude <> '0' |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | // echo $query; |
| 249 | 249 | } |
| 250 | 250 | |
| 251 | - try { |
|
| 251 | + try { |
|
| 252 | 252 | $sth = $this->db->prepare($query); |
| 253 | 253 | $sth->execute(); |
| 254 | 254 | } catch(PDOException $e) { |
@@ -260,11 +260,11 @@ discard block |
||
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | /** |
| 263 | - * Gets number of latest data entry |
|
| 264 | - * |
|
| 265 | - * @return String number of entry |
|
| 266 | - * |
|
| 267 | - */ |
|
| 263 | + * Gets number of latest data entry |
|
| 264 | + * |
|
| 265 | + * @return String number of entry |
|
| 266 | + * |
|
| 267 | + */ |
|
| 268 | 268 | public function getLiveSpotterCount($filter = array()) |
| 269 | 269 | { |
| 270 | 270 | global $globalDBdriver, $globalLiveInterval; |
@@ -291,11 +291,11 @@ discard block |
||
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | /** |
| 294 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 295 | - * |
|
| 296 | - * @return Array the spotter information |
|
| 297 | - * |
|
| 298 | - */ |
|
| 294 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 295 | + * |
|
| 296 | + * @return Array the spotter information |
|
| 297 | + * |
|
| 298 | + */ |
|
| 299 | 299 | public function getLiveSpotterDatabyCoord($coord, $filter = array()) |
| 300 | 300 | { |
| 301 | 301 | global $globalDBdriver, $globalLiveInterval; |
@@ -320,11 +320,11 @@ discard block |
||
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
| 323 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 324 | - * |
|
| 325 | - * @return Array the spotter information |
|
| 326 | - * |
|
| 327 | - */ |
|
| 323 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 324 | + * |
|
| 325 | + * @return Array the spotter information |
|
| 326 | + * |
|
| 327 | + */ |
|
| 328 | 328 | public function getLatestSpotterForLayar($lat, $lng, $radius, $interval) |
| 329 | 329 | { |
| 330 | 330 | $Spotter = new Spotter($this->db); |
@@ -334,145 +334,145 @@ discard block |
||
| 334 | 334 | return false; |
| 335 | 335 | } |
| 336 | 336 | } |
| 337 | - if ($lng != '') |
|
| 338 | - { |
|
| 339 | - if (!is_numeric($lng)) |
|
| 340 | - { |
|
| 341 | - return false; |
|
| 342 | - } |
|
| 343 | - } |
|
| 344 | - |
|
| 345 | - if ($radius != '') |
|
| 346 | - { |
|
| 347 | - if (!is_numeric($radius)) |
|
| 348 | - { |
|
| 349 | - return false; |
|
| 350 | - } |
|
| 351 | - } |
|
| 337 | + if ($lng != '') |
|
| 338 | + { |
|
| 339 | + if (!is_numeric($lng)) |
|
| 340 | + { |
|
| 341 | + return false; |
|
| 342 | + } |
|
| 343 | + } |
|
| 344 | + |
|
| 345 | + if ($radius != '') |
|
| 346 | + { |
|
| 347 | + if (!is_numeric($radius)) |
|
| 348 | + { |
|
| 349 | + return false; |
|
| 350 | + } |
|
| 351 | + } |
|
| 352 | 352 | $additional_query = ''; |
| 353 | - if ($interval != '') |
|
| 354 | - { |
|
| 355 | - if (!is_string($interval)) |
|
| 356 | - { |
|
| 357 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 358 | - return false; |
|
| 359 | - } else { |
|
| 360 | - if ($interval == '1m') |
|
| 361 | - { |
|
| 362 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 363 | - } else if ($interval == '15m'){ |
|
| 364 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 365 | - } |
|
| 366 | - } |
|
| 367 | - } else { |
|
| 368 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 353 | + if ($interval != '') |
|
| 354 | + { |
|
| 355 | + if (!is_string($interval)) |
|
| 356 | + { |
|
| 357 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 358 | + return false; |
|
| 359 | + } else { |
|
| 360 | + if ($interval == '1m') |
|
| 361 | + { |
|
| 362 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 363 | + } else if ($interval == '15m'){ |
|
| 364 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= spotter_live.date '; |
|
| 365 | + } |
|
| 366 | + } |
|
| 367 | + } else { |
|
| 368 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= spotter_live.date '; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + $query = "SELECT spotter_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM spotter_live |
|
| 372 | 372 | WHERE spotter_live.latitude <> '' |
| 373 | 373 | AND spotter_live.longitude <> '' |
| 374 | 374 | ".$additional_query." |
| 375 | 375 | HAVING distance < :radius |
| 376 | 376 | ORDER BY distance"; |
| 377 | 377 | |
| 378 | - $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 378 | + $spotter_array = $Spotter->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 379 | 379 | |
| 380 | - return $spotter_array; |
|
| 381 | - } |
|
| 380 | + return $spotter_array; |
|
| 381 | + } |
|
| 382 | 382 | |
| 383 | 383 | |
| 384 | - /** |
|
| 385 | - * Gets all the spotter information based on a particular callsign |
|
| 386 | - * |
|
| 387 | - * @return Array the spotter information |
|
| 388 | - * |
|
| 389 | - */ |
|
| 384 | + /** |
|
| 385 | + * Gets all the spotter information based on a particular callsign |
|
| 386 | + * |
|
| 387 | + * @return Array the spotter information |
|
| 388 | + * |
|
| 389 | + */ |
|
| 390 | 390 | public function getLastLiveSpotterDataByIdent($ident) |
| 391 | 391 | { |
| 392 | 392 | $Spotter = new Spotter($this->db); |
| 393 | 393 | date_default_timezone_set('UTC'); |
| 394 | 394 | |
| 395 | 395 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 396 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 396 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 397 | 397 | |
| 398 | 398 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 399 | 399 | |
| 400 | 400 | return $spotter_array; |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - /** |
|
| 404 | - * Gets all the spotter information based on a particular callsign |
|
| 405 | - * |
|
| 406 | - * @return Array the spotter information |
|
| 407 | - * |
|
| 408 | - */ |
|
| 403 | + /** |
|
| 404 | + * Gets all the spotter information based on a particular callsign |
|
| 405 | + * |
|
| 406 | + * @return Array the spotter information |
|
| 407 | + * |
|
| 408 | + */ |
|
| 409 | 409 | public function getDateLiveSpotterDataByIdent($ident,$date) |
| 410 | 410 | { |
| 411 | 411 | $Spotter = new Spotter($this->db); |
| 412 | 412 | date_default_timezone_set('UTC'); |
| 413 | 413 | |
| 414 | 414 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 415 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 415 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 416 | 416 | |
| 417 | - $date = date('c',$date); |
|
| 417 | + $date = date('c',$date); |
|
| 418 | 418 | $spotter_array = $Spotter->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
| 419 | 419 | |
| 420 | 420 | return $spotter_array; |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - /** |
|
| 424 | - * Gets last spotter information based on a particular callsign |
|
| 425 | - * |
|
| 426 | - * @return Array the spotter information |
|
| 427 | - * |
|
| 428 | - */ |
|
| 423 | + /** |
|
| 424 | + * Gets last spotter information based on a particular callsign |
|
| 425 | + * |
|
| 426 | + * @return Array the spotter information |
|
| 427 | + * |
|
| 428 | + */ |
|
| 429 | 429 | public function getLastLiveSpotterDataById($id) |
| 430 | 430 | { |
| 431 | 431 | $Spotter = new Spotter($this->db); |
| 432 | 432 | date_default_timezone_set('UTC'); |
| 433 | 433 | |
| 434 | 434 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 435 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 435 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 436 | 436 | |
| 437 | 437 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id),'',true); |
| 438 | 438 | |
| 439 | 439 | return $spotter_array; |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - /** |
|
| 443 | - * Gets last spotter information based on a particular callsign |
|
| 444 | - * |
|
| 445 | - * @return Array the spotter information |
|
| 446 | - * |
|
| 447 | - */ |
|
| 442 | + /** |
|
| 443 | + * Gets last spotter information based on a particular callsign |
|
| 444 | + * |
|
| 445 | + * @return Array the spotter information |
|
| 446 | + * |
|
| 447 | + */ |
|
| 448 | 448 | public function getDateLiveSpotterDataById($id,$date) |
| 449 | 449 | { |
| 450 | 450 | $Spotter = new Spotter($this->db); |
| 451 | 451 | date_default_timezone_set('UTC'); |
| 452 | 452 | |
| 453 | 453 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 454 | - $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 455 | - $date = date('c',$date); |
|
| 454 | + $query = 'SELECT spotter_live.* FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l WHERE l.flightaware_id = :id AND l.date <= :date GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate ORDER BY spotter_live.date DESC'; |
|
| 455 | + $date = date('c',$date); |
|
| 456 | 456 | $spotter_array = $Spotter->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 457 | 457 | |
| 458 | 458 | return $spotter_array; |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | - /** |
|
| 462 | - * Gets altitude information based on a particular callsign |
|
| 463 | - * |
|
| 464 | - * @return Array the spotter information |
|
| 465 | - * |
|
| 466 | - */ |
|
| 461 | + /** |
|
| 462 | + * Gets altitude information based on a particular callsign |
|
| 463 | + * |
|
| 464 | + * @return Array the spotter information |
|
| 465 | + * |
|
| 466 | + */ |
|
| 467 | 467 | public function getAltitudeLiveSpotterDataByIdent($ident) |
| 468 | 468 | { |
| 469 | 469 | |
| 470 | 470 | date_default_timezone_set('UTC'); |
| 471 | 471 | |
| 472 | 472 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 473 | - $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 473 | + $query = 'SELECT spotter_live.altitude, spotter_live.date FROM spotter_live WHERE spotter_live.ident = :ident'; |
|
| 474 | 474 | |
| 475 | - try { |
|
| 475 | + try { |
|
| 476 | 476 | |
| 477 | 477 | $sth = $this->db->prepare($query); |
| 478 | 478 | $sth->execute(array(':ident' => $ident)); |
@@ -485,12 +485,12 @@ discard block |
||
| 485 | 485 | return $spotter_array; |
| 486 | 486 | } |
| 487 | 487 | |
| 488 | - /** |
|
| 489 | - * Gets all the spotter information based on a particular id |
|
| 490 | - * |
|
| 491 | - * @return Array the spotter information |
|
| 492 | - * |
|
| 493 | - */ |
|
| 488 | + /** |
|
| 489 | + * Gets all the spotter information based on a particular id |
|
| 490 | + * |
|
| 491 | + * @return Array the spotter information |
|
| 492 | + * |
|
| 493 | + */ |
|
| 494 | 494 | public function getAllLiveSpotterDataById($id,$liveinterval = false) |
| 495 | 495 | { |
| 496 | 496 | global $globalDBdriver, $globalLiveInterval; |
@@ -518,18 +518,18 @@ discard block |
||
| 518 | 518 | return $spotter_array; |
| 519 | 519 | } |
| 520 | 520 | |
| 521 | - /** |
|
| 522 | - * Gets all the spotter information based on a particular ident |
|
| 523 | - * |
|
| 524 | - * @return Array the spotter information |
|
| 525 | - * |
|
| 526 | - */ |
|
| 521 | + /** |
|
| 522 | + * Gets all the spotter information based on a particular ident |
|
| 523 | + * |
|
| 524 | + * @return Array the spotter information |
|
| 525 | + * |
|
| 526 | + */ |
|
| 527 | 527 | public function getAllLiveSpotterDataByIdent($ident) |
| 528 | 528 | { |
| 529 | 529 | date_default_timezone_set('UTC'); |
| 530 | 530 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 531 | 531 | $query = self::$global_query.' WHERE spotter_live.ident = :ident'; |
| 532 | - try { |
|
| 532 | + try { |
|
| 533 | 533 | |
| 534 | 534 | $sth = $this->db->prepare($query); |
| 535 | 535 | $sth->execute(array(':ident' => $ident)); |
@@ -543,23 +543,23 @@ discard block |
||
| 543 | 543 | |
| 544 | 544 | |
| 545 | 545 | /** |
| 546 | - * Deletes all info in the table |
|
| 547 | - * |
|
| 548 | - * @return String success or false |
|
| 549 | - * |
|
| 550 | - */ |
|
| 546 | + * Deletes all info in the table |
|
| 547 | + * |
|
| 548 | + * @return String success or false |
|
| 549 | + * |
|
| 550 | + */ |
|
| 551 | 551 | public function deleteLiveSpotterData() |
| 552 | 552 | { |
| 553 | 553 | global $globalDBdriver; |
| 554 | 554 | if ($globalDBdriver == 'mysql') { |
| 555 | 555 | //$query = "DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= spotter_live.date"; |
| 556 | 556 | $query = 'DELETE FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= spotter_live.date'; |
| 557 | - //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 557 | + //$query = "DELETE FROM spotter_live WHERE spotter_live.id IN (SELECT spotter_live.id FROM spotter_live INNER JOIN (SELECT l.flightaware_id, max(l.date) as maxdate FROM spotter_live l GROUP BY l.flightaware_id) s on spotter_live.flightaware_id = s.flightaware_id AND spotter_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= spotter_live.date)"; |
|
| 558 | 558 | } else { |
| 559 | 559 | $query = "DELETE FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date"; |
| 560 | 560 | } |
| 561 | 561 | |
| 562 | - try { |
|
| 562 | + try { |
|
| 563 | 563 | |
| 564 | 564 | $sth = $this->db->prepare($query); |
| 565 | 565 | $sth->execute(); |
@@ -571,18 +571,18 @@ discard block |
||
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | /** |
| 574 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 575 | - * |
|
| 576 | - * @return String success or false |
|
| 577 | - * |
|
| 578 | - */ |
|
| 574 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 575 | + * |
|
| 576 | + * @return String success or false |
|
| 577 | + * |
|
| 578 | + */ |
|
| 579 | 579 | public function deleteLiveSpotterDataNotUpdated() |
| 580 | 580 | { |
| 581 | 581 | global $globalDBdriver, $globalDebug; |
| 582 | 582 | if ($globalDBdriver == 'mysql') { |
| 583 | 583 | //$query = 'SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < spotter_live.date) LIMIT 800 OFFSET 0'; |
| 584 | - $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 585 | - try { |
|
| 584 | + $query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 585 | + try { |
|
| 586 | 586 | |
| 587 | 587 | $sth = $this->db->prepare($query); |
| 588 | 588 | $sth->execute(); |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | return "error"; |
| 591 | 591 | } |
| 592 | 592 | $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
| 593 | - $i = 0; |
|
| 594 | - $j =0; |
|
| 593 | + $i = 0; |
|
| 594 | + $j =0; |
|
| 595 | 595 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 596 | 596 | foreach($all as $row) |
| 597 | 597 | { |
@@ -599,20 +599,20 @@ discard block |
||
| 599 | 599 | $j++; |
| 600 | 600 | if ($j == 30) { |
| 601 | 601 | if ($globalDebug) echo "."; |
| 602 | - try { |
|
| 602 | + try { |
|
| 603 | 603 | |
| 604 | 604 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 605 | 605 | $sth->execute(); |
| 606 | 606 | } catch(PDOException $e) { |
| 607 | 607 | return "error"; |
| 608 | 608 | } |
| 609 | - $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 610 | - $j = 0; |
|
| 609 | + $query_delete = 'DELETE FROM spotter_live WHERE flightaware_id IN ('; |
|
| 610 | + $j = 0; |
|
| 611 | 611 | } |
| 612 | 612 | $query_delete .= "'".$row['flightaware_id']."',"; |
| 613 | 613 | } |
| 614 | 614 | if ($i > 0) { |
| 615 | - try { |
|
| 615 | + try { |
|
| 616 | 616 | |
| 617 | 617 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 618 | 618 | $sth->execute(); |
@@ -623,9 +623,9 @@ discard block |
||
| 623 | 623 | return "success"; |
| 624 | 624 | } elseif ($globalDBdriver == 'pgsql') { |
| 625 | 625 | //$query = "SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= spotter_live.date AND spotter_live.flightaware_id NOT IN (SELECT flightaware_id FROM spotter_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < spotter_live.date) LIMIT 800 OFFSET 0"; |
| 626 | - //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 627 | - $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 628 | - try { |
|
| 626 | + //$query = "SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 627 | + $query = "DELETE FROM spotter_live WHERE flightaware_id IN (SELECT spotter_live.flightaware_id FROM spotter_live INNER JOIN (SELECT flightaware_id,MAX(date) as max_date FROM spotter_live GROUP BY flightaware_id) s ON s.flightaware_id = spotter_live.flightaware_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 628 | + try { |
|
| 629 | 629 | |
| 630 | 630 | $sth = $this->db->prepare($query); |
| 631 | 631 | $sth->execute(); |
@@ -669,17 +669,17 @@ discard block |
||
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | /** |
| 672 | - * Deletes all info in the table for an ident |
|
| 673 | - * |
|
| 674 | - * @return String success or false |
|
| 675 | - * |
|
| 676 | - */ |
|
| 672 | + * Deletes all info in the table for an ident |
|
| 673 | + * |
|
| 674 | + * @return String success or false |
|
| 675 | + * |
|
| 676 | + */ |
|
| 677 | 677 | public function deleteLiveSpotterDataByIdent($ident) |
| 678 | 678 | { |
| 679 | 679 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 680 | 680 | $query = 'DELETE FROM spotter_live WHERE ident = :ident'; |
| 681 | 681 | |
| 682 | - try { |
|
| 682 | + try { |
|
| 683 | 683 | |
| 684 | 684 | $sth = $this->db->prepare($query); |
| 685 | 685 | $sth->execute(array(':ident' => $ident)); |
@@ -691,17 +691,17 @@ discard block |
||
| 691 | 691 | } |
| 692 | 692 | |
| 693 | 693 | /** |
| 694 | - * Deletes all info in the table for an id |
|
| 695 | - * |
|
| 696 | - * @return String success or false |
|
| 697 | - * |
|
| 698 | - */ |
|
| 694 | + * Deletes all info in the table for an id |
|
| 695 | + * |
|
| 696 | + * @return String success or false |
|
| 697 | + * |
|
| 698 | + */ |
|
| 699 | 699 | public function deleteLiveSpotterDataById($id) |
| 700 | 700 | { |
| 701 | 701 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 702 | 702 | $query = 'DELETE FROM spotter_live WHERE flightaware_id = :id'; |
| 703 | 703 | |
| 704 | - try { |
|
| 704 | + try { |
|
| 705 | 705 | |
| 706 | 706 | $sth = $this->db->prepare($query); |
| 707 | 707 | $sth->execute(array(':id' => $id)); |
@@ -714,11 +714,11 @@ discard block |
||
| 714 | 714 | |
| 715 | 715 | |
| 716 | 716 | /** |
| 717 | - * Gets the aircraft ident within the last hour |
|
| 718 | - * |
|
| 719 | - * @return String the ident |
|
| 720 | - * |
|
| 721 | - */ |
|
| 717 | + * Gets the aircraft ident within the last hour |
|
| 718 | + * |
|
| 719 | + * @return String the ident |
|
| 720 | + * |
|
| 721 | + */ |
|
| 722 | 722 | public function getIdentFromLastHour($ident) |
| 723 | 723 | { |
| 724 | 724 | global $globalDBdriver, $globalTimezone; |
@@ -744,14 +744,14 @@ discard block |
||
| 744 | 744 | $ident_result = $row['ident']; |
| 745 | 745 | } |
| 746 | 746 | return $ident_result; |
| 747 | - } |
|
| 747 | + } |
|
| 748 | 748 | |
| 749 | 749 | /** |
| 750 | - * Check recent aircraft |
|
| 751 | - * |
|
| 752 | - * @return String the ident |
|
| 753 | - * |
|
| 754 | - */ |
|
| 750 | + * Check recent aircraft |
|
| 751 | + * |
|
| 752 | + * @return String the ident |
|
| 753 | + * |
|
| 754 | + */ |
|
| 755 | 755 | public function checkIdentRecent($ident) |
| 756 | 756 | { |
| 757 | 757 | global $globalDBdriver, $globalTimezone; |
@@ -777,14 +777,14 @@ discard block |
||
| 777 | 777 | $ident_result = $row['flightaware_id']; |
| 778 | 778 | } |
| 779 | 779 | return $ident_result; |
| 780 | - } |
|
| 780 | + } |
|
| 781 | 781 | |
| 782 | 782 | /** |
| 783 | - * Check recent aircraft by id |
|
| 784 | - * |
|
| 785 | - * @return String the ident |
|
| 786 | - * |
|
| 787 | - */ |
|
| 783 | + * Check recent aircraft by id |
|
| 784 | + * |
|
| 785 | + * @return String the ident |
|
| 786 | + * |
|
| 787 | + */ |
|
| 788 | 788 | public function checkIdRecent($id) |
| 789 | 789 | { |
| 790 | 790 | global $globalDBdriver, $globalTimezone; |
@@ -810,14 +810,14 @@ discard block |
||
| 810 | 810 | $ident_result = $row['flightaware_id']; |
| 811 | 811 | } |
| 812 | 812 | return $ident_result; |
| 813 | - } |
|
| 813 | + } |
|
| 814 | 814 | |
| 815 | 815 | /** |
| 816 | - * Check recent aircraft by ModeS |
|
| 817 | - * |
|
| 818 | - * @return String the ModeS |
|
| 819 | - * |
|
| 820 | - */ |
|
| 816 | + * Check recent aircraft by ModeS |
|
| 817 | + * |
|
| 818 | + * @return String the ModeS |
|
| 819 | + * |
|
| 820 | + */ |
|
| 821 | 821 | public function checkModeSRecent($modes) |
| 822 | 822 | { |
| 823 | 823 | global $globalDBdriver, $globalTimezone; |
@@ -844,19 +844,19 @@ discard block |
||
| 844 | 844 | $ident_result = $row['flightaware_id']; |
| 845 | 845 | } |
| 846 | 846 | return $ident_result; |
| 847 | - } |
|
| 847 | + } |
|
| 848 | 848 | |
| 849 | 849 | /** |
| 850 | - * Adds a new spotter data |
|
| 851 | - * |
|
| 852 | - * @param String $flightaware_id the ID from flightaware |
|
| 853 | - * @param String $ident the flight ident |
|
| 854 | - * @param String $aircraft_icao the aircraft type |
|
| 855 | - * @param String $departure_airport_icao the departure airport |
|
| 856 | - * @param String $arrival_airport_icao the arrival airport |
|
| 857 | - * @return String success or false |
|
| 858 | - * |
|
| 859 | - */ |
|
| 850 | + * Adds a new spotter data |
|
| 851 | + * |
|
| 852 | + * @param String $flightaware_id the ID from flightaware |
|
| 853 | + * @param String $ident the flight ident |
|
| 854 | + * @param String $aircraft_icao the aircraft type |
|
| 855 | + * @param String $departure_airport_icao the departure airport |
|
| 856 | + * @param String $arrival_airport_icao the arrival airport |
|
| 857 | + * @return String success or false |
|
| 858 | + * |
|
| 859 | + */ |
|
| 860 | 860 | public function addLiveSpotterData($flightaware_id = '', $ident = '', $aircraft_icao = '', $departure_airport_icao = '', $arrival_airport_icao = '', $latitude = '', $longitude = '', $waypoints = '', $altitude = '', $heading = '', $groundspeed = '', $date = '',$departure_airport_time = '', $arrival_airport_time = '', $squawk = '', $route_stop = '', $ModeS = '', $putinarchive = false,$registration = '',$pilot_id = '', $pilot_name = '', $verticalrate = '', $noarchive = false, $ground = false,$format_source = '', $source_name = '', $over_country = '') |
| 861 | 861 | { |
| 862 | 862 | global $globalURL, $globalArchive, $globalDebug; |
@@ -991,10 +991,10 @@ discard block |
||
| 991 | 991 | $arrival_airport_country = ''; |
| 992 | 992 | |
| 993 | 993 | |
| 994 | - if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 995 | - if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 996 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 997 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 994 | + if ($squawk == '' || $Common->isInteger($squawk) === false ) $squawk = NULL; |
|
| 995 | + if ($verticalrate == '' || $Common->isInteger($verticalrate) === false ) $verticalrate = NULL; |
|
| 996 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 997 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 998 | 998 | |
| 999 | 999 | $query = 'INSERT INTO spotter_live (flightaware_id, ident, registration, airline_name, airline_icao, airline_country, airline_type, aircraft_icao, aircraft_shadow, aircraft_name, aircraft_manufacturer, departure_airport_icao, departure_airport_name, departure_airport_city, departure_airport_country, arrival_airport_icao, arrival_airport_name, arrival_airport_city, arrival_airport_country, latitude, longitude, waypoints, altitude, heading, ground_speed, date, departure_airport_time, arrival_airport_time, squawk, route_stop, ModeS, pilot_id, pilot_name, verticalrate, ground, format_source, source_name, over_country) |
| 1000 | 1000 | VALUES (:flightaware_id,:ident,:registration,:airline_name,:airline_icao,:airline_country,:airline_type,:aircraft_icao,:aircraft_shadow,:aircraft_type,:aircraft_manufacturer,:departure_airport_icao,:departure_airport_name, :departure_airport_city, :departure_airport_country, :arrival_airport_icao, :arrival_airport_name, :arrival_airport_city, :arrival_airport_country, :latitude,:longitude,:waypoints,:altitude,:heading,:groundspeed,:date,:departure_airport_time,:arrival_airport_time,:squawk,:route_stop,:ModeS, :pilot_id, :pilot_name, :verticalrate, :ground, :format_source, :source_name, :over_country)'; |
@@ -1004,14 +1004,14 @@ discard block |
||
| 1004 | 1004 | |
| 1005 | 1005 | $sth = $this->db->prepare($query); |
| 1006 | 1006 | $sth->execute($query_values); |
| 1007 | - } catch(PDOException $e) { |
|
| 1008 | - return "error : ".$e->getMessage(); |
|
| 1009 | - } |
|
| 1007 | + } catch(PDOException $e) { |
|
| 1008 | + return "error : ".$e->getMessage(); |
|
| 1009 | + } |
|
| 1010 | 1010 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1011 | - if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1012 | - $SpotterArchive = new SpotterArchive($this->db); |
|
| 1013 | - $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1014 | - if ($globalDebug) echo $result.')'; |
|
| 1011 | + if ($globalDebug) echo '(Add to SBS archive : '; |
|
| 1012 | + $SpotterArchive = new SpotterArchive($this->db); |
|
| 1013 | + $result = $SpotterArchive->addSpotterArchiveData($flightaware_id, $ident, $registration, $airline_name, $airline_icao, $airline_country, $airline_type, $aircraft_icao, $aircraft_shadow, $aircraft_name, $aircraft_manufacturer, $departure_airport_icao, $departure_airport_name, $departure_airport_city, $departure_airport_country, $departure_airport_time,$arrival_airport_icao, $arrival_airport_name, $arrival_airport_city, $arrival_airport_country, $arrival_airport_time, $route_stop, $date,$latitude, $longitude, $waypoints, $altitude, $heading, $groundspeed, $squawk, $ModeS, $pilot_id, $pilot_name,$verticalrate,$format_source,$source_name, $over_country); |
|
| 1014 | + if ($globalDebug) echo $result.')'; |
|
| 1015 | 1015 | } |
| 1016 | 1016 | return "success"; |
| 1017 | 1017 | |
@@ -7,18 +7,18 @@ discard block |
||
| 7 | 7 | public $latest_schema = 36; |
| 8 | 8 | |
| 9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | - global $globalDBdriver; |
|
| 11 | - if ($dbc === null) { |
|
| 10 | + global $globalDBdriver; |
|
| 11 | + if ($dbc === null) { |
|
| 12 | 12 | if ($this->db === null && $dbname === null) { |
| 13 | - if ($user === null && $pass === null) { |
|
| 13 | + if ($user === null && $pass === null) { |
|
| 14 | 14 | $this->createDBConnection(); |
| 15 | - } else { |
|
| 15 | + } else { |
|
| 16 | 16 | $this->createDBConnection(null,$user,$pass); |
| 17 | - } |
|
| 17 | + } |
|
| 18 | 18 | } else { |
| 19 | - $this->createDBConnection($dbname); |
|
| 19 | + $this->createDBConnection($dbname); |
|
| 20 | 20 | } |
| 21 | - } elseif ($dbname === null || $dbname === 'default') { |
|
| 21 | + } elseif ($dbname === null || $dbname === 'default') { |
|
| 22 | 22 | $this->db = $dbc; |
| 23 | 23 | if ($this->connectionExists() === false) { |
| 24 | 24 | /* |
@@ -28,10 +28,10 @@ discard block |
||
| 28 | 28 | */ |
| 29 | 29 | $this->createDBConnection(); |
| 30 | 30 | } |
| 31 | - } else { |
|
| 31 | + } else { |
|
| 32 | 32 | //$this->connectionExists(); |
| 33 | 33 | $this->dbs[$dbname] = $dbc; |
| 34 | - } |
|
| 34 | + } |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | public function db() { |
@@ -47,11 +47,11 @@ discard block |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | /** |
| 50 | - * Creates the database connection |
|
| 51 | - * |
|
| 52 | - * @return Boolean of the database connection |
|
| 53 | - * |
|
| 54 | - */ |
|
| 50 | + * Creates the database connection |
|
| 51 | + * |
|
| 52 | + * @return Boolean of the database connection |
|
| 53 | + * |
|
| 54 | + */ |
|
| 55 | 55 | |
| 56 | 56 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
| 57 | 57 | { |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | return false; |
| 149 | 149 | } |
| 150 | 150 | if($results->rowCount()>0) { |
| 151 | - return true; |
|
| 151 | + return true; |
|
| 152 | 152 | } |
| 153 | 153 | else return false; |
| 154 | 154 | } |
@@ -165,14 +165,14 @@ discard block |
||
| 165 | 165 | $sum = $sum->fetchColumn(0); |
| 166 | 166 | } else $sum = 0; |
| 167 | 167 | if (intval($sum) !== 2) { |
| 168 | - return false; |
|
| 168 | + return false; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | } catch(PDOException $e) { |
| 172 | 172 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
| 173 | - throw $e; |
|
| 174 | - } |
|
| 175 | - //echo 'error ! '.$e->getMessage(); |
|
| 173 | + throw $e; |
|
| 174 | + } |
|
| 175 | + //echo 'error ! '.$e->getMessage(); |
|
| 176 | 176 | return false; |
| 177 | 177 | } |
| 178 | 178 | return true; |
@@ -276,8 +276,8 @@ discard block |
||
| 276 | 276 | $version = 0; |
| 277 | 277 | if ($this->tableExists('aircraft')) { |
| 278 | 278 | if (!$this->tableExists('config')) { |
| 279 | - $version = '1'; |
|
| 280 | - return $version; |
|
| 279 | + $version = '1'; |
|
| 280 | + return $version; |
|
| 281 | 281 | } else { |
| 282 | 282 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
| 283 | 283 | try { |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | * @return Boolean if latest version or not |
| 299 | 299 | */ |
| 300 | 300 | public function latest() { |
| 301 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 302 | - else return false; |
|
| 301 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
| 302 | + else return false; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | } |
@@ -8,18 +8,18 @@ discard block |
||
| 8 | 8 | class update_schema { |
| 9 | 9 | |
| 10 | 10 | public static function update_schedule() { |
| 11 | - $Connection = new Connection(); |
|
| 12 | - $Schedule = new Schedule(); |
|
| 13 | - $query = "SELECT * FROM schedule"; |
|
| 14 | - try { |
|
| 15 | - $sth = $Connection->db->prepare($query); |
|
| 11 | + $Connection = new Connection(); |
|
| 12 | + $Schedule = new Schedule(); |
|
| 13 | + $query = "SELECT * FROM schedule"; |
|
| 14 | + try { |
|
| 15 | + $sth = $Connection->db->prepare($query); |
|
| 16 | 16 | $sth->execute(); |
| 17 | - } catch(PDOException $e) { |
|
| 17 | + } catch(PDOException $e) { |
|
| 18 | 18 | return "error : ".$e->getMessage()."\n"; |
| 19 | - } |
|
| 20 | - while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 21 | - $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 22 | - } |
|
| 19 | + } |
|
| 20 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 21 | + $Schedule->addSchedule($row['ident'],$row['departure_airport_icao'],$row['departure_airport_time'],$row['arrival_airport_icao'],$row['arrival_airport_time']); |
|
| 22 | + } |
|
| 23 | 23 | |
| 24 | 24 | } |
| 25 | 25 | /* |
@@ -43,198 +43,198 @@ discard block |
||
| 43 | 43 | } |
| 44 | 44 | */ |
| 45 | 45 | private static function update_from_1() { |
| 46 | - $Connection = new Connection(); |
|
| 47 | - // Add new column to routes table |
|
| 48 | - //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
| 46 | + $Connection = new Connection(); |
|
| 47 | + // Add new column to routes table |
|
| 48 | + //$query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10),`ToAirport_Time` VARCHAR(10),`Source` VARCHAR(255),`date_added` DATETIME DEFAULT CURRENT TIMESTAMP,`date_modified` DATETIME,`date_lastseen` DATETIME"; |
|
| 49 | 49 | $query = "ALTER TABLE `routes` ADD `FromAirport_Time` VARCHAR(10) NULL , ADD `ToAirport_Time` VARCHAR(10) NULL , ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP, ADD `date_modified` timestamp NULL, ADD `date_lastseen` timestamp NULL"; |
| 50 | - try { |
|
| 51 | - $sth = $Connection->db->prepare($query); |
|
| 52 | - $sth->execute(); |
|
| 53 | - } catch(PDOException $e) { |
|
| 54 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 55 | - } |
|
| 56 | - // Copy schedules data to routes table |
|
| 57 | - self::update_schedule(); |
|
| 58 | - // Delete schedule table |
|
| 50 | + try { |
|
| 51 | + $sth = $Connection->db->prepare($query); |
|
| 52 | + $sth->execute(); |
|
| 53 | + } catch(PDOException $e) { |
|
| 54 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 55 | + } |
|
| 56 | + // Copy schedules data to routes table |
|
| 57 | + self::update_schedule(); |
|
| 58 | + // Delete schedule table |
|
| 59 | 59 | $query = "DROP TABLE `schedule`"; |
| 60 | - try { |
|
| 61 | - $sth = $Connection->db->prepare($query); |
|
| 62 | - $sth->execute(); |
|
| 63 | - } catch(PDOException $e) { |
|
| 64 | - return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
| 65 | - } |
|
| 66 | - // Add source column |
|
| 67 | - $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
| 68 | - try { |
|
| 69 | - $sth = $Connection->db->prepare($query); |
|
| 70 | - $sth->execute(); |
|
| 71 | - } catch(PDOException $e) { |
|
| 72 | - return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 73 | - } |
|
| 60 | + try { |
|
| 61 | + $sth = $Connection->db->prepare($query); |
|
| 62 | + $sth->execute(); |
|
| 63 | + } catch(PDOException $e) { |
|
| 64 | + return "error (delete schedule table) : ".$e->getMessage()."\n"; |
|
| 65 | + } |
|
| 66 | + // Add source column |
|
| 67 | + $query = "ALTER TABLE `aircraft_modes` ADD `Source` VARCHAR(255) NULL"; |
|
| 68 | + try { |
|
| 69 | + $sth = $Connection->db->prepare($query); |
|
| 70 | + $sth->execute(); |
|
| 71 | + } catch(PDOException $e) { |
|
| 72 | + return "error (add source column to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 73 | + } |
|
| 74 | 74 | // Delete unused column |
| 75 | 75 | $query = "ALTER TABLE `aircraft_modes` DROP `SerialNo`, DROP `OperatorFlagCode`, DROP `Manufacturer`, DROP `Type`, DROP `FirstRegDate`, DROP `CurrentRegDate`, DROP `Country`, DROP `PreviousID`, DROP `DeRegDate`, DROP `Status`, DROP `PopularName`, DROP `GenericName`, DROP `AircraftClass`, DROP `Engines`, DROP `OwnershipStatus`, DROP `RegisteredOwners`, DROP `MTOW`, DROP `TotalHours`, DROP `YearBuilt`, DROP `CofACategory`, DROP `CofAExpiry`, DROP `UserNotes`, DROP `Interested`, DROP `UserTag`, DROP `InfoUrl`, DROP `PictureUrl1`, DROP `PictureUrl2`, DROP `PictureUrl3`, DROP `UserBool1`, DROP `UserBool2`, DROP `UserBool3`, DROP `UserBool4`, DROP `UserBool5`, DROP `UserString1`, DROP `UserString2`, DROP `UserString3`, DROP `UserString4`, DROP `UserString5`, DROP `UserInt1`, DROP `UserInt2`, DROP `UserInt3`, DROP `UserInt4`, DROP `UserInt5`"; |
| 76 | - try { |
|
| 77 | - $sth = $Connection->db->prepare($query); |
|
| 78 | - $sth->execute(); |
|
| 79 | - } catch(PDOException $e) { |
|
| 80 | - return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 81 | - } |
|
| 76 | + try { |
|
| 77 | + $sth = $Connection->db->prepare($query); |
|
| 78 | + $sth->execute(); |
|
| 79 | + } catch(PDOException $e) { |
|
| 80 | + return "error (Delete unused column of aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 81 | + } |
|
| 82 | 82 | // Add ModeS column |
| 83 | 83 | $query = "ALTER TABLE `spotter_output` ADD `ModeS` VARCHAR(255) NULL"; |
| 84 | - try { |
|
| 85 | - $sth = $Connection->db->prepare($query); |
|
| 86 | - $sth->execute(); |
|
| 87 | - } catch(PDOException $e) { |
|
| 88 | - return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
| 89 | - } |
|
| 84 | + try { |
|
| 85 | + $sth = $Connection->db->prepare($query); |
|
| 86 | + $sth->execute(); |
|
| 87 | + } catch(PDOException $e) { |
|
| 88 | + return "error (Add ModeS column in spotter_output) : ".$e->getMessage()."\n"; |
|
| 89 | + } |
|
| 90 | 90 | $query = "ALTER TABLE `spotter_live` ADD `ModeS` VARCHAR(255)"; |
| 91 | - try { |
|
| 92 | - $sth = $Connection->db->prepare($query); |
|
| 93 | - $sth->execute(); |
|
| 94 | - } catch(PDOException $e) { |
|
| 95 | - return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
| 96 | - } |
|
| 97 | - // Add auto_increment for aircraft_modes |
|
| 98 | - $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
| 99 | - try { |
|
| 100 | - $sth = $Connection->db->prepare($query); |
|
| 101 | - $sth->execute(); |
|
| 102 | - } catch(PDOException $e) { |
|
| 103 | - return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 104 | - } |
|
| 105 | - $error = ''; |
|
| 91 | + try { |
|
| 92 | + $sth = $Connection->db->prepare($query); |
|
| 93 | + $sth->execute(); |
|
| 94 | + } catch(PDOException $e) { |
|
| 95 | + return "error (Add ModeS column in spotter_live) : ".$e->getMessage()."\n"; |
|
| 96 | + } |
|
| 97 | + // Add auto_increment for aircraft_modes |
|
| 98 | + $query = "ALTER TABLE `aircraft_modes` CHANGE `AircraftID` `AircraftID` INT(11) NOT NULL AUTO_INCREMENT"; |
|
| 99 | + try { |
|
| 100 | + $sth = $Connection->db->prepare($query); |
|
| 101 | + $sth->execute(); |
|
| 102 | + } catch(PDOException $e) { |
|
| 103 | + return "error (Add Auto increment in aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 104 | + } |
|
| 105 | + $error = ''; |
|
| 106 | 106 | $error .= create_db::import_file('../db/acars_live.sql'); |
| 107 | 107 | $error .= create_db::import_file('../db/config.sql'); |
| 108 | 108 | // Update schema_version to 2 |
| 109 | 109 | $query = "UPDATE `config` SET `value` = '2' WHERE `name` = 'schema_version'"; |
| 110 | - try { |
|
| 111 | - $sth = $Connection->db->prepare($query); |
|
| 112 | - $sth->execute(); |
|
| 113 | - } catch(PDOException $e) { |
|
| 114 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 115 | - } |
|
| 110 | + try { |
|
| 111 | + $sth = $Connection->db->prepare($query); |
|
| 112 | + $sth->execute(); |
|
| 113 | + } catch(PDOException $e) { |
|
| 114 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 115 | + } |
|
| 116 | 116 | return $error; |
| 117 | - } |
|
| 117 | + } |
|
| 118 | 118 | |
| 119 | 119 | private static function update_from_2() { |
| 120 | - $Connection = new Connection(); |
|
| 121 | - // Add new column decode to acars_live table |
|
| 120 | + $Connection = new Connection(); |
|
| 121 | + // Add new column decode to acars_live table |
|
| 122 | 122 | $query = "ALTER TABLE `acars_live` ADD `decode` TEXT"; |
| 123 | - try { |
|
| 124 | - $sth = $Connection->db->prepare($query); |
|
| 125 | - $sth->execute(); |
|
| 126 | - } catch(PDOException $e) { |
|
| 127 | - return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 128 | - } |
|
| 129 | - $error = ''; |
|
| 130 | - // Create table acars_archive |
|
| 123 | + try { |
|
| 124 | + $sth = $Connection->db->prepare($query); |
|
| 125 | + $sth->execute(); |
|
| 126 | + } catch(PDOException $e) { |
|
| 127 | + return "error (add new columns to routes table) : ".$e->getMessage()."\n"; |
|
| 128 | + } |
|
| 129 | + $error = ''; |
|
| 130 | + // Create table acars_archive |
|
| 131 | 131 | $error .= create_db::import_file('../db/acars_archive.sql'); |
| 132 | 132 | // Update schema_version to 3 |
| 133 | 133 | $query = "UPDATE `config` SET `value` = '3' WHERE `name` = 'schema_version'"; |
| 134 | - try { |
|
| 135 | - $sth = $Connection->db->prepare($query); |
|
| 136 | - $sth->execute(); |
|
| 137 | - } catch(PDOException $e) { |
|
| 138 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 139 | - } |
|
| 134 | + try { |
|
| 135 | + $sth = $Connection->db->prepare($query); |
|
| 136 | + $sth->execute(); |
|
| 137 | + } catch(PDOException $e) { |
|
| 138 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 139 | + } |
|
| 140 | 140 | return $error; |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | private static function update_from_3() { |
| 144 | - $Connection = new Connection(); |
|
| 145 | - // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
| 144 | + $Connection = new Connection(); |
|
| 145 | + // Add default CURRENT_TIMESTAMP to aircraft_modes column FirstCreated |
|
| 146 | 146 | $query = "ALTER TABLE `aircraft_modes` CHANGE `FirstCreated` `FirstCreated` timestamp DEFAULT CURRENT_TIMESTAMP"; |
| 147 | - try { |
|
| 148 | - $sth = $Connection->db->prepare($query); |
|
| 149 | - $sth->execute(); |
|
| 150 | - } catch(PDOException $e) { |
|
| 151 | - return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 152 | - } |
|
| 153 | - // Add image_source_website column to spotter_image |
|
| 147 | + try { |
|
| 148 | + $sth = $Connection->db->prepare($query); |
|
| 149 | + $sth->execute(); |
|
| 150 | + } catch(PDOException $e) { |
|
| 151 | + return "error (add new columns to aircraft_modes) : ".$e->getMessage()."\n"; |
|
| 152 | + } |
|
| 153 | + // Add image_source_website column to spotter_image |
|
| 154 | 154 | $query = "ALTER TABLE `spotter_image` ADD `image_source_website` VARCHAR(999) NULL"; |
| 155 | - try { |
|
| 156 | - $sth = $Connection->db->prepare($query); |
|
| 157 | - $sth->execute(); |
|
| 158 | - } catch(PDOException $e) { |
|
| 159 | - return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
| 160 | - } |
|
| 161 | - $error = ''; |
|
| 155 | + try { |
|
| 156 | + $sth = $Connection->db->prepare($query); |
|
| 157 | + $sth->execute(); |
|
| 158 | + } catch(PDOException $e) { |
|
| 159 | + return "error (add new columns to spotter_image) : ".$e->getMessage()."\n"; |
|
| 160 | + } |
|
| 161 | + $error = ''; |
|
| 162 | 162 | // Update schema_version to 4 |
| 163 | 163 | $query = "UPDATE `config` SET `value` = '4' WHERE `name` = 'schema_version'"; |
| 164 | - try { |
|
| 165 | - $sth = $Connection->db->prepare($query); |
|
| 166 | - $sth->execute(); |
|
| 167 | - } catch(PDOException $e) { |
|
| 168 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 169 | - } |
|
| 164 | + try { |
|
| 165 | + $sth = $Connection->db->prepare($query); |
|
| 166 | + $sth->execute(); |
|
| 167 | + } catch(PDOException $e) { |
|
| 168 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 169 | + } |
|
| 170 | 170 | return $error; |
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | private static function update_from_4() { |
| 174 | - $Connection = new Connection(); |
|
| 174 | + $Connection = new Connection(); |
|
| 175 | 175 | |
| 176 | - $error = ''; |
|
| 177 | - // Create table acars_label |
|
| 176 | + $error = ''; |
|
| 177 | + // Create table acars_label |
|
| 178 | 178 | $error .= create_db::import_file('../db/acars_label.sql'); |
| 179 | 179 | if ($error == '') { |
| 180 | - // Update schema_version to 5 |
|
| 181 | - $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
| 182 | - try { |
|
| 183 | - $sth = $Connection->db->prepare($query); |
|
| 180 | + // Update schema_version to 5 |
|
| 181 | + $query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'"; |
|
| 182 | + try { |
|
| 183 | + $sth = $Connection->db->prepare($query); |
|
| 184 | 184 | $sth->execute(); |
| 185 | - } catch(PDOException $e) { |
|
| 185 | + } catch(PDOException $e) { |
|
| 186 | 186 | return "error (update schema_version) : ".$e->getMessage()."\n"; |
| 187 | - } |
|
| 188 | - } |
|
| 187 | + } |
|
| 188 | + } |
|
| 189 | 189 | return $error; |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | private static function update_from_5() { |
| 193 | - $Connection = new Connection(); |
|
| 194 | - // Add columns to translation |
|
| 193 | + $Connection = new Connection(); |
|
| 194 | + // Add columns to translation |
|
| 195 | 195 | $query = "ALTER TABLE `translation` ADD `Source` VARCHAR(255) NULL, ADD `date_added` timestamp DEFAULT CURRENT_TIMESTAMP , ADD `date_modified` timestamp DEFAULT CURRENT_TIMESTAMP ;"; |
| 196 | - try { |
|
| 197 | - $sth = $Connection->db->prepare($query); |
|
| 198 | - $sth->execute(); |
|
| 199 | - } catch(PDOException $e) { |
|
| 200 | - return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
| 201 | - } |
|
| 202 | - // Add aircraft_shadow column to aircraft |
|
| 203 | - $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 204 | - try { |
|
| 205 | - $sth = $Connection->db->prepare($query); |
|
| 206 | - $sth->execute(); |
|
| 207 | - } catch(PDOException $e) { |
|
| 208 | - return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
| 209 | - } |
|
| 210 | - // Add aircraft_shadow column to spotter_live |
|
| 211 | - $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 212 | - try { |
|
| 213 | - $sth = $Connection->db->prepare($query); |
|
| 214 | - $sth->execute(); |
|
| 215 | - } catch(PDOException $e) { |
|
| 216 | - return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 217 | - } |
|
| 218 | - $error = ''; |
|
| 219 | - // Update table aircraft |
|
| 196 | + try { |
|
| 197 | + $sth = $Connection->db->prepare($query); |
|
| 198 | + $sth->execute(); |
|
| 199 | + } catch(PDOException $e) { |
|
| 200 | + return "error (add new columns to translation) : ".$e->getMessage()."\n"; |
|
| 201 | + } |
|
| 202 | + // Add aircraft_shadow column to aircraft |
|
| 203 | + $query = "ALTER TABLE `aircraft` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 204 | + try { |
|
| 205 | + $sth = $Connection->db->prepare($query); |
|
| 206 | + $sth->execute(); |
|
| 207 | + } catch(PDOException $e) { |
|
| 208 | + return "error (add new column to aircraft) : ".$e->getMessage()."\n"; |
|
| 209 | + } |
|
| 210 | + // Add aircraft_shadow column to spotter_live |
|
| 211 | + $query = "ALTER TABLE `spotter_live` ADD `aircraft_shadow` VARCHAR(255) NULL"; |
|
| 212 | + try { |
|
| 213 | + $sth = $Connection->db->prepare($query); |
|
| 214 | + $sth->execute(); |
|
| 215 | + } catch(PDOException $e) { |
|
| 216 | + return "error (add new column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 217 | + } |
|
| 218 | + $error = ''; |
|
| 219 | + // Update table aircraft |
|
| 220 | 220 | $error .= create_db::import_file('../db/aircraft.sql'); |
| 221 | 221 | $error .= create_db::import_file('../db/spotter_archive.sql'); |
| 222 | 222 | |
| 223 | 223 | // Update schema_version to 6 |
| 224 | 224 | $query = "UPDATE `config` SET `value` = '6' WHERE `name` = 'schema_version'"; |
| 225 | - try { |
|
| 226 | - $sth = $Connection->db->prepare($query); |
|
| 227 | - $sth->execute(); |
|
| 228 | - } catch(PDOException $e) { |
|
| 229 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 230 | - } |
|
| 225 | + try { |
|
| 226 | + $sth = $Connection->db->prepare($query); |
|
| 227 | + $sth->execute(); |
|
| 228 | + } catch(PDOException $e) { |
|
| 229 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 230 | + } |
|
| 231 | 231 | return $error; |
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | private static function update_from_6() { |
| 235 | - $Connection = new Connection(); |
|
| 236 | - if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 237 | - $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
| 235 | + $Connection = new Connection(); |
|
| 236 | + if (!$Connection->indexExists('spotter_output','flightaware_id')) { |
|
| 237 | + $query = "ALTER TABLE spotter_output ADD INDEX(flightaware_id); |
|
| 238 | 238 | ALTER TABLE spotter_output ADD INDEX(date); |
| 239 | 239 | ALTER TABLE spotter_output ADD INDEX(ident); |
| 240 | 240 | ALTER TABLE spotter_live ADD INDEX(flightaware_id); |
@@ -247,147 +247,147 @@ discard block |
||
| 247 | 247 | ALTER TABLE aircraft ADD INDEX(icao); |
| 248 | 248 | ALTER TABLE airport ADD INDEX(icao); |
| 249 | 249 | ALTER TABLE translation ADD INDEX(Operator);"; |
| 250 | - try { |
|
| 251 | - $sth = $Connection->db->prepare($query); |
|
| 250 | + try { |
|
| 251 | + $sth = $Connection->db->prepare($query); |
|
| 252 | 252 | $sth->execute(); |
| 253 | - } catch(PDOException $e) { |
|
| 253 | + } catch(PDOException $e) { |
|
| 254 | 254 | return "error (add some indexes) : ".$e->getMessage()."\n"; |
| 255 | - } |
|
| 256 | - } |
|
| 257 | - $error = ''; |
|
| 258 | - // Update table countries |
|
| 259 | - if ($Connection->tableExists('airspace')) { |
|
| 260 | - $error .= update_db::update_countries(); |
|
| 261 | - if ($error != '') return $error; |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + $error = ''; |
|
| 258 | + // Update table countries |
|
| 259 | + if ($Connection->tableExists('airspace')) { |
|
| 260 | + $error .= update_db::update_countries(); |
|
| 261 | + if ($error != '') return $error; |
|
| 262 | 262 | } |
| 263 | 263 | // Update schema_version to 7 |
| 264 | 264 | $query = "UPDATE `config` SET `value` = '7' WHERE `name` = 'schema_version'"; |
| 265 | - try { |
|
| 266 | - $sth = $Connection->db->prepare($query); |
|
| 267 | - $sth->execute(); |
|
| 268 | - } catch(PDOException $e) { |
|
| 269 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 270 | - } |
|
| 265 | + try { |
|
| 266 | + $sth = $Connection->db->prepare($query); |
|
| 267 | + $sth->execute(); |
|
| 268 | + } catch(PDOException $e) { |
|
| 269 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 270 | + } |
|
| 271 | 271 | return $error; |
| 272 | - } |
|
| 272 | + } |
|
| 273 | 273 | |
| 274 | 274 | private static function update_from_7() { |
| 275 | 275 | global $globalDBname, $globalDBdriver; |
| 276 | - $Connection = new Connection(); |
|
| 277 | - $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 276 | + $Connection = new Connection(); |
|
| 277 | + $query="ALTER TABLE spotter_live ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
|
| 278 | 278 | ALTER TABLE spotter_output ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL;"; |
| 279 | - try { |
|
| 280 | - $sth = $Connection->db->prepare($query); |
|
| 281 | - $sth->execute(); |
|
| 282 | - } catch(PDOException $e) { |
|
| 283 | - return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 284 | - } |
|
| 285 | - if ($globalDBdriver == 'mysql') { |
|
| 286 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 287 | - try { |
|
| 288 | - $sth = $Connection->db->prepare($query); |
|
| 279 | + try { |
|
| 280 | + $sth = $Connection->db->prepare($query); |
|
| 281 | + $sth->execute(); |
|
| 282 | + } catch(PDOException $e) { |
|
| 283 | + return "error (add pilot column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 284 | + } |
|
| 285 | + if ($globalDBdriver == 'mysql') { |
|
| 286 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 287 | + try { |
|
| 288 | + $sth = $Connection->db->prepare($query); |
|
| 289 | 289 | $sth->execute(); |
| 290 | - } catch(PDOException $e) { |
|
| 290 | + } catch(PDOException $e) { |
|
| 291 | 291 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 292 | - } |
|
| 293 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 294 | - if ($row['engine'] == 'ARCHIVE') { |
|
| 292 | + } |
|
| 293 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 294 | + if ($row['engine'] == 'ARCHIVE') { |
|
| 295 | 295 | $query = "CREATE TABLE copy LIKE spotter_archive; |
| 296 | 296 | ALTER TABLE copy ENGINE=ARCHIVE; |
| 297 | 297 | ALTER TABLE copy ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL; |
| 298 | 298 | INSERT INTO copy SELECT *, '' as pilot_name, '' as pilot_id FROM spotter_archive ORDER BY `spotter_archive_id`; |
| 299 | 299 | DROP TABLE spotter_archive; |
| 300 | 300 | RENAME TABLE copy TO spotter_archive;"; |
| 301 | - } else { |
|
| 302 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | - } |
|
| 304 | - } else { |
|
| 305 | - $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | - } |
|
| 307 | - try { |
|
| 308 | - $sth = $Connection->db->prepare($query); |
|
| 309 | - $sth->execute(); |
|
| 310 | - } catch(PDOException $e) { |
|
| 311 | - return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 312 | - } |
|
| 301 | + } else { |
|
| 302 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 303 | + } |
|
| 304 | + } else { |
|
| 305 | + $query="ALTER TABLE spotter_archive ADD pilot_name VARCHAR(255) NULL, ADD pilot_id VARCHAR(255) NULL"; |
|
| 306 | + } |
|
| 307 | + try { |
|
| 308 | + $sth = $Connection->db->prepare($query); |
|
| 309 | + $sth->execute(); |
|
| 310 | + } catch(PDOException $e) { |
|
| 311 | + return "error (add pilot column to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - $error = ''; |
|
| 315 | - // Update table aircraft |
|
| 314 | + $error = ''; |
|
| 315 | + // Update table aircraft |
|
| 316 | 316 | $error .= create_db::import_file('../db/source_location.sql'); |
| 317 | 317 | if ($error != '') return $error; |
| 318 | 318 | // Update schema_version to 6 |
| 319 | 319 | $query = "UPDATE `config` SET `value` = '8' WHERE `name` = 'schema_version'"; |
| 320 | - try { |
|
| 321 | - $sth = $Connection->db->prepare($query); |
|
| 322 | - $sth->execute(); |
|
| 323 | - } catch(PDOException $e) { |
|
| 324 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 325 | - } |
|
| 320 | + try { |
|
| 321 | + $sth = $Connection->db->prepare($query); |
|
| 322 | + $sth->execute(); |
|
| 323 | + } catch(PDOException $e) { |
|
| 324 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 325 | + } |
|
| 326 | 326 | return $error; |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | private static function update_from_8() { |
| 330 | - $Connection = new Connection(); |
|
| 331 | - $error = ''; |
|
| 332 | - // Update table aircraft |
|
| 330 | + $Connection = new Connection(); |
|
| 331 | + $error = ''; |
|
| 332 | + // Update table aircraft |
|
| 333 | 333 | $error .= create_db::import_file('../db/notam.sql'); |
| 334 | 334 | if ($error != '') return $error; |
| 335 | 335 | $query = "DELETE FROM config WHERE name = 'last_update_db'; |
| 336 | 336 | INSERT INTO config (name,value) VALUES ('last_update_db',NOW()); |
| 337 | 337 | DELETE FROM config WHERE name = 'last_update_notam_db'; |
| 338 | 338 | INSERT INTO config (name,value) VALUES ('last_update_notam_db',NOW());"; |
| 339 | - try { |
|
| 340 | - $sth = $Connection->db->prepare($query); |
|
| 341 | - $sth->execute(); |
|
| 342 | - } catch(PDOException $e) { |
|
| 343 | - return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
| 344 | - } |
|
| 339 | + try { |
|
| 340 | + $sth = $Connection->db->prepare($query); |
|
| 341 | + $sth->execute(); |
|
| 342 | + } catch(PDOException $e) { |
|
| 343 | + return "error (insert last_update values) : ".$e->getMessage()."\n"; |
|
| 344 | + } |
|
| 345 | 345 | $query = "UPDATE `config` SET `value` = '9' WHERE `name` = 'schema_version'"; |
| 346 | - try { |
|
| 347 | - $sth = $Connection->db->prepare($query); |
|
| 348 | - $sth->execute(); |
|
| 349 | - } catch(PDOException $e) { |
|
| 350 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 351 | - } |
|
| 346 | + try { |
|
| 347 | + $sth = $Connection->db->prepare($query); |
|
| 348 | + $sth->execute(); |
|
| 349 | + } catch(PDOException $e) { |
|
| 350 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 351 | + } |
|
| 352 | 352 | return $error; |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | private static function update_from_9() { |
| 356 | - $Connection = new Connection(); |
|
| 357 | - $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 356 | + $Connection = new Connection(); |
|
| 357 | + $query="ALTER TABLE spotter_live ADD verticalrate INT(11) NULL; |
|
| 358 | 358 | ALTER TABLE spotter_output ADD verticalrate INT(11) NULL;"; |
| 359 | - try { |
|
| 360 | - $sth = $Connection->db->prepare($query); |
|
| 361 | - $sth->execute(); |
|
| 362 | - } catch(PDOException $e) { |
|
| 363 | - return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 364 | - } |
|
| 359 | + try { |
|
| 360 | + $sth = $Connection->db->prepare($query); |
|
| 361 | + $sth->execute(); |
|
| 362 | + } catch(PDOException $e) { |
|
| 363 | + return "error (add verticalrate column to spotter_live and spotter_output) : ".$e->getMessage()."\n"; |
|
| 364 | + } |
|
| 365 | 365 | $error = ''; |
| 366 | - // Update table atc |
|
| 366 | + // Update table atc |
|
| 367 | 367 | $error .= create_db::import_file('../db/atc.sql'); |
| 368 | 368 | if ($error != '') return $error; |
| 369 | 369 | |
| 370 | 370 | $query = "UPDATE `config` SET `value` = '10' WHERE `name` = 'schema_version'"; |
| 371 | - try { |
|
| 372 | - $sth = $Connection->db->prepare($query); |
|
| 373 | - $sth->execute(); |
|
| 374 | - } catch(PDOException $e) { |
|
| 375 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 376 | - } |
|
| 371 | + try { |
|
| 372 | + $sth = $Connection->db->prepare($query); |
|
| 373 | + $sth->execute(); |
|
| 374 | + } catch(PDOException $e) { |
|
| 375 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 376 | + } |
|
| 377 | 377 | return $error; |
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | private static function update_from_10() { |
| 381 | - $Connection = new Connection(); |
|
| 382 | - $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | - try { |
|
| 384 | - $sth = $Connection->db->prepare($query); |
|
| 385 | - $sth->execute(); |
|
| 386 | - } catch(PDOException $e) { |
|
| 387 | - return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
| 388 | - } |
|
| 381 | + $Connection = new Connection(); |
|
| 382 | + $query="ALTER TABLE atc CHANGE `type` `type` ENUM('Observer','Flight Information','Delivery','Tower','Approach','ACC','Departure','Ground','Flight Service Station','Control Radar or Centre') CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL"; |
|
| 383 | + try { |
|
| 384 | + $sth = $Connection->db->prepare($query); |
|
| 385 | + $sth->execute(); |
|
| 386 | + } catch(PDOException $e) { |
|
| 387 | + return "error (add new enum to ATC table) : ".$e->getMessage()."\n"; |
|
| 388 | + } |
|
| 389 | 389 | $error = ''; |
| 390 | - // Add tables |
|
| 390 | + // Add tables |
|
| 391 | 391 | $error .= create_db::import_file('../db/aircraft_owner.sql'); |
| 392 | 392 | if ($error != '') return $error; |
| 393 | 393 | $error .= create_db::import_file('../db/metar.sql'); |
@@ -398,76 +398,76 @@ discard block |
||
| 398 | 398 | if ($error != '') return $error; |
| 399 | 399 | |
| 400 | 400 | $query = "UPDATE `config` SET `value` = '11' WHERE `name` = 'schema_version'"; |
| 401 | - try { |
|
| 402 | - $sth = $Connection->db->prepare($query); |
|
| 403 | - $sth->execute(); |
|
| 404 | - } catch(PDOException $e) { |
|
| 405 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 406 | - } |
|
| 401 | + try { |
|
| 402 | + $sth = $Connection->db->prepare($query); |
|
| 403 | + $sth->execute(); |
|
| 404 | + } catch(PDOException $e) { |
|
| 405 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 406 | + } |
|
| 407 | 407 | return $error; |
| 408 | 408 | } |
| 409 | 409 | |
| 410 | 410 | private static function update_from_11() { |
| 411 | 411 | global $globalDBdriver, $globalDBname; |
| 412 | - $Connection = new Connection(); |
|
| 413 | - $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | - try { |
|
| 415 | - $sth = $Connection->db->prepare($query); |
|
| 416 | - $sth->execute(); |
|
| 417 | - } catch(PDOException $e) { |
|
| 418 | - return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
| 419 | - } |
|
| 420 | - $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | - try { |
|
| 422 | - $sth = $Connection->db->prepare($query); |
|
| 423 | - $sth->execute(); |
|
| 424 | - } catch(PDOException $e) { |
|
| 425 | - return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 426 | - } |
|
| 427 | - if ($globalDBdriver == 'mysql') { |
|
| 428 | - $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 429 | - try { |
|
| 430 | - $sth = $Connection->db->prepare($query); |
|
| 412 | + $Connection = new Connection(); |
|
| 413 | + $query="ALTER TABLE spotter_output ADD owner_name VARCHAR(255) NULL DEFAULT NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_ground BOOLEAN NOT NULL DEFAULT FALSE, ADD last_seen DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP, ADD last_latitude FLOAT NULL, ADD last_longitude FLOAT NULL, ADD last_altitude INT(11) NULL, ADD last_ground_speed INT(11), ADD real_arrival_airport_icao VARCHAR(999), ADD real_arrival_airport_time VARCHAR(20),ADD real_departure_airport_icao VARCHAR(999), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 414 | + try { |
|
| 415 | + $sth = $Connection->db->prepare($query); |
|
| 416 | + $sth->execute(); |
|
| 417 | + } catch(PDOException $e) { |
|
| 418 | + return "error (add owner_name & format_source column to spotter_output) : ".$e->getMessage()."\n"; |
|
| 419 | + } |
|
| 420 | + $query="ALTER TABLE spotter_live ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 421 | + try { |
|
| 422 | + $sth = $Connection->db->prepare($query); |
|
| 423 | + $sth->execute(); |
|
| 424 | + } catch(PDOException $e) { |
|
| 425 | + return "error (format_source column to spotter_live) : ".$e->getMessage()."\n"; |
|
| 426 | + } |
|
| 427 | + if ($globalDBdriver == 'mysql') { |
|
| 428 | + $query = "SELECT ENGINE FROM information_schema.TABLES where TABLE_SCHEMA = '".$globalDBname."' AND TABLE_NAME = 'spotter_archive'"; |
|
| 429 | + try { |
|
| 430 | + $sth = $Connection->db->prepare($query); |
|
| 431 | 431 | $sth->execute(); |
| 432 | - } catch(PDOException $e) { |
|
| 432 | + } catch(PDOException $e) { |
|
| 433 | 433 | return "error (problem when select engine for spotter_engine) : ".$e->getMessage()."\n"; |
| 434 | - } |
|
| 435 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 436 | - if ($row['engine'] == 'ARCHIVE') { |
|
| 434 | + } |
|
| 435 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 436 | + if ($row['engine'] == 'ARCHIVE') { |
|
| 437 | 437 | $query = "CREATE TABLE copy LIKE spotter_archive; |
| 438 | 438 | ALTER TABLE copy ENGINE=ARCHIVE; |
| 439 | 439 | ALTER TABLE copy ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE; |
| 440 | 440 | INSERT INTO copy SELECT *, '' as verticalrate, '' as format_source, '0' as ground FROM spotter_archive ORDER BY `spotter_archive_id`; |
| 441 | 441 | DROP TABLE spotter_archive; |
| 442 | 442 | RENAME TABLE copy TO spotter_archive;"; |
| 443 | - } else { |
|
| 444 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | - } |
|
| 446 | - } else { |
|
| 447 | - $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | - } |
|
| 449 | - try { |
|
| 450 | - $sth = $Connection->db->prepare($query); |
|
| 451 | - $sth->execute(); |
|
| 452 | - } catch(PDOException $e) { |
|
| 453 | - return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 454 | - } |
|
| 443 | + } else { |
|
| 444 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 445 | + } |
|
| 446 | + } else { |
|
| 447 | + $query="ALTER TABLE spotter_archive ADD verticalrate INT(11) NULL, ADD format_source VARCHAR(255) NULL DEFAULT NULL, ADD ground BOOLEAN NOT NULL DEFAULT FALSE"; |
|
| 448 | + } |
|
| 449 | + try { |
|
| 450 | + $sth = $Connection->db->prepare($query); |
|
| 451 | + $sth->execute(); |
|
| 452 | + } catch(PDOException $e) { |
|
| 453 | + return "error (add columns to spotter_archive) : ".$e->getMessage()."\n"; |
|
| 454 | + } |
|
| 455 | 455 | |
| 456 | 456 | $error = ''; |
| 457 | 457 | |
| 458 | 458 | $query = "UPDATE `config` SET `value` = '12' WHERE `name` = 'schema_version'"; |
| 459 | - try { |
|
| 460 | - $sth = $Connection->db->prepare($query); |
|
| 461 | - $sth->execute(); |
|
| 462 | - } catch(PDOException $e) { |
|
| 463 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 464 | - } |
|
| 459 | + try { |
|
| 460 | + $sth = $Connection->db->prepare($query); |
|
| 461 | + $sth->execute(); |
|
| 462 | + } catch(PDOException $e) { |
|
| 463 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 464 | + } |
|
| 465 | 465 | return $error; |
| 466 | 466 | } |
| 467 | 467 | private static function update_from_12() { |
| 468 | - $Connection = new Connection(); |
|
| 468 | + $Connection = new Connection(); |
|
| 469 | 469 | $error = ''; |
| 470 | - // Add tables |
|
| 470 | + // Add tables |
|
| 471 | 471 | $error .= create_db::import_file('../db/stats.sql'); |
| 472 | 472 | if ($error != '') return $error; |
| 473 | 473 | $error .= create_db::import_file('../db/stats_aircraft.sql'); |
@@ -484,166 +484,166 @@ discard block |
||
| 484 | 484 | if ($error != '') return $error; |
| 485 | 485 | |
| 486 | 486 | $query = "UPDATE `config` SET `value` = '13' WHERE `name` = 'schema_version'"; |
| 487 | - try { |
|
| 488 | - $sth = $Connection->db->prepare($query); |
|
| 489 | - $sth->execute(); |
|
| 490 | - } catch(PDOException $e) { |
|
| 491 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 492 | - } |
|
| 487 | + try { |
|
| 488 | + $sth = $Connection->db->prepare($query); |
|
| 489 | + $sth->execute(); |
|
| 490 | + } catch(PDOException $e) { |
|
| 491 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 492 | + } |
|
| 493 | 493 | return $error; |
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | private static function update_from_13() { |
| 497 | - $Connection = new Connection(); |
|
| 498 | - if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | - $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 497 | + $Connection = new Connection(); |
|
| 498 | + if (!$Connection->checkColumnName('spotter_archive_output','real_departure_airport_icao')) { |
|
| 499 | + $query="ALTER TABLE spotter_archive_output ADD real_departure_airport_icao VARCHAR(20), ADD real_departure_airport_time VARCHAR(20)"; |
|
| 500 | 500 | try { |
| 501 | 501 | $sth = $Connection->db->prepare($query); |
| 502 | 502 | $sth->execute(); |
| 503 | - } catch(PDOException $e) { |
|
| 503 | + } catch(PDOException $e) { |
|
| 504 | 504 | return "error (update spotter_archive_output) : ".$e->getMessage()."\n"; |
| 505 | - } |
|
| 505 | + } |
|
| 506 | 506 | } |
| 507 | - $error = ''; |
|
| 507 | + $error = ''; |
|
| 508 | 508 | $query = "UPDATE `config` SET `value` = '14' WHERE `name` = 'schema_version'"; |
| 509 | - try { |
|
| 510 | - $sth = $Connection->db->prepare($query); |
|
| 511 | - $sth->execute(); |
|
| 512 | - } catch(PDOException $e) { |
|
| 513 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 514 | - } |
|
| 509 | + try { |
|
| 510 | + $sth = $Connection->db->prepare($query); |
|
| 511 | + $sth->execute(); |
|
| 512 | + } catch(PDOException $e) { |
|
| 513 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 514 | + } |
|
| 515 | 515 | return $error; |
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | private static function update_from_14() { |
| 519 | - $Connection = new Connection(); |
|
| 519 | + $Connection = new Connection(); |
|
| 520 | 520 | $error = ''; |
| 521 | - // Add tables |
|
| 522 | - if (!$Connection->tableExists('stats_flight')) { |
|
| 521 | + // Add tables |
|
| 522 | + if (!$Connection->tableExists('stats_flight')) { |
|
| 523 | 523 | $error .= create_db::import_file('../db/stats_flight.sql'); |
| 524 | 524 | if ($error != '') return $error; |
| 525 | 525 | } |
| 526 | 526 | $query = "UPDATE `config` SET `value` = '15' WHERE `name` = 'schema_version'"; |
| 527 | - try { |
|
| 528 | - $sth = $Connection->db->prepare($query); |
|
| 529 | - $sth->execute(); |
|
| 530 | - } catch(PDOException $e) { |
|
| 531 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 532 | - } |
|
| 527 | + try { |
|
| 528 | + $sth = $Connection->db->prepare($query); |
|
| 529 | + $sth->execute(); |
|
| 530 | + } catch(PDOException $e) { |
|
| 531 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 532 | + } |
|
| 533 | 533 | return $error; |
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | |
| 537 | 537 | private static function update_from_15() { |
| 538 | - $Connection = new Connection(); |
|
| 538 | + $Connection = new Connection(); |
|
| 539 | 539 | $error = ''; |
| 540 | - // Add tables |
|
| 541 | - $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | - try { |
|
| 543 | - $sth = $Connection->db->prepare($query); |
|
| 544 | - $sth->execute(); |
|
| 545 | - } catch(PDOException $e) { |
|
| 546 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 547 | - } |
|
| 540 | + // Add tables |
|
| 541 | + $query="ALTER TABLE `stats` CHANGE `stats_date` `stats_date` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP"; |
|
| 542 | + try { |
|
| 543 | + $sth = $Connection->db->prepare($query); |
|
| 544 | + $sth->execute(); |
|
| 545 | + } catch(PDOException $e) { |
|
| 546 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 547 | + } |
|
| 548 | 548 | if ($error != '') return $error; |
| 549 | 549 | $query = "UPDATE `config` SET `value` = '16' WHERE `name` = 'schema_version'"; |
| 550 | - try { |
|
| 551 | - $sth = $Connection->db->prepare($query); |
|
| 552 | - $sth->execute(); |
|
| 553 | - } catch(PDOException $e) { |
|
| 554 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 555 | - } |
|
| 550 | + try { |
|
| 551 | + $sth = $Connection->db->prepare($query); |
|
| 552 | + $sth->execute(); |
|
| 553 | + } catch(PDOException $e) { |
|
| 554 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 555 | + } |
|
| 556 | 556 | return $error; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | 559 | private static function update_from_16() { |
| 560 | - $Connection = new Connection(); |
|
| 560 | + $Connection = new Connection(); |
|
| 561 | 561 | $error = ''; |
| 562 | - // Add tables |
|
| 563 | - if (!$Connection->tableExists('stats_registration')) { |
|
| 562 | + // Add tables |
|
| 563 | + if (!$Connection->tableExists('stats_registration')) { |
|
| 564 | 564 | $error .= create_db::import_file('../db/stats_registration.sql'); |
| 565 | 565 | } |
| 566 | - if (!$Connection->tableExists('stats_callsign')) { |
|
| 566 | + if (!$Connection->tableExists('stats_callsign')) { |
|
| 567 | 567 | $error .= create_db::import_file('../db/stats_callsign.sql'); |
| 568 | 568 | } |
| 569 | 569 | if ($error != '') return $error; |
| 570 | 570 | $query = "UPDATE `config` SET `value` = '17' WHERE `name` = 'schema_version'"; |
| 571 | - try { |
|
| 572 | - $sth = $Connection->db->prepare($query); |
|
| 573 | - $sth->execute(); |
|
| 574 | - } catch(PDOException $e) { |
|
| 575 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 576 | - } |
|
| 571 | + try { |
|
| 572 | + $sth = $Connection->db->prepare($query); |
|
| 573 | + $sth->execute(); |
|
| 574 | + } catch(PDOException $e) { |
|
| 575 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 576 | + } |
|
| 577 | 577 | return $error; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | private static function update_from_17() { |
| 581 | - $Connection = new Connection(); |
|
| 581 | + $Connection = new Connection(); |
|
| 582 | 582 | $error = ''; |
| 583 | - // Add tables |
|
| 584 | - if (!$Connection->tableExists('stats_country')) { |
|
| 583 | + // Add tables |
|
| 584 | + if (!$Connection->tableExists('stats_country')) { |
|
| 585 | 585 | $error .= create_db::import_file('../db/stats_country.sql'); |
| 586 | 586 | } |
| 587 | 587 | if ($error != '') return $error; |
| 588 | 588 | $query = "UPDATE `config` SET `value` = '18' WHERE `name` = 'schema_version'"; |
| 589 | - try { |
|
| 590 | - $sth = $Connection->db->prepare($query); |
|
| 591 | - $sth->execute(); |
|
| 592 | - } catch(PDOException $e) { |
|
| 593 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 594 | - } |
|
| 589 | + try { |
|
| 590 | + $sth = $Connection->db->prepare($query); |
|
| 591 | + $sth->execute(); |
|
| 592 | + } catch(PDOException $e) { |
|
| 593 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 594 | + } |
|
| 595 | 595 | return $error; |
| 596 | 596 | } |
| 597 | 597 | private static function update_from_18() { |
| 598 | - $Connection = new Connection(); |
|
| 598 | + $Connection = new Connection(); |
|
| 599 | 599 | $error = ''; |
| 600 | - // Modify stats_airport table |
|
| 601 | - if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 602 | - $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
| 603 | - try { |
|
| 604 | - $sth = $Connection->db->prepare($query); |
|
| 605 | - $sth->execute(); |
|
| 606 | - } catch(PDOException $e) { |
|
| 607 | - return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 608 | - } |
|
| 609 | - } |
|
| 600 | + // Modify stats_airport table |
|
| 601 | + if (!$Connection->checkColumnName('stats_airport','airport_name')) { |
|
| 602 | + $query = "ALTER TABLE `stats_airport` ADD `stats_type` VARCHAR(50) NOT NULL DEFAULT 'yearly', ADD `airport_name` VARCHAR(255) NOT NULL, ADD `date` DATE NULL DEFAULT NULL, DROP INDEX `airport_icao`, ADD UNIQUE `airport_icao` (`airport_icao`, `type`, `date`)"; |
|
| 603 | + try { |
|
| 604 | + $sth = $Connection->db->prepare($query); |
|
| 605 | + $sth->execute(); |
|
| 606 | + } catch(PDOException $e) { |
|
| 607 | + return "error (update stats) : ".$e->getMessage()."\n"; |
|
| 608 | + } |
|
| 609 | + } |
|
| 610 | 610 | if ($error != '') return $error; |
| 611 | 611 | $query = "UPDATE `config` SET `value` = '19' WHERE `name` = 'schema_version'"; |
| 612 | - try { |
|
| 613 | - $sth = $Connection->db->prepare($query); |
|
| 614 | - $sth->execute(); |
|
| 615 | - } catch(PDOException $e) { |
|
| 616 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 617 | - } |
|
| 612 | + try { |
|
| 613 | + $sth = $Connection->db->prepare($query); |
|
| 614 | + $sth->execute(); |
|
| 615 | + } catch(PDOException $e) { |
|
| 616 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 617 | + } |
|
| 618 | 618 | return $error; |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | private static function update_from_19() { |
| 622 | - $Connection = new Connection(); |
|
| 622 | + $Connection = new Connection(); |
|
| 623 | 623 | $error = ''; |
| 624 | - // Update airport table |
|
| 624 | + // Update airport table |
|
| 625 | 625 | $error .= create_db::import_file('../db/airport.sql'); |
| 626 | 626 | if ($error != '') return 'Import airport.sql : '.$error; |
| 627 | 627 | // Remove primary key on Spotter_Archive |
| 628 | 628 | $query = "alter table spotter_archive drop spotter_archive_id"; |
| 629 | - try { |
|
| 630 | - $sth = $Connection->db->prepare($query); |
|
| 631 | - $sth->execute(); |
|
| 632 | - } catch(PDOException $e) { |
|
| 633 | - return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 634 | - } |
|
| 629 | + try { |
|
| 630 | + $sth = $Connection->db->prepare($query); |
|
| 631 | + $sth->execute(); |
|
| 632 | + } catch(PDOException $e) { |
|
| 633 | + return "error (remove primary key on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 634 | + } |
|
| 635 | 635 | $query = "alter table spotter_archive add spotter_archive_id INT(11)"; |
| 636 | - try { |
|
| 637 | - $sth = $Connection->db->prepare($query); |
|
| 638 | - $sth->execute(); |
|
| 639 | - } catch(PDOException $e) { |
|
| 640 | - return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 641 | - } |
|
| 636 | + try { |
|
| 637 | + $sth = $Connection->db->prepare($query); |
|
| 638 | + $sth->execute(); |
|
| 639 | + } catch(PDOException $e) { |
|
| 640 | + return "error (add id again on spotter_archive) : ".$e->getMessage()."\n"; |
|
| 641 | + } |
|
| 642 | 642 | if (!$Connection->checkColumnName('spotter_archive','over_country')) { |
| 643 | 643 | // Add column over_country |
| 644 | - $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 644 | + $query = "ALTER TABLE `spotter_archive` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 645 | 645 | try { |
| 646 | - $sth = $Connection->db->prepare($query); |
|
| 646 | + $sth = $Connection->db->prepare($query); |
|
| 647 | 647 | $sth->execute(); |
| 648 | 648 | } catch(PDOException $e) { |
| 649 | 649 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | } |
| 652 | 652 | if (!$Connection->checkColumnName('spotter_live','over_country')) { |
| 653 | 653 | // Add column over_country |
| 654 | - $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 654 | + $query = "ALTER TABLE `spotter_live` ADD `over_country` VARCHAR(5) NULL DEFAULT NULL"; |
|
| 655 | 655 | try { |
| 656 | - $sth = $Connection->db->prepare($query); |
|
| 656 | + $sth = $Connection->db->prepare($query); |
|
| 657 | 657 | $sth->execute(); |
| 658 | 658 | } catch(PDOException $e) { |
| 659 | 659 | return "error (add over_country) : ".$e->getMessage()."\n"; |
@@ -661,74 +661,74 @@ discard block |
||
| 661 | 661 | } |
| 662 | 662 | if (!$Connection->checkColumnName('spotter_output','source_name')) { |
| 663 | 663 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 664 | - $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 664 | + $query = "ALTER TABLE `spotter_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 665 | 665 | try { |
| 666 | 666 | $sth = $Connection->db->prepare($query); |
| 667 | 667 | $sth->execute(); |
| 668 | 668 | } catch(PDOException $e) { |
| 669 | 669 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 670 | - } |
|
| 671 | - } |
|
| 670 | + } |
|
| 671 | + } |
|
| 672 | 672 | if (!$Connection->checkColumnName('spotter_live','source_name')) { |
| 673 | 673 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 674 | - $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 674 | + $query = "ALTER TABLE `spotter_live` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 675 | 675 | try { |
| 676 | 676 | $sth = $Connection->db->prepare($query); |
| 677 | 677 | $sth->execute(); |
| 678 | 678 | } catch(PDOException $e) { |
| 679 | 679 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 680 | - } |
|
| 681 | - } |
|
| 680 | + } |
|
| 681 | + } |
|
| 682 | 682 | if (!$Connection->checkColumnName('spotter_archive_output','source_name')) { |
| 683 | 683 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 684 | - $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 684 | + $query = "ALTER TABLE `spotter_archive_output` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`"; |
|
| 685 | 685 | try { |
| 686 | 686 | $sth = $Connection->db->prepare($query); |
| 687 | 687 | $sth->execute(); |
| 688 | 688 | } catch(PDOException $e) { |
| 689 | 689 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 690 | - } |
|
| 691 | - } |
|
| 690 | + } |
|
| 691 | + } |
|
| 692 | 692 | if (!$Connection->checkColumnName('spotter_archive','source_name')) { |
| 693 | 693 | // Add source_name to spotter_output, spotter_live, spotter_archive, spotter_archive_output |
| 694 | - $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
| 694 | + $query = "ALTER TABLE `spotter_archive` ADD `source_name` VARCHAR(255) NULL AFTER `format_source`;"; |
|
| 695 | 695 | try { |
| 696 | 696 | $sth = $Connection->db->prepare($query); |
| 697 | 697 | $sth->execute(); |
| 698 | 698 | } catch(PDOException $e) { |
| 699 | 699 | return "error (add source_name column) : ".$e->getMessage()."\n"; |
| 700 | - } |
|
| 701 | - } |
|
| 700 | + } |
|
| 701 | + } |
|
| 702 | 702 | if ($error != '') return $error; |
| 703 | 703 | $query = "UPDATE `config` SET `value` = '20' WHERE `name` = 'schema_version'"; |
| 704 | - try { |
|
| 705 | - $sth = $Connection->db->prepare($query); |
|
| 706 | - $sth->execute(); |
|
| 707 | - } catch(PDOException $e) { |
|
| 708 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 709 | - } |
|
| 704 | + try { |
|
| 705 | + $sth = $Connection->db->prepare($query); |
|
| 706 | + $sth->execute(); |
|
| 707 | + } catch(PDOException $e) { |
|
| 708 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 709 | + } |
|
| 710 | 710 | return $error; |
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | private static function update_from_20() { |
| 714 | 714 | global $globalIVAO, $globalVATSIM, $globalphpVMS; |
| 715 | - $Connection = new Connection(); |
|
| 715 | + $Connection = new Connection(); |
|
| 716 | 716 | $error = ''; |
| 717 | - // Update airline table |
|
| 718 | - if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
| 717 | + // Update airline table |
|
| 718 | + if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
|
| 719 | 719 | $error .= create_db::import_file('../db/airlines.sql'); |
| 720 | 720 | if ($error != '') return 'Import airlines.sql : '.$error; |
| 721 | 721 | } |
| 722 | 722 | if (!$Connection->checkColumnName('aircraft_modes','type_flight')) { |
| 723 | 723 | // Add column over_country |
| 724 | - $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
| 725 | - try { |
|
| 724 | + $query = "ALTER TABLE `aircraft_modes` ADD `type_flight` VARCHAR(50) NULL DEFAULT NULL;"; |
|
| 725 | + try { |
|
| 726 | 726 | $sth = $Connection->db->prepare($query); |
| 727 | 727 | $sth->execute(); |
| 728 | 728 | } catch(PDOException $e) { |
| 729 | 729 | return "error (add over_country) : ".$e->getMessage()."\n"; |
| 730 | - } |
|
| 731 | - } |
|
| 730 | + } |
|
| 731 | + } |
|
| 732 | 732 | if ($error != '') return $error; |
| 733 | 733 | /* |
| 734 | 734 | if (!$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | } |
| 739 | 739 | */ |
| 740 | 740 | $query = "UPDATE `config` SET `value` = '21' WHERE `name` = 'schema_version'"; |
| 741 | - try { |
|
| 742 | - $sth = $Connection->db->prepare($query); |
|
| 743 | - $sth->execute(); |
|
| 744 | - } catch(PDOException $e) { |
|
| 745 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 746 | - } |
|
| 741 | + try { |
|
| 742 | + $sth = $Connection->db->prepare($query); |
|
| 743 | + $sth->execute(); |
|
| 744 | + } catch(PDOException $e) { |
|
| 745 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 746 | + } |
|
| 747 | 747 | return $error; |
| 748 | 748 | } |
| 749 | 749 | |
@@ -762,35 +762,35 @@ discard block |
||
| 762 | 762 | if ($error != '') return $error; |
| 763 | 763 | } |
| 764 | 764 | $query = "UPDATE `config` SET `value` = '22' WHERE `name` = 'schema_version'"; |
| 765 | - try { |
|
| 766 | - $sth = $Connection->db->prepare($query); |
|
| 767 | - $sth->execute(); |
|
| 768 | - } catch(PDOException $e) { |
|
| 769 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 770 | - } |
|
| 765 | + try { |
|
| 766 | + $sth = $Connection->db->prepare($query); |
|
| 767 | + $sth->execute(); |
|
| 768 | + } catch(PDOException $e) { |
|
| 769 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 770 | + } |
|
| 771 | 771 | return $error; |
| 772 | 772 | } |
| 773 | 773 | |
| 774 | 774 | private static function update_from_22() { |
| 775 | 775 | global $globalDBdriver; |
| 776 | - $Connection = new Connection(); |
|
| 776 | + $Connection = new Connection(); |
|
| 777 | 777 | $error = ''; |
| 778 | 778 | // Add table stats polar |
| 779 | - if (!$Connection->tableExists('stats_source')) { |
|
| 779 | + if (!$Connection->tableExists('stats_source')) { |
|
| 780 | 780 | if ($globalDBdriver == 'mysql') { |
| 781 | - $error .= create_db::import_file('../db/stats_source.sql'); |
|
| 781 | + $error .= create_db::import_file('../db/stats_source.sql'); |
|
| 782 | 782 | } else { |
| 783 | 783 | $error .= create_db::import_file('../db/pgsql/stats_source.sql'); |
| 784 | 784 | } |
| 785 | 785 | if ($error != '') return $error; |
| 786 | 786 | } |
| 787 | 787 | $query = "UPDATE config SET value = '23' WHERE name = 'schema_version'"; |
| 788 | - try { |
|
| 789 | - $sth = $Connection->db->prepare($query); |
|
| 790 | - $sth->execute(); |
|
| 791 | - } catch(PDOException $e) { |
|
| 792 | - return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 793 | - } |
|
| 788 | + try { |
|
| 789 | + $sth = $Connection->db->prepare($query); |
|
| 790 | + $sth->execute(); |
|
| 791 | + } catch(PDOException $e) { |
|
| 792 | + return "error (update schema_version) : ".$e->getMessage()."\n"; |
|
| 793 | + } |
|
| 794 | 794 | return $error; |
| 795 | 795 | } |
| 796 | 796 | |
@@ -821,14 +821,14 @@ discard block |
||
| 821 | 821 | } |
| 822 | 822 | if (!$Connection->checkColumnName('stats_aircraft','aircraft_manufacturer')) { |
| 823 | 823 | // Add aircraft_manufacturer to stats_aircraft |
| 824 | - $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
| 824 | + $query = "ALTER TABLE stats_aircraft ADD aircraft_manufacturer VARCHAR(255) NULL"; |
|
| 825 | 825 | try { |
| 826 | 826 | $sth = $Connection->db->prepare($query); |
| 827 | 827 | $sth->execute(); |
| 828 | 828 | } catch(PDOException $e) { |
| 829 | 829 | return "error (add aircraft_manufacturer column) : ".$e->getMessage()."\n"; |
| 830 | - } |
|
| 831 | - } |
|
| 830 | + } |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | 833 | $query = "UPDATE config SET value = '24' WHERE name = 'schema_version'"; |
| 834 | 834 | try { |
@@ -1176,7 +1176,7 @@ discard block |
||
| 1176 | 1176 | } catch(PDOException $e) { |
| 1177 | 1177 | return "error (add index latitude,longitude on spotter_live) : ".$e->getMessage()."\n"; |
| 1178 | 1178 | } |
| 1179 | - } |
|
| 1179 | + } |
|
| 1180 | 1180 | if (!$Connection->checkColumnName('aircraft','mfr')) { |
| 1181 | 1181 | // Add mfr to aircraft |
| 1182 | 1182 | $query = "ALTER TABLE aircraft ADD mfr VARCHAR(255) NULL"; |
@@ -1250,7 +1250,7 @@ discard block |
||
| 1250 | 1250 | } catch(PDOException $e) { |
| 1251 | 1251 | return "error (add index ref on notam) : ".$e->getMessage()."\n"; |
| 1252 | 1252 | } |
| 1253 | - } |
|
| 1253 | + } |
|
| 1254 | 1254 | if (!$Connection->indexExists('accidents','registration_idx')) { |
| 1255 | 1255 | // Add index key |
| 1256 | 1256 | $query = "create index registration_idx on accidents (registration)"; |
@@ -1260,7 +1260,7 @@ discard block |
||
| 1260 | 1260 | } catch(PDOException $e) { |
| 1261 | 1261 | return "error (add index registration on accidents) : ".$e->getMessage()."\n"; |
| 1262 | 1262 | } |
| 1263 | - } |
|
| 1263 | + } |
|
| 1264 | 1264 | if (!$Connection->indexExists('accidents','rdts')) { |
| 1265 | 1265 | // Add index key |
| 1266 | 1266 | $query = "create index rdts on accidents (registration,date,type,source)"; |
@@ -1270,7 +1270,7 @@ discard block |
||
| 1270 | 1270 | } catch(PDOException $e) { |
| 1271 | 1271 | return "error (add index registration, date, type & source on accidents) : ".$e->getMessage()."\n"; |
| 1272 | 1272 | } |
| 1273 | - } |
|
| 1273 | + } |
|
| 1274 | 1274 | |
| 1275 | 1275 | $query = "UPDATE config SET value = '31' WHERE name = 'schema_version'"; |
| 1276 | 1276 | try { |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | } catch(PDOException $e) { |
| 1563 | 1563 | return "error (add index type on accidents) : ".$e->getMessage()."\n"; |
| 1564 | 1564 | } |
| 1565 | - } |
|
| 1565 | + } |
|
| 1566 | 1566 | $query = "UPDATE config SET value = '36' WHERE name = 'schema_version'"; |
| 1567 | 1567 | try { |
| 1568 | 1568 | $sth = $Connection->db->prepare($query); |
@@ -1574,169 +1574,169 @@ discard block |
||
| 1574 | 1574 | } |
| 1575 | 1575 | |
| 1576 | 1576 | |
| 1577 | - public static function check_version($update = false) { |
|
| 1578 | - global $globalDBname; |
|
| 1579 | - $version = 0; |
|
| 1580 | - $Connection = new Connection(); |
|
| 1581 | - if ($Connection->tableExists('aircraft')) { |
|
| 1582 | - if (!$Connection->tableExists('config')) { |
|
| 1583 | - $version = '1'; |
|
| 1584 | - if ($update) return self::update_from_1(); |
|
| 1585 | - else return $version; |
|
| 1577 | + public static function check_version($update = false) { |
|
| 1578 | + global $globalDBname; |
|
| 1579 | + $version = 0; |
|
| 1580 | + $Connection = new Connection(); |
|
| 1581 | + if ($Connection->tableExists('aircraft')) { |
|
| 1582 | + if (!$Connection->tableExists('config')) { |
|
| 1583 | + $version = '1'; |
|
| 1584 | + if ($update) return self::update_from_1(); |
|
| 1585 | + else return $version; |
|
| 1586 | 1586 | } else { |
| 1587 | - $Connection = new Connection(); |
|
| 1588 | - $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
| 1589 | - try { |
|
| 1590 | - $sth = $Connection->db->prepare($query); |
|
| 1591 | - $sth->execute(); |
|
| 1592 | - } catch(PDOException $e) { |
|
| 1587 | + $Connection = new Connection(); |
|
| 1588 | + $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
|
| 1589 | + try { |
|
| 1590 | + $sth = $Connection->db->prepare($query); |
|
| 1591 | + $sth->execute(); |
|
| 1592 | + } catch(PDOException $e) { |
|
| 1593 | 1593 | return "error : ".$e->getMessage()."\n"; |
| 1594 | - } |
|
| 1595 | - $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1596 | - if ($update) { |
|
| 1597 | - if ($result['value'] == '2') { |
|
| 1598 | - $error = self::update_from_2(); |
|
| 1599 | - if ($error != '') return $error; |
|
| 1600 | - else return self::check_version(true); |
|
| 1601 | - } elseif ($result['value'] == '3') { |
|
| 1602 | - $error = self::update_from_3(); |
|
| 1603 | - if ($error != '') return $error; |
|
| 1604 | - else return self::check_version(true); |
|
| 1605 | - } elseif ($result['value'] == '4') { |
|
| 1606 | - $error = self::update_from_4(); |
|
| 1607 | - if ($error != '') return $error; |
|
| 1608 | - else return self::check_version(true); |
|
| 1609 | - } elseif ($result['value'] == '5') { |
|
| 1610 | - $error = self::update_from_5(); |
|
| 1611 | - if ($error != '') return $error; |
|
| 1612 | - else return self::check_version(true); |
|
| 1613 | - } elseif ($result['value'] == '6') { |
|
| 1614 | - $error = self::update_from_6(); |
|
| 1615 | - if ($error != '') return $error; |
|
| 1616 | - else return self::check_version(true); |
|
| 1617 | - } elseif ($result['value'] == '7') { |
|
| 1618 | - $error = self::update_from_7(); |
|
| 1619 | - if ($error != '') return $error; |
|
| 1620 | - else return self::check_version(true); |
|
| 1621 | - } elseif ($result['value'] == '8') { |
|
| 1622 | - $error = self::update_from_8(); |
|
| 1623 | - if ($error != '') return $error; |
|
| 1624 | - else return self::check_version(true); |
|
| 1625 | - } elseif ($result['value'] == '9') { |
|
| 1626 | - $error = self::update_from_9(); |
|
| 1627 | - if ($error != '') return $error; |
|
| 1628 | - else return self::check_version(true); |
|
| 1629 | - } elseif ($result['value'] == '10') { |
|
| 1630 | - $error = self::update_from_10(); |
|
| 1631 | - if ($error != '') return $error; |
|
| 1632 | - else return self::check_version(true); |
|
| 1633 | - } elseif ($result['value'] == '11') { |
|
| 1634 | - $error = self::update_from_11(); |
|
| 1635 | - if ($error != '') return $error; |
|
| 1636 | - else return self::check_version(true); |
|
| 1637 | - } elseif ($result['value'] == '12') { |
|
| 1638 | - $error = self::update_from_12(); |
|
| 1639 | - if ($error != '') return $error; |
|
| 1640 | - else return self::check_version(true); |
|
| 1641 | - } elseif ($result['value'] == '13') { |
|
| 1642 | - $error = self::update_from_13(); |
|
| 1643 | - if ($error != '') return $error; |
|
| 1644 | - else return self::check_version(true); |
|
| 1645 | - } elseif ($result['value'] == '14') { |
|
| 1646 | - $error = self::update_from_14(); |
|
| 1647 | - if ($error != '') return $error; |
|
| 1648 | - else return self::check_version(true); |
|
| 1649 | - } elseif ($result['value'] == '15') { |
|
| 1650 | - $error = self::update_from_15(); |
|
| 1651 | - if ($error != '') return $error; |
|
| 1652 | - else return self::check_version(true); |
|
| 1653 | - } elseif ($result['value'] == '16') { |
|
| 1654 | - $error = self::update_from_16(); |
|
| 1655 | - if ($error != '') return $error; |
|
| 1656 | - else return self::check_version(true); |
|
| 1657 | - } elseif ($result['value'] == '17') { |
|
| 1658 | - $error = self::update_from_17(); |
|
| 1659 | - if ($error != '') return $error; |
|
| 1660 | - else return self::check_version(true); |
|
| 1661 | - } elseif ($result['value'] == '18') { |
|
| 1662 | - $error = self::update_from_18(); |
|
| 1663 | - if ($error != '') return $error; |
|
| 1664 | - else return self::check_version(true); |
|
| 1665 | - } elseif ($result['value'] == '19') { |
|
| 1666 | - $error = self::update_from_19(); |
|
| 1667 | - if ($error != '') return $error; |
|
| 1668 | - else return self::check_version(true); |
|
| 1669 | - } elseif ($result['value'] == '20') { |
|
| 1670 | - $error = self::update_from_20(); |
|
| 1671 | - if ($error != '') return $error; |
|
| 1672 | - else return self::check_version(true); |
|
| 1673 | - } elseif ($result['value'] == '21') { |
|
| 1674 | - $error = self::update_from_21(); |
|
| 1675 | - if ($error != '') return $error; |
|
| 1676 | - else return self::check_version(true); |
|
| 1677 | - } elseif ($result['value'] == '22') { |
|
| 1678 | - $error = self::update_from_22(); |
|
| 1679 | - if ($error != '') return $error; |
|
| 1680 | - else return self::check_version(true); |
|
| 1681 | - } elseif ($result['value'] == '23') { |
|
| 1682 | - $error = self::update_from_23(); |
|
| 1683 | - if ($error != '') return $error; |
|
| 1684 | - else return self::check_version(true); |
|
| 1685 | - } elseif ($result['value'] == '24') { |
|
| 1686 | - $error = self::update_from_24(); |
|
| 1687 | - if ($error != '') return $error; |
|
| 1688 | - else return self::check_version(true); |
|
| 1689 | - } elseif ($result['value'] == '25') { |
|
| 1690 | - $error = self::update_from_25(); |
|
| 1691 | - if ($error != '') return $error; |
|
| 1692 | - else return self::check_version(true); |
|
| 1693 | - } elseif ($result['value'] == '26') { |
|
| 1694 | - $error = self::update_from_26(); |
|
| 1695 | - if ($error != '') return $error; |
|
| 1696 | - else return self::check_version(true); |
|
| 1697 | - } elseif ($result['value'] == '27') { |
|
| 1698 | - $error = self::update_from_27(); |
|
| 1699 | - if ($error != '') return $error; |
|
| 1700 | - else return self::check_version(true); |
|
| 1701 | - } elseif ($result['value'] == '28') { |
|
| 1702 | - $error = self::update_from_28(); |
|
| 1703 | - if ($error != '') return $error; |
|
| 1704 | - else return self::check_version(true); |
|
| 1705 | - } elseif ($result['value'] == '29') { |
|
| 1706 | - $error = self::update_from_29(); |
|
| 1707 | - if ($error != '') return $error; |
|
| 1708 | - else return self::check_version(true); |
|
| 1709 | - } elseif ($result['value'] == '30') { |
|
| 1710 | - $error = self::update_from_30(); |
|
| 1711 | - if ($error != '') return $error; |
|
| 1712 | - else return self::check_version(true); |
|
| 1713 | - } elseif ($result['value'] == '31') { |
|
| 1714 | - $error = self::update_from_31(); |
|
| 1715 | - if ($error != '') return $error; |
|
| 1716 | - else return self::check_version(true); |
|
| 1717 | - } elseif ($result['value'] == '32') { |
|
| 1718 | - $error = self::update_from_32(); |
|
| 1719 | - if ($error != '') return $error; |
|
| 1720 | - else return self::check_version(true); |
|
| 1721 | - } elseif ($result['value'] == '33') { |
|
| 1722 | - $error = self::update_from_33(); |
|
| 1723 | - if ($error != '') return $error; |
|
| 1724 | - else return self::check_version(true); |
|
| 1725 | - } elseif ($result['value'] == '34') { |
|
| 1726 | - $error = self::update_from_34(); |
|
| 1727 | - if ($error != '') return $error; |
|
| 1728 | - else return self::check_version(true); |
|
| 1729 | - } elseif ($result['value'] == '35') { |
|
| 1730 | - $error = self::update_from_35(); |
|
| 1731 | - if ($error != '') return $error; |
|
| 1732 | - else return self::check_version(true); |
|
| 1733 | - } else return ''; |
|
| 1734 | - } |
|
| 1735 | - else return $result['value']; |
|
| 1594 | + } |
|
| 1595 | + $result = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1596 | + if ($update) { |
|
| 1597 | + if ($result['value'] == '2') { |
|
| 1598 | + $error = self::update_from_2(); |
|
| 1599 | + if ($error != '') return $error; |
|
| 1600 | + else return self::check_version(true); |
|
| 1601 | + } elseif ($result['value'] == '3') { |
|
| 1602 | + $error = self::update_from_3(); |
|
| 1603 | + if ($error != '') return $error; |
|
| 1604 | + else return self::check_version(true); |
|
| 1605 | + } elseif ($result['value'] == '4') { |
|
| 1606 | + $error = self::update_from_4(); |
|
| 1607 | + if ($error != '') return $error; |
|
| 1608 | + else return self::check_version(true); |
|
| 1609 | + } elseif ($result['value'] == '5') { |
|
| 1610 | + $error = self::update_from_5(); |
|
| 1611 | + if ($error != '') return $error; |
|
| 1612 | + else return self::check_version(true); |
|
| 1613 | + } elseif ($result['value'] == '6') { |
|
| 1614 | + $error = self::update_from_6(); |
|
| 1615 | + if ($error != '') return $error; |
|
| 1616 | + else return self::check_version(true); |
|
| 1617 | + } elseif ($result['value'] == '7') { |
|
| 1618 | + $error = self::update_from_7(); |
|
| 1619 | + if ($error != '') return $error; |
|
| 1620 | + else return self::check_version(true); |
|
| 1621 | + } elseif ($result['value'] == '8') { |
|
| 1622 | + $error = self::update_from_8(); |
|
| 1623 | + if ($error != '') return $error; |
|
| 1624 | + else return self::check_version(true); |
|
| 1625 | + } elseif ($result['value'] == '9') { |
|
| 1626 | + $error = self::update_from_9(); |
|
| 1627 | + if ($error != '') return $error; |
|
| 1628 | + else return self::check_version(true); |
|
| 1629 | + } elseif ($result['value'] == '10') { |
|
| 1630 | + $error = self::update_from_10(); |
|
| 1631 | + if ($error != '') return $error; |
|
| 1632 | + else return self::check_version(true); |
|
| 1633 | + } elseif ($result['value'] == '11') { |
|
| 1634 | + $error = self::update_from_11(); |
|
| 1635 | + if ($error != '') return $error; |
|
| 1636 | + else return self::check_version(true); |
|
| 1637 | + } elseif ($result['value'] == '12') { |
|
| 1638 | + $error = self::update_from_12(); |
|
| 1639 | + if ($error != '') return $error; |
|
| 1640 | + else return self::check_version(true); |
|
| 1641 | + } elseif ($result['value'] == '13') { |
|
| 1642 | + $error = self::update_from_13(); |
|
| 1643 | + if ($error != '') return $error; |
|
| 1644 | + else return self::check_version(true); |
|
| 1645 | + } elseif ($result['value'] == '14') { |
|
| 1646 | + $error = self::update_from_14(); |
|
| 1647 | + if ($error != '') return $error; |
|
| 1648 | + else return self::check_version(true); |
|
| 1649 | + } elseif ($result['value'] == '15') { |
|
| 1650 | + $error = self::update_from_15(); |
|
| 1651 | + if ($error != '') return $error; |
|
| 1652 | + else return self::check_version(true); |
|
| 1653 | + } elseif ($result['value'] == '16') { |
|
| 1654 | + $error = self::update_from_16(); |
|
| 1655 | + if ($error != '') return $error; |
|
| 1656 | + else return self::check_version(true); |
|
| 1657 | + } elseif ($result['value'] == '17') { |
|
| 1658 | + $error = self::update_from_17(); |
|
| 1659 | + if ($error != '') return $error; |
|
| 1660 | + else return self::check_version(true); |
|
| 1661 | + } elseif ($result['value'] == '18') { |
|
| 1662 | + $error = self::update_from_18(); |
|
| 1663 | + if ($error != '') return $error; |
|
| 1664 | + else return self::check_version(true); |
|
| 1665 | + } elseif ($result['value'] == '19') { |
|
| 1666 | + $error = self::update_from_19(); |
|
| 1667 | + if ($error != '') return $error; |
|
| 1668 | + else return self::check_version(true); |
|
| 1669 | + } elseif ($result['value'] == '20') { |
|
| 1670 | + $error = self::update_from_20(); |
|
| 1671 | + if ($error != '') return $error; |
|
| 1672 | + else return self::check_version(true); |
|
| 1673 | + } elseif ($result['value'] == '21') { |
|
| 1674 | + $error = self::update_from_21(); |
|
| 1675 | + if ($error != '') return $error; |
|
| 1676 | + else return self::check_version(true); |
|
| 1677 | + } elseif ($result['value'] == '22') { |
|
| 1678 | + $error = self::update_from_22(); |
|
| 1679 | + if ($error != '') return $error; |
|
| 1680 | + else return self::check_version(true); |
|
| 1681 | + } elseif ($result['value'] == '23') { |
|
| 1682 | + $error = self::update_from_23(); |
|
| 1683 | + if ($error != '') return $error; |
|
| 1684 | + else return self::check_version(true); |
|
| 1685 | + } elseif ($result['value'] == '24') { |
|
| 1686 | + $error = self::update_from_24(); |
|
| 1687 | + if ($error != '') return $error; |
|
| 1688 | + else return self::check_version(true); |
|
| 1689 | + } elseif ($result['value'] == '25') { |
|
| 1690 | + $error = self::update_from_25(); |
|
| 1691 | + if ($error != '') return $error; |
|
| 1692 | + else return self::check_version(true); |
|
| 1693 | + } elseif ($result['value'] == '26') { |
|
| 1694 | + $error = self::update_from_26(); |
|
| 1695 | + if ($error != '') return $error; |
|
| 1696 | + else return self::check_version(true); |
|
| 1697 | + } elseif ($result['value'] == '27') { |
|
| 1698 | + $error = self::update_from_27(); |
|
| 1699 | + if ($error != '') return $error; |
|
| 1700 | + else return self::check_version(true); |
|
| 1701 | + } elseif ($result['value'] == '28') { |
|
| 1702 | + $error = self::update_from_28(); |
|
| 1703 | + if ($error != '') return $error; |
|
| 1704 | + else return self::check_version(true); |
|
| 1705 | + } elseif ($result['value'] == '29') { |
|
| 1706 | + $error = self::update_from_29(); |
|
| 1707 | + if ($error != '') return $error; |
|
| 1708 | + else return self::check_version(true); |
|
| 1709 | + } elseif ($result['value'] == '30') { |
|
| 1710 | + $error = self::update_from_30(); |
|
| 1711 | + if ($error != '') return $error; |
|
| 1712 | + else return self::check_version(true); |
|
| 1713 | + } elseif ($result['value'] == '31') { |
|
| 1714 | + $error = self::update_from_31(); |
|
| 1715 | + if ($error != '') return $error; |
|
| 1716 | + else return self::check_version(true); |
|
| 1717 | + } elseif ($result['value'] == '32') { |
|
| 1718 | + $error = self::update_from_32(); |
|
| 1719 | + if ($error != '') return $error; |
|
| 1720 | + else return self::check_version(true); |
|
| 1721 | + } elseif ($result['value'] == '33') { |
|
| 1722 | + $error = self::update_from_33(); |
|
| 1723 | + if ($error != '') return $error; |
|
| 1724 | + else return self::check_version(true); |
|
| 1725 | + } elseif ($result['value'] == '34') { |
|
| 1726 | + $error = self::update_from_34(); |
|
| 1727 | + if ($error != '') return $error; |
|
| 1728 | + else return self::check_version(true); |
|
| 1729 | + } elseif ($result['value'] == '35') { |
|
| 1730 | + $error = self::update_from_35(); |
|
| 1731 | + if ($error != '') return $error; |
|
| 1732 | + else return self::check_version(true); |
|
| 1733 | + } else return ''; |
|
| 1734 | + } |
|
| 1735 | + else return $result['value']; |
|
| 1736 | 1736 | } |
| 1737 | 1737 | |
| 1738 | - } else return $version; |
|
| 1739 | - } |
|
| 1738 | + } else return $version; |
|
| 1739 | + } |
|
| 1740 | 1740 | |
| 1741 | 1741 | } |
| 1742 | 1742 | //echo update_schema::check_version(); |
@@ -19,47 +19,47 @@ discard block |
||
| 19 | 19 | // Check if schema is at latest version |
| 20 | 20 | $Connection = new Connection(); |
| 21 | 21 | if ($Connection->latest() === false) { |
| 22 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | - exit(); |
|
| 22 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
| 23 | + exit(); |
|
| 24 | 24 | } |
| 25 | 25 | if (PHP_SAPI != 'cli') { |
| 26 | - echo "This script MUST be called from console, not a web browser."; |
|
| 26 | + echo "This script MUST be called from console, not a web browser."; |
|
| 27 | 27 | // exit(); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | // This is to be compatible with old version of settings.php |
| 31 | 31 | if (!isset($globalSources)) { |
| 32 | - if (isset($globalSBS1Hosts)) { |
|
| 33 | - //$hosts = $globalSBS1Hosts; |
|
| 34 | - foreach ($globalSBS1Hosts as $host) { |
|
| 35 | - $globalSources[] = array('host' => $host); |
|
| 36 | - } |
|
| 37 | - } else { |
|
| 38 | - if (!isset($globalSBS1Host)) { |
|
| 39 | - echo '$globalSources MUST be defined !'; |
|
| 40 | - die; |
|
| 32 | + if (isset($globalSBS1Hosts)) { |
|
| 33 | + //$hosts = $globalSBS1Hosts; |
|
| 34 | + foreach ($globalSBS1Hosts as $host) { |
|
| 35 | + $globalSources[] = array('host' => $host); |
|
| 36 | + } |
|
| 37 | + } else { |
|
| 38 | + if (!isset($globalSBS1Host)) { |
|
| 39 | + echo '$globalSources MUST be defined !'; |
|
| 40 | + die; |
|
| 41 | 41 | } |
| 42 | 42 | //$hosts = array($globalSBS1Host.':'.$globalSBS1Port); |
| 43 | 43 | $globalSources[] = array('host' => $globalSBS1Host,'port' => $globalSBS1Port); |
| 44 | - } |
|
| 44 | + } |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | $options = getopt('s::',array('source::','server','idsource::')); |
| 48 | 48 | //if (isset($options['s'])) $hosts = array($options['s']); |
| 49 | 49 | //elseif (isset($options['source'])) $hosts = array($options['source']); |
| 50 | 50 | if (isset($options['s'])) { |
| 51 | - $globalSources = array(); |
|
| 52 | - $globalSources[] = array('host' => $options['s']); |
|
| 51 | + $globalSources = array(); |
|
| 52 | + $globalSources[] = array('host' => $options['s']); |
|
| 53 | 53 | } elseif (isset($options['source'])) { |
| 54 | - $globalSources = array(); |
|
| 55 | - $globalSources[] = array('host' => $options['source']); |
|
| 54 | + $globalSources = array(); |
|
| 55 | + $globalSources[] = array('host' => $options['source']); |
|
| 56 | 56 | } |
| 57 | 57 | if (isset($options['server'])) $globalServer = TRUE; |
| 58 | 58 | if (isset($options['idsource'])) $id_source = $options['idsource']; |
| 59 | 59 | else $id_source = 1; |
| 60 | 60 | if (isset($globalServer) && $globalServer) { |
| 61 | - if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | - $SI=new SpotterServer(); |
|
| 61 | + if ($globalDebug) echo "Using Server Mode\n"; |
|
| 62 | + $SI=new SpotterServer(); |
|
| 63 | 63 | } else $SI=new SpotterImport($Connection->db); |
| 64 | 64 | //$APRS=new APRS($Connection->db); |
| 65 | 65 | $SBS=new SBS(); |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | //$servertz = system('date +%Z'); |
| 70 | 70 | // signal handler - playing nice with sockets and dump1090 |
| 71 | 71 | if (function_exists('pcntl_fork')) { |
| 72 | - pcntl_signal(SIGINT, function() { |
|
| 73 | - global $sockets; |
|
| 74 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | - die("Bye!\n"); |
|
| 76 | - }); |
|
| 77 | - pcntl_signal_dispatch(); |
|
| 72 | + pcntl_signal(SIGINT, function() { |
|
| 73 | + global $sockets; |
|
| 74 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
| 75 | + die("Bye!\n"); |
|
| 76 | + }); |
|
| 77 | + pcntl_signal_dispatch(); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | // let's try and connect |
@@ -84,162 +84,162 @@ discard block |
||
| 84 | 84 | $reset = 0; |
| 85 | 85 | |
| 86 | 86 | function create_socket($host, $port, &$errno, &$errstr) { |
| 87 | - $ip = gethostbyname($host); |
|
| 88 | - $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 89 | - $r = @socket_connect($s, $ip, $port); |
|
| 90 | - if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 91 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 92 | - return $s; |
|
| 93 | - } |
|
| 94 | - $errno = socket_last_error($s); |
|
| 95 | - $errstr = socket_strerror($errno); |
|
| 96 | - socket_close($s); |
|
| 97 | - return false; |
|
| 87 | + $ip = gethostbyname($host); |
|
| 88 | + $s = socket_create(AF_INET, SOCK_STREAM, 0); |
|
| 89 | + $r = @socket_connect($s, $ip, $port); |
|
| 90 | + if (!socket_set_nonblock($s)) echo "Unable to set nonblock on socket\n"; |
|
| 91 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 92 | + return $s; |
|
| 93 | + } |
|
| 94 | + $errno = socket_last_error($s); |
|
| 95 | + $errstr = socket_strerror($errno); |
|
| 96 | + socket_close($s); |
|
| 97 | + return false; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | function create_socket_udp($host, $port, &$errno, &$errstr) { |
| 101 | - echo "Create an UDP socket...\n"; |
|
| 102 | - $ip = gethostbyname($host); |
|
| 103 | - $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 104 | - $r = @socket_bind($s, $ip, $port); |
|
| 105 | - if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 106 | - return $s; |
|
| 107 | - } |
|
| 108 | - $errno = socket_last_error($s); |
|
| 109 | - $errstr = socket_strerror($errno); |
|
| 110 | - socket_close($s); |
|
| 111 | - return false; |
|
| 101 | + echo "Create an UDP socket...\n"; |
|
| 102 | + $ip = gethostbyname($host); |
|
| 103 | + $s = socket_create(AF_INET, SOCK_DGRAM, 0); |
|
| 104 | + $r = @socket_bind($s, $ip, $port); |
|
| 105 | + if ($r || socket_last_error() == 114 || socket_last_error() == 115) { |
|
| 106 | + return $s; |
|
| 107 | + } |
|
| 108 | + $errno = socket_last_error($s); |
|
| 109 | + $errstr = socket_strerror($errno); |
|
| 110 | + socket_close($s); |
|
| 111 | + return false; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | function connect_all($hosts) { |
| 115 | - //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | - global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset; |
|
| 117 | - $reset++; |
|
| 118 | - if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 119 | - foreach ($hosts as $id => $value) { |
|
| 115 | + //global $sockets, $formats, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs; |
|
| 116 | + global $sockets, $globalSources, $globalDebug,$aprs_connect,$last_exec, $globalSourcesRights, $use_aprs, $reset; |
|
| 117 | + $reset++; |
|
| 118 | + if ($globalDebug) echo 'Connect to all...'."\n"; |
|
| 119 | + foreach ($hosts as $id => $value) { |
|
| 120 | 120 | $host = $value['host']; |
| 121 | 121 | $globalSources[$id]['last_exec'] = 0; |
| 122 | 122 | // Here we check type of source(s) |
| 123 | 123 | if (filter_var($host,FILTER_VALIDATE_URL) && (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto')) { |
| 124 | - if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 125 | - //$formats[$id] = 'deltadbtxt'; |
|
| 126 | - $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 127 | - //$last_exec['deltadbtxt'] = 0; |
|
| 128 | - if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 129 | - } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 130 | - //$formats[$id] = 'vatsimtxt'; |
|
| 131 | - $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 132 | - //$last_exec['vatsimtxt'] = 0; |
|
| 133 | - if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 134 | - } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 135 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 136 | - $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 137 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 138 | - if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 139 | - } else if (preg_match('/opensky/i',$host)) { |
|
| 140 | - //$formats[$id] = 'aircraftlistjson'; |
|
| 141 | - $globalSources[$id]['format'] = 'opensky'; |
|
| 142 | - //$last_exec['aircraftlistjson'] = 0; |
|
| 143 | - if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 144 | - } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 145 | - //$formats[$id] = 'radarvirtueljson'; |
|
| 146 | - $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 147 | - //$last_exec['radarvirtueljson'] = 0; |
|
| 148 | - if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 149 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 150 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 151 | - exit(0); |
|
| 152 | - } |
|
| 153 | - } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 154 | - //$formats[$id] = 'planeupdatefaa'; |
|
| 155 | - $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 156 | - //$last_exec['planeupdatefaa'] = 0; |
|
| 157 | - if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 158 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 159 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 160 | - exit(0); |
|
| 161 | - } |
|
| 162 | - } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 163 | - //$formats[$id] = 'phpvmacars'; |
|
| 164 | - $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 165 | - //$last_exec['phpvmacars'] = 0; |
|
| 166 | - if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 167 | - } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 168 | - //$formats[$id] = 'phpvmacars'; |
|
| 169 | - $globalSources[$id]['format'] = 'vam'; |
|
| 170 | - if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 171 | - } else if (preg_match('/whazzup/i',$host)) { |
|
| 172 | - //$formats[$id] = 'whazzup'; |
|
| 173 | - $globalSources[$id]['format'] = 'whazzup'; |
|
| 174 | - //$last_exec['whazzup'] = 0; |
|
| 175 | - if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 176 | - } else if (preg_match('/recentpireps/i',$host)) { |
|
| 177 | - //$formats[$id] = 'pirepsjson'; |
|
| 178 | - $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 179 | - //$last_exec['pirepsjson'] = 0; |
|
| 180 | - if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 181 | - } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 182 | - //$formats[$id] = 'fr24json'; |
|
| 183 | - $globalSources[$id]['format'] = 'fr24json'; |
|
| 184 | - //$last_exec['fr24json'] = 0; |
|
| 185 | - if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 186 | - if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 187 | - echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 188 | - exit(0); |
|
| 189 | - } |
|
| 190 | - //} else if (preg_match('/10001/',$host)) { |
|
| 191 | - } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 192 | - //$formats[$id] = 'tsv'; |
|
| 193 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 194 | - if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 195 | - } |
|
| 196 | - } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | - if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 198 | - } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 199 | - $hostport = explode(':',$host); |
|
| 200 | - if (isset($hostport[1])) { |
|
| 124 | + if (preg_match('/deltadb.txt$/i',$host)) { |
|
| 125 | + //$formats[$id] = 'deltadbtxt'; |
|
| 126 | + $globalSources[$id]['format'] = 'deltadbtxt'; |
|
| 127 | + //$last_exec['deltadbtxt'] = 0; |
|
| 128 | + if ($globalDebug) echo "Connect to deltadb source (".$host.")...\n"; |
|
| 129 | + } else if (preg_match('/vatsim-data.txt$/i',$host)) { |
|
| 130 | + //$formats[$id] = 'vatsimtxt'; |
|
| 131 | + $globalSources[$id]['format'] = 'vatsimtxt'; |
|
| 132 | + //$last_exec['vatsimtxt'] = 0; |
|
| 133 | + if ($globalDebug) echo "Connect to vatsim source (".$host.")...\n"; |
|
| 134 | + } else if (preg_match('/aircraftlist.json$/i',$host)) { |
|
| 135 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 136 | + $globalSources[$id]['format'] = 'aircraftlistjson'; |
|
| 137 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 138 | + if ($globalDebug) echo "Connect to aircraftlist.json source (".$host.")...\n"; |
|
| 139 | + } else if (preg_match('/opensky/i',$host)) { |
|
| 140 | + //$formats[$id] = 'aircraftlistjson'; |
|
| 141 | + $globalSources[$id]['format'] = 'opensky'; |
|
| 142 | + //$last_exec['aircraftlistjson'] = 0; |
|
| 143 | + if ($globalDebug) echo "Connect to opensky source (".$host.")...\n"; |
|
| 144 | + } else if (preg_match('/radarvirtuel.com\/file.json$/i',$host)) { |
|
| 145 | + //$formats[$id] = 'radarvirtueljson'; |
|
| 146 | + $globalSources[$id]['format'] = 'radarvirtueljson'; |
|
| 147 | + //$last_exec['radarvirtueljson'] = 0; |
|
| 148 | + if ($globalDebug) echo "Connect to radarvirtuel.com/file.json source (".$host.")...\n"; |
|
| 149 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 150 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 151 | + exit(0); |
|
| 152 | + } |
|
| 153 | + } else if (preg_match('/planeUpdateFAA.php$/i',$host)) { |
|
| 154 | + //$formats[$id] = 'planeupdatefaa'; |
|
| 155 | + $globalSources[$id]['format'] = 'planeupdatefaa'; |
|
| 156 | + //$last_exec['planeupdatefaa'] = 0; |
|
| 157 | + if ($globalDebug) echo "Connect to planeUpdateFAA.php source (".$host.")...\n"; |
|
| 158 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 159 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 160 | + exit(0); |
|
| 161 | + } |
|
| 162 | + } else if (preg_match('/\/action.php\/acars\/data$/i',$host)) { |
|
| 163 | + //$formats[$id] = 'phpvmacars'; |
|
| 164 | + $globalSources[$id]['format'] = 'phpvmacars'; |
|
| 165 | + //$last_exec['phpvmacars'] = 0; |
|
| 166 | + if ($globalDebug) echo "Connect to phpvmacars source (".$host.")...\n"; |
|
| 167 | + } else if (preg_match('/VAM-json.php$/i',$host)) { |
|
| 168 | + //$formats[$id] = 'phpvmacars'; |
|
| 169 | + $globalSources[$id]['format'] = 'vam'; |
|
| 170 | + if ($globalDebug) echo "Connect to Vam source (".$host.")...\n"; |
|
| 171 | + } else if (preg_match('/whazzup/i',$host)) { |
|
| 172 | + //$formats[$id] = 'whazzup'; |
|
| 173 | + $globalSources[$id]['format'] = 'whazzup'; |
|
| 174 | + //$last_exec['whazzup'] = 0; |
|
| 175 | + if ($globalDebug) echo "Connect to whazzup source (".$host.")...\n"; |
|
| 176 | + } else if (preg_match('/recentpireps/i',$host)) { |
|
| 177 | + //$formats[$id] = 'pirepsjson'; |
|
| 178 | + $globalSources[$id]['format'] = 'pirepsjson'; |
|
| 179 | + //$last_exec['pirepsjson'] = 0; |
|
| 180 | + if ($globalDebug) echo "Connect to pirepsjson source (".$host.")...\n"; |
|
| 181 | + } else if (preg_match(':data.fr24.com/zones/fcgi/feed.js:i',$host)) { |
|
| 182 | + //$formats[$id] = 'fr24json'; |
|
| 183 | + $globalSources[$id]['format'] = 'fr24json'; |
|
| 184 | + //$last_exec['fr24json'] = 0; |
|
| 185 | + if ($globalDebug) echo "Connect to fr24 source (".$host.")...\n"; |
|
| 186 | + if (!isset($globalSourcesRights) || (isset($globalSourcesRights) && !$globalSourcesRights)) { |
|
| 187 | + echo '!!! You MUST set $globalSourcesRights = TRUE in settings.php if you have the right to use this feed !!!'."\n"; |
|
| 188 | + exit(0); |
|
| 189 | + } |
|
| 190 | + //} else if (preg_match('/10001/',$host)) { |
|
| 191 | + } else if (preg_match('/10001/',$host) || (isset($globalSources[$id]['port']) && $globalSources[$id]['port'] == '10001')) { |
|
| 192 | + //$formats[$id] = 'tsv'; |
|
| 193 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 194 | + if ($globalDebug) echo "Connect to tsv source (".$host.")...\n"; |
|
| 195 | + } |
|
| 196 | + } elseif (filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 197 | + if ($globalDebug) echo "Connect to ".$globalSources[$id]['format']." source (".$host.")...\n"; |
|
| 198 | + } elseif (!filter_var($host,FILTER_VALIDATE_URL)) { |
|
| 199 | + $hostport = explode(':',$host); |
|
| 200 | + if (isset($hostport[1])) { |
|
| 201 | 201 | $port = $hostport[1]; |
| 202 | 202 | $hostn = $hostport[0]; |
| 203 | - } else { |
|
| 203 | + } else { |
|
| 204 | 204 | $port = $globalSources[$id]['port']; |
| 205 | 205 | $hostn = $globalSources[$id]['host']; |
| 206 | - } |
|
| 207 | - if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 208 | - $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 209 | - } else { |
|
| 210 | - $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 211 | - } |
|
| 212 | - if ($s) { |
|
| 213 | - $sockets[$id] = $s; |
|
| 214 | - if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 215 | - if (preg_match('/aprs/',$hostn)) { |
|
| 206 | + } |
|
| 207 | + if (!isset($globalSources[$id]['format']) || ($globalSources[$id]['format'] != 'acars' && $globalSources[$id]['format'] != 'flightgearsp')) { |
|
| 208 | + $s = create_socket($hostn,$port, $errno, $errstr); |
|
| 209 | + } else { |
|
| 210 | + $s = create_socket_udp($hostn,$port, $errno, $errstr); |
|
| 211 | + } |
|
| 212 | + if ($s) { |
|
| 213 | + $sockets[$id] = $s; |
|
| 214 | + if (!isset($globalSources[$id]['format']) || strtolower($globalSources[$id]['format']) == 'auto') { |
|
| 215 | + if (preg_match('/aprs/',$hostn)) { |
|
| 216 | 216 | //$formats[$id] = 'aprs'; |
| 217 | 217 | $globalSources[$id]['format'] = 'aprs'; |
| 218 | 218 | //$aprs_connect = 0; |
| 219 | 219 | //$use_aprs = true; |
| 220 | - } elseif ($port == '10001') { |
|
| 221 | - //$formats[$id] = 'tsv'; |
|
| 222 | - $globalSources[$id]['format'] = 'tsv'; |
|
| 223 | - } elseif ($port == '30002') { |
|
| 224 | - //$formats[$id] = 'raw'; |
|
| 225 | - $globalSources[$id]['format'] = 'raw'; |
|
| 226 | - } elseif ($port == '5001') { |
|
| 227 | - //$formats[$id] = 'raw'; |
|
| 228 | - $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 229 | - } elseif ($port == '30005') { |
|
| 220 | + } elseif ($port == '10001') { |
|
| 221 | + //$formats[$id] = 'tsv'; |
|
| 222 | + $globalSources[$id]['format'] = 'tsv'; |
|
| 223 | + } elseif ($port == '30002') { |
|
| 224 | + //$formats[$id] = 'raw'; |
|
| 225 | + $globalSources[$id]['format'] = 'raw'; |
|
| 226 | + } elseif ($port == '5001') { |
|
| 227 | + //$formats[$id] = 'raw'; |
|
| 228 | + $globalSources[$id]['format'] = 'flightgearmp'; |
|
| 229 | + } elseif ($port == '30005') { |
|
| 230 | 230 | // Not yet supported |
| 231 | - //$formats[$id] = 'beast'; |
|
| 232 | - $globalSources[$id]['format'] = 'beast'; |
|
| 233 | - //} else $formats[$id] = 'sbs'; |
|
| 234 | - } else $globalSources[$id]['format'] = 'sbs'; |
|
| 235 | - //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 231 | + //$formats[$id] = 'beast'; |
|
| 232 | + $globalSources[$id]['format'] = 'beast'; |
|
| 233 | + //} else $formats[$id] = 'sbs'; |
|
| 234 | + } else $globalSources[$id]['format'] = 'sbs'; |
|
| 235 | + //if ($globalDebug) echo 'Connection in progress to '.$host.'('.$formats[$id].')....'."\n"; |
|
| 236 | 236 | } |
| 237 | 237 | if ($globalDebug) echo 'Connection in progress to '.$hostn.':'.$port.' ('.$globalSources[$id]['format'].')....'."\n"; |
| 238 | - } else { |
|
| 238 | + } else { |
|
| 239 | 239 | if ($globalDebug) echo 'Connection failed to '.$hostn.':'.$port.' : '.$errno.' '.$errstr."\n"; |
| 240 | - } |
|
| 241 | - } |
|
| 242 | - } |
|
| 240 | + } |
|
| 241 | + } |
|
| 242 | + } |
|
| 243 | 243 | } |
| 244 | 244 | if (!isset($globalMinFetch)) $globalMinFetch = 15; |
| 245 | 245 | |
@@ -266,18 +266,18 @@ discard block |
||
| 266 | 266 | die; |
| 267 | 267 | } |
| 268 | 268 | foreach ($globalSources as $key => $source) { |
| 269 | - if (!isset($source['format'])) { |
|
| 270 | - $globalSources[$key]['format'] = 'auto'; |
|
| 271 | - } |
|
| 269 | + if (!isset($source['format'])) { |
|
| 270 | + $globalSources[$key]['format'] = 'auto'; |
|
| 271 | + } |
|
| 272 | 272 | } |
| 273 | 273 | connect_all($globalSources); |
| 274 | 274 | foreach ($globalSources as $key => $source) { |
| 275 | - if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 275 | + if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 276 | 276 | $aprs_connect = 0; |
| 277 | 277 | $use_aprs = true; |
| 278 | 278 | if (isset($source['port']) && $source['port'] == '10152') $aprs_full = true; |
| 279 | 279 | break; |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | if ($use_aprs) { |
@@ -316,70 +316,70 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // Infinite loop if daemon, else work for time defined in $globalCronEnd or only one time. |
| 318 | 318 | while ($i > 0) { |
| 319 | - if (!$globalDaemon) $i = $endtime-time(); |
|
| 320 | - // Delete old ATC |
|
| 321 | - if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 319 | + if (!$globalDaemon) $i = $endtime-time(); |
|
| 320 | + // Delete old ATC |
|
| 321 | + if ($globalDaemon && ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM))) { |
|
| 322 | 322 | if ($globalDebug) echo 'Delete old ATC...'."\n"; |
| 323 | - $ATC->deleteOldATC(); |
|
| 324 | - } |
|
| 323 | + $ATC->deleteOldATC(); |
|
| 324 | + } |
|
| 325 | 325 | |
| 326 | - if (count($last_exec) > 0) { |
|
| 326 | + if (count($last_exec) > 0) { |
|
| 327 | 327 | $max = $globalMinFetch; |
| 328 | 328 | foreach ($last_exec as $last) { |
| 329 | - if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 329 | + if ((time() - $last['last']) < $max) $max = time() - $last['last']; |
|
| 330 | 330 | } |
| 331 | 331 | if ($max != $globalMinFetch) { |
| 332 | - if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 333 | - sleep($globalMinFetch-$max+2); |
|
| 332 | + if ($globalDebug) echo 'Sleeping...'."\n"; |
|
| 333 | + sleep($globalMinFetch-$max+2); |
|
| 334 | + } |
|
| 334 | 335 | } |
| 335 | - } |
|
| 336 | 336 | |
| 337 | 337 | |
| 338 | - //foreach ($formats as $id => $value) { |
|
| 339 | - foreach ($globalSources as $id => $value) { |
|
| 338 | + //foreach ($formats as $id => $value) { |
|
| 339 | + foreach ($globalSources as $id => $value) { |
|
| 340 | 340 | date_default_timezone_set('UTC'); |
| 341 | 341 | if (!isset($last_exec[$id]['last'])) $last_exec[$id]['last'] = 0; |
| 342 | 342 | if ($value['format'] == 'deltadbtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
| 343 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 344 | - $buffer = $Common->getData($value['host']); |
|
| 345 | - if ($buffer != '') $reset = 0; |
|
| 346 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 347 | - $buffer = explode('\n',$buffer); |
|
| 348 | - foreach ($buffer as $line) { |
|
| 349 | - if ($line != '' && count($line) > 7) { |
|
| 350 | - $line = explode(',', $line); |
|
| 351 | - $data = array(); |
|
| 352 | - $data['hex'] = $line[1]; // hex |
|
| 353 | - $data['ident'] = $line[2]; // ident |
|
| 354 | - if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 355 | - if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 356 | - if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 357 | - if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 358 | - if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 359 | - $data['verticalrate'] = ''; // vertical rate |
|
| 360 | - //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 361 | - $data['emergency'] = ''; // emergency |
|
| 362 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 363 | - $data['format_source'] = 'deltadbtxt'; |
|
| 364 | - $data['id_source'] = $id_source; |
|
| 365 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 366 | - if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 367 | - $SI->add($data); |
|
| 368 | - unset($data); |
|
| 369 | - } |
|
| 370 | - } |
|
| 371 | - $last_exec[$id]['last'] = time(); |
|
| 343 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 344 | + $buffer = $Common->getData($value['host']); |
|
| 345 | + if ($buffer != '') $reset = 0; |
|
| 346 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 347 | + $buffer = explode('\n',$buffer); |
|
| 348 | + foreach ($buffer as $line) { |
|
| 349 | + if ($line != '' && count($line) > 7) { |
|
| 350 | + $line = explode(',', $line); |
|
| 351 | + $data = array(); |
|
| 352 | + $data['hex'] = $line[1]; // hex |
|
| 353 | + $data['ident'] = $line[2]; // ident |
|
| 354 | + if (isset($line[3])) $data['altitude'] = $line[3]; // altitude |
|
| 355 | + if (isset($line[4])) $data['speed'] = $line[4]; // speed |
|
| 356 | + if (isset($line[5])) $data['heading'] = $line[5]; // heading |
|
| 357 | + if (isset($line[6])) $data['latitude'] = $line[6]; // lat |
|
| 358 | + if (isset($line[7])) $data['longitude'] = $line[7]; // long |
|
| 359 | + $data['verticalrate'] = ''; // vertical rate |
|
| 360 | + //if (isset($line[9])) $data['squawk'] = $line[9]; // squawk |
|
| 361 | + $data['emergency'] = ''; // emergency |
|
| 362 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 363 | + $data['format_source'] = 'deltadbtxt'; |
|
| 364 | + $data['id_source'] = $id_source; |
|
| 365 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 366 | + if (isset($value['sourcestats'])) $data['sourcestats'] = $value['sourcestats']; |
|
| 367 | + $SI->add($data); |
|
| 368 | + unset($data); |
|
| 369 | + } |
|
| 370 | + } |
|
| 371 | + $last_exec[$id]['last'] = time(); |
|
| 372 | 372 | //} elseif (($value == 'whazzup' && (time() - $last_exec['whazzup'] > $globalMinFetch)) || ($value == 'vatsimtxt' && (time() - $last_exec['vatsimtxt'] > $globalMinFetch))) { |
| 373 | 373 | } elseif (($value['format'] == 'whazzup' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) || ($value['format'] == 'vatsimtxt' && (time() - $last_exec[$id]['last'] > $globalMinFetch))) { |
| 374 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 375 | - $buffer = $Common->getData($value['host']); |
|
| 376 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 377 | - $buffer = explode('\n',$buffer); |
|
| 378 | - $reset = 0; |
|
| 379 | - foreach ($buffer as $line) { |
|
| 380 | - if ($line != '') { |
|
| 381 | - $line = explode(':', $line); |
|
| 382 | - if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 374 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 375 | + $buffer = $Common->getData($value['host']); |
|
| 376 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'\n',$buffer)); |
|
| 377 | + $buffer = explode('\n',$buffer); |
|
| 378 | + $reset = 0; |
|
| 379 | + foreach ($buffer as $line) { |
|
| 380 | + if ($line != '') { |
|
| 381 | + $line = explode(':', $line); |
|
| 382 | + if (count($line) > 30 && $line[0] != 'callsign') { |
|
| 383 | 383 | $data = array(); |
| 384 | 384 | if (isset($line[37]) && $line[37] != '') $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0].'-'.$line[37]; |
| 385 | 385 | else $data['id'] = $value['format'].'-'.$line[1].'-'.$line[0]; |
@@ -392,36 +392,36 @@ discard block |
||
| 392 | 392 | if (isset($line[45])) $data['heading'] = $line[45]; // heading |
| 393 | 393 | elseif (isset($line[38])) $data['heading'] = $line[38]; // heading |
| 394 | 394 | $data['latitude'] = $line[5]; // lat |
| 395 | - $data['longitude'] = $line[6]; // long |
|
| 396 | - $data['verticalrate'] = ''; // vertical rate |
|
| 397 | - $data['squawk'] = ''; // squawk |
|
| 398 | - $data['emergency'] = ''; // emergency |
|
| 399 | - $data['waypoints'] = $line[30]; |
|
| 395 | + $data['longitude'] = $line[6]; // long |
|
| 396 | + $data['verticalrate'] = ''; // vertical rate |
|
| 397 | + $data['squawk'] = ''; // squawk |
|
| 398 | + $data['emergency'] = ''; // emergency |
|
| 399 | + $data['waypoints'] = $line[30]; |
|
| 400 | 400 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 401 | 401 | //$data['datetime'] = date('Y-m-d H:i:s',strtotime($line[37])); |
| 402 | 402 | //if (isset($line[37])) $data['last_update'] = $line[37]; |
| 403 | - $data['departure_airport_icao'] = $line[11]; |
|
| 404 | - $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 405 | - $data['arrival_airport_icao'] = $line[13]; |
|
| 403 | + $data['departure_airport_icao'] = $line[11]; |
|
| 404 | + $data['departure_airport_time'] = rtrim(chunk_split($line[22],2,':'),':'); |
|
| 405 | + $data['arrival_airport_icao'] = $line[13]; |
|
| 406 | 406 | $data['frequency'] = $line[4]; |
| 407 | 407 | $data['type'] = $line[18]; |
| 408 | 408 | $data['range'] = $line[19]; |
| 409 | 409 | if (isset($line[35])) $data['info'] = $line[35]; |
| 410 | - $data['id_source'] = $id_source; |
|
| 411 | - //$data['arrival_airport_time'] = ; |
|
| 412 | - if ($line[9] != '') { |
|
| 413 | - $aircraft_data = explode('/',$line[9]); |
|
| 414 | - if (isset($aircraft_data[1])) { |
|
| 415 | - $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 416 | - } |
|
| 417 | - } |
|
| 418 | - /* |
|
| 410 | + $data['id_source'] = $id_source; |
|
| 411 | + //$data['arrival_airport_time'] = ; |
|
| 412 | + if ($line[9] != '') { |
|
| 413 | + $aircraft_data = explode('/',$line[9]); |
|
| 414 | + if (isset($aircraft_data[1])) { |
|
| 415 | + $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 416 | + } |
|
| 417 | + } |
|
| 418 | + /* |
|
| 419 | 419 | if ($value == 'whazzup') $data['format_source'] = 'whazzup'; |
| 420 | 420 | elseif ($value == 'vatsimtxt') $data['format_source'] = 'vatsimtxt'; |
| 421 | 421 | */ |
| 422 | - $data['format_source'] = $value['format']; |
|
| 422 | + $data['format_source'] = $value['format']; |
|
| 423 | 423 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 424 | - if ($line[3] == 'PILOT') $SI->add($data); |
|
| 424 | + if ($line[3] == 'PILOT') $SI->add($data); |
|
| 425 | 425 | elseif ($line[3] == 'ATC') { |
| 426 | 426 | //print_r($data); |
| 427 | 427 | $data['info'] = str_replace('^§','<br />',$data['info']); |
@@ -439,247 +439,247 @@ discard block |
||
| 439 | 439 | if (!isset($data['source_name'])) $data['source_name'] = ''; |
| 440 | 440 | if (isset($ATC)) echo $ATC->add($data['ident'],$data['frequency'],$data['latitude'],$data['longitude'],$data['range'],$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source'],$data['source_name']); |
| 441 | 441 | } |
| 442 | - unset($data); |
|
| 443 | - } |
|
| 444 | - } |
|
| 445 | - } |
|
| 446 | - //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 447 | - //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 448 | - $last_exec[$id]['last'] = time(); |
|
| 449 | - //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 450 | - } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 451 | - $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 452 | - if ($buffer != '') { |
|
| 453 | - $all_data = json_decode($buffer,true); |
|
| 454 | - if (isset($all_data['acList'])) { |
|
| 442 | + unset($data); |
|
| 443 | + } |
|
| 444 | + } |
|
| 445 | + } |
|
| 446 | + //if ($value == 'whazzup') $last_exec['whazzup'] = time(); |
|
| 447 | + //elseif ($value == 'vatsimtxt') $last_exec['vatsimtxt'] = time(); |
|
| 448 | + $last_exec[$id]['last'] = time(); |
|
| 449 | + //} elseif ($value == 'aircraftlistjson' && (time() - $last_exec['aircraftlistjson'] > $globalMinFetch)) { |
|
| 450 | + } elseif ($value['format'] == 'aircraftlistjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 451 | + $buffer = $Common->getData($value['host'],'get','','','','','20'); |
|
| 452 | + if ($buffer != '') { |
|
| 453 | + $all_data = json_decode($buffer,true); |
|
| 454 | + if (isset($all_data['acList'])) { |
|
| 455 | 455 | $reset = 0; |
| 456 | 456 | foreach ($all_data['acList'] as $line) { |
| 457 | - $data = array(); |
|
| 458 | - $data['hex'] = $line['Icao']; // hex |
|
| 459 | - if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 460 | - if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 461 | - if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 462 | - if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 463 | - if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 464 | - if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 465 | - //$data['verticalrate'] = $line['']; // verticale rate |
|
| 466 | - if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 467 | - $data['emergency'] = ''; // emergency |
|
| 468 | - if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 469 | - /* |
|
| 457 | + $data = array(); |
|
| 458 | + $data['hex'] = $line['Icao']; // hex |
|
| 459 | + if (isset($line['Call'])) $data['ident'] = $line['Call']; // ident |
|
| 460 | + if (isset($line['Alt'])) $data['altitude'] = $line['Alt']; // altitude |
|
| 461 | + if (isset($line['Spd'])) $data['speed'] = $line['Spd']; // speed |
|
| 462 | + if (isset($line['Trak'])) $data['heading'] = $line['Trak']; // heading |
|
| 463 | + if (isset($line['Lat'])) $data['latitude'] = $line['Lat']; // lat |
|
| 464 | + if (isset($line['Long'])) $data['longitude'] = $line['Long']; // long |
|
| 465 | + //$data['verticalrate'] = $line['']; // verticale rate |
|
| 466 | + if (isset($line['Sqk'])) $data['squawk'] = $line['Sqk']; // squawk |
|
| 467 | + $data['emergency'] = ''; // emergency |
|
| 468 | + if (isset($line['Reg'])) $data['registration'] = $line['Reg']; |
|
| 469 | + /* |
|
| 470 | 470 | if (isset($line['PosTime'])) $data['datetime'] = date('Y-m-d H:i:s',$line['PosTime']/1000); |
| 471 | 471 | else $data['datetime'] = date('Y-m-d H:i:s'); |
| 472 | 472 | */ |
| 473 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 474 | - if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 475 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 476 | - $data['id_source'] = $id_source; |
|
| 477 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 478 | - if (isset($data['datetime'])) $SI->add($data); |
|
| 479 | - unset($data); |
|
| 473 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 474 | + if (isset($line['Type'])) $data['aircraft_icao'] = $line['Type']; |
|
| 475 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 476 | + $data['id_source'] = $id_source; |
|
| 477 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 478 | + if (isset($data['datetime'])) $SI->add($data); |
|
| 479 | + unset($data); |
|
| 480 | 480 | } |
| 481 | - } else { |
|
| 481 | + } else { |
|
| 482 | 482 | $reset = 0; |
| 483 | 483 | foreach ($all_data as $line) { |
| 484 | - $data = array(); |
|
| 485 | - $data['hex'] = $line['hex']; // hex |
|
| 486 | - $data['ident'] = $line['flight']; // ident |
|
| 487 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 488 | - $data['speed'] = $line['speed']; // speed |
|
| 489 | - $data['heading'] = $line['track']; // heading |
|
| 490 | - $data['latitude'] = $line['lat']; // lat |
|
| 491 | - $data['longitude'] = $line['lon']; // long |
|
| 492 | - $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 493 | - $data['squawk'] = $line['squawk']; // squawk |
|
| 494 | - $data['emergency'] = ''; // emergency |
|
| 495 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 496 | - $data['format_source'] = 'aircraftlistjson'; |
|
| 497 | - $data['id_source'] = $id_source; |
|
| 498 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 499 | - $SI->add($data); |
|
| 500 | - unset($data); |
|
| 484 | + $data = array(); |
|
| 485 | + $data['hex'] = $line['hex']; // hex |
|
| 486 | + $data['ident'] = $line['flight']; // ident |
|
| 487 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 488 | + $data['speed'] = $line['speed']; // speed |
|
| 489 | + $data['heading'] = $line['track']; // heading |
|
| 490 | + $data['latitude'] = $line['lat']; // lat |
|
| 491 | + $data['longitude'] = $line['lon']; // long |
|
| 492 | + $data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 493 | + $data['squawk'] = $line['squawk']; // squawk |
|
| 494 | + $data['emergency'] = ''; // emergency |
|
| 495 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 496 | + $data['format_source'] = 'aircraftlistjson'; |
|
| 497 | + $data['id_source'] = $id_source; |
|
| 498 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 499 | + $SI->add($data); |
|
| 500 | + unset($data); |
|
| 501 | + } |
|
| 501 | 502 | } |
| 502 | - } |
|
| 503 | - } |
|
| 504 | - //$last_exec['aircraftlistjson'] = time(); |
|
| 505 | - $last_exec[$id]['last'] = time(); |
|
| 506 | - //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 507 | - } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 508 | - $buffer = $Common->getData($value['host']); |
|
| 509 | - $all_data = json_decode($buffer,true); |
|
| 510 | - if (isset($all_data['planes'])) { |
|
| 503 | + } |
|
| 504 | + //$last_exec['aircraftlistjson'] = time(); |
|
| 505 | + $last_exec[$id]['last'] = time(); |
|
| 506 | + //} elseif ($value == 'planeupdatefaa' && (time() - $last_exec['planeupdatefaa'] > $globalMinFetch)) { |
|
| 507 | + } elseif ($value['format'] == 'planeupdatefaa' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 508 | + $buffer = $Common->getData($value['host']); |
|
| 509 | + $all_data = json_decode($buffer,true); |
|
| 510 | + if (isset($all_data['planes'])) { |
|
| 511 | 511 | $reset = 0; |
| 512 | 512 | foreach ($all_data['planes'] as $key => $line) { |
| 513 | - $data = array(); |
|
| 514 | - $data['hex'] = $key; // hex |
|
| 515 | - $data['ident'] = $line[3]; // ident |
|
| 516 | - $data['altitude'] = $line[6]; // altitude |
|
| 517 | - $data['speed'] = $line[8]; // speed |
|
| 518 | - $data['heading'] = $line[7]; // heading |
|
| 519 | - $data['latitude'] = $line[4]; // lat |
|
| 520 | - $data['longitude'] = $line[5]; // long |
|
| 521 | - //$data['verticalrate'] = $line[]; // verticale rate |
|
| 522 | - $data['squawk'] = $line[10]; // squawk |
|
| 523 | - $data['emergency'] = ''; // emergency |
|
| 524 | - $data['registration'] = $line[2]; |
|
| 525 | - $data['aircraft_icao'] = $line[0]; |
|
| 526 | - $deparr = explode('-',$line[1]); |
|
| 527 | - if (count($deparr) == 2) { |
|
| 513 | + $data = array(); |
|
| 514 | + $data['hex'] = $key; // hex |
|
| 515 | + $data['ident'] = $line[3]; // ident |
|
| 516 | + $data['altitude'] = $line[6]; // altitude |
|
| 517 | + $data['speed'] = $line[8]; // speed |
|
| 518 | + $data['heading'] = $line[7]; // heading |
|
| 519 | + $data['latitude'] = $line[4]; // lat |
|
| 520 | + $data['longitude'] = $line[5]; // long |
|
| 521 | + //$data['verticalrate'] = $line[]; // verticale rate |
|
| 522 | + $data['squawk'] = $line[10]; // squawk |
|
| 523 | + $data['emergency'] = ''; // emergency |
|
| 524 | + $data['registration'] = $line[2]; |
|
| 525 | + $data['aircraft_icao'] = $line[0]; |
|
| 526 | + $deparr = explode('-',$line[1]); |
|
| 527 | + if (count($deparr) == 2) { |
|
| 528 | 528 | $data['departure_airport_icao'] = $deparr[0]; |
| 529 | 529 | $data['arrival_airport_icao'] = $deparr[1]; |
| 530 | - } |
|
| 531 | - $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 532 | - $data['format_source'] = 'planeupdatefaa'; |
|
| 533 | - $data['id_source'] = $id_source; |
|
| 534 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 535 | - $SI->add($data); |
|
| 536 | - unset($data); |
|
| 530 | + } |
|
| 531 | + $data['datetime'] = date('Y-m-d H:i:s',$line[9]); |
|
| 532 | + $data['format_source'] = 'planeupdatefaa'; |
|
| 533 | + $data['id_source'] = $id_source; |
|
| 534 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 535 | + $SI->add($data); |
|
| 536 | + unset($data); |
|
| 537 | + } |
|
| 537 | 538 | } |
| 538 | - } |
|
| 539 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 540 | - $last_exec[$id]['last'] = time(); |
|
| 541 | - } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 542 | - $buffer = $Common->getData($value['host']); |
|
| 543 | - $all_data = json_decode($buffer,true); |
|
| 544 | - if (isset($all_data['states'])) { |
|
| 539 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 540 | + $last_exec[$id]['last'] = time(); |
|
| 541 | + } elseif ($value['format'] == 'opensky' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 542 | + $buffer = $Common->getData($value['host']); |
|
| 543 | + $all_data = json_decode($buffer,true); |
|
| 544 | + if (isset($all_data['states'])) { |
|
| 545 | 545 | $reset = 0; |
| 546 | 546 | foreach ($all_data['states'] as $key => $line) { |
| 547 | - $data = array(); |
|
| 548 | - $data['hex'] = $line[0]; // hex |
|
| 549 | - $data['ident'] = trim($line[1]); // ident |
|
| 550 | - $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 551 | - $data['speed'] = round($line[9]*1.94384); // speed |
|
| 552 | - $data['heading'] = round($line[10]); // heading |
|
| 553 | - $data['latitude'] = $line[5]; // lat |
|
| 554 | - $data['longitude'] = $line[6]; // long |
|
| 555 | - $data['verticalrate'] = $line[11]; // verticale rate |
|
| 556 | - //$data['squawk'] = $line[10]; // squawk |
|
| 557 | - //$data['emergency'] = ''; // emergency |
|
| 558 | - //$data['registration'] = $line[2]; |
|
| 559 | - //$data['aircraft_icao'] = $line[0]; |
|
| 560 | - $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 561 | - $data['format_source'] = 'opensky'; |
|
| 562 | - $data['id_source'] = $id_source; |
|
| 563 | - $SI->add($data); |
|
| 564 | - unset($data); |
|
| 547 | + $data = array(); |
|
| 548 | + $data['hex'] = $line[0]; // hex |
|
| 549 | + $data['ident'] = trim($line[1]); // ident |
|
| 550 | + $data['altitude'] = round($line[7]*3.28084); // altitude |
|
| 551 | + $data['speed'] = round($line[9]*1.94384); // speed |
|
| 552 | + $data['heading'] = round($line[10]); // heading |
|
| 553 | + $data['latitude'] = $line[5]; // lat |
|
| 554 | + $data['longitude'] = $line[6]; // long |
|
| 555 | + $data['verticalrate'] = $line[11]; // verticale rate |
|
| 556 | + //$data['squawk'] = $line[10]; // squawk |
|
| 557 | + //$data['emergency'] = ''; // emergency |
|
| 558 | + //$data['registration'] = $line[2]; |
|
| 559 | + //$data['aircraft_icao'] = $line[0]; |
|
| 560 | + $data['datetime'] = date('Y-m-d H:i:s',$line[3]); |
|
| 561 | + $data['format_source'] = 'opensky'; |
|
| 562 | + $data['id_source'] = $id_source; |
|
| 563 | + $SI->add($data); |
|
| 564 | + unset($data); |
|
| 565 | + } |
|
| 565 | 566 | } |
| 566 | - } |
|
| 567 | - //$last_exec['planeupdatefaa'] = time(); |
|
| 568 | - $last_exec[$id]['last'] = time(); |
|
| 569 | - //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 570 | - } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 571 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 572 | - $buffer = $Common->getData($value['host']); |
|
| 573 | - $all_data = json_decode($buffer,true); |
|
| 574 | - if (!empty($all_data)) $reset = 0; |
|
| 575 | - foreach ($all_data as $key => $line) { |
|
| 567 | + //$last_exec['planeupdatefaa'] = time(); |
|
| 568 | + $last_exec[$id]['last'] = time(); |
|
| 569 | + //} elseif ($value == 'fr24json' && (time() - $last_exec['fr24json'] > $globalMinFetch)) { |
|
| 570 | + } elseif ($value['format'] == 'fr24json' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 571 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 572 | + $buffer = $Common->getData($value['host']); |
|
| 573 | + $all_data = json_decode($buffer,true); |
|
| 574 | + if (!empty($all_data)) $reset = 0; |
|
| 575 | + foreach ($all_data as $key => $line) { |
|
| 576 | 576 | if ($key != 'full_count' && $key != 'version' && $key != 'stats') { |
| 577 | - $data = array(); |
|
| 578 | - $data['hex'] = $line[0]; |
|
| 579 | - $data['ident'] = $line[16]; //$line[13] |
|
| 580 | - $data['altitude'] = $line[4]; // altitude |
|
| 581 | - $data['speed'] = $line[5]; // speed |
|
| 582 | - $data['heading'] = $line[3]; // heading |
|
| 583 | - $data['latitude'] = $line[1]; // lat |
|
| 584 | - $data['longitude'] = $line[2]; // long |
|
| 585 | - $data['verticalrate'] = $line[15]; // verticale rate |
|
| 586 | - $data['squawk'] = $line[6]; // squawk |
|
| 587 | - $data['aircraft_icao'] = $line[8]; |
|
| 588 | - $data['registration'] = $line[9]; |
|
| 589 | - $data['departure_airport_iata'] = $line[11]; |
|
| 590 | - $data['arrival_airport_iata'] = $line[12]; |
|
| 591 | - $data['emergency'] = ''; // emergency |
|
| 592 | - $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 593 | - $data['format_source'] = 'fr24json'; |
|
| 594 | - $data['id_source'] = $id_source; |
|
| 595 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 596 | - $SI->add($data); |
|
| 597 | - unset($data); |
|
| 577 | + $data = array(); |
|
| 578 | + $data['hex'] = $line[0]; |
|
| 579 | + $data['ident'] = $line[16]; //$line[13] |
|
| 580 | + $data['altitude'] = $line[4]; // altitude |
|
| 581 | + $data['speed'] = $line[5]; // speed |
|
| 582 | + $data['heading'] = $line[3]; // heading |
|
| 583 | + $data['latitude'] = $line[1]; // lat |
|
| 584 | + $data['longitude'] = $line[2]; // long |
|
| 585 | + $data['verticalrate'] = $line[15]; // verticale rate |
|
| 586 | + $data['squawk'] = $line[6]; // squawk |
|
| 587 | + $data['aircraft_icao'] = $line[8]; |
|
| 588 | + $data['registration'] = $line[9]; |
|
| 589 | + $data['departure_airport_iata'] = $line[11]; |
|
| 590 | + $data['arrival_airport_iata'] = $line[12]; |
|
| 591 | + $data['emergency'] = ''; // emergency |
|
| 592 | + $data['datetime'] = date('Y-m-d H:i:s'); //$line[10] |
|
| 593 | + $data['format_source'] = 'fr24json'; |
|
| 594 | + $data['id_source'] = $id_source; |
|
| 595 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 596 | + $SI->add($data); |
|
| 597 | + unset($data); |
|
| 598 | + } |
|
| 598 | 599 | } |
| 599 | - } |
|
| 600 | - //$last_exec['fr24json'] = time(); |
|
| 601 | - $last_exec[$id]['last'] = time(); |
|
| 602 | - //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 603 | - } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 604 | - //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 605 | - $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 606 | - //echo $buffer; |
|
| 607 | - $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 608 | - $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 609 | - $all_data = json_decode($buffer,true); |
|
| 610 | - if (json_last_error() != JSON_ERROR_NONE) { |
|
| 600 | + //$last_exec['fr24json'] = time(); |
|
| 601 | + $last_exec[$id]['last'] = time(); |
|
| 602 | + //} elseif ($value == 'radarvirtueljson' && (time() - $last_exec['radarvirtueljson'] > $globalMinFetch)) { |
|
| 603 | + } elseif ($value['format'] == 'radarvirtueljson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 604 | + //$buffer = $Common->getData($hosts[$id],'get','','','','','150'); |
|
| 605 | + $buffer = $Common->getData($value['host'],'get','','','','','150'); |
|
| 606 | + //echo $buffer; |
|
| 607 | + $buffer = str_replace(array("\n","\r"),"",$buffer); |
|
| 608 | + $buffer = preg_replace('/,"num":(.+)/','}',$buffer); |
|
| 609 | + $all_data = json_decode($buffer,true); |
|
| 610 | + if (json_last_error() != JSON_ERROR_NONE) { |
|
| 611 | 611 | die(json_last_error_msg()); |
| 612 | - } |
|
| 613 | - if (isset($all_data['mrkrs'])) { |
|
| 612 | + } |
|
| 613 | + if (isset($all_data['mrkrs'])) { |
|
| 614 | 614 | $reset = 0; |
| 615 | 615 | foreach ($all_data['mrkrs'] as $key => $line) { |
| 616 | - if (isset($line['inf'])) { |
|
| 616 | + if (isset($line['inf'])) { |
|
| 617 | 617 | $data = array(); |
| 618 | 618 | $data['hex'] = $line['inf']['ia']; |
| 619 | 619 | if (isset($line['inf']['cs'])) $data['ident'] = $line['inf']['cs']; //$line[13] |
| 620 | - $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 621 | - if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 622 | - if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 623 | - $data['latitude'] = $line['pt'][0]; // lat |
|
| 624 | - $data['longitude'] = $line['pt'][1]; // long |
|
| 625 | - //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 626 | - if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 627 | - //$data['aircraft_icao'] = $line[8]; |
|
| 628 | - if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 620 | + $data['altitude'] = round($line['inf']['al']*3.28084); // altitude |
|
| 621 | + if (isset($line['inf']['gs'])) $data['speed'] = round($line['inf']['gs']*0.539957); // speed |
|
| 622 | + if (isset($line['inf']['tr'])) $data['heading'] = $line['inf']['tr']; // heading |
|
| 623 | + $data['latitude'] = $line['pt'][0]; // lat |
|
| 624 | + $data['longitude'] = $line['pt'][1]; // long |
|
| 625 | + //if (isset($line['inf']['vs'])) $data['verticalrate'] = $line['inf']['vs']; // verticale rate |
|
| 626 | + if (isset($line['inf']['sq'])) $data['squawk'] = $line['inf']['sq']; // squawk |
|
| 627 | + //$data['aircraft_icao'] = $line[8]; |
|
| 628 | + if (isset($line['inf']['rc'])) $data['registration'] = $line['inf']['rc']; |
|
| 629 | 629 | //$data['departure_airport_iata'] = $line[11]; |
| 630 | 630 | //$data['arrival_airport_iata'] = $line[12]; |
| 631 | - //$data['emergency'] = ''; // emergency |
|
| 631 | + //$data['emergency'] = ''; // emergency |
|
| 632 | 632 | $data['datetime'] = date('Y-m-d H:i:s',$line['inf']['dt']); //$line[10] |
| 633 | - $data['format_source'] = 'radarvirtueljson'; |
|
| 634 | - $data['id_source'] = $id_source; |
|
| 633 | + $data['format_source'] = 'radarvirtueljson'; |
|
| 634 | + $data['id_source'] = $id_source; |
|
| 635 | 635 | if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
| 636 | 636 | $SI->add($data); |
| 637 | 637 | unset($data); |
| 638 | - } |
|
| 638 | + } |
|
| 639 | + } |
|
| 639 | 640 | } |
| 640 | - } |
|
| 641 | - //$last_exec['radarvirtueljson'] = time(); |
|
| 642 | - $last_exec[$id]['last'] = time(); |
|
| 643 | - //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 644 | - } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 645 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 646 | - $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 647 | - $all_data = json_decode(utf8_encode($buffer),true); |
|
| 641 | + //$last_exec['radarvirtueljson'] = time(); |
|
| 642 | + $last_exec[$id]['last'] = time(); |
|
| 643 | + //} elseif ($value == 'pirepsjson' && (time() - $last_exec['pirepsjson'] > $globalMinFetch)) { |
|
| 644 | + } elseif ($value['format'] == 'pirepsjson' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 645 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 646 | + $buffer = $Common->getData($value['host'].'?'.time()); |
|
| 647 | + $all_data = json_decode(utf8_encode($buffer),true); |
|
| 648 | 648 | |
| 649 | - if (isset($all_data['pireps'])) { |
|
| 649 | + if (isset($all_data['pireps'])) { |
|
| 650 | 650 | $reset = 0; |
| 651 | - foreach ($all_data['pireps'] as $line) { |
|
| 652 | - $data = array(); |
|
| 653 | - $data['id'] = $line['id']; |
|
| 654 | - $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 655 | - $data['ident'] = $line['callsign']; // ident |
|
| 656 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 657 | - if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 658 | - if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 659 | - if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 660 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 661 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 662 | - $data['latitude'] = $line['lat']; // lat |
|
| 663 | - $data['longitude'] = $line['lon']; // long |
|
| 664 | - //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 665 | - //$data['squawk'] = $line['squawk']; // squawk |
|
| 666 | - //$data['emergency'] = ''; // emergency |
|
| 667 | - if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 668 | - if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 669 | - if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 670 | - //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 671 | - if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 672 | - if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 673 | - if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 674 | - else $data['info'] = ''; |
|
| 675 | - $data['format_source'] = 'pireps'; |
|
| 676 | - $data['id_source'] = $id_source; |
|
| 677 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 678 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 679 | - if ($line['icon'] == 'plane') { |
|
| 651 | + foreach ($all_data['pireps'] as $line) { |
|
| 652 | + $data = array(); |
|
| 653 | + $data['id'] = $line['id']; |
|
| 654 | + $data['hex'] = substr(str_pad(dechex($line['id']),6,'000000',STR_PAD_LEFT),0,6); |
|
| 655 | + $data['ident'] = $line['callsign']; // ident |
|
| 656 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; // pilot id |
|
| 657 | + if (isset($line['name'])) $data['pilot_name'] = $line['name']; // pilot name |
|
| 658 | + if (isset($line['alt'])) $data['altitude'] = $line['alt']; // altitude |
|
| 659 | + if (isset($line['gs'])) $data['speed'] = $line['gs']; // speed |
|
| 660 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; // heading |
|
| 661 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 662 | + $data['latitude'] = $line['lat']; // lat |
|
| 663 | + $data['longitude'] = $line['lon']; // long |
|
| 664 | + //$data['verticalrate'] = $line['vrt']; // verticale rate |
|
| 665 | + //$data['squawk'] = $line['squawk']; // squawk |
|
| 666 | + //$data['emergency'] = ''; // emergency |
|
| 667 | + if (isset($line['depicao'])) $data['departure_airport_icao'] = $line['depicao']; |
|
| 668 | + if (isset($line['deptime'])) $data['departure_airport_time'] = $line['deptime']; |
|
| 669 | + if (isset($line['arricao'])) $data['arrival_airport_icao'] = $line['arricao']; |
|
| 670 | + //$data['arrival_airport_time'] = $line['arrtime']; |
|
| 671 | + if (isset($line['aircraft'])) $data['aircraft_icao'] = $line['aircraft']; |
|
| 672 | + if (isset($line['transponder'])) $data['squawk'] = $line['transponder']; |
|
| 673 | + if (isset($line['atis'])) $data['info'] = $line['atis']; |
|
| 674 | + else $data['info'] = ''; |
|
| 675 | + $data['format_source'] = 'pireps'; |
|
| 676 | + $data['id_source'] = $id_source; |
|
| 677 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 678 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 679 | + if ($line['icon'] == 'plane') { |
|
| 680 | 680 | $SI->add($data); |
| 681 | - // print_r($data); |
|
| 682 | - } elseif ($line['icon'] == 'ct') { |
|
| 681 | + // print_r($data); |
|
| 682 | + } elseif ($line['icon'] == 'ct') { |
|
| 683 | 683 | $data['info'] = str_replace('^§','<br />',$data['info']); |
| 684 | 684 | $data['info'] = str_replace('&sect;','',$data['info']); |
| 685 | 685 | $typec = substr($data['ident'],-3); |
@@ -694,163 +694,163 @@ discard block |
||
| 694 | 694 | elseif ($typec == 'CTR') $data['type'] = 'Control Radar or Centre'; |
| 695 | 695 | else $data['type'] = 'Observer'; |
| 696 | 696 | if (isset($ATC)) echo $ATC->add($data['ident'],'',$data['latitude'],$data['longitude'],'0',$data['info'],$data['datetime'],$data['type'],$data['pilot_id'],$data['pilot_name'],$data['format_source']); |
| 697 | - } |
|
| 698 | - unset($data); |
|
| 697 | + } |
|
| 698 | + unset($data); |
|
| 699 | + } |
|
| 699 | 700 | } |
| 700 | - } |
|
| 701 | - //$last_exec['pirepsjson'] = time(); |
|
| 702 | - $last_exec[$id]['last'] = time(); |
|
| 703 | - //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 704 | - } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 705 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 706 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 707 | - $buffer = $Common->getData($value['host']); |
|
| 708 | - $all_data = json_decode($buffer,true); |
|
| 709 | - if ($buffer != '' && is_array($all_data)) { |
|
| 701 | + //$last_exec['pirepsjson'] = time(); |
|
| 702 | + $last_exec[$id]['last'] = time(); |
|
| 703 | + //} elseif ($value == 'phpvmacars' && (time() - $last_exec['phpvmacars'] > $globalMinFetch)) { |
|
| 704 | + } elseif ($value['format'] == 'phpvmacars' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 705 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 706 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 707 | + $buffer = $Common->getData($value['host']); |
|
| 708 | + $all_data = json_decode($buffer,true); |
|
| 709 | + if ($buffer != '' && is_array($all_data)) { |
|
| 710 | 710 | $reset = 0; |
| 711 | 711 | foreach ($all_data as $line) { |
| 712 | - $data = array(); |
|
| 713 | - //$data['id'] = $line['id']; // id not usable |
|
| 714 | - if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 715 | - $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 716 | - if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 717 | - if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 718 | - $data['ident'] = $line['flightnum']; // ident |
|
| 719 | - $data['altitude'] = $line['alt']; // altitude |
|
| 720 | - $data['speed'] = $line['gs']; // speed |
|
| 721 | - $data['heading'] = $line['heading']; // heading |
|
| 722 | - $data['latitude'] = $line['lat']; // lat |
|
| 723 | - $data['longitude'] = $line['lng']; // long |
|
| 724 | - $data['verticalrate'] = ''; // verticale rate |
|
| 725 | - $data['squawk'] = ''; // squawk |
|
| 726 | - $data['emergency'] = ''; // emergency |
|
| 727 | - //$data['datetime'] = $line['lastupdate']; |
|
| 728 | - $data['last_update'] = $line['lastupdate']; |
|
| 729 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 730 | - $data['departure_airport_icao'] = $line['depicao']; |
|
| 731 | - $data['departure_airport_time'] = $line['deptime']; |
|
| 732 | - $data['arrival_airport_icao'] = $line['arricao']; |
|
| 733 | - $data['arrival_airport_time'] = $line['arrtime']; |
|
| 734 | - $data['registration'] = $line['aircraft']; |
|
| 735 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 736 | - if (isset($line['aircraftname'])) { |
|
| 712 | + $data = array(); |
|
| 713 | + //$data['id'] = $line['id']; // id not usable |
|
| 714 | + if (isset($line['pilotid'])) $data['id'] = $line['pilotid'].$line['flightnum']; |
|
| 715 | + $data['hex'] = substr(str_pad(bin2hex($line['flightnum']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 716 | + if (isset($line['pilotname'])) $data['pilot_name'] = $line['pilotname']; |
|
| 717 | + if (isset($line['pilotid'])) $data['pilot_id'] = $line['pilotid']; |
|
| 718 | + $data['ident'] = $line['flightnum']; // ident |
|
| 719 | + $data['altitude'] = $line['alt']; // altitude |
|
| 720 | + $data['speed'] = $line['gs']; // speed |
|
| 721 | + $data['heading'] = $line['heading']; // heading |
|
| 722 | + $data['latitude'] = $line['lat']; // lat |
|
| 723 | + $data['longitude'] = $line['lng']; // long |
|
| 724 | + $data['verticalrate'] = ''; // verticale rate |
|
| 725 | + $data['squawk'] = ''; // squawk |
|
| 726 | + $data['emergency'] = ''; // emergency |
|
| 727 | + //$data['datetime'] = $line['lastupdate']; |
|
| 728 | + $data['last_update'] = $line['lastupdate']; |
|
| 729 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 730 | + $data['departure_airport_icao'] = $line['depicao']; |
|
| 731 | + $data['departure_airport_time'] = $line['deptime']; |
|
| 732 | + $data['arrival_airport_icao'] = $line['arricao']; |
|
| 733 | + $data['arrival_airport_time'] = $line['arrtime']; |
|
| 734 | + $data['registration'] = $line['aircraft']; |
|
| 735 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 736 | + if (isset($line['aircraftname'])) { |
|
| 737 | 737 | $line['aircraftname'] = strtoupper($line['aircraftname']); |
| 738 | 738 | $line['aircraftname'] = str_replace('BOEING ','B',$line['aircraftname']); |
| 739 | - $aircraft_data = explode('-',$line['aircraftname']); |
|
| 740 | - if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 741 | - elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 742 | - else { |
|
| 743 | - $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 744 | - if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 745 | - else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 746 | - } |
|
| 747 | - } |
|
| 748 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 749 | - $data['id_source'] = $id_source; |
|
| 750 | - $data['format_source'] = 'phpvmacars'; |
|
| 751 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 752 | - $SI->add($data); |
|
| 753 | - unset($data); |
|
| 739 | + $aircraft_data = explode('-',$line['aircraftname']); |
|
| 740 | + if (isset($aircraft_data[1]) && strlen($aircraft_data[0]) < 5) $data['aircraft_icao'] = $aircraft_data[0]; |
|
| 741 | + elseif (isset($aircraft_data[1]) && strlen($aircraft_data[1]) < 5) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 742 | + else { |
|
| 743 | + $aircraft_data = explode(' ',$line['aircraftname']); |
|
| 744 | + if (isset($aircraft_data[1])) $data['aircraft_icao'] = $aircraft_data[1]; |
|
| 745 | + else $data['aircraft_icao'] = $line['aircraftname']; |
|
| 746 | + } |
|
| 747 | + } |
|
| 748 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; |
|
| 749 | + $data['id_source'] = $id_source; |
|
| 750 | + $data['format_source'] = 'phpvmacars'; |
|
| 751 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 752 | + $SI->add($data); |
|
| 753 | + unset($data); |
|
| 754 | 754 | } |
| 755 | 755 | if ($globalDebug) echo 'No more data...'."\n"; |
| 756 | 756 | unset($buffer); |
| 757 | 757 | unset($all_data); |
| 758 | - } |
|
| 759 | - //$last_exec['phpvmacars'] = time(); |
|
| 760 | - $last_exec[$id]['last'] = time(); |
|
| 761 | - } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 762 | - //$buffer = $Common->getData($hosts[$id]); |
|
| 763 | - if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 764 | - $buffer = $Common->getData($value['host']); |
|
| 765 | - $all_data = json_decode($buffer,true); |
|
| 766 | - if ($buffer != '' && is_array($all_data)) { |
|
| 758 | + } |
|
| 759 | + //$last_exec['phpvmacars'] = time(); |
|
| 760 | + $last_exec[$id]['last'] = time(); |
|
| 761 | + } elseif ($value['format'] == 'vam' && (time() - $last_exec[$id]['last'] > $globalMinFetch)) { |
|
| 762 | + //$buffer = $Common->getData($hosts[$id]); |
|
| 763 | + if ($globalDebug) echo 'Get Data...'."\n"; |
|
| 764 | + $buffer = $Common->getData($value['host']); |
|
| 765 | + $all_data = json_decode($buffer,true); |
|
| 766 | + if ($buffer != '' && is_array($all_data)) { |
|
| 767 | 767 | $reset = 0; |
| 768 | 768 | foreach ($all_data as $line) { |
| 769 | - $data = array(); |
|
| 770 | - //$data['id'] = $line['id']; // id not usable |
|
| 771 | - $data['id'] = trim($line['flight_id']); |
|
| 772 | - $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 773 | - $data['pilot_name'] = $line['pilot_name']; |
|
| 774 | - $data['pilot_id'] = $line['pilot_id']; |
|
| 775 | - $data['ident'] = trim($line['callsign']); // ident |
|
| 776 | - $data['altitude'] = $line['altitude']; // altitude |
|
| 777 | - $data['speed'] = $line['gs']; // speed |
|
| 778 | - $data['heading'] = $line['heading']; // heading |
|
| 779 | - $data['latitude'] = $line['latitude']; // lat |
|
| 780 | - $data['longitude'] = $line['longitude']; // long |
|
| 781 | - $data['verticalrate'] = ''; // verticale rate |
|
| 782 | - $data['squawk'] = ''; // squawk |
|
| 783 | - $data['emergency'] = ''; // emergency |
|
| 784 | - //$data['datetime'] = $line['lastupdate']; |
|
| 785 | - $data['last_update'] = $line['last_update']; |
|
| 786 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 787 | - $data['departure_airport_icao'] = $line['departure']; |
|
| 788 | - //$data['departure_airport_time'] = $line['departure_time']; |
|
| 789 | - $data['arrival_airport_icao'] = $line['arrival']; |
|
| 790 | - //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 791 | - //$data['registration'] = $line['aircraft']; |
|
| 792 | - if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 793 | - $data['aircraft_icao'] = $line['plane_type']; |
|
| 794 | - $data['id_source'] = $id_source; |
|
| 795 | - $data['format_source'] = 'vam'; |
|
| 796 | - if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 797 | - $SI->add($data); |
|
| 798 | - unset($data); |
|
| 769 | + $data = array(); |
|
| 770 | + //$data['id'] = $line['id']; // id not usable |
|
| 771 | + $data['id'] = trim($line['flight_id']); |
|
| 772 | + $data['hex'] = substr(str_pad(bin2hex($line['callsign']),6,'000000',STR_PAD_LEFT),-6); // hex |
|
| 773 | + $data['pilot_name'] = $line['pilot_name']; |
|
| 774 | + $data['pilot_id'] = $line['pilot_id']; |
|
| 775 | + $data['ident'] = trim($line['callsign']); // ident |
|
| 776 | + $data['altitude'] = $line['altitude']; // altitude |
|
| 777 | + $data['speed'] = $line['gs']; // speed |
|
| 778 | + $data['heading'] = $line['heading']; // heading |
|
| 779 | + $data['latitude'] = $line['latitude']; // lat |
|
| 780 | + $data['longitude'] = $line['longitude']; // long |
|
| 781 | + $data['verticalrate'] = ''; // verticale rate |
|
| 782 | + $data['squawk'] = ''; // squawk |
|
| 783 | + $data['emergency'] = ''; // emergency |
|
| 784 | + //$data['datetime'] = $line['lastupdate']; |
|
| 785 | + $data['last_update'] = $line['last_update']; |
|
| 786 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 787 | + $data['departure_airport_icao'] = $line['departure']; |
|
| 788 | + //$data['departure_airport_time'] = $line['departure_time']; |
|
| 789 | + $data['arrival_airport_icao'] = $line['arrival']; |
|
| 790 | + //$data['arrival_airport_time'] = $line['arrival_time']; |
|
| 791 | + //$data['registration'] = $line['aircraft']; |
|
| 792 | + if (isset($line['route'])) $data['waypoints'] = $line['route']; // route |
|
| 793 | + $data['aircraft_icao'] = $line['plane_type']; |
|
| 794 | + $data['id_source'] = $id_source; |
|
| 795 | + $data['format_source'] = 'vam'; |
|
| 796 | + if (isset($value['name']) && $value['name'] != '') $data['source_name'] = $value['name']; |
|
| 797 | + $SI->add($data); |
|
| 798 | + unset($data); |
|
| 799 | 799 | } |
| 800 | 800 | if ($globalDebug) echo 'No more data...'."\n"; |
| 801 | 801 | unset($buffer); |
| 802 | 802 | unset($all_data); |
| 803 | - } |
|
| 804 | - //$last_exec['phpvmacars'] = time(); |
|
| 805 | - $last_exec[$id]['last'] = time(); |
|
| 803 | + } |
|
| 804 | + //$last_exec['phpvmacars'] = time(); |
|
| 805 | + $last_exec[$id]['last'] = time(); |
|
| 806 | 806 | //} elseif ($value == 'sbs' || $value == 'tsv' || $value == 'raw' || $value == 'aprs' || $value == 'beast') { |
| 807 | 807 | } elseif ($value['format'] == 'sbs' || $value['format'] == 'tsv' || $value['format'] == 'raw' || $value['format'] == 'aprs' || $value['format'] == 'beast' || $value['format'] == 'flightgearmp' || $value['format'] == 'flightgearsp' || $value['format'] == 'acars' || $value['format'] == 'acarssbs3') { |
| 808 | - if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 809 | - //$last_exec[$id]['last'] = time(); |
|
| 808 | + if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 809 | + //$last_exec[$id]['last'] = time(); |
|
| 810 | 810 | |
| 811 | - //$read = array( $sockets[$id] ); |
|
| 812 | - $read = $sockets; |
|
| 813 | - $write = NULL; |
|
| 814 | - $e = NULL; |
|
| 815 | - $n = socket_select($read, $write, $e, $timeout); |
|
| 816 | - if ($e != NULL) var_dump($e); |
|
| 817 | - if ($n > 0) { |
|
| 811 | + //$read = array( $sockets[$id] ); |
|
| 812 | + $read = $sockets; |
|
| 813 | + $write = NULL; |
|
| 814 | + $e = NULL; |
|
| 815 | + $n = socket_select($read, $write, $e, $timeout); |
|
| 816 | + if ($e != NULL) var_dump($e); |
|
| 817 | + if ($n > 0) { |
|
| 818 | 818 | $reset = 0; |
| 819 | 819 | foreach ($read as $nb => $r) { |
| 820 | - //$value = $formats[$nb]; |
|
| 821 | - $format = $globalSources[$nb]['format']; |
|
| 822 | - if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 823 | - $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 824 | - } else { |
|
| 825 | - $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 826 | - } |
|
| 827 | - //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 828 | - //echo $buffer."\n"; |
|
| 829 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 830 | - //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 831 | - $error = false; |
|
| 832 | - //$SI::del(); |
|
| 833 | - $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 834 | - // SBS format is CSV format |
|
| 835 | - if ($buffer != '') { |
|
| 820 | + //$value = $formats[$nb]; |
|
| 821 | + $format = $globalSources[$nb]['format']; |
|
| 822 | + if ($format == 'sbs' || $format == 'aprs' || $format == 'raw' || $format == 'tsv' || $format == 'acarssbs3') { |
|
| 823 | + $buffer = socket_read($r, 6000,PHP_NORMAL_READ); |
|
| 824 | + } else { |
|
| 825 | + $az = socket_recvfrom($r,$buffer,6000,0,$remote_ip,$remote_port); |
|
| 826 | + } |
|
| 827 | + //$buffer = socket_read($r, 60000,PHP_NORMAL_READ); |
|
| 828 | + //echo $buffer."\n"; |
|
| 829 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
| 830 | + //if (function_exists('pcntl_fork')) pcntl_signal_dispatch(); |
|
| 831 | + $error = false; |
|
| 832 | + //$SI::del(); |
|
| 833 | + $buffer=trim(str_replace(array("\r\n","\r","\n","\\r","\\n","\\r\\n"),'',$buffer)); |
|
| 834 | + // SBS format is CSV format |
|
| 835 | + if ($buffer != '') { |
|
| 836 | 836 | $tt[$format] = 0; |
| 837 | 837 | if ($format == 'acarssbs3') { |
| 838 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 839 | - $ACARS->add(trim($buffer)); |
|
| 840 | - $ACARS->deleteLiveAcarsData(); |
|
| 838 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 839 | + $ACARS->add(trim($buffer)); |
|
| 840 | + $ACARS->deleteLiveAcarsData(); |
|
| 841 | 841 | } elseif ($format == 'raw') { |
| 842 | - // AVR format |
|
| 843 | - $data = $SBS->parse($buffer); |
|
| 844 | - if (is_array($data)) { |
|
| 842 | + // AVR format |
|
| 843 | + $data = $SBS->parse($buffer); |
|
| 844 | + if (is_array($data)) { |
|
| 845 | 845 | $data['datetime'] = date('Y-m-d H:i:s'); |
| 846 | 846 | $data['format_source'] = 'raw'; |
| 847 | 847 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 848 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 849 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 850 | - } |
|
| 851 | - } elseif ($format == 'flightgearsp') { |
|
| 852 | - //echo $buffer."\n"; |
|
| 853 | - if (strlen($buffer) > 5) { |
|
| 848 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 849 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 850 | + } |
|
| 851 | + } elseif ($format == 'flightgearsp') { |
|
| 852 | + //echo $buffer."\n"; |
|
| 853 | + if (strlen($buffer) > 5) { |
|
| 854 | 854 | $line = explode(',',$buffer); |
| 855 | 855 | $data = array(); |
| 856 | 856 | //XGPS,2.0947,41.3093,-3047.6953,198.930,0.000,callsign,c172p |
@@ -866,124 +866,124 @@ discard block |
||
| 866 | 866 | $data['format_source'] = 'flightgearsp'; |
| 867 | 867 | if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
| 868 | 868 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 869 | - } |
|
| 870 | - } elseif ($format == 'acars') { |
|
| 871 | - if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 872 | - $ACARS->add(trim($buffer)); |
|
| 873 | - socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 874 | - $ACARS->deleteLiveAcarsData(); |
|
| 869 | + } |
|
| 870 | + } elseif ($format == 'acars') { |
|
| 871 | + if ($globalDebug) echo 'ACARS : '.$buffer."\n"; |
|
| 872 | + $ACARS->add(trim($buffer)); |
|
| 873 | + socket_sendto($r, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
| 874 | + $ACARS->deleteLiveAcarsData(); |
|
| 875 | 875 | } elseif ($format == 'flightgearmp') { |
| 876 | - if (substr($buffer,0,1) != '#') { |
|
| 876 | + if (substr($buffer,0,1) != '#') { |
|
| 877 | 877 | $data = array(); |
| 878 | 878 | //echo $buffer."\n"; |
| 879 | 879 | $line = explode(' ',$buffer); |
| 880 | 880 | if (count($line) == 11) { |
| 881 | - $userserver = explode('@',$line[0]); |
|
| 882 | - $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 883 | - $data['ident'] = $userserver[0]; |
|
| 884 | - $data['registration'] = $userserver[0]; |
|
| 885 | - $data['latitude'] = $line[4]; |
|
| 886 | - $data['longitude'] = $line[5]; |
|
| 887 | - $data['altitude'] = $line[6]; |
|
| 888 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 889 | - $aircraft_type = $line[10]; |
|
| 890 | - $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 891 | - $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 892 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 881 | + $userserver = explode('@',$line[0]); |
|
| 882 | + $data['hex'] = substr(str_pad(bin2hex($line[0]),6,'000000',STR_PAD_LEFT),0,6); // hex |
|
| 883 | + $data['ident'] = $userserver[0]; |
|
| 884 | + $data['registration'] = $userserver[0]; |
|
| 885 | + $data['latitude'] = $line[4]; |
|
| 886 | + $data['longitude'] = $line[5]; |
|
| 887 | + $data['altitude'] = $line[6]; |
|
| 888 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 889 | + $aircraft_type = $line[10]; |
|
| 890 | + $aircraft_type = preg_split(':/:',$aircraft_type); |
|
| 891 | + $data['aircraft_name'] = substr(end($aircraft_type),0,-4); |
|
| 892 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 893 | + } |
|
| 893 | 894 | } |
| 894 | - } |
|
| 895 | 895 | } elseif ($format == 'beast') { |
| 896 | - echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 897 | - die; |
|
| 896 | + echo 'Beast Binary format not yet supported. Beast AVR format is supported in alpha state'."\n"; |
|
| 897 | + die; |
|
| 898 | 898 | } elseif ($format == 'tsv' || substr($buffer,0,4) == 'clock') { |
| 899 | - $line = explode("\t", $buffer); |
|
| 900 | - for($k = 0; $k < count($line); $k=$k+2) { |
|
| 899 | + $line = explode("\t", $buffer); |
|
| 900 | + for($k = 0; $k < count($line); $k=$k+2) { |
|
| 901 | 901 | $key = $line[$k]; |
| 902 | - $lined[$key] = $line[$k+1]; |
|
| 903 | - } |
|
| 904 | - if (count($lined) > 3) { |
|
| 905 | - $data['hex'] = $lined['hexid']; |
|
| 906 | - //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 907 | - $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 908 | - if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 909 | - if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 910 | - if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 911 | - if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 912 | - if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 913 | - if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 914 | - if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 915 | - $data['id_source'] = $id_source; |
|
| 916 | - $data['format_source'] = 'tsv'; |
|
| 917 | - if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 918 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 919 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 920 | - unset($lined); |
|
| 921 | - unset($data); |
|
| 922 | - } else $error = true; |
|
| 902 | + $lined[$key] = $line[$k+1]; |
|
| 903 | + } |
|
| 904 | + if (count($lined) > 3) { |
|
| 905 | + $data['hex'] = $lined['hexid']; |
|
| 906 | + //$data['datetime'] = date('Y-m-d H:i:s',strtotime($lined['clock']));; |
|
| 907 | + $data['datetime'] = date('Y-m-d H:i:s');; |
|
| 908 | + if (isset($lined['ident'])) $data['ident'] = $lined['ident']; |
|
| 909 | + if (isset($lined['lat'])) $data['latitude'] = $lined['lat']; |
|
| 910 | + if (isset($lined['lon'])) $data['longitude'] = $lined['lon']; |
|
| 911 | + if (isset($lined['speed'])) $data['speed'] = $lined['speed']; |
|
| 912 | + if (isset($lined['squawk'])) $data['squawk'] = $lined['squawk']; |
|
| 913 | + if (isset($lined['alt'])) $data['altitude'] = $lined['alt']; |
|
| 914 | + if (isset($lined['heading'])) $data['heading'] = $lined['heading']; |
|
| 915 | + $data['id_source'] = $id_source; |
|
| 916 | + $data['format_source'] = 'tsv'; |
|
| 917 | + if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
|
| 918 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 919 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $SI->add($data); |
|
| 920 | + unset($lined); |
|
| 921 | + unset($data); |
|
| 922 | + } else $error = true; |
|
| 923 | 923 | } elseif ($format == 'aprs' && $use_aprs) { |
| 924 | - if ($aprs_connect == 0) { |
|
| 924 | + if ($aprs_connect == 0) { |
|
| 925 | 925 | $send = @ socket_send( $r , $aprs_login , strlen($aprs_login) , 0 ); |
| 926 | 926 | $aprs_connect = 1; |
| 927 | - } |
|
| 927 | + } |
|
| 928 | 928 | |
| 929 | - if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 929 | + if ( $aprs_keep>60 && time() - $aprs_last_tx > $aprs_keep ) { |
|
| 930 | 930 | $aprs_last_tx = time(); |
| 931 | 931 | $data_aprs = "# Keep alive"; |
| 932 | 932 | $send = @ socket_send( $r , $data_aprs , strlen($data_aprs) , 0 ); |
| 933 | - } |
|
| 933 | + } |
|
| 934 | 934 | |
| 935 | - //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 936 | - $buffer = str_replace('APRS <- ','',$buffer); |
|
| 937 | - $buffer = str_replace('APRS -> ','',$buffer); |
|
| 938 | - //echo $buffer."\n"; |
|
| 939 | - if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 935 | + //echo 'Connect : '.$aprs_connect.' '.$buffer."\n"; |
|
| 936 | + $buffer = str_replace('APRS <- ','',$buffer); |
|
| 937 | + $buffer = str_replace('APRS -> ','',$buffer); |
|
| 938 | + //echo $buffer."\n"; |
|
| 939 | + if (substr($buffer,0,1) != '#' && substr($buffer,0,1) != '@' && substr($buffer,0,5) != 'APRS ') { |
|
| 940 | 940 | $line = $APRS->parse($buffer); |
| 941 | 941 | //print_r($line); |
| 942 | 942 | if (is_array($line) && isset($line['address']) && $line['address'] != '' && isset($line['ident'])) { |
| 943 | - $aprs_last_tx = time(); |
|
| 944 | - $data = array(); |
|
| 945 | - //print_r($line); |
|
| 946 | - $data['hex'] = $line['address']; |
|
| 947 | - if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 948 | - else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 949 | - //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 950 | - $data['ident'] = $line['ident']; |
|
| 951 | - $data['latitude'] = $line['latitude']; |
|
| 952 | - $data['longitude'] = $line['longitude']; |
|
| 953 | - //$data['verticalrate'] = $line[16]; |
|
| 954 | - if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 955 | - else $data['speed'] = 0; |
|
| 956 | - $data['altitude'] = $line['altitude']; |
|
| 957 | - if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 958 | - //else $data['heading'] = 0; |
|
| 959 | - $data['aircraft_type'] = $line['stealth']; |
|
| 960 | - if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 961 | - $data['id_source'] = $id_source; |
|
| 962 | - $data['format_source'] = 'aprs'; |
|
| 963 | - $data['source_name'] = $line['source']; |
|
| 964 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 965 | - $currentdate = date('Y-m-d H:i:s'); |
|
| 966 | - $aprsdate = strtotime($data['datetime']); |
|
| 967 | - // Accept data if time <= system time + 20s |
|
| 968 | - if (($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
| 943 | + $aprs_last_tx = time(); |
|
| 944 | + $data = array(); |
|
| 945 | + //print_r($line); |
|
| 946 | + $data['hex'] = $line['address']; |
|
| 947 | + if (isset($line['timestamp'])) $data['datetime'] = date('Y-m-d H:i:s',$line['timestamp']); |
|
| 948 | + else $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 949 | + //$data['datetime'] = date('Y-m-d H:i:s'); |
|
| 950 | + $data['ident'] = $line['ident']; |
|
| 951 | + $data['latitude'] = $line['latitude']; |
|
| 952 | + $data['longitude'] = $line['longitude']; |
|
| 953 | + //$data['verticalrate'] = $line[16]; |
|
| 954 | + if (isset($line['speed'])) $data['speed'] = $line['speed']; |
|
| 955 | + else $data['speed'] = 0; |
|
| 956 | + $data['altitude'] = $line['altitude']; |
|
| 957 | + if (isset($line['heading'])) $data['heading'] = $line['heading']; |
|
| 958 | + //else $data['heading'] = 0; |
|
| 959 | + $data['aircraft_type'] = $line['stealth']; |
|
| 960 | + if (!isset($globalAPRSarchive) || (isset($globalAPRSarchive) && $globalAPRSarchive == FALSE)) $data['noarchive'] = true; |
|
| 961 | + $data['id_source'] = $id_source; |
|
| 962 | + $data['format_source'] = 'aprs'; |
|
| 963 | + $data['source_name'] = $line['source']; |
|
| 964 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 965 | + $currentdate = date('Y-m-d H:i:s'); |
|
| 966 | + $aprsdate = strtotime($data['datetime']); |
|
| 967 | + // Accept data if time <= system time + 20s |
|
| 968 | + if (($line['stealth'] == 0 || $line['stealth'] == '') && (strtotime($data['datetime']) <= strtotime($currentdate)+20) && (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude'])))) { |
|
| 969 | 969 | $send = $SI->add($data); |
| 970 | - } else { |
|
| 970 | + } else { |
|
| 971 | 971 | if ($line['stealth'] != 0) echo '-------- '.$data['ident'].' : APRS stealth ON => not adding'."\n"; |
| 972 | 972 | else echo '--------- '.$data['ident'].' : Date APRS : '.$data['datetime'].' - Current date : '.$currentdate.' => not adding future event'."\n"; |
| 973 | - } |
|
| 974 | - unset($data); |
|
| 973 | + } |
|
| 974 | + unset($data); |
|
| 975 | 975 | } |
| 976 | 976 | elseif (is_array($line) && $globalDebug && isset($line['symbol']) && $line['symbol'] == 'Weather Station') { |
| 977 | 977 | echo '!! Weather Station not yet supported'."\n"; |
| 978 | 978 | } |
| 979 | 979 | //elseif ($line == false && $globalDebug) echo 'Ignored ('.$buffer.")\n"; |
| 980 | 980 | //elseif ($line == true && $globalDebug) echo '!! Failed : '.$buffer."!!\n"; |
| 981 | - } |
|
| 981 | + } |
|
| 982 | 982 | } else { |
| 983 | - $line = explode(',', $buffer); |
|
| 984 | - if (count($line) > 20) { |
|
| 985 | - $data['hex'] = $line[4]; |
|
| 986 | - /* |
|
| 983 | + $line = explode(',', $buffer); |
|
| 984 | + if (count($line) > 20) { |
|
| 985 | + $data['hex'] = $line[4]; |
|
| 986 | + /* |
|
| 987 | 987 | $data['datetime'] = $line[6].' '.$line[7]; |
| 988 | 988 | date_default_timezone_set($globalTimezone); |
| 989 | 989 | $datetime = new DateTime($data['datetime']); |
@@ -991,29 +991,29 @@ discard block |
||
| 991 | 991 | $data['datetime'] = $datetime->format('Y-m-d H:i:s'); |
| 992 | 992 | date_default_timezone_set('UTC'); |
| 993 | 993 | */ |
| 994 | - // Force datetime to current UTC datetime |
|
| 995 | - date_default_timezone_set('UTC'); |
|
| 996 | - $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 997 | - $data['ident'] = trim($line[10]); |
|
| 998 | - $data['latitude'] = $line[14]; |
|
| 999 | - $data['longitude'] = $line[15]; |
|
| 1000 | - $data['verticalrate'] = $line[16]; |
|
| 1001 | - $data['emergency'] = $line[20]; |
|
| 1002 | - $data['speed'] = $line[12]; |
|
| 1003 | - $data['squawk'] = $line[17]; |
|
| 1004 | - $data['altitude'] = $line[11]; |
|
| 1005 | - $data['heading'] = $line[13]; |
|
| 1006 | - $data['ground'] = $line[21]; |
|
| 1007 | - $data['emergency'] = $line[19]; |
|
| 1008 | - $data['format_source'] = 'sbs'; |
|
| 994 | + // Force datetime to current UTC datetime |
|
| 995 | + date_default_timezone_set('UTC'); |
|
| 996 | + $data['datetime'] = date('Y-m-d H:i:s'); |
|
| 997 | + $data['ident'] = trim($line[10]); |
|
| 998 | + $data['latitude'] = $line[14]; |
|
| 999 | + $data['longitude'] = $line[15]; |
|
| 1000 | + $data['verticalrate'] = $line[16]; |
|
| 1001 | + $data['emergency'] = $line[20]; |
|
| 1002 | + $data['speed'] = $line[12]; |
|
| 1003 | + $data['squawk'] = $line[17]; |
|
| 1004 | + $data['altitude'] = $line[11]; |
|
| 1005 | + $data['heading'] = $line[13]; |
|
| 1006 | + $data['ground'] = $line[21]; |
|
| 1007 | + $data['emergency'] = $line[19]; |
|
| 1008 | + $data['format_source'] = 'sbs'; |
|
| 1009 | 1009 | if (isset($globalSources[$nb]['name']) && $globalSources[$nb]['name'] != '') $data['source_name'] = $globalSources[$nb]['name']; |
| 1010 | - if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1011 | - $data['id_source'] = $id_source; |
|
| 1012 | - if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1013 | - else $error = true; |
|
| 1014 | - unset($data); |
|
| 1015 | - } else $error = true; |
|
| 1016 | - if ($error) { |
|
| 1010 | + if (isset($globalSources[$nb]['sourcestats'])) $data['sourcestats'] = $globalSources[$nb]['sourcestats']; |
|
| 1011 | + $data['id_source'] = $id_source; |
|
| 1012 | + if (($data['latitude'] == '' && $data['longitude'] == '') || (is_numeric($data['latitude']) && is_numeric($data['longitude']))) $send = $SI->add($data); |
|
| 1013 | + else $error = true; |
|
| 1014 | + unset($data); |
|
| 1015 | + } else $error = true; |
|
| 1016 | + if ($error) { |
|
| 1017 | 1017 | if (count($line) > 1 && ($line[0] == 'STA' || $line[0] == 'AIR' || $line[0] == 'SEL' || $line[0] == 'ID' || $line[0] == 'CLK')) { |
| 1018 | 1018 | if ($globalDebug) echo "Not a message. Ignoring... \n"; |
| 1019 | 1019 | } else { |
@@ -1029,13 +1029,13 @@ discard block |
||
| 1029 | 1029 | connect_all($sourceer); |
| 1030 | 1030 | $sourceer = array(); |
| 1031 | 1031 | } |
| 1032 | - } |
|
| 1032 | + } |
|
| 1033 | 1033 | } |
| 1034 | 1034 | // Sleep for xxx microseconds |
| 1035 | 1035 | if (isset($globalSBSSleep)) usleep($globalSBSSleep); |
| 1036 | - } else { |
|
| 1036 | + } else { |
|
| 1037 | 1037 | if ($format == 'flightgearmp') { |
| 1038 | - if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1038 | + if ($globalDebug) echo "Reconnect FlightGear MP..."; |
|
| 1039 | 1039 | //@socket_close($r); |
| 1040 | 1040 | sleep($globalMinFetch); |
| 1041 | 1041 | $sourcefg[$nb] = $globalSources[$nb]; |
@@ -1044,9 +1044,9 @@ discard block |
||
| 1044 | 1044 | break; |
| 1045 | 1045 | |
| 1046 | 1046 | } elseif ($format != 'acars' && $format != 'flightgearsp') { |
| 1047 | - if (isset($tt[$format])) $tt[$format]++; |
|
| 1048 | - else $tt[$format] = 0; |
|
| 1049 | - if ($tt[$format] > 30) { |
|
| 1047 | + if (isset($tt[$format])) $tt[$format]++; |
|
| 1048 | + else $tt[$format] = 0; |
|
| 1049 | + if ($tt[$format] > 30) { |
|
| 1050 | 1050 | if ($globalDebug) echo "ERROR : Reconnect ".$format."..."; |
| 1051 | 1051 | //@socket_close($r); |
| 1052 | 1052 | sleep(2); |
@@ -1057,23 +1057,23 @@ discard block |
||
| 1057 | 1057 | //connect_all($globalSources); |
| 1058 | 1058 | $tt[$format]=0; |
| 1059 | 1059 | break; |
| 1060 | - } |
|
| 1060 | + } |
|
| 1061 | + } |
|
| 1061 | 1062 | } |
| 1062 | - } |
|
| 1063 | 1063 | } |
| 1064 | - } else { |
|
| 1064 | + } else { |
|
| 1065 | 1065 | $error = socket_strerror(socket_last_error()); |
| 1066 | 1066 | if ($globalDebug) echo "ERROR : socket_select give this error ".$error . "\n"; |
| 1067 | 1067 | if (($error != SOCKET_EINPROGRESS && $error != SOCKET_EALREADY && $error != 'Success') || time() - $time >= $timeout) { |
| 1068 | 1068 | if (isset($globalDebug)) echo "Restarting...\n"; |
| 1069 | 1069 | // Restart the script if possible |
| 1070 | 1070 | if (is_array($sockets)) { |
| 1071 | - if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1071 | + if ($globalDebug) echo "Shutdown all sockets..."; |
|
| 1072 | 1072 | |
| 1073 | - foreach ($sockets as $sock) { |
|
| 1073 | + foreach ($sockets as $sock) { |
|
| 1074 | 1074 | @socket_shutdown($sock,2); |
| 1075 | 1075 | @socket_close($sock); |
| 1076 | - } |
|
| 1076 | + } |
|
| 1077 | 1077 | |
| 1078 | 1078 | } |
| 1079 | 1079 | if ($globalDebug) echo "Restart all connections..."; |
@@ -1084,13 +1084,13 @@ discard block |
||
| 1084 | 1084 | if ($reset > 40) exit('Too many attempts...'); |
| 1085 | 1085 | connect_all($globalSources); |
| 1086 | 1086 | } |
| 1087 | - } |
|
| 1087 | + } |
|
| 1088 | 1088 | } |
| 1089 | 1089 | if ($globalDaemon === false) { |
| 1090 | - if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1091 | - $SI->checkAll(); |
|
| 1090 | + if ($globalDebug) echo 'Check all...'."\n"; |
|
| 1091 | + $SI->checkAll(); |
|
| 1092 | + } |
|
| 1092 | 1093 | } |
| 1093 | - } |
|
| 1094 | 1094 | } |
| 1095 | 1095 | |
| 1096 | 1096 | ?> |