@@ -97,6 +97,10 @@ discard block |
||
| 97 | 97 | return strlen($headerLine); // Needed by curl |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | + /** |
|
| 101 | + * @param string $url |
|
| 102 | + * @param string $file |
|
| 103 | + */ |
|
| 100 | 104 | public static function download($url, $file, $referer = '') { |
| 101 | 105 | global $globalDebug, $globalProxy, $globalForceIPv4; |
| 102 | 106 | $fp = fopen($file, 'w'); |
@@ -121,6 +125,9 @@ discard block |
||
| 121 | 125 | fclose($fp); |
| 122 | 126 | } |
| 123 | 127 | |
| 128 | + /** |
|
| 129 | + * @param string $in_file |
|
| 130 | + */ |
|
| 124 | 131 | public static function gunzip($in_file,$out_file_name = '') { |
| 125 | 132 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 126 | 133 | $buffer_size = 4096; // read 4kb at a time |
@@ -272,7 +279,7 @@ discard block |
||
| 272 | 279 | * Check is distance realistic |
| 273 | 280 | * @param int $timeDifference the time between the reception of both messages |
| 274 | 281 | * @param float $distance distance covered |
| 275 | - * @return whether distance is realistic |
|
| 282 | + * @return boolean distance is realistic |
|
| 276 | 283 | */ |
| 277 | 284 | public function withinThreshold ($timeDifference, $distance) { |
| 278 | 285 | $x = abs($timeDifference); |
@@ -295,6 +302,9 @@ discard block |
||
| 295 | 302 | } |
| 296 | 303 | |
| 297 | 304 | |
| 305 | + /** |
|
| 306 | + * @param string $latlong |
|
| 307 | + */ |
|
| 298 | 308 | public function convertDec($dms,$latlong) { |
| 299 | 309 | if ($latlong == 'latitude') { |
| 300 | 310 | $deg = substr($dms, 0, 2); |
@@ -306,6 +316,9 @@ discard block |
||
| 306 | 316 | return $deg+(($min*60)/3600); |
| 307 | 317 | } |
| 308 | 318 | |
| 319 | + /** |
|
| 320 | + * @param string $latlong |
|
| 321 | + */ |
|
| 309 | 322 | public function convertDM($coord,$latlong) { |
| 310 | 323 | if ($latlong == 'latitude') { |
| 311 | 324 | if ($coord < 0) $NSEW = 'S'; |
@@ -443,7 +456,7 @@ discard block |
||
| 443 | 456 | /** |
| 444 | 457 | * Returns list of available locales |
| 445 | 458 | * |
| 446 | - * @return array |
|
| 459 | + * @return string[] |
|
| 447 | 460 | */ |
| 448 | 461 | public function listLocaleDir() |
| 449 | 462 | { |
@@ -174,6 +174,10 @@ |
||
| 174 | 174 | '\|' => 'TNC Stream SW', |
| 175 | 175 | '\~' => 'TNC Stream SW'); |
| 176 | 176 | |
| 177 | + /** |
|
| 178 | + * @param integer $n |
|
| 179 | + * @param integer $s |
|
| 180 | + */ |
|
| 177 | 181 | private function urshift($n, $s) { |
| 178 | 182 | return ($n >= 0) ? ($n >> $s) : |
| 179 | 183 | (($n & 0x7fffffff) >> $s) | |
@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 50; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $dbname |
|
| 11 | + */ |
|
| 9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 13 | global $globalNoDB; |
| 11 | 14 | if (isset($globalNoDB) && $globalNoDB === TRUE) { |
@@ -142,6 +145,9 @@ discard block |
||
| 142 | 145 | return true; |
| 143 | 146 | } |
| 144 | 147 | |
| 148 | + /** |
|
| 149 | + * @param string $table |
|
| 150 | + */ |
|
| 145 | 151 | public function tableExists($table) |
| 146 | 152 | { |
| 147 | 153 | global $globalDBdriver, $globalDBname; |
@@ -192,6 +198,11 @@ discard block |
||
| 192 | 198 | /* |
| 193 | 199 | * Check if index exist |
| 194 | 200 | */ |
| 201 | + |
|
| 202 | + /** |
|
| 203 | + * @param string $table |
|
| 204 | + * @param string $index |
|
| 205 | + */ |
|
| 195 | 206 | public function indexExists($table,$index) |
| 196 | 207 | { |
| 197 | 208 | global $globalDBdriver, $globalDBname; |
@@ -234,6 +245,10 @@ discard block |
||
| 234 | 245 | return $columns; |
| 235 | 246 | } |
| 236 | 247 | |
| 248 | + /** |
|
| 249 | + * @param string $table |
|
| 250 | + * @param string $column |
|
| 251 | + */ |
|
| 237 | 252 | public function getColumnType($table,$column) { |
| 238 | 253 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 239 | 254 | $tomet = $select->getColumnMeta(0); |
@@ -244,6 +259,11 @@ discard block |
||
| 244 | 259 | * Check if a column name exist in a table |
| 245 | 260 | * @return Boolean column exist or not |
| 246 | 261 | */ |
| 262 | + |
|
| 263 | + /** |
|
| 264 | + * @param string $table |
|
| 265 | + * @param string $name |
|
| 266 | + */ |
|
| 247 | 267 | public function checkColumnName($table,$name) |
| 248 | 268 | { |
| 249 | 269 | global $globalDBdriver, $globalDBname; |
@@ -190,12 +190,20 @@ |
||
| 190 | 190 | return 1; |
| 191 | 191 | } |
| 192 | 192 | |
| 193 | + /** |
|
| 194 | + * @param double $lat |
|
| 195 | + * @param integer $isodd |
|
| 196 | + */ |
|
| 193 | 197 | private function cprN($lat,$isodd) { |
| 194 | 198 | $nl = $this->cprNL($lat) - $isodd; |
| 195 | 199 | if ($nl > 1) return $nl; |
| 196 | 200 | else return 1; |
| 197 | 201 | } |
| 198 | 202 | |
| 203 | + /** |
|
| 204 | + * @param string $msg |
|
| 205 | + * @param string $bin |
|
| 206 | + */ |
|
| 199 | 207 | private function parityCheck($msg, $bin) { |
| 200 | 208 | $modes_checksum_table = array( |
| 201 | 209 | 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
@@ -156,6 +156,10 @@ discard block |
||
| 156 | 156 | 't', 'u', 'v', 'w' // 119 |
| 157 | 157 | ); // char 64 |
| 158 | 158 | */ |
| 159 | + |
|
| 160 | + /** |
|
| 161 | + * @param integer $ascii |
|
| 162 | + */ |
|
| 159 | 163 | private function asciidec_2_8bit($ascii) { |
| 160 | 164 | //only process in the following range: 48-87, 96-119 |
| 161 | 165 | if ($ascii < 48) { } |
@@ -181,6 +185,10 @@ discard block |
||
| 181 | 185 | return(substr($bin, -6)); |
| 182 | 186 | } |
| 183 | 187 | |
| 188 | + /** |
|
| 189 | + * @param integer $_start |
|
| 190 | + * @param integer $_size |
|
| 191 | + */ |
|
| 184 | 192 | private function binchar($_str, $_start, $_size) { |
| 185 | 193 | // ' ' --- '?', // 0x20 - 0x3F |
| 186 | 194 | // '@' --- '_', // 0x40 - 0x5F |
@@ -206,6 +214,10 @@ discard block |
||
| 206 | 214 | } |
| 207 | 215 | |
| 208 | 216 | // function for decoding the AIS Message ITU Payload |
| 217 | + |
|
| 218 | + /** |
|
| 219 | + * @param string $_aisdata |
|
| 220 | + */ |
|
| 209 | 221 | private function decode_ais($_aisdata) { |
| 210 | 222 | $ro = new stdClass(); // return object |
| 211 | 223 | $ro->cls = 0; // AIS class undefined, also indicate unparsed msg |
@@ -378,6 +390,12 @@ discard block |
||
| 378 | 390 | else return 0; |
| 379 | 391 | } |
| 380 | 392 | |
| 393 | + /** |
|
| 394 | + * @param string $_itu |
|
| 395 | + * @param integer $_len |
|
| 396 | + * @param integer $_filler |
|
| 397 | + * @param string $aux |
|
| 398 | + */ |
|
| 381 | 399 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
| 382 | 400 | global $port; // tcpip port... |
| 383 | 401 | static $debug_counter = 0; |
@@ -397,6 +415,10 @@ discard block |
||
| 397 | 415 | |
| 398 | 416 | // char* - AIS \r terminated string |
| 399 | 417 | // TCP based streams which send messages in full can use this instead of calling process_ais_buf |
| 418 | + |
|
| 419 | + /** |
|
| 420 | + * @param string $rawdata |
|
| 421 | + */ |
|
| 400 | 422 | public function process_ais_raw($rawdata, $aux = '') { // return int |
| 401 | 423 | static $num_seq; // 1 to 9 |
| 402 | 424 | static $seq; // 1 to 9 |
@@ -622,6 +644,9 @@ discard block |
||
| 622 | 644 | return $result; |
| 623 | 645 | } |
| 624 | 646 | |
| 647 | + /** |
|
| 648 | + * @param string $mmsi |
|
| 649 | + */ |
|
| 625 | 650 | public function mmsitype($mmsi) { |
| 626 | 651 | if (strlen($mmsi) == 9) { |
| 627 | 652 | if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |
@@ -1126,6 +1126,10 @@ discard block |
||
| 1126 | 1126 | else return array(); |
| 1127 | 1127 | } |
| 1128 | 1128 | |
| 1129 | + /** |
|
| 1130 | + * @param string $type |
|
| 1131 | + * @param string $rules |
|
| 1132 | + */ |
|
| 1129 | 1133 | public function addNOTAM($ref,$title,$type,$fir,$code,$rules,$scope,$lower_limit,$upper_limit,$center_latitude,$center_longitude,$radius,$date_begin,$date_end,$permanent,$text,$full_notam) { |
| 1130 | 1134 | $query = "INSERT INTO notam (ref,title,notam_type,fir,code,rules,scope,lower_limit,upper_limit,center_latitude,center_longitude,radius,date_begin,date_end,permanent,notam_text,full_notam) VALUES (:ref,:title,:type,:fir,:code,:rules,:scope,:lower_limit,:upper_limit,:center_latitude,:center_longitude,:radius,:date_begin,:date_end,:permanent,:text,:full_notam)"; |
| 1131 | 1135 | $query_values = array(':ref' => $ref,':title' => $title,':type' => $type,':fir' => $fir,':code' => $code,':rules' => $rules,':scope' => $scope,':lower_limit' => $lower_limit,':upper_limit' => $upper_limit,':center_latitude' => $center_latitude,':center_longitude' => $center_longitude,':radius' => $radius,':date_begin' => $date_begin,':date_end' => $date_end,':permanent' => $permanent,':text' => $text,':full_notam' => $full_notam); |
@@ -1207,6 +1211,10 @@ discard block |
||
| 1207 | 1211 | } |
| 1208 | 1212 | } |
| 1209 | 1213 | } |
| 1214 | + |
|
| 1215 | + /** |
|
| 1216 | + * @param string $filename |
|
| 1217 | + */ |
|
| 1210 | 1218 | public function updateNOTAMfromTextFile($filename) { |
| 1211 | 1219 | global $globalTransaction, $globalDebug; |
| 1212 | 1220 | $alldata = $this->parseNOTAMtextFile($filename); |
@@ -1261,6 +1269,9 @@ discard block |
||
| 1261 | 1269 | } |
| 1262 | 1270 | } |
| 1263 | 1271 | |
| 1272 | + /** |
|
| 1273 | + * @param string $icao |
|
| 1274 | + */ |
|
| 1264 | 1275 | public function downloadNOTAM($icao) { |
| 1265 | 1276 | date_default_timezone_set("UTC"); |
| 1266 | 1277 | $Common = new Common(); |
@@ -1416,6 +1427,9 @@ discard block |
||
| 1416 | 1427 | return $result; |
| 1417 | 1428 | } |
| 1418 | 1429 | |
| 1430 | + /** |
|
| 1431 | + * @param string $code |
|
| 1432 | + */ |
|
| 1419 | 1433 | public function parse_code($code) { |
| 1420 | 1434 | $code = str_split($code); |
| 1421 | 1435 | $code_fp = $code[1].$code[2]; |