@@ -10,6 +10,9 @@ discard block |
||
| 10 | 10 | class update_db { |
| 11 | 11 | public static $db_sqlite; |
| 12 | 12 | |
| 13 | + /** |
|
| 14 | + * @param string $file |
|
| 15 | + */ |
|
| 13 | 16 | public static function download($url, $file, $referer = '') { |
| 14 | 17 | $fp = fopen($file, 'w+'); |
| 15 | 18 | $ch = curl_init(); |
@@ -24,6 +27,9 @@ discard block |
||
| 24 | 27 | fclose($fp); |
| 25 | 28 | } |
| 26 | 29 | |
| 30 | + /** |
|
| 31 | + * @param string $in_file |
|
| 32 | + */ |
|
| 27 | 33 | public static function gunzip($in_file,$out_file_name = '') { |
| 28 | 34 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 29 | 35 | $buffer_size = 4096; // read 4kb at a time |
@@ -45,6 +51,9 @@ discard block |
||
| 45 | 51 | } |
| 46 | 52 | } |
| 47 | 53 | |
| 54 | + /** |
|
| 55 | + * @param string $in_file |
|
| 56 | + */ |
|
| 48 | 57 | public static function unzip($in_file) { |
| 49 | 58 | if ($in_file != '' && file_exists($in_file)) { |
| 50 | 59 | $path = pathinfo(realpath($in_file), PATHINFO_DIRNAME); |
@@ -66,6 +75,9 @@ discard block |
||
| 66 | 75 | } |
| 67 | 76 | } |
| 68 | 77 | |
| 78 | + /** |
|
| 79 | + * @param string $database_file |
|
| 80 | + */ |
|
| 69 | 81 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 70 | 82 | global $globalDebug, $globalTransaction; |
| 71 | 83 | //$query = 'TRUNCATE TABLE routes'; |
@@ -108,6 +120,10 @@ discard block |
||
| 108 | 120 | } |
| 109 | 121 | return ''; |
| 110 | 122 | } |
| 123 | + |
|
| 124 | + /** |
|
| 125 | + * @param string $database_file |
|
| 126 | + */ |
|
| 111 | 127 | public static function retrieve_route_oneworld($database_file) { |
| 112 | 128 | global $globalDebug, $globalTransaction; |
| 113 | 129 | //$query = 'TRUNCATE TABLE routes'; |
@@ -149,6 +165,9 @@ discard block |
||
| 149 | 165 | return ''; |
| 150 | 166 | } |
| 151 | 167 | |
| 168 | + /** |
|
| 169 | + * @param string $database_file |
|
| 170 | + */ |
|
| 152 | 171 | public static function retrieve_route_skyteam($database_file) { |
| 153 | 172 | global $globalDebug, $globalTransaction; |
| 154 | 173 | //$query = 'TRUNCATE TABLE routes'; |
@@ -191,6 +210,10 @@ discard block |
||
| 191 | 210 | } |
| 192 | 211 | return ''; |
| 193 | 212 | } |
| 213 | + |
|
| 214 | + /** |
|
| 215 | + * @param string $database_file |
|
| 216 | + */ |
|
| 194 | 217 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
| 195 | 218 | global $globalTransaction; |
| 196 | 219 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -257,6 +280,9 @@ discard block |
||
| 257 | 280 | return ''; |
| 258 | 281 | } |
| 259 | 282 | |
| 283 | + /** |
|
| 284 | + * @param string $database_file |
|
| 285 | + */ |
|
| 260 | 286 | public static function retrieve_modes_flarmnet($database_file) { |
| 261 | 287 | global $globalTransaction; |
| 262 | 288 | $Common = new Common(); |
@@ -327,6 +353,9 @@ discard block |
||
| 327 | 353 | return ''; |
| 328 | 354 | } |
| 329 | 355 | |
| 356 | + /** |
|
| 357 | + * @param string $database_file |
|
| 358 | + */ |
|
| 330 | 359 | public static function retrieve_modes_ogn($database_file) { |
| 331 | 360 | global $globalTransaction; |
| 332 | 361 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -395,6 +424,9 @@ discard block |
||
| 395 | 424 | return ''; |
| 396 | 425 | } |
| 397 | 426 | |
| 427 | + /** |
|
| 428 | + * @param string $database_file |
|
| 429 | + */ |
|
| 398 | 430 | public static function retrieve_owner($database_file,$country = 'F') { |
| 399 | 431 | global $globalTransaction, $globalMasterSource; |
| 400 | 432 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
@@ -1235,6 +1267,10 @@ discard block |
||
| 1235 | 1267 | return ''; |
| 1236 | 1268 | } |
| 1237 | 1269 | |
| 1270 | + /** |
|
| 1271 | + * @param string $filename |
|
| 1272 | + * @param string $tletype |
|
| 1273 | + */ |
|
| 1238 | 1274 | public static function tle($filename,$tletype) { |
| 1239 | 1275 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1240 | 1276 | global $tmp_dir, $globalTransaction; |
@@ -1367,6 +1403,9 @@ discard block |
||
| 1367 | 1403 | |
| 1368 | 1404 | } |
| 1369 | 1405 | */ |
| 1406 | + /** |
|
| 1407 | + * @param string $filename |
|
| 1408 | + */ |
|
| 1370 | 1409 | public static function waypoints($filename) { |
| 1371 | 1410 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1372 | 1411 | global $tmp_dir, $globalTransaction; |
@@ -1414,6 +1453,9 @@ discard block |
||
| 1414 | 1453 | return ''; |
| 1415 | 1454 | } |
| 1416 | 1455 | |
| 1456 | + /** |
|
| 1457 | + * @param string $filename |
|
| 1458 | + */ |
|
| 1417 | 1459 | public static function ivao_airlines($filename) { |
| 1418 | 1460 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1419 | 1461 | global $tmp_dir, $globalTransaction; |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | /** |
| 58 | 58 | * Get SQL query part for filter used |
| 59 | 59 | * @param Array $filter the filter |
| 60 | - * @return Array the SQL part |
|
| 60 | + * @return string the SQL part |
|
| 61 | 61 | */ |
| 62 | 62 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 63 | 63 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -10171,6 +10171,7 @@ discard block |
||
| 10171 | 10171 | /** |
| 10172 | 10172 | * Counts all hours |
| 10173 | 10173 | * |
| 10174 | + * @param string $orderby |
|
| 10174 | 10175 | * @return Array the hour list |
| 10175 | 10176 | * |
| 10176 | 10177 | */ |
@@ -10236,6 +10237,7 @@ discard block |
||
| 10236 | 10237 | /** |
| 10237 | 10238 | * Counts all hours |
| 10238 | 10239 | * |
| 10240 | + * @param string $orderby |
|
| 10239 | 10241 | * @return Array the hour list |
| 10240 | 10242 | * |
| 10241 | 10243 | */ |
@@ -11288,7 +11290,7 @@ discard block |
||
| 11288 | 11290 | /** |
| 11289 | 11291 | * Parses the direction degrees to working |
| 11290 | 11292 | * |
| 11291 | - * @param Float $direction the direction in degrees |
|
| 11293 | + * @param integer $direction the direction in degrees |
|
| 11292 | 11294 | * @return Array the direction information |
| 11293 | 11295 | * |
| 11294 | 11296 | */ |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | /** |
| 12 | 12 | * Get SQL query part for filter used |
| 13 | 13 | * @param Array $filter the filter |
| 14 | - * @return Array the SQL part |
|
| 14 | + * @return string the SQL part |
|
| 15 | 15 | */ |
| 16 | 16 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 17 | 17 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -84,6 +84,10 @@ |
||
| 84 | 84 | 'y' => 'Yagi At QTH'); |
| 85 | 85 | |
| 86 | 86 | |
| 87 | + /** |
|
| 88 | + * @param integer $n |
|
| 89 | + * @param integer $s |
|
| 90 | + */ |
|
| 87 | 91 | private function urshift($n, $s) { |
| 88 | 92 | return ($n >= 0) ? ($n >> $s) : |
| 89 | 93 | (($n & 0x7fffffff) >> $s) | |
@@ -18,6 +18,10 @@ discard block |
||
| 18 | 18 | $this->db = $Connection->db(); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | + /** |
|
| 22 | + * @param string $type |
|
| 23 | + * @param string $stats_date |
|
| 24 | + */ |
|
| 21 | 25 | public function addLastStatsUpdate($type,$stats_date) { |
| 22 | 26 | $query = "DELETE FROM config WHERE name = :type; |
| 23 | 27 | INSERT INTO config (name,value) VALUES (:type,:stats_date);"; |
@@ -961,6 +965,10 @@ discard block |
||
| 961 | 965 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 962 | 966 | return $all; |
| 963 | 967 | } |
| 968 | + |
|
| 969 | + /** |
|
| 970 | + * @param string $type |
|
| 971 | + */ |
|
| 964 | 972 | public function deleteStatsByType($type,$stats_airline = '', $filter_name = '') { |
| 965 | 973 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 966 | 974 | $query = "DELETE FROM stats WHERE stats_type = :type AND stats_airline = :stats_airline AND filter_name = :filter_name"; |
@@ -972,6 +980,11 @@ discard block |
||
| 972 | 980 | echo "error : ".$e->getMessage(); |
| 973 | 981 | } |
| 974 | 982 | } |
| 983 | + |
|
| 984 | + /** |
|
| 985 | + * @param string $type |
|
| 986 | + * @param string $year |
|
| 987 | + */ |
|
| 975 | 988 | public function getSumStats($type,$year,$stats_airline = '',$filter_name = '',$month = '') { |
| 976 | 989 | if ($filter_name == '') $filter_name = $this->filter_name; |
| 977 | 990 | global $globalArchiveMonths, $globalDBdriver; |
@@ -1116,6 +1129,10 @@ discard block |
||
| 1116 | 1129 | else return 0; |
| 1117 | 1130 | } |
| 1118 | 1131 | |
| 1132 | + /** |
|
| 1133 | + * @param string $type |
|
| 1134 | + * @param string $stats_date |
|
| 1135 | + */ |
|
| 1119 | 1136 | public function addStat($type,$cnt,$stats_date,$stats_airline = '',$filter_name = '') { |
| 1120 | 1137 | global $globalDBdriver; |
| 1121 | 1138 | if ($filter_name == '') $filter_name = $this->filter_name; |
@@ -1169,6 +1186,9 @@ discard block |
||
| 1169 | 1186 | } |
| 1170 | 1187 | */ |
| 1171 | 1188 | |
| 1189 | + /** |
|
| 1190 | + * @param string $stats_type |
|
| 1191 | + */ |
|
| 1172 | 1192 | public function getStatsSource($stats_type,$year = '',$month = '',$day = '') { |
| 1173 | 1193 | global $globalDBdriver; |
| 1174 | 1194 | $query = "SELECT * FROM stats_source WHERE stats_type = :stats_type"; |
@@ -1212,6 +1232,9 @@ discard block |
||
| 1212 | 1232 | return $all; |
| 1213 | 1233 | } |
| 1214 | 1234 | |
| 1235 | + /** |
|
| 1236 | + * @param string $stats_type |
|
| 1237 | + */ |
|
| 1215 | 1238 | public function addStatSource($data,$source_name,$stats_type,$date) { |
| 1216 | 1239 | global $globalDBdriver; |
| 1217 | 1240 | if ($globalDBdriver == 'mysql') { |
@@ -1227,6 +1250,10 @@ discard block |
||
| 1227 | 1250 | return "error : ".$e->getMessage(); |
| 1228 | 1251 | } |
| 1229 | 1252 | } |
| 1253 | + |
|
| 1254 | + /** |
|
| 1255 | + * @param string $type |
|
| 1256 | + */ |
|
| 1230 | 1257 | public function addStatFlight($type,$date_name,$cnt,$stats_airline = '',$filter_name = '') { |
| 1231 | 1258 | $query = "INSERT INTO stats_flight (stats_type,flight_date,cnt,stats_airline,filter_name) VALUES (:type,:flight_date,:cnt,:stats_airline,:filter_name)"; |
| 1232 | 1259 | $query_values = array(':type' => $type,':flight_date' => $date_name,':cnt' => $cnt, ':stats_airline' => $stats_airline,':filter_name' => $filter_name); |
@@ -1493,6 +1520,10 @@ discard block |
||
| 1493 | 1520 | return "error : ".$e->getMessage(); |
| 1494 | 1521 | } |
| 1495 | 1522 | } |
| 1523 | + |
|
| 1524 | + /** |
|
| 1525 | + * @param string $type |
|
| 1526 | + */ |
|
| 1496 | 1527 | public function deleteStatFlight($type) { |
| 1497 | 1528 | $query = "DELETE FROM stats_flight WHERE stats_type = :type"; |
| 1498 | 1529 | $query_values = array(':type' => $type); |
@@ -1503,6 +1534,10 @@ discard block |
||
| 1503 | 1534 | return "error : ".$e->getMessage(); |
| 1504 | 1535 | } |
| 1505 | 1536 | } |
| 1537 | + |
|
| 1538 | + /** |
|
| 1539 | + * @param string $type |
|
| 1540 | + */ |
|
| 1506 | 1541 | public function deleteStatAirport($type) { |
| 1507 | 1542 | $query = "DELETE FROM stats_airport WHERE stats_type = :type"; |
| 1508 | 1543 | $query_values = array(':type' => $type); |
@@ -6,6 +6,9 @@ discard block |
||
| 6 | 6 | public $dbs = array(); |
| 7 | 7 | public $latest_schema = 37; |
| 8 | 8 | |
| 9 | + /** |
|
| 10 | + * @param string $dbname |
|
| 11 | + */ |
|
| 9 | 12 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
| 10 | 13 | global $globalDBdriver; |
| 11 | 14 | if ($dbc === null) { |
@@ -132,6 +135,9 @@ discard block |
||
| 132 | 135 | return true; |
| 133 | 136 | } |
| 134 | 137 | |
| 138 | + /** |
|
| 139 | + * @param string $table |
|
| 140 | + */ |
|
| 135 | 141 | public function tableExists($table) |
| 136 | 142 | { |
| 137 | 143 | global $globalDBdriver, $globalDBname; |
@@ -181,6 +187,11 @@ discard block |
||
| 181 | 187 | /* |
| 182 | 188 | * Check if index exist |
| 183 | 189 | */ |
| 190 | + |
|
| 191 | + /** |
|
| 192 | + * @param string $table |
|
| 193 | + * @param string $index |
|
| 194 | + */ |
|
| 184 | 195 | public function indexExists($table,$index) |
| 185 | 196 | { |
| 186 | 197 | global $globalDBdriver, $globalDBname; |
@@ -223,6 +234,10 @@ discard block |
||
| 223 | 234 | return $columns; |
| 224 | 235 | } |
| 225 | 236 | |
| 237 | + /** |
|
| 238 | + * @param string $table |
|
| 239 | + * @param string $column |
|
| 240 | + */ |
|
| 226 | 241 | public function getColumnType($table,$column) { |
| 227 | 242 | $select = $this->db->query('SELECT '.$column.' FROM '.$table); |
| 228 | 243 | $tomet = $select->getColumnMeta(0); |
@@ -233,6 +248,11 @@ discard block |
||
| 233 | 248 | * Check if a column name exist in a table |
| 234 | 249 | * @return Boolean column exist or not |
| 235 | 250 | */ |
| 251 | + |
|
| 252 | + /** |
|
| 253 | + * @param string $table |
|
| 254 | + * @param string $name |
|
| 255 | + */ |
|
| 236 | 256 | public function checkColumnName($table,$name) |
| 237 | 257 | { |
| 238 | 258 | global $globalDBdriver, $globalDBname; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | /** |
| 16 | 16 | * Get SQL query part for filter used |
| 17 | 17 | * @param Array $filter the filter |
| 18 | - * @return Array the SQL part |
|
| 18 | + * @return string the SQL part |
|
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | public function getFilter($filter = array(),$where = false,$and = false) { |
@@ -486,9 +486,6 @@ discard block |
||
| 486 | 486 | /** |
| 487 | 487 | * Update ident spotter data |
| 488 | 488 | * |
| 489 | - * @param String $flightaware_id the ID from flightaware |
|
| 490 | - * @param String $ident the flight ident |
|
| 491 | - * @return String success or false |
|
| 492 | 489 | * |
| 493 | 490 | */ |
| 494 | 491 | public function updateIdentTrackerData($famtrackid = '', $ident = '',$fromsource = NULL) |
@@ -510,10 +507,6 @@ discard block |
||
| 510 | 507 | /** |
| 511 | 508 | * Update latest spotter data |
| 512 | 509 | * |
| 513 | - * @param String $flightaware_id the ID from flightaware |
|
| 514 | - * @param String $ident the flight ident |
|
| 515 | - * @param String $arrival_airport_icao the arrival airport |
|
| 516 | - * @return String success or false |
|
| 517 | 510 | * |
| 518 | 511 | */ |
| 519 | 512 | public function updateLatestTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $groundspeed = NULL, $date = '') |
@@ -535,29 +528,6 @@ discard block |
||
| 535 | 528 | /** |
| 536 | 529 | * Adds a new spotter data |
| 537 | 530 | * |
| 538 | - * @param String $flightaware_id the ID from flightaware |
|
| 539 | - * @param String $ident the flight ident |
|
| 540 | - * @param String $aircraft_icao the aircraft type |
|
| 541 | - * @param String $departure_airport_icao the departure airport |
|
| 542 | - * @param String $arrival_airport_icao the arrival airport |
|
| 543 | - * @param String $latitude latitude of flight |
|
| 544 | - * @param String $longitude latitude of flight |
|
| 545 | - * @param String $waypoints waypoints of flight |
|
| 546 | - * @param String $altitude altitude of flight |
|
| 547 | - * @param String $heading heading of flight |
|
| 548 | - * @param String $groundspeed speed of flight |
|
| 549 | - * @param String $date date of flight |
|
| 550 | - * @param String $departure_airport_time departure time of flight |
|
| 551 | - * @param String $arrival_airport_time arrival time of flight |
|
| 552 | - * @param String $squawk squawk code of flight |
|
| 553 | - * @param String $route_stop route stop of flight |
|
| 554 | - * @param String $highlight highlight or not |
|
| 555 | - * @param String $ModeS ModesS code of flight |
|
| 556 | - * @param String $registration registration code of flight |
|
| 557 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 558 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 559 | - * @param String $verticalrate vertival rate of flight |
|
| 560 | - * @return String success or false |
|
| 561 | 531 | */ |
| 562 | 532 | public function addTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $comment = '', $type = '',$format_source = '', $source_name = '') |
| 563 | 533 | { |
@@ -1428,7 +1398,7 @@ discard block |
||
| 1428 | 1398 | /** |
| 1429 | 1399 | * Parses the direction degrees to working |
| 1430 | 1400 | * |
| 1431 | - * @param Float $direction the direction in degrees |
|
| 1401 | + * @param integer $direction the direction in degrees |
|
| 1432 | 1402 | * @return Array the direction information |
| 1433 | 1403 | * |
| 1434 | 1404 | */ |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * Get SQL query part for filter used |
| 16 | 16 | * @param Array $filter the filter |
| 17 | - * @return Array the SQL part |
|
| 17 | + * @return string the SQL part |
|
| 18 | 18 | */ |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -759,10 +759,6 @@ discard block |
||
| 759 | 759 | * |
| 760 | 760 | * @param String $famtrackid the ID from flightaware |
| 761 | 761 | * @param String $ident the flight ident |
| 762 | - * @param String $aircraft_icao the aircraft type |
|
| 763 | - * @param String $departure_airport_icao the departure airport |
|
| 764 | - * @param String $arrival_airport_icao the arrival airport |
|
| 765 | - * @return String success or false |
|
| 766 | 762 | * |
| 767 | 763 | */ |
| 768 | 764 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |