@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 27 | 27 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 28 | 28 | curl_setopt($ch, CURLOPT_TIMEOUT, 200); |
| 29 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 29 | + if ($referer != '') { |
|
| 30 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 31 | + } |
|
| 30 | 32 | curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5'); |
| 31 | 33 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 32 | 34 | curl_exec($ch); |
@@ -37,12 +39,16 @@ discard block |
||
| 37 | 39 | public static function gunzip($in_file,$out_file_name = '') { |
| 38 | 40 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 39 | 41 | $buffer_size = 4096; // read 4kb at a time |
| 40 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 42 | + if ($out_file_name == '') { |
|
| 43 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 44 | + } |
|
| 41 | 45 | if ($in_file != '' && file_exists($in_file)) { |
| 42 | 46 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 45 | - else { |
|
| 47 | + if (function_exists('gzopen')) { |
|
| 48 | + $file = gzopen($in_file,'rb'); |
|
| 49 | + } elseif (function_exists('gzopen64')) { |
|
| 50 | + $file = gzopen64($in_file,'rb'); |
|
| 51 | + } else { |
|
| 46 | 52 | echo 'gzopen not available'; |
| 47 | 53 | die; |
| 48 | 54 | } |
@@ -63,8 +69,12 @@ discard block |
||
| 63 | 69 | if ($res === TRUE) { |
| 64 | 70 | $zip->extractTo($path); |
| 65 | 71 | $zip->close(); |
| 66 | - } else return false; |
|
| 67 | - } else return false; |
|
| 72 | + } else { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + } else { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 68 | 78 | } |
| 69 | 79 | |
| 70 | 80 | public static function connect_sqlite($database) { |
@@ -79,7 +89,9 @@ discard block |
||
| 79 | 89 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 80 | 90 | global $globalDebug, $globalTransaction; |
| 81 | 91 | //$query = 'TRUNCATE TABLE routes'; |
| 82 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 92 | + if ($globalDebug) { |
|
| 93 | + echo " - Delete previous routes from DB -"; |
|
| 94 | + } |
|
| 83 | 95 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 84 | 96 | $Connection = new Connection(); |
| 85 | 97 | try { |
@@ -90,7 +102,9 @@ discard block |
||
| 90 | 102 | return "error : ".$e->getMessage(); |
| 91 | 103 | } |
| 92 | 104 | |
| 93 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 105 | + if ($globalDebug) { |
|
| 106 | + echo " - Add routes to DB -"; |
|
| 107 | + } |
|
| 94 | 108 | update_db::connect_sqlite($database_file); |
| 95 | 109 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
| 96 | 110 | $query = "select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao, rstp.allstop AS AllStop from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID LEFT JOIN (select RouteId,GROUP_CONCAT(icao,' ') as allstop from routestop left join Airport as air ON routestop.AirportId = air.AirportID group by RouteID) AS rstp ON Route.RouteID = rstp.RouteID"; |
@@ -105,15 +119,21 @@ discard block |
||
| 105 | 119 | $Connection = new Connection(); |
| 106 | 120 | $sth_dest = $Connection->db->prepare($query_dest); |
| 107 | 121 | try { |
| 108 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 122 | + if ($globalTransaction) { |
|
| 123 | + $Connection->db->beginTransaction(); |
|
| 124 | + } |
|
| 109 | 125 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 110 | 126 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 111 | 127 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 112 | 128 | $sth_dest->execute($query_dest_values); |
| 113 | 129 | } |
| 114 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 130 | + if ($globalTransaction) { |
|
| 131 | + $Connection->db->commit(); |
|
| 132 | + } |
|
| 115 | 133 | } catch(PDOException $e) { |
| 116 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 134 | + if ($globalTransaction) { |
|
| 135 | + $Connection->db->rollBack(); |
|
| 136 | + } |
|
| 117 | 137 | return "error : ".$e->getMessage(); |
| 118 | 138 | } |
| 119 | 139 | return ''; |
@@ -121,7 +141,9 @@ discard block |
||
| 121 | 141 | public static function retrieve_route_oneworld($database_file) { |
| 122 | 142 | global $globalDebug, $globalTransaction; |
| 123 | 143 | //$query = 'TRUNCATE TABLE routes'; |
| 124 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 144 | + if ($globalDebug) { |
|
| 145 | + echo " - Delete previous routes from DB -"; |
|
| 146 | + } |
|
| 125 | 147 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 126 | 148 | $Connection = new Connection(); |
| 127 | 149 | try { |
@@ -132,14 +154,18 @@ discard block |
||
| 132 | 154 | return "error : ".$e->getMessage(); |
| 133 | 155 | } |
| 134 | 156 | |
| 135 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 157 | + if ($globalDebug) { |
|
| 158 | + echo " - Add routes to DB -"; |
|
| 159 | + } |
|
| 136 | 160 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 137 | 161 | $Spotter = new Spotter(); |
| 138 | 162 | if ($fh = fopen($database_file,"r")) { |
| 139 | 163 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 140 | 164 | $Connection = new Connection(); |
| 141 | 165 | $sth_dest = $Connection->db->prepare($query_dest); |
| 142 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 166 | + if ($globalTransaction) { |
|
| 167 | + $Connection->db->beginTransaction(); |
|
| 168 | + } |
|
| 143 | 169 | while (!feof($fh)) { |
| 144 | 170 | $line = fgetcsv($fh,9999,','); |
| 145 | 171 | if ($line[0] != '') { |
@@ -148,13 +174,17 @@ discard block |
||
| 148 | 174 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
| 149 | 175 | $sth_dest->execute($query_dest_values); |
| 150 | 176 | } catch(PDOException $e) { |
| 151 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 177 | + if ($globalTransaction) { |
|
| 178 | + $Connection->db->rollBack(); |
|
| 179 | + } |
|
| 152 | 180 | return "error : ".$e->getMessage(); |
| 153 | 181 | } |
| 154 | 182 | } |
| 155 | 183 | } |
| 156 | 184 | } |
| 157 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 185 | + if ($globalTransaction) { |
|
| 186 | + $Connection->db->commit(); |
|
| 187 | + } |
|
| 158 | 188 | } |
| 159 | 189 | return ''; |
| 160 | 190 | } |
@@ -162,7 +192,9 @@ discard block |
||
| 162 | 192 | public static function retrieve_route_skyteam($database_file) { |
| 163 | 193 | global $globalDebug, $globalTransaction; |
| 164 | 194 | //$query = 'TRUNCATE TABLE routes'; |
| 165 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 195 | + if ($globalDebug) { |
|
| 196 | + echo " - Delete previous routes from DB -"; |
|
| 197 | + } |
|
| 166 | 198 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 167 | 199 | $Connection = new Connection(); |
| 168 | 200 | try { |
@@ -173,7 +205,9 @@ discard block |
||
| 173 | 205 | return "error : ".$e->getMessage(); |
| 174 | 206 | } |
| 175 | 207 | |
| 176 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 208 | + if ($globalDebug) { |
|
| 209 | + echo " - Add routes to DB -"; |
|
| 210 | + } |
|
| 177 | 211 | |
| 178 | 212 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 179 | 213 | $Spotter = new Spotter(); |
@@ -182,7 +216,9 @@ discard block |
||
| 182 | 216 | $Connection = new Connection(); |
| 183 | 217 | $sth_dest = $Connection->db->prepare($query_dest); |
| 184 | 218 | try { |
| 185 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 219 | + if ($globalTransaction) { |
|
| 220 | + $Connection->db->beginTransaction(); |
|
| 221 | + } |
|
| 186 | 222 | while (!feof($fh)) { |
| 187 | 223 | $line = fgetcsv($fh,9999,','); |
| 188 | 224 | if ($line[0] != '') { |
@@ -193,9 +229,13 @@ discard block |
||
| 193 | 229 | } |
| 194 | 230 | } |
| 195 | 231 | } |
| 196 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 232 | + if ($globalTransaction) { |
|
| 233 | + $Connection->db->commit(); |
|
| 234 | + } |
|
| 197 | 235 | } catch(PDOException $e) { |
| 198 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 236 | + if ($globalTransaction) { |
|
| 237 | + $Connection->db->rollBack(); |
|
| 238 | + } |
|
| 199 | 239 | return "error : ".$e->getMessage(); |
| 200 | 240 | } |
| 201 | 241 | } |
@@ -238,11 +278,16 @@ discard block |
||
| 238 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
| 239 | 279 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 240 | 280 | try { |
| 241 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 281 | + if ($globalTransaction) { |
|
| 282 | + $Connection->db->beginTransaction(); |
|
| 283 | + } |
|
| 242 | 284 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 243 | 285 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 244 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
| 245 | - else $type = null; |
|
| 286 | + if ($values['UserString4'] == 'M') { |
|
| 287 | + $type = 'military'; |
|
| 288 | + } else { |
|
| 289 | + $type = null; |
|
| 290 | + } |
|
| 246 | 291 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 247 | 292 | $sth_dest->execute($query_dest_values); |
| 248 | 293 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -250,7 +295,9 @@ discard block |
||
| 250 | 295 | $sth_dest_owner->execute($query_dest_owner_values); |
| 251 | 296 | } |
| 252 | 297 | } |
| 253 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 298 | + if ($globalTransaction) { |
|
| 299 | + $Connection->db->commit(); |
|
| 300 | + } |
|
| 254 | 301 | } catch(PDOException $e) { |
| 255 | 302 | return "error : ".$e->getMessage(); |
| 256 | 303 | } |
@@ -287,7 +334,9 @@ discard block |
||
| 287 | 334 | $Connection = new Connection(); |
| 288 | 335 | $sth_dest = $Connection->db->prepare($query_dest); |
| 289 | 336 | try { |
| 290 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 337 | + if ($globalTransaction) { |
|
| 338 | + $Connection->db->beginTransaction(); |
|
| 339 | + } |
|
| 291 | 340 | while (!feof($fh)) { |
| 292 | 341 | $values = array(); |
| 293 | 342 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -298,7 +347,9 @@ discard block |
||
| 298 | 347 | // Check if we can find ICAO, else set it to GLID |
| 299 | 348 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 300 | 349 | $search_more = ''; |
| 301 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 350 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 351 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 352 | + } |
|
| 302 | 353 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 303 | 354 | $sth_search = $Connection->db->prepare($query_search); |
| 304 | 355 | try { |
@@ -311,7 +362,9 @@ discard block |
||
| 311 | 362 | } catch(PDOException $e) { |
| 312 | 363 | return "error : ".$e->getMessage(); |
| 313 | 364 | } |
| 314 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
| 365 | + if (!isset($values['ICAOTypeCode'])) { |
|
| 366 | + $values['ICAOTypeCode'] = 'GLID'; |
|
| 367 | + } |
|
| 315 | 368 | // Add data to db |
| 316 | 369 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 317 | 370 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
@@ -320,7 +373,9 @@ discard block |
||
| 320 | 373 | $sth_dest->execute($query_dest_values); |
| 321 | 374 | } |
| 322 | 375 | } |
| 323 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 376 | + if ($globalTransaction) { |
|
| 377 | + $Connection->db->commit(); |
|
| 378 | + } |
|
| 324 | 379 | } catch(PDOException $e) { |
| 325 | 380 | return "error : ".$e->getMessage(); |
| 326 | 381 | } |
@@ -356,7 +411,9 @@ discard block |
||
| 356 | 411 | $Connection = new Connection(); |
| 357 | 412 | $sth_dest = $Connection->db->prepare($query_dest); |
| 358 | 413 | try { |
| 359 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 414 | + if ($globalTransaction) { |
|
| 415 | + $Connection->db->beginTransaction(); |
|
| 416 | + } |
|
| 360 | 417 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 361 | 418 | while (!feof($fh)) { |
| 362 | 419 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -370,13 +427,17 @@ discard block |
||
| 370 | 427 | // Check if we can find ICAO, else set it to GLID |
| 371 | 428 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 372 | 429 | $search_more = ''; |
| 373 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 430 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 431 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 432 | + } |
|
| 374 | 433 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 375 | 434 | $sth_search = $Connection->db->prepare($query_search); |
| 376 | 435 | try { |
| 377 | 436 | $sth_search->execute(); |
| 378 | 437 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 379 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 438 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 439 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 440 | + } |
|
| 380 | 441 | } catch(PDOException $e) { |
| 381 | 442 | return "error : ".$e->getMessage(); |
| 382 | 443 | } |
@@ -389,7 +450,9 @@ discard block |
||
| 389 | 450 | $sth_dest->execute($query_dest_values); |
| 390 | 451 | } |
| 391 | 452 | } |
| 392 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 453 | + if ($globalTransaction) { |
|
| 454 | + $Connection->db->commit(); |
|
| 455 | + } |
|
| 393 | 456 | } catch(PDOException $e) { |
| 394 | 457 | return "error : ".$e->getMessage(); |
| 395 | 458 | } |
@@ -428,7 +491,9 @@ discard block |
||
| 428 | 491 | $sth_dest = $Connection->db->prepare($query_dest); |
| 429 | 492 | $sth_modes = $Connection->db->prepare($query_modes); |
| 430 | 493 | try { |
| 431 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 494 | + if ($globalTransaction) { |
|
| 495 | + $Connection->db->beginTransaction(); |
|
| 496 | + } |
|
| 432 | 497 | $tmp = fgetcsv($fh,9999,',','"'); |
| 433 | 498 | while (!feof($fh)) { |
| 434 | 499 | $line = fgetcsv($fh,9999,',','"'); |
@@ -438,16 +503,22 @@ discard block |
||
| 438 | 503 | $values['registration'] = $line[0]; |
| 439 | 504 | $values['base'] = $line[4]; |
| 440 | 505 | $values['owner'] = $line[5]; |
| 441 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 506 | + if ($line[6] == '') { |
|
| 507 | + $values['date_first_reg'] = null; |
|
| 508 | + } else { |
|
| 509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 510 | + } |
|
| 443 | 511 | $values['cancel'] = $line[7]; |
| 444 | 512 | } elseif ($country == 'EI') { |
| 445 | 513 | // TODO : add modeS & reg to aircraft_modes |
| 446 | 514 | $values['registration'] = $line[0]; |
| 447 | 515 | $values['base'] = $line[3]; |
| 448 | 516 | $values['owner'] = $line[2]; |
| 449 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 517 | + if ($line[1] == '') { |
|
| 518 | + $values['date_first_reg'] = null; |
|
| 519 | + } else { |
|
| 520 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 521 | + } |
|
| 451 | 522 | $values['cancel'] = ''; |
| 452 | 523 | $values['modes'] = $line[7]; |
| 453 | 524 | $values['icao'] = $line[8]; |
@@ -466,16 +537,22 @@ discard block |
||
| 466 | 537 | $values['registration'] = $line[3]; |
| 467 | 538 | $values['base'] = null; |
| 468 | 539 | $values['owner'] = $line[5]; |
| 469 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 540 | + if ($line[18] == '') { |
|
| 541 | + $values['date_first_reg'] = null; |
|
| 542 | + } else { |
|
| 543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 544 | + } |
|
| 471 | 545 | $values['cancel'] = ''; |
| 472 | 546 | } elseif ($country == 'VH') { |
| 473 | 547 | // TODO : add modeS & reg to aircraft_modes |
| 474 | 548 | $values['registration'] = $line[0]; |
| 475 | 549 | $values['base'] = null; |
| 476 | 550 | $values['owner'] = $line[12]; |
| 477 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 551 | + if ($line[28] == '') { |
|
| 552 | + $values['date_first_reg'] = null; |
|
| 553 | + } else { |
|
| 554 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 555 | + } |
|
| 479 | 556 | |
| 480 | 557 | $values['cancel'] = $line[39]; |
| 481 | 558 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -494,29 +571,41 @@ discard block |
||
| 494 | 571 | $values['registration'] = $line[0]; |
| 495 | 572 | $values['base'] = null; |
| 496 | 573 | $values['owner'] = $line[8]; |
| 497 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 574 | + if ($line[7] == '') { |
|
| 575 | + $values['date_first_reg'] = null; |
|
| 576 | + } else { |
|
| 577 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 578 | + } |
|
| 499 | 579 | $values['cancel'] = ''; |
| 500 | 580 | } elseif ($country == 'PP') { |
| 501 | 581 | $values['registration'] = $line[0]; |
| 502 | 582 | $values['base'] = null; |
| 503 | 583 | $values['owner'] = $line[4]; |
| 504 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 584 | + if ($line[6] == '') { |
|
| 585 | + $values['date_first_reg'] = null; |
|
| 586 | + } else { |
|
| 587 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 588 | + } |
|
| 506 | 589 | $values['cancel'] = $line[7]; |
| 507 | 590 | } elseif ($country == 'E7') { |
| 508 | 591 | $values['registration'] = $line[0]; |
| 509 | 592 | $values['base'] = null; |
| 510 | 593 | $values['owner'] = $line[4]; |
| 511 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 594 | + if ($line[5] == '') { |
|
| 595 | + $values['date_first_reg'] = null; |
|
| 596 | + } else { |
|
| 597 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 598 | + } |
|
| 513 | 599 | $values['cancel'] = ''; |
| 514 | 600 | } elseif ($country == '8Q') { |
| 515 | 601 | $values['registration'] = $line[0]; |
| 516 | 602 | $values['base'] = null; |
| 517 | 603 | $values['owner'] = $line[3]; |
| 518 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 604 | + if ($line[7] == '') { |
|
| 605 | + $values['date_first_reg'] = null; |
|
| 606 | + } else { |
|
| 607 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 608 | + } |
|
| 520 | 609 | $values['cancel'] = ''; |
| 521 | 610 | } elseif ($country == 'ZK') { |
| 522 | 611 | $values['registration'] = $line[0]; |
@@ -561,7 +650,9 @@ discard block |
||
| 561 | 650 | $sth_modes->execute($query_modes_values); |
| 562 | 651 | } |
| 563 | 652 | } |
| 564 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 653 | + if ($globalTransaction) { |
|
| 654 | + $Connection->db->commit(); |
|
| 655 | + } |
|
| 565 | 656 | } catch(PDOException $e) { |
| 566 | 657 | return "error : ".$e->getMessage(); |
| 567 | 658 | } |
@@ -697,25 +788,45 @@ discard block |
||
| 697 | 788 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
| 698 | 789 | $Connection = new Connection(); |
| 699 | 790 | $sth_dest = $Connection->db->prepare($query_dest); |
| 700 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 791 | + if ($globalTransaction) { |
|
| 792 | + $Connection->db->beginTransaction(); |
|
| 793 | + } |
|
| 701 | 794 | |
| 702 | 795 | $i = 0; |
| 703 | 796 | while($row = sparql_fetch_array($result)) |
| 704 | 797 | { |
| 705 | 798 | if ($i >= 1) { |
| 706 | 799 | //print_r($row); |
| 707 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
| 708 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
| 709 | - if (!isset($row['type'])) $row['type'] = ''; |
|
| 710 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
| 800 | + if (!isset($row['iata'])) { |
|
| 801 | + $row['iata'] = ''; |
|
| 802 | + } |
|
| 803 | + if (!isset($row['icao'])) { |
|
| 804 | + $row['icao'] = ''; |
|
| 805 | + } |
|
| 806 | + if (!isset($row['type'])) { |
|
| 807 | + $row['type'] = ''; |
|
| 808 | + } |
|
| 809 | + if (!isset($row['altitude'])) { |
|
| 810 | + $row['altitude'] = ''; |
|
| 811 | + } |
|
| 711 | 812 | if (isset($row['city_bis'])) { |
| 712 | 813 | $row['city'] = $row['city_bis']; |
| 713 | 814 | } |
| 714 | - if (!isset($row['city'])) $row['city'] = ''; |
|
| 715 | - if (!isset($row['country'])) $row['country'] = ''; |
|
| 716 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
| 717 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
| 718 | - if (!isset($row['name'])) continue; |
|
| 815 | + if (!isset($row['city'])) { |
|
| 816 | + $row['city'] = ''; |
|
| 817 | + } |
|
| 818 | + if (!isset($row['country'])) { |
|
| 819 | + $row['country'] = ''; |
|
| 820 | + } |
|
| 821 | + if (!isset($row['homepage'])) { |
|
| 822 | + $row['homepage'] = ''; |
|
| 823 | + } |
|
| 824 | + if (!isset($row['wikipedia_page'])) { |
|
| 825 | + $row['wikipedia_page'] = ''; |
|
| 826 | + } |
|
| 827 | + if (!isset($row['name'])) { |
|
| 828 | + continue; |
|
| 829 | + } |
|
| 719 | 830 | if (!isset($row['image'])) { |
| 720 | 831 | $row['image'] = ''; |
| 721 | 832 | $row['image_thumb'] = ''; |
@@ -771,7 +882,9 @@ discard block |
||
| 771 | 882 | |
| 772 | 883 | $i++; |
| 773 | 884 | } |
| 774 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 885 | + if ($globalTransaction) { |
|
| 886 | + $Connection->db->commit(); |
|
| 887 | + } |
|
| 775 | 888 | /* |
| 776 | 889 | echo "Delete duplicate rows...\n"; |
| 777 | 890 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -814,7 +927,9 @@ discard block |
||
| 814 | 927 | $delimiter = ','; |
| 815 | 928 | $out_file = $tmp_dir.'airports.csv'; |
| 816 | 929 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
| 817 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 930 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 931 | + return FALSE; |
|
| 932 | + } |
|
| 818 | 933 | echo "Add data from ourairports.com...\n"; |
| 819 | 934 | |
| 820 | 935 | $header = NULL; |
@@ -824,8 +939,9 @@ discard block |
||
| 824 | 939 | //$Connection->db->beginTransaction(); |
| 825 | 940 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 826 | 941 | { |
| 827 | - if(!$header) $header = $row; |
|
| 828 | - else { |
|
| 942 | + if(!$header) { |
|
| 943 | + $header = $row; |
|
| 944 | + } else { |
|
| 829 | 945 | $data = array(); |
| 830 | 946 | $data = array_combine($header, $row); |
| 831 | 947 | try { |
@@ -866,7 +982,9 @@ discard block |
||
| 866 | 982 | echo "Download data from another free database...\n"; |
| 867 | 983 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 868 | 984 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
| 869 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 985 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 986 | + return FALSE; |
|
| 987 | + } |
|
| 870 | 988 | update_db::unzip($out_file); |
| 871 | 989 | $header = NULL; |
| 872 | 990 | echo "Add data from another free database...\n"; |
@@ -877,8 +995,9 @@ discard block |
||
| 877 | 995 | //$Connection->db->beginTransaction(); |
| 878 | 996 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 879 | 997 | { |
| 880 | - if(!$header) $header = $row; |
|
| 881 | - else { |
|
| 998 | + if(!$header) { |
|
| 999 | + $header = $row; |
|
| 1000 | + } else { |
|
| 882 | 1001 | $data = $row; |
| 883 | 1002 | |
| 884 | 1003 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1047,7 +1166,9 @@ discard block |
||
| 1047 | 1166 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
| 1048 | 1167 | { |
| 1049 | 1168 | $i = 0; |
| 1050 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1169 | + if ($globalTransaction) { |
|
| 1170 | + $Connection->db->beginTransaction(); |
|
| 1171 | + } |
|
| 1051 | 1172 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1052 | 1173 | { |
| 1053 | 1174 | if ($i > 0) { |
@@ -1060,7 +1181,9 @@ discard block |
||
| 1060 | 1181 | } |
| 1061 | 1182 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
| 1062 | 1183 | if (!empty($result_search)) { |
| 1063 | - if ($globalDebug) echo '.'; |
|
| 1184 | + if ($globalDebug) { |
|
| 1185 | + echo '.'; |
|
| 1186 | + } |
|
| 1064 | 1187 | //if ($globalDBdriver == 'mysql') { |
| 1065 | 1188 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
| 1066 | 1189 | //} else { |
@@ -1082,8 +1205,12 @@ discard block |
||
| 1082 | 1205 | } |
| 1083 | 1206 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
| 1084 | 1207 | if (!empty($result_search_mfr)) { |
| 1085 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
| 1086 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
| 1208 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
| 1209 | + $data[16] = $data[23]; |
|
| 1210 | + } |
|
| 1211 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
| 1212 | + $data[16] = $data[15]; |
|
| 1213 | + } |
|
| 1087 | 1214 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1088 | 1215 | try { |
| 1089 | 1216 | $sthf = $Connection->db->prepare($queryf); |
@@ -1094,7 +1221,9 @@ discard block |
||
| 1094 | 1221 | } |
| 1095 | 1222 | } |
| 1096 | 1223 | if (strtotime($data[29]) > time()) { |
| 1097 | - if ($globalDebug) echo 'i'; |
|
| 1224 | + if ($globalDebug) { |
|
| 1225 | + echo 'i'; |
|
| 1226 | + } |
|
| 1098 | 1227 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1099 | 1228 | try { |
| 1100 | 1229 | $sth = $Connection->db->prepare($query); |
@@ -1105,13 +1234,19 @@ discard block |
||
| 1105 | 1234 | } |
| 1106 | 1235 | } |
| 1107 | 1236 | if ($i % 90 == 0) { |
| 1108 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1109 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1237 | + if ($globalTransaction) { |
|
| 1238 | + $Connection->db->commit(); |
|
| 1239 | + } |
|
| 1240 | + if ($globalTransaction) { |
|
| 1241 | + $Connection->db->beginTransaction(); |
|
| 1242 | + } |
|
| 1110 | 1243 | } |
| 1111 | 1244 | $i++; |
| 1112 | 1245 | } |
| 1113 | 1246 | fclose($handle); |
| 1114 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1247 | + if ($globalTransaction) { |
|
| 1248 | + $Connection->db->commit(); |
|
| 1249 | + } |
|
| 1115 | 1250 | } |
| 1116 | 1251 | return ''; |
| 1117 | 1252 | } |
@@ -1131,11 +1266,15 @@ discard block |
||
| 1131 | 1266 | if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE) |
| 1132 | 1267 | { |
| 1133 | 1268 | $i = 0; |
| 1134 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1269 | + if ($globalTransaction) { |
|
| 1270 | + $Connection->db->beginTransaction(); |
|
| 1271 | + } |
|
| 1135 | 1272 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1136 | 1273 | { |
| 1137 | 1274 | if ($i > 0) { |
| 1138 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1275 | + if ($data[1] == 'NULL') { |
|
| 1276 | + $data[1] = $data[0]; |
|
| 1277 | + } |
|
| 1139 | 1278 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1140 | 1279 | try { |
| 1141 | 1280 | $sth = $Connection->db->prepare($query); |
@@ -1147,7 +1286,9 @@ discard block |
||
| 1147 | 1286 | $i++; |
| 1148 | 1287 | } |
| 1149 | 1288 | fclose($handle); |
| 1150 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1289 | + if ($globalTransaction) { |
|
| 1290 | + $Connection->db->commit(); |
|
| 1291 | + } |
|
| 1151 | 1292 | } |
| 1152 | 1293 | return ''; |
| 1153 | 1294 | } |
@@ -1179,11 +1320,15 @@ discard block |
||
| 1179 | 1320 | if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE) |
| 1180 | 1321 | { |
| 1181 | 1322 | $i = 0; |
| 1182 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1323 | + if ($globalTransaction) { |
|
| 1324 | + $Connection->db->beginTransaction(); |
|
| 1325 | + } |
|
| 1183 | 1326 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1184 | 1327 | { |
| 1185 | 1328 | if ($i > 0) { |
| 1186 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1329 | + if ($data[1] == 'NULL') { |
|
| 1330 | + $data[1] = $data[0]; |
|
| 1331 | + } |
|
| 1187 | 1332 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
| 1188 | 1333 | try { |
| 1189 | 1334 | $sth = $Connection->db->prepare($query); |
@@ -1195,7 +1340,9 @@ discard block |
||
| 1195 | 1340 | $i++; |
| 1196 | 1341 | } |
| 1197 | 1342 | fclose($handle); |
| 1198 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1343 | + if ($globalTransaction) { |
|
| 1344 | + $Connection->db->commit(); |
|
| 1345 | + } |
|
| 1199 | 1346 | } |
| 1200 | 1347 | /* |
| 1201 | 1348 | $query = "UNLOCK TABLES"; |
@@ -1225,7 +1372,9 @@ discard block |
||
| 1225 | 1372 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
| 1226 | 1373 | { |
| 1227 | 1374 | $i = 0; |
| 1228 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1375 | + if ($globalTransaction) { |
|
| 1376 | + $Connection->db->beginTransaction(); |
|
| 1377 | + } |
|
| 1229 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1230 | 1379 | { |
| 1231 | 1380 | if ($i > 0) { |
@@ -1241,7 +1390,9 @@ discard block |
||
| 1241 | 1390 | $i++; |
| 1242 | 1391 | } |
| 1243 | 1392 | fclose($handle); |
| 1244 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1393 | + if ($globalTransaction) { |
|
| 1394 | + $Connection->db->commit(); |
|
| 1395 | + } |
|
| 1245 | 1396 | } |
| 1246 | 1397 | return ''; |
| 1247 | 1398 | } |
@@ -1261,7 +1412,9 @@ discard block |
||
| 1261 | 1412 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
| 1262 | 1413 | { |
| 1263 | 1414 | $i = 0; |
| 1264 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1415 | + if ($globalTransaction) { |
|
| 1416 | + $Connection->db->beginTransaction(); |
|
| 1417 | + } |
|
| 1265 | 1418 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1266 | 1419 | { |
| 1267 | 1420 | if ($i > 0) { |
@@ -1271,19 +1424,25 @@ discard block |
||
| 1271 | 1424 | $sth = $Connection->db->prepare($query); |
| 1272 | 1425 | $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
| 1273 | 1426 | } catch(PDOException $e) { |
| 1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1427 | + if ($globalDebug) { |
|
| 1428 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1429 | + } |
|
| 1275 | 1430 | die(); |
| 1276 | 1431 | } |
| 1277 | 1432 | } |
| 1278 | 1433 | if ($globalTransaction && $i % 2000 == 0) { |
| 1279 | 1434 | $Connection->db->commit(); |
| 1280 | - if ($globalDebug) echo '.'; |
|
| 1435 | + if ($globalDebug) { |
|
| 1436 | + echo '.'; |
|
| 1437 | + } |
|
| 1281 | 1438 | $Connection->db->beginTransaction(); |
| 1282 | 1439 | } |
| 1283 | 1440 | $i++; |
| 1284 | 1441 | } |
| 1285 | 1442 | fclose($handle); |
| 1286 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1443 | + if ($globalTransaction) { |
|
| 1444 | + $Connection->db->commit(); |
|
| 1445 | + } |
|
| 1287 | 1446 | } |
| 1288 | 1447 | return ''; |
| 1289 | 1448 | } |
@@ -1302,7 +1461,9 @@ discard block |
||
| 1302 | 1461 | if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE) |
| 1303 | 1462 | { |
| 1304 | 1463 | $i = 0; |
| 1305 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1464 | + if ($globalTransaction) { |
|
| 1465 | + $Connection->db->beginTransaction(); |
|
| 1466 | + } |
|
| 1306 | 1467 | while (($data = fgets($handle, 1000)) !== FALSE) |
| 1307 | 1468 | { |
| 1308 | 1469 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
@@ -1310,18 +1471,24 @@ discard block |
||
| 1310 | 1471 | $sth = $Connection->db->prepare($query); |
| 1311 | 1472 | $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
| 1312 | 1473 | } catch(PDOException $e) { |
| 1313 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1474 | + if ($globalDebug) { |
|
| 1475 | + echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1476 | + } |
|
| 1314 | 1477 | die(); |
| 1315 | 1478 | } |
| 1316 | 1479 | if ($globalTransaction && $i % 2000 == 0) { |
| 1317 | 1480 | $Connection->db->commit(); |
| 1318 | - if ($globalDebug) echo '.'; |
|
| 1481 | + if ($globalDebug) { |
|
| 1482 | + echo '.'; |
|
| 1483 | + } |
|
| 1319 | 1484 | $Connection->db->beginTransaction(); |
| 1320 | 1485 | } |
| 1321 | 1486 | $i++; |
| 1322 | 1487 | } |
| 1323 | 1488 | fclose($handle); |
| 1324 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1489 | + if ($globalTransaction) { |
|
| 1490 | + $Connection->db->commit(); |
|
| 1491 | + } |
|
| 1325 | 1492 | } |
| 1326 | 1493 | return ''; |
| 1327 | 1494 | } |
@@ -1346,7 +1513,9 @@ discard block |
||
| 1346 | 1513 | $i = 0; |
| 1347 | 1514 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1348 | 1515 | //$Connection->db->beginTransaction(); |
| 1349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1516 | + if ($globalTransaction) { |
|
| 1517 | + $Connection->db->beginTransaction(); |
|
| 1518 | + } |
|
| 1350 | 1519 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1351 | 1520 | { |
| 1352 | 1521 | if ($i > 0) { |
@@ -1362,7 +1531,9 @@ discard block |
||
| 1362 | 1531 | $i++; |
| 1363 | 1532 | } |
| 1364 | 1533 | fclose($handle); |
| 1365 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1534 | + if ($globalTransaction) { |
|
| 1535 | + $Connection->db->commit(); |
|
| 1536 | + } |
|
| 1366 | 1537 | } |
| 1367 | 1538 | return ''; |
| 1368 | 1539 | } |
@@ -1382,7 +1553,9 @@ discard block |
||
| 1382 | 1553 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
| 1383 | 1554 | { |
| 1384 | 1555 | $i = 0; |
| 1385 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1556 | + if ($globalTransaction) { |
|
| 1557 | + $Connection->db->beginTransaction(); |
|
| 1558 | + } |
|
| 1386 | 1559 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1387 | 1560 | { |
| 1388 | 1561 | if ($i > 0) { |
@@ -1399,7 +1572,9 @@ discard block |
||
| 1399 | 1572 | $i++; |
| 1400 | 1573 | } |
| 1401 | 1574 | fclose($handle); |
| 1402 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1575 | + if ($globalTransaction) { |
|
| 1576 | + $Connection->db->commit(); |
|
| 1577 | + } |
|
| 1403 | 1578 | } |
| 1404 | 1579 | return ''; |
| 1405 | 1580 | } |
@@ -1418,7 +1593,9 @@ discard block |
||
| 1418 | 1593 | $Connection = new Connection(); |
| 1419 | 1594 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
| 1420 | 1595 | { |
| 1421 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1596 | + if ($globalTransaction) { |
|
| 1597 | + $Connection->db->beginTransaction(); |
|
| 1598 | + } |
|
| 1422 | 1599 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
| 1423 | 1600 | { |
| 1424 | 1601 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1433,7 +1610,9 @@ discard block |
||
| 1433 | 1610 | } |
| 1434 | 1611 | } |
| 1435 | 1612 | fclose($handle); |
| 1436 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1613 | + if ($globalTransaction) { |
|
| 1614 | + $Connection->db->commit(); |
|
| 1615 | + } |
|
| 1437 | 1616 | } |
| 1438 | 1617 | return ''; |
| 1439 | 1618 | } |
@@ -1511,9 +1690,14 @@ discard block |
||
| 1511 | 1690 | if ($i > 0 && $data[0] != '') { |
| 1512 | 1691 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1513 | 1692 | $period = str_replace(',','',$data[14]); |
| 1514 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1515 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1516 | - else $launch_date = NULL; |
|
| 1693 | + if (!empty($period) && strpos($period,'days')) { |
|
| 1694 | + $period = str_replace(' days','',$period)*24*60; |
|
| 1695 | + } |
|
| 1696 | + if ($data[18] != '') { |
|
| 1697 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1698 | + } else { |
|
| 1699 | + $launch_date = NULL; |
|
| 1700 | + } |
|
| 1517 | 1701 | $data = array_map(function($value) { |
| 1518 | 1702 | return trim($value) === '' ? null : $value; |
| 1519 | 1703 | }, $data); |
@@ -1705,10 +1889,14 @@ discard block |
||
| 1705 | 1889 | $owner_code = trim(substr($data,49,5)); |
| 1706 | 1890 | |
| 1707 | 1891 | if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
| 1708 | - if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
|
| 1892 | + if ($globalDebug) { |
|
| 1893 | + echo $data.'owner_code: '.$owner_code."\n"; |
|
| 1894 | + } |
|
| 1709 | 1895 | } |
| 1710 | 1896 | if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
| 1711 | - if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1897 | + if ($globalDebug) { |
|
| 1898 | + echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1899 | + } |
|
| 1712 | 1900 | } |
| 1713 | 1901 | |
| 1714 | 1902 | if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
@@ -1875,7 +2063,9 @@ discard block |
||
| 1875 | 2063 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1876 | 2064 | { |
| 1877 | 2065 | $i = 0; |
| 1878 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2066 | + if ($globalTransaction) { |
|
| 2067 | + $Connection->db->beginTransaction(); |
|
| 2068 | + } |
|
| 1879 | 2069 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1880 | 2070 | { |
| 1881 | 2071 | $i++; |
@@ -1903,7 +2093,9 @@ discard block |
||
| 1903 | 2093 | } |
| 1904 | 2094 | } |
| 1905 | 2095 | fclose($handle); |
| 1906 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2096 | + if ($globalTransaction) { |
|
| 2097 | + $Connection->db->commit(); |
|
| 2098 | + } |
|
| 1907 | 2099 | } |
| 1908 | 2100 | return ''; |
| 1909 | 2101 | } |
@@ -1919,7 +2111,9 @@ discard block |
||
| 1919 | 2111 | $Source->deleteLocationByType('fires'); |
| 1920 | 2112 | $i = 0; |
| 1921 | 2113 | if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
| 1922 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2114 | + if ($globalTransaction) { |
|
| 2115 | + $Connection->db->beginTransaction(); |
|
| 2116 | + } |
|
| 1923 | 2117 | while (($row = fgetcsv($handle,1000)) !== false) { |
| 1924 | 2118 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
| 1925 | 2119 | $description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]); |
@@ -1934,7 +2128,9 @@ discard block |
||
| 1934 | 2128 | } |
| 1935 | 2129 | $i++; |
| 1936 | 2130 | } |
| 1937 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2131 | + if ($globalTransaction) { |
|
| 2132 | + $Connection->db->commit(); |
|
| 2133 | + } |
|
| 1938 | 2134 | } |
| 1939 | 2135 | } |
| 1940 | 2136 | |
@@ -1955,7 +2151,9 @@ discard block |
||
| 1955 | 2151 | $Connection = new Connection(); |
| 1956 | 2152 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1957 | 2153 | { |
| 1958 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2154 | + if ($globalTransaction) { |
|
| 2155 | + $Connection->db->beginTransaction(); |
|
| 2156 | + } |
|
| 1959 | 2157 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1960 | 2158 | { |
| 1961 | 2159 | if(count($row) > 1) { |
@@ -1969,7 +2167,9 @@ discard block |
||
| 1969 | 2167 | } |
| 1970 | 2168 | } |
| 1971 | 2169 | fclose($handle); |
| 1972 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2170 | + if ($globalTransaction) { |
|
| 2171 | + $Connection->db->commit(); |
|
| 2172 | + } |
|
| 1973 | 2173 | } |
| 1974 | 2174 | return ''; |
| 1975 | 2175 | } |
@@ -1989,8 +2189,9 @@ discard block |
||
| 1989 | 2189 | } |
| 1990 | 2190 | |
| 1991 | 2191 | |
| 1992 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1993 | - else { |
|
| 2192 | + if ($globalDBdriver == 'mysql') { |
|
| 2193 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2194 | + } else { |
|
| 1994 | 2195 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 1995 | 2196 | $query = "CREATE EXTENSION postgis"; |
| 1996 | 2197 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -2009,7 +2210,9 @@ discard block |
||
| 2009 | 2210 | global $tmp_dir, $globalDebug; |
| 2010 | 2211 | include_once('class.create_db.php'); |
| 2011 | 2212 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2012 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2213 | + if ($globalDebug) { |
|
| 2214 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2215 | + } |
|
| 2013 | 2216 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
| 2014 | 2217 | $error = ''; |
| 2015 | 2218 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2019,20 +2222,34 @@ discard block |
||
| 2019 | 2222 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
| 2020 | 2223 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2021 | 2224 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2022 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2225 | + if ($globalDebug) { |
|
| 2226 | + echo "Gunzip..."; |
|
| 2227 | + } |
|
| 2023 | 2228 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
| 2024 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2229 | + if ($globalDebug) { |
|
| 2230 | + echo "Add to DB..."; |
|
| 2231 | + } |
|
| 2025 | 2232 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
| 2026 | 2233 | $NOTAM = new NOTAM(); |
| 2027 | 2234 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
| 2028 | 2235 | update_db::insert_notam_version($notam_md5); |
| 2029 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2030 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2031 | - } elseif ($globalDebug) echo "No new version."; |
|
| 2032 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2236 | + } else { |
|
| 2237 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2238 | + } |
|
| 2239 | + } else { |
|
| 2240 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2241 | + } |
|
| 2242 | + } elseif ($globalDebug) { |
|
| 2243 | + echo "No new version."; |
|
| 2244 | + } |
|
| 2245 | + } else { |
|
| 2246 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2247 | + } |
|
| 2033 | 2248 | if ($error != '') { |
| 2034 | 2249 | return $error; |
| 2035 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2250 | + } elseif ($globalDebug) { |
|
| 2251 | + echo "Done\n"; |
|
| 2252 | + } |
|
| 2036 | 2253 | return ''; |
| 2037 | 2254 | } |
| 2038 | 2255 | |
@@ -2087,68 +2304,114 @@ discard block |
||
| 2087 | 2304 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 2088 | 2305 | if (extension_loaded('zip')) { |
| 2089 | 2306 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 2090 | - if ($globalDebug) echo "Unzip..."; |
|
| 2307 | + if ($globalDebug) { |
|
| 2308 | + echo "Unzip..."; |
|
| 2309 | + } |
|
| 2091 | 2310 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 2092 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2311 | + if ($globalDebug) { |
|
| 2312 | + echo "Add to DB..."; |
|
| 2313 | + } |
|
| 2093 | 2314 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2094 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 2315 | + if ($globalDebug) { |
|
| 2316 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 2317 | + } |
|
| 2095 | 2318 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2096 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2097 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2098 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2099 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
| 2319 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 2320 | + $error = "Failed to copy airlines logo."; |
|
| 2321 | + } |
|
| 2322 | + } else { |
|
| 2323 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2324 | + } |
|
| 2325 | + } else { |
|
| 2326 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2327 | + } |
|
| 2328 | + } else { |
|
| 2329 | + $error = "ZIP module not loaded but required for IVAO."; |
|
| 2330 | + } |
|
| 2100 | 2331 | if ($error != '') { |
| 2101 | 2332 | return $error; |
| 2102 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2333 | + } elseif ($globalDebug) { |
|
| 2334 | + echo "Done\n"; |
|
| 2335 | + } |
|
| 2103 | 2336 | return ''; |
| 2104 | 2337 | } |
| 2105 | 2338 | |
| 2106 | 2339 | public static function update_routes() { |
| 2107 | 2340 | global $tmp_dir, $globalDebug; |
| 2108 | 2341 | $error = ''; |
| 2109 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 2342 | + if ($globalDebug) { |
|
| 2343 | + echo "Routes : Download..."; |
|
| 2344 | + } |
|
| 2110 | 2345 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 2111 | 2346 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2112 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2347 | + if ($globalDebug) { |
|
| 2348 | + echo "Gunzip..."; |
|
| 2349 | + } |
|
| 2113 | 2350 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 2114 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2351 | + if ($globalDebug) { |
|
| 2352 | + echo "Add to DB..."; |
|
| 2353 | + } |
|
| 2115 | 2354 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 2116 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2355 | + } else { |
|
| 2356 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2357 | + } |
|
| 2117 | 2358 | if ($error != '') { |
| 2118 | 2359 | return $error; |
| 2119 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2360 | + } elseif ($globalDebug) { |
|
| 2361 | + echo "Done\n"; |
|
| 2362 | + } |
|
| 2120 | 2363 | return ''; |
| 2121 | 2364 | } |
| 2122 | 2365 | public static function update_oneworld() { |
| 2123 | 2366 | global $tmp_dir, $globalDebug; |
| 2124 | 2367 | $error = ''; |
| 2125 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
| 2368 | + if ($globalDebug) { |
|
| 2369 | + echo "Schedules Oneworld : Download..."; |
|
| 2370 | + } |
|
| 2126 | 2371 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
| 2127 | 2372 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2128 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2373 | + if ($globalDebug) { |
|
| 2374 | + echo "Gunzip..."; |
|
| 2375 | + } |
|
| 2129 | 2376 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
| 2130 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2377 | + if ($globalDebug) { |
|
| 2378 | + echo "Add to DB..."; |
|
| 2379 | + } |
|
| 2131 | 2380 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
| 2132 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2381 | + } else { |
|
| 2382 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2383 | + } |
|
| 2133 | 2384 | if ($error != '') { |
| 2134 | 2385 | return $error; |
| 2135 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2386 | + } elseif ($globalDebug) { |
|
| 2387 | + echo "Done\n"; |
|
| 2388 | + } |
|
| 2136 | 2389 | return ''; |
| 2137 | 2390 | } |
| 2138 | 2391 | public static function update_skyteam() { |
| 2139 | 2392 | global $tmp_dir, $globalDebug; |
| 2140 | 2393 | $error = ''; |
| 2141 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
| 2394 | + if ($globalDebug) { |
|
| 2395 | + echo "Schedules Skyteam : Download..."; |
|
| 2396 | + } |
|
| 2142 | 2397 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
| 2143 | 2398 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2144 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2399 | + if ($globalDebug) { |
|
| 2400 | + echo "Gunzip..."; |
|
| 2401 | + } |
|
| 2145 | 2402 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
| 2146 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2403 | + if ($globalDebug) { |
|
| 2404 | + echo "Add to DB..."; |
|
| 2405 | + } |
|
| 2147 | 2406 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
| 2148 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2407 | + } else { |
|
| 2408 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2409 | + } |
|
| 2149 | 2410 | if ($error != '') { |
| 2150 | 2411 | return $error; |
| 2151 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2412 | + } elseif ($globalDebug) { |
|
| 2413 | + echo "Done\n"; |
|
| 2414 | + } |
|
| 2152 | 2415 | return ''; |
| 2153 | 2416 | } |
| 2154 | 2417 | public static function update_ModeS() { |
@@ -2165,340 +2428,590 @@ discard block |
||
| 2165 | 2428 | exit; |
| 2166 | 2429 | } elseif ($globalDebug) echo "Done\n"; |
| 2167 | 2430 | */ |
| 2168 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 2169 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2431 | + if ($globalDebug) { |
|
| 2432 | + echo "Modes : Download..."; |
|
| 2433 | + } |
|
| 2434 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2170 | 2435 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
| 2171 | 2436 | |
| 2172 | 2437 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2173 | 2438 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
| 2174 | - if ($globalDebug) echo "Unzip..."; |
|
| 2175 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2439 | + if ($globalDebug) { |
|
| 2440 | + echo "Unzip..."; |
|
| 2441 | + } |
|
| 2442 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2176 | 2443 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
| 2177 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2444 | + if ($globalDebug) { |
|
| 2445 | + echo "Add to DB..."; |
|
| 2446 | + } |
|
| 2178 | 2447 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 2179 | 2448 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
| 2180 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2449 | + } else { |
|
| 2450 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2451 | + } |
|
| 2181 | 2452 | if ($error != '') { |
| 2182 | 2453 | return $error; |
| 2183 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2454 | + } elseif ($globalDebug) { |
|
| 2455 | + echo "Done\n"; |
|
| 2456 | + } |
|
| 2184 | 2457 | return ''; |
| 2185 | 2458 | } |
| 2186 | 2459 | |
| 2187 | 2460 | public static function update_ModeS_faa() { |
| 2188 | 2461 | global $tmp_dir, $globalDebug; |
| 2189 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
| 2462 | + if ($globalDebug) { |
|
| 2463 | + echo "Modes FAA: Download..."; |
|
| 2464 | + } |
|
| 2190 | 2465 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
| 2191 | 2466 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2192 | - if ($globalDebug) echo "Unzip..."; |
|
| 2467 | + if ($globalDebug) { |
|
| 2468 | + echo "Unzip..."; |
|
| 2469 | + } |
|
| 2193 | 2470 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
| 2194 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2471 | + if ($globalDebug) { |
|
| 2472 | + echo "Add to DB..."; |
|
| 2473 | + } |
|
| 2195 | 2474 | $error = update_db::modes_faa(); |
| 2196 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2475 | + } else { |
|
| 2476 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2477 | + } |
|
| 2197 | 2478 | if ($error != '') { |
| 2198 | 2479 | return $error; |
| 2199 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2480 | + } elseif ($globalDebug) { |
|
| 2481 | + echo "Done\n"; |
|
| 2482 | + } |
|
| 2200 | 2483 | return ''; |
| 2201 | 2484 | } |
| 2202 | 2485 | |
| 2203 | 2486 | public static function update_ModeS_flarm() { |
| 2204 | 2487 | global $tmp_dir, $globalDebug; |
| 2205 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 2488 | + if ($globalDebug) { |
|
| 2489 | + echo "Modes Flarmnet: Download..."; |
|
| 2490 | + } |
|
| 2206 | 2491 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 2207 | 2492 | if (file_exists($tmp_dir.'data.fln')) { |
| 2208 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2493 | + if ($globalDebug) { |
|
| 2494 | + echo "Add to DB..."; |
|
| 2495 | + } |
|
| 2209 | 2496 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 2210 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2497 | + } else { |
|
| 2498 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2499 | + } |
|
| 2211 | 2500 | if ($error != '') { |
| 2212 | 2501 | return $error; |
| 2213 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2502 | + } elseif ($globalDebug) { |
|
| 2503 | + echo "Done\n"; |
|
| 2504 | + } |
|
| 2214 | 2505 | return ''; |
| 2215 | 2506 | } |
| 2216 | 2507 | |
| 2217 | 2508 | public static function update_ModeS_ogn() { |
| 2218 | 2509 | global $tmp_dir, $globalDebug; |
| 2219 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 2510 | + if ($globalDebug) { |
|
| 2511 | + echo "Modes OGN: Download..."; |
|
| 2512 | + } |
|
| 2220 | 2513 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 2221 | 2514 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2222 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2515 | + if ($globalDebug) { |
|
| 2516 | + echo "Add to DB..."; |
|
| 2517 | + } |
|
| 2223 | 2518 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 2224 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2519 | + } else { |
|
| 2520 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2521 | + } |
|
| 2225 | 2522 | if ($error != '') { |
| 2226 | 2523 | return $error; |
| 2227 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2524 | + } elseif ($globalDebug) { |
|
| 2525 | + echo "Done\n"; |
|
| 2526 | + } |
|
| 2228 | 2527 | return ''; |
| 2229 | 2528 | } |
| 2230 | 2529 | |
| 2231 | 2530 | public static function update_owner() { |
| 2232 | 2531 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2233 | 2532 | |
| 2234 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 2533 | + if ($globalDebug) { |
|
| 2534 | + echo "Owner France: Download..."; |
|
| 2535 | + } |
|
| 2235 | 2536 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 2236 | 2537 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2237 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2538 | + if ($globalDebug) { |
|
| 2539 | + echo "Add to DB..."; |
|
| 2540 | + } |
|
| 2238 | 2541 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 2239 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2542 | + } else { |
|
| 2543 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2544 | + } |
|
| 2240 | 2545 | if ($error != '') { |
| 2241 | 2546 | return $error; |
| 2242 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2547 | + } elseif ($globalDebug) { |
|
| 2548 | + echo "Done\n"; |
|
| 2549 | + } |
|
| 2243 | 2550 | |
| 2244 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 2551 | + if ($globalDebug) { |
|
| 2552 | + echo "Owner Ireland: Download..."; |
|
| 2553 | + } |
|
| 2245 | 2554 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 2246 | 2555 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2247 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2556 | + if ($globalDebug) { |
|
| 2557 | + echo "Add to DB..."; |
|
| 2558 | + } |
|
| 2248 | 2559 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 2249 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2560 | + } else { |
|
| 2561 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2562 | + } |
|
| 2250 | 2563 | if ($error != '') { |
| 2251 | 2564 | return $error; |
| 2252 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2253 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 2565 | + } elseif ($globalDebug) { |
|
| 2566 | + echo "Done\n"; |
|
| 2567 | + } |
|
| 2568 | + if ($globalDebug) { |
|
| 2569 | + echo "Owner Switzerland: Download..."; |
|
| 2570 | + } |
|
| 2254 | 2571 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 2255 | 2572 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2256 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2573 | + if ($globalDebug) { |
|
| 2574 | + echo "Add to DB..."; |
|
| 2575 | + } |
|
| 2257 | 2576 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 2258 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2577 | + } else { |
|
| 2578 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2579 | + } |
|
| 2259 | 2580 | if ($error != '') { |
| 2260 | 2581 | return $error; |
| 2261 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2262 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 2582 | + } elseif ($globalDebug) { |
|
| 2583 | + echo "Done\n"; |
|
| 2584 | + } |
|
| 2585 | + if ($globalDebug) { |
|
| 2586 | + echo "Owner Czech Republic: Download..."; |
|
| 2587 | + } |
|
| 2263 | 2588 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 2264 | 2589 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2265 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2590 | + if ($globalDebug) { |
|
| 2591 | + echo "Add to DB..."; |
|
| 2592 | + } |
|
| 2266 | 2593 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 2267 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2594 | + } else { |
|
| 2595 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2596 | + } |
|
| 2268 | 2597 | if ($error != '') { |
| 2269 | 2598 | return $error; |
| 2270 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2271 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 2599 | + } elseif ($globalDebug) { |
|
| 2600 | + echo "Done\n"; |
|
| 2601 | + } |
|
| 2602 | + if ($globalDebug) { |
|
| 2603 | + echo "Owner Australia: Download..."; |
|
| 2604 | + } |
|
| 2272 | 2605 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 2273 | 2606 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2274 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2607 | + if ($globalDebug) { |
|
| 2608 | + echo "Add to DB..."; |
|
| 2609 | + } |
|
| 2275 | 2610 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 2276 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2611 | + } else { |
|
| 2612 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2613 | + } |
|
| 2277 | 2614 | if ($error != '') { |
| 2278 | 2615 | return $error; |
| 2279 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2280 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 2616 | + } elseif ($globalDebug) { |
|
| 2617 | + echo "Done\n"; |
|
| 2618 | + } |
|
| 2619 | + if ($globalDebug) { |
|
| 2620 | + echo "Owner Austria: Download..."; |
|
| 2621 | + } |
|
| 2281 | 2622 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 2282 | 2623 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2283 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2624 | + if ($globalDebug) { |
|
| 2625 | + echo "Add to DB..."; |
|
| 2626 | + } |
|
| 2284 | 2627 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 2285 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2628 | + } else { |
|
| 2629 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2630 | + } |
|
| 2286 | 2631 | if ($error != '') { |
| 2287 | 2632 | return $error; |
| 2288 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2289 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 2633 | + } elseif ($globalDebug) { |
|
| 2634 | + echo "Done\n"; |
|
| 2635 | + } |
|
| 2636 | + if ($globalDebug) { |
|
| 2637 | + echo "Owner Chile: Download..."; |
|
| 2638 | + } |
|
| 2290 | 2639 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 2291 | 2640 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2292 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2641 | + if ($globalDebug) { |
|
| 2642 | + echo "Add to DB..."; |
|
| 2643 | + } |
|
| 2293 | 2644 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 2294 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2645 | + } else { |
|
| 2646 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2647 | + } |
|
| 2295 | 2648 | if ($error != '') { |
| 2296 | 2649 | return $error; |
| 2297 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2298 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 2650 | + } elseif ($globalDebug) { |
|
| 2651 | + echo "Done\n"; |
|
| 2652 | + } |
|
| 2653 | + if ($globalDebug) { |
|
| 2654 | + echo "Owner Colombia: Download..."; |
|
| 2655 | + } |
|
| 2299 | 2656 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 2300 | 2657 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2301 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2658 | + if ($globalDebug) { |
|
| 2659 | + echo "Add to DB..."; |
|
| 2660 | + } |
|
| 2302 | 2661 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 2303 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2662 | + } else { |
|
| 2663 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2664 | + } |
|
| 2304 | 2665 | if ($error != '') { |
| 2305 | 2666 | return $error; |
| 2306 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2307 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2667 | + } elseif ($globalDebug) { |
|
| 2668 | + echo "Done\n"; |
|
| 2669 | + } |
|
| 2670 | + if ($globalDebug) { |
|
| 2671 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2672 | + } |
|
| 2308 | 2673 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 2309 | 2674 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2310 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2675 | + if ($globalDebug) { |
|
| 2676 | + echo "Add to DB..."; |
|
| 2677 | + } |
|
| 2311 | 2678 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 2312 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2679 | + } else { |
|
| 2680 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2681 | + } |
|
| 2313 | 2682 | if ($error != '') { |
| 2314 | 2683 | return $error; |
| 2315 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2316 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 2684 | + } elseif ($globalDebug) { |
|
| 2685 | + echo "Done\n"; |
|
| 2686 | + } |
|
| 2687 | + if ($globalDebug) { |
|
| 2688 | + echo "Owner Brazil: Download..."; |
|
| 2689 | + } |
|
| 2317 | 2690 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 2318 | 2691 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2319 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2692 | + if ($globalDebug) { |
|
| 2693 | + echo "Add to DB..."; |
|
| 2694 | + } |
|
| 2320 | 2695 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 2321 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2696 | + } else { |
|
| 2697 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2698 | + } |
|
| 2322 | 2699 | if ($error != '') { |
| 2323 | 2700 | return $error; |
| 2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2325 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 2701 | + } elseif ($globalDebug) { |
|
| 2702 | + echo "Done\n"; |
|
| 2703 | + } |
|
| 2704 | + if ($globalDebug) { |
|
| 2705 | + echo "Owner Cayman Islands: Download..."; |
|
| 2706 | + } |
|
| 2326 | 2707 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 2327 | 2708 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2328 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2709 | + if ($globalDebug) { |
|
| 2710 | + echo "Add to DB..."; |
|
| 2711 | + } |
|
| 2329 | 2712 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 2330 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2713 | + } else { |
|
| 2714 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2715 | + } |
|
| 2331 | 2716 | if ($error != '') { |
| 2332 | 2717 | return $error; |
| 2333 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2334 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 2718 | + } elseif ($globalDebug) { |
|
| 2719 | + echo "Done\n"; |
|
| 2720 | + } |
|
| 2721 | + if ($globalDebug) { |
|
| 2722 | + echo "Owner Croatia: Download..."; |
|
| 2723 | + } |
|
| 2335 | 2724 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 2336 | 2725 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2337 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2726 | + if ($globalDebug) { |
|
| 2727 | + echo "Add to DB..."; |
|
| 2728 | + } |
|
| 2338 | 2729 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 2339 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2730 | + } else { |
|
| 2731 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2732 | + } |
|
| 2340 | 2733 | if ($error != '') { |
| 2341 | 2734 | return $error; |
| 2342 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2343 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 2735 | + } elseif ($globalDebug) { |
|
| 2736 | + echo "Done\n"; |
|
| 2737 | + } |
|
| 2738 | + if ($globalDebug) { |
|
| 2739 | + echo "Owner Luxembourg: Download..."; |
|
| 2740 | + } |
|
| 2344 | 2741 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 2345 | 2742 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2346 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2743 | + if ($globalDebug) { |
|
| 2744 | + echo "Add to DB..."; |
|
| 2745 | + } |
|
| 2347 | 2746 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 2348 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2747 | + } else { |
|
| 2748 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2749 | + } |
|
| 2349 | 2750 | if ($error != '') { |
| 2350 | 2751 | return $error; |
| 2351 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2352 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 2752 | + } elseif ($globalDebug) { |
|
| 2753 | + echo "Done\n"; |
|
| 2754 | + } |
|
| 2755 | + if ($globalDebug) { |
|
| 2756 | + echo "Owner Maldives: Download..."; |
|
| 2757 | + } |
|
| 2353 | 2758 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 2354 | 2759 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2355 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2760 | + if ($globalDebug) { |
|
| 2761 | + echo "Add to DB..."; |
|
| 2762 | + } |
|
| 2356 | 2763 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 2357 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2764 | + } else { |
|
| 2765 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2766 | + } |
|
| 2358 | 2767 | if ($error != '') { |
| 2359 | 2768 | return $error; |
| 2360 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2361 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 2769 | + } elseif ($globalDebug) { |
|
| 2770 | + echo "Done\n"; |
|
| 2771 | + } |
|
| 2772 | + if ($globalDebug) { |
|
| 2773 | + echo "Owner New Zealand: Download..."; |
|
| 2774 | + } |
|
| 2362 | 2775 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 2363 | 2776 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2364 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2777 | + if ($globalDebug) { |
|
| 2778 | + echo "Add to DB..."; |
|
| 2779 | + } |
|
| 2365 | 2780 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 2366 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2367 | - if ($error != '') { |
|
| 2781 | + } else { |
|
| 2782 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2783 | + } |
|
| 2784 | + if ($error != '') { |
|
| 2368 | 2785 | return $error; |
| 2369 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2370 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 2786 | + } elseif ($globalDebug) { |
|
| 2787 | + echo "Done\n"; |
|
| 2788 | + } |
|
| 2789 | + if ($globalDebug) { |
|
| 2790 | + echo "Owner Papua New Guinea: Download..."; |
|
| 2791 | + } |
|
| 2371 | 2792 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 2372 | 2793 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2373 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2794 | + if ($globalDebug) { |
|
| 2795 | + echo "Add to DB..."; |
|
| 2796 | + } |
|
| 2374 | 2797 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 2375 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2798 | + } else { |
|
| 2799 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2800 | + } |
|
| 2376 | 2801 | if ($error != '') { |
| 2377 | 2802 | return $error; |
| 2378 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2379 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 2803 | + } elseif ($globalDebug) { |
|
| 2804 | + echo "Done\n"; |
|
| 2805 | + } |
|
| 2806 | + if ($globalDebug) { |
|
| 2807 | + echo "Owner Slovakia: Download..."; |
|
| 2808 | + } |
|
| 2380 | 2809 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 2381 | 2810 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2382 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2811 | + if ($globalDebug) { |
|
| 2812 | + echo "Add to DB..."; |
|
| 2813 | + } |
|
| 2383 | 2814 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 2384 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2815 | + } else { |
|
| 2816 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2817 | + } |
|
| 2385 | 2818 | if ($error != '') { |
| 2386 | 2819 | return $error; |
| 2387 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2388 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 2820 | + } elseif ($globalDebug) { |
|
| 2821 | + echo "Done\n"; |
|
| 2822 | + } |
|
| 2823 | + if ($globalDebug) { |
|
| 2824 | + echo "Owner Ecuador: Download..."; |
|
| 2825 | + } |
|
| 2389 | 2826 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 2390 | 2827 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2391 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2828 | + if ($globalDebug) { |
|
| 2829 | + echo "Add to DB..."; |
|
| 2830 | + } |
|
| 2392 | 2831 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 2393 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2832 | + } else { |
|
| 2833 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2834 | + } |
|
| 2394 | 2835 | if ($error != '') { |
| 2395 | 2836 | return $error; |
| 2396 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2397 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 2837 | + } elseif ($globalDebug) { |
|
| 2838 | + echo "Done\n"; |
|
| 2839 | + } |
|
| 2840 | + if ($globalDebug) { |
|
| 2841 | + echo "Owner Iceland: Download..."; |
|
| 2842 | + } |
|
| 2398 | 2843 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 2399 | 2844 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2400 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2845 | + if ($globalDebug) { |
|
| 2846 | + echo "Add to DB..."; |
|
| 2847 | + } |
|
| 2401 | 2848 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 2402 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2849 | + } else { |
|
| 2850 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2851 | + } |
|
| 2403 | 2852 | if ($error != '') { |
| 2404 | 2853 | return $error; |
| 2405 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2406 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
| 2854 | + } elseif ($globalDebug) { |
|
| 2855 | + echo "Done\n"; |
|
| 2856 | + } |
|
| 2857 | + if ($globalDebug) { |
|
| 2858 | + echo "Owner Isle of Man: Download..."; |
|
| 2859 | + } |
|
| 2407 | 2860 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
| 2408 | 2861 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2409 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2862 | + if ($globalDebug) { |
|
| 2863 | + echo "Add to DB..."; |
|
| 2864 | + } |
|
| 2410 | 2865 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
| 2411 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2866 | + } else { |
|
| 2867 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2868 | + } |
|
| 2412 | 2869 | if ($error != '') { |
| 2413 | 2870 | return $error; |
| 2414 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2871 | + } elseif ($globalDebug) { |
|
| 2872 | + echo "Done\n"; |
|
| 2873 | + } |
|
| 2415 | 2874 | if ($globalMasterSource) { |
| 2416 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
| 2875 | + if ($globalDebug) { |
|
| 2876 | + echo "ModeS Netherlands: Download..."; |
|
| 2877 | + } |
|
| 2417 | 2878 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
| 2418 | 2879 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2419 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2880 | + if ($globalDebug) { |
|
| 2881 | + echo "Add to DB..."; |
|
| 2882 | + } |
|
| 2420 | 2883 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
| 2421 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2884 | + } else { |
|
| 2885 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2886 | + } |
|
| 2422 | 2887 | if ($error != '') { |
| 2423 | 2888 | return $error; |
| 2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2425 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
| 2889 | + } elseif ($globalDebug) { |
|
| 2890 | + echo "Done\n"; |
|
| 2891 | + } |
|
| 2892 | + if ($globalDebug) { |
|
| 2893 | + echo "ModeS Denmark: Download..."; |
|
| 2894 | + } |
|
| 2426 | 2895 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
| 2427 | 2896 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2428 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2897 | + if ($globalDebug) { |
|
| 2898 | + echo "Add to DB..."; |
|
| 2899 | + } |
|
| 2429 | 2900 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
| 2430 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2901 | + } else { |
|
| 2902 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2903 | + } |
|
| 2431 | 2904 | if ($error != '') { |
| 2432 | 2905 | return $error; |
| 2433 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2434 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2906 | + } elseif ($globalDebug) { |
|
| 2907 | + echo "Done\n"; |
|
| 2908 | + } |
|
| 2909 | + } elseif ($globalDebug) { |
|
| 2910 | + echo "Done\n"; |
|
| 2911 | + } |
|
| 2435 | 2912 | return ''; |
| 2436 | 2913 | } |
| 2437 | 2914 | |
| 2438 | 2915 | public static function update_translation() { |
| 2439 | 2916 | global $tmp_dir, $globalDebug; |
| 2440 | 2917 | $error = ''; |
| 2441 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 2918 | + if ($globalDebug) { |
|
| 2919 | + echo "Translation : Download..."; |
|
| 2920 | + } |
|
| 2442 | 2921 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 2443 | 2922 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2444 | - if ($globalDebug) echo "Unzip..."; |
|
| 2923 | + if ($globalDebug) { |
|
| 2924 | + echo "Unzip..."; |
|
| 2925 | + } |
|
| 2445 | 2926 | update_db::unzip($tmp_dir.'translation.zip'); |
| 2446 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2927 | + if ($globalDebug) { |
|
| 2928 | + echo "Add to DB..."; |
|
| 2929 | + } |
|
| 2447 | 2930 | $error = update_db::translation(); |
| 2448 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2931 | + } else { |
|
| 2932 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2933 | + } |
|
| 2449 | 2934 | if ($error != '') { |
| 2450 | 2935 | return $error; |
| 2451 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2936 | + } elseif ($globalDebug) { |
|
| 2937 | + echo "Done\n"; |
|
| 2938 | + } |
|
| 2452 | 2939 | return ''; |
| 2453 | 2940 | } |
| 2454 | 2941 | |
| 2455 | 2942 | public static function update_translation_fam() { |
| 2456 | 2943 | global $tmp_dir, $globalDebug; |
| 2457 | 2944 | $error = ''; |
| 2458 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 2945 | + if ($globalDebug) { |
|
| 2946 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 2947 | + } |
|
| 2459 | 2948 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 2460 | 2949 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
| 2461 | 2950 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2462 | 2951 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
| 2463 | 2952 | $translation_md5 = $translation_md5_file[0]; |
| 2464 | 2953 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2465 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2954 | + if ($globalDebug) { |
|
| 2955 | + echo "Gunzip..."; |
|
| 2956 | + } |
|
| 2466 | 2957 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 2467 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2958 | + if ($globalDebug) { |
|
| 2959 | + echo "Add to DB..."; |
|
| 2960 | + } |
|
| 2468 | 2961 | $error = update_db::translation_fam(); |
| 2469 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2470 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2962 | + } else { |
|
| 2963 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2964 | + } |
|
| 2965 | + } else { |
|
| 2966 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2967 | + } |
|
| 2471 | 2968 | if ($error != '') { |
| 2472 | 2969 | return $error; |
| 2473 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2970 | + } elseif ($globalDebug) { |
|
| 2971 | + echo "Done\n"; |
|
| 2972 | + } |
|
| 2474 | 2973 | return ''; |
| 2475 | 2974 | } |
| 2476 | 2975 | public static function update_ModeS_fam() { |
| 2477 | 2976 | global $tmp_dir, $globalDebug; |
| 2478 | 2977 | $error = ''; |
| 2479 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
| 2978 | + if ($globalDebug) { |
|
| 2979 | + echo "ModeS from FlightAirMap website : Download..."; |
|
| 2980 | + } |
|
| 2480 | 2981 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
| 2481 | 2982 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
| 2482 | 2983 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2483 | 2984 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
| 2484 | 2985 | $modes_md5 = $modes_md5_file[0]; |
| 2485 | 2986 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2486 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2987 | + if ($globalDebug) { |
|
| 2988 | + echo "Gunzip..."; |
|
| 2989 | + } |
|
| 2487 | 2990 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
| 2488 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2991 | + if ($globalDebug) { |
|
| 2992 | + echo "Add to DB..."; |
|
| 2993 | + } |
|
| 2489 | 2994 | $error = update_db::modes_fam(); |
| 2490 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2491 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2995 | + } else { |
|
| 2996 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2997 | + } |
|
| 2998 | + } else { |
|
| 2999 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3000 | + } |
|
| 2492 | 3001 | if ($error != '') { |
| 2493 | 3002 | return $error; |
| 2494 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3003 | + } elseif ($globalDebug) { |
|
| 3004 | + echo "Done\n"; |
|
| 3005 | + } |
|
| 2495 | 3006 | return ''; |
| 2496 | 3007 | } |
| 2497 | 3008 | |
| 2498 | 3009 | public static function update_airlines_fam() { |
| 2499 | 3010 | global $tmp_dir, $globalDebug; |
| 2500 | 3011 | $error = ''; |
| 2501 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
| 3012 | + if ($globalDebug) { |
|
| 3013 | + echo "Airlines from FlightAirMap website : Download..."; |
|
| 3014 | + } |
|
| 2502 | 3015 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
| 2503 | 3016 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2504 | 3017 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2507,26 +3020,42 @@ discard block |
||
| 2507 | 3020 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
| 2508 | 3021 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2509 | 3022 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2510 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3023 | + if ($globalDebug) { |
|
| 3024 | + echo "Gunzip..."; |
|
| 3025 | + } |
|
| 2511 | 3026 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
| 2512 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3027 | + if ($globalDebug) { |
|
| 3028 | + echo "Add to DB..."; |
|
| 3029 | + } |
|
| 2513 | 3030 | $error = update_db::airlines_fam(); |
| 2514 | 3031 | update_db::insert_airlines_version($airlines_md5); |
| 2515 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 2516 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2517 | - } elseif ($globalDebug) echo "No update."; |
|
| 2518 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3032 | + } else { |
|
| 3033 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 3034 | + } |
|
| 3035 | + } else { |
|
| 3036 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 3037 | + } |
|
| 3038 | + } elseif ($globalDebug) { |
|
| 3039 | + echo "No update."; |
|
| 3040 | + } |
|
| 3041 | + } else { |
|
| 3042 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3043 | + } |
|
| 2519 | 3044 | if ($error != '') { |
| 2520 | 3045 | return $error; |
| 2521 | 3046 | } else { |
| 2522 | - if ($globalDebug) echo "Done\n"; |
|
| 3047 | + if ($globalDebug) { |
|
| 3048 | + echo "Done\n"; |
|
| 3049 | + } |
|
| 2523 | 3050 | } |
| 2524 | 3051 | return ''; |
| 2525 | 3052 | } |
| 2526 | 3053 | |
| 2527 | 3054 | public static function update_owner_fam() { |
| 2528 | 3055 | global $tmp_dir, $globalDebug, $globalOwner; |
| 2529 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
| 3056 | + if ($globalDebug) { |
|
| 3057 | + echo "owner from FlightAirMap website : Download..."; |
|
| 3058 | + } |
|
| 2530 | 3059 | $error = ''; |
| 2531 | 3060 | if ($globalOwner === TRUE) { |
| 2532 | 3061 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2539,55 +3068,89 @@ discard block |
||
| 2539 | 3068 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
| 2540 | 3069 | $owners_md5 = $owners_md5_file[0]; |
| 2541 | 3070 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2542 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3071 | + if ($globalDebug) { |
|
| 3072 | + echo "Gunzip..."; |
|
| 3073 | + } |
|
| 2543 | 3074 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
| 2544 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3075 | + if ($globalDebug) { |
|
| 3076 | + echo "Add to DB..."; |
|
| 3077 | + } |
|
| 2545 | 3078 | $error = update_db::owner_fam(); |
| 2546 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 2547 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3079 | + } else { |
|
| 3080 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 3081 | + } |
|
| 3082 | + } else { |
|
| 3083 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3084 | + } |
|
| 2548 | 3085 | if ($error != '') { |
| 2549 | 3086 | return $error; |
| 2550 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3087 | + } elseif ($globalDebug) { |
|
| 3088 | + echo "Done\n"; |
|
| 3089 | + } |
|
| 2551 | 3090 | return ''; |
| 2552 | 3091 | } |
| 2553 | 3092 | public static function update_routes_fam() { |
| 2554 | 3093 | global $tmp_dir, $globalDebug; |
| 2555 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
| 3094 | + if ($globalDebug) { |
|
| 3095 | + echo "Routes from FlightAirMap website : Download..."; |
|
| 3096 | + } |
|
| 2556 | 3097 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
| 2557 | 3098 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
| 2558 | 3099 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2559 | 3100 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
| 2560 | 3101 | $routes_md5 = $routes_md5_file[0]; |
| 2561 | 3102 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2562 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3103 | + if ($globalDebug) { |
|
| 3104 | + echo "Gunzip..."; |
|
| 3105 | + } |
|
| 2563 | 3106 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
| 2564 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3107 | + if ($globalDebug) { |
|
| 3108 | + echo "Add to DB..."; |
|
| 3109 | + } |
|
| 2565 | 3110 | $error = update_db::routes_fam(); |
| 2566 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 2567 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3111 | + } else { |
|
| 3112 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 3113 | + } |
|
| 3114 | + } else { |
|
| 3115 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3116 | + } |
|
| 2568 | 3117 | if ($error != '') { |
| 2569 | 3118 | return $error; |
| 2570 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3119 | + } elseif ($globalDebug) { |
|
| 3120 | + echo "Done\n"; |
|
| 3121 | + } |
|
| 2571 | 3122 | return ''; |
| 2572 | 3123 | } |
| 2573 | 3124 | public static function update_block_fam() { |
| 2574 | 3125 | global $tmp_dir, $globalDebug; |
| 2575 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3126 | + if ($globalDebug) { |
|
| 3127 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3128 | + } |
|
| 2576 | 3129 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
| 2577 | 3130 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
| 2578 | 3131 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2579 | 3132 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
| 2580 | 3133 | $block_md5 = $block_md5_file[0]; |
| 2581 | 3134 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2582 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3135 | + if ($globalDebug) { |
|
| 3136 | + echo "Gunzip..."; |
|
| 3137 | + } |
|
| 2583 | 3138 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
| 2584 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3139 | + if ($globalDebug) { |
|
| 3140 | + echo "Add to DB..."; |
|
| 3141 | + } |
|
| 2585 | 3142 | $error = update_db::block_fam(); |
| 2586 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 2587 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3143 | + } else { |
|
| 3144 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 3145 | + } |
|
| 3146 | + } else { |
|
| 3147 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3148 | + } |
|
| 2588 | 3149 | if ($error != '') { |
| 2589 | 3150 | return $error; |
| 2590 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3151 | + } elseif ($globalDebug) { |
|
| 3152 | + echo "Done\n"; |
|
| 3153 | + } |
|
| 2591 | 3154 | return ''; |
| 2592 | 3155 | } |
| 2593 | 3156 | public static function update_marine_identity_fam() { |
@@ -2597,21 +3160,33 @@ discard block |
||
| 2597 | 3160 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
| 2598 | 3161 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2599 | 3162 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2600 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3163 | + if ($globalDebug) { |
|
| 3164 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3165 | + } |
|
| 2601 | 3166 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
| 2602 | 3167 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2603 | 3168 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2604 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3169 | + if ($globalDebug) { |
|
| 3170 | + echo "Gunzip..."; |
|
| 3171 | + } |
|
| 2605 | 3172 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
| 2606 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3173 | + if ($globalDebug) { |
|
| 3174 | + echo "Add to DB..."; |
|
| 3175 | + } |
|
| 2607 | 3176 | $error = update_db::marine_identity_fam(); |
| 2608 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 2609 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3177 | + } else { |
|
| 3178 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 3179 | + } |
|
| 3180 | + } else { |
|
| 3181 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3182 | + } |
|
| 2610 | 3183 | if ($error != '') { |
| 2611 | 3184 | return $error; |
| 2612 | 3185 | } else { |
| 2613 | 3186 | update_db::insert_marine_identity_version($marine_identity_md5); |
| 2614 | - if ($globalDebug) echo "Done\n"; |
|
| 3187 | + if ($globalDebug) { |
|
| 3188 | + echo "Done\n"; |
|
| 3189 | + } |
|
| 2615 | 3190 | } |
| 2616 | 3191 | } |
| 2617 | 3192 | } |
@@ -2625,21 +3200,33 @@ discard block |
||
| 2625 | 3200 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
| 2626 | 3201 | $satellite_md5 = $satellite_md5_file[0]; |
| 2627 | 3202 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2628 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
| 3203 | + if ($globalDebug) { |
|
| 3204 | + echo "Satellite from FlightAirMap website : Download..."; |
|
| 3205 | + } |
|
| 2629 | 3206 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
| 2630 | 3207 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2631 | 3208 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2632 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3209 | + if ($globalDebug) { |
|
| 3210 | + echo "Gunzip..."; |
|
| 3211 | + } |
|
| 2633 | 3212 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
| 2634 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3213 | + if ($globalDebug) { |
|
| 3214 | + echo "Add to DB..."; |
|
| 3215 | + } |
|
| 2635 | 3216 | $error = update_db::satellite_fam(); |
| 2636 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 2637 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3217 | + } else { |
|
| 3218 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 3219 | + } |
|
| 3220 | + } else { |
|
| 3221 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3222 | + } |
|
| 2638 | 3223 | if ($error != '') { |
| 2639 | 3224 | return $error; |
| 2640 | 3225 | } else { |
| 2641 | 3226 | update_db::insert_satellite_version($satellite_md5); |
| 2642 | - if ($globalDebug) echo "Done\n"; |
|
| 3227 | + if ($globalDebug) { |
|
| 3228 | + echo "Done\n"; |
|
| 3229 | + } |
|
| 2643 | 3230 | } |
| 2644 | 3231 | } |
| 2645 | 3232 | } |
@@ -2647,17 +3234,25 @@ discard block |
||
| 2647 | 3234 | } |
| 2648 | 3235 | public static function update_banned_fam() { |
| 2649 | 3236 | global $tmp_dir, $globalDebug; |
| 2650 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3237 | + if ($globalDebug) { |
|
| 3238 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3239 | + } |
|
| 2651 | 3240 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
| 2652 | 3241 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2653 | 3242 | //if ($globalDebug) echo "Gunzip..."; |
| 2654 | 3243 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
| 2655 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3244 | + if ($globalDebug) { |
|
| 3245 | + echo "Add to DB..."; |
|
| 3246 | + } |
|
| 2656 | 3247 | $error = update_db::banned_fam(); |
| 2657 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3248 | + } else { |
|
| 3249 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3250 | + } |
|
| 2658 | 3251 | if ($error != '') { |
| 2659 | 3252 | return $error; |
| 2660 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3253 | + } elseif ($globalDebug) { |
|
| 3254 | + echo "Done\n"; |
|
| 3255 | + } |
|
| 2661 | 3256 | return ''; |
| 2662 | 3257 | } |
| 2663 | 3258 | |
@@ -2665,7 +3260,9 @@ discard block |
||
| 2665 | 3260 | global $tmp_dir, $globalDebug, $globalDBdriver; |
| 2666 | 3261 | include_once('class.create_db.php'); |
| 2667 | 3262 | $error = ''; |
| 2668 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
| 3263 | + if ($globalDebug) { |
|
| 3264 | + echo "Airspace from FlightAirMap website : Download..."; |
|
| 3265 | + } |
|
| 2669 | 3266 | if ($globalDBdriver == 'mysql') { |
| 2670 | 3267 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
| 2671 | 3268 | } else { |
@@ -2682,9 +3279,13 @@ discard block |
||
| 2682 | 3279 | } |
| 2683 | 3280 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2684 | 3281 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
| 2685 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3282 | + if ($globalDebug) { |
|
| 3283 | + echo "Gunzip..."; |
|
| 3284 | + } |
|
| 2686 | 3285 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
| 2687 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3286 | + if ($globalDebug) { |
|
| 3287 | + echo "Add to DB..."; |
|
| 3288 | + } |
|
| 2688 | 3289 | $Connection = new Connection(); |
| 2689 | 3290 | if ($Connection->tableExists('airspace')) { |
| 2690 | 3291 | $query = 'DROP TABLE airspace'; |
@@ -2697,20 +3298,30 @@ discard block |
||
| 2697 | 3298 | } |
| 2698 | 3299 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 2699 | 3300 | update_db::insert_airspace_version($airspace_md5); |
| 2700 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 2701 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3301 | + } else { |
|
| 3302 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 3303 | + } |
|
| 3304 | + } else { |
|
| 3305 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3306 | + } |
|
| 2702 | 3307 | } |
| 2703 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3308 | + } else { |
|
| 3309 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3310 | + } |
|
| 2704 | 3311 | if ($error != '') { |
| 2705 | 3312 | return $error; |
| 2706 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3313 | + } elseif ($globalDebug) { |
|
| 3314 | + echo "Done\n"; |
|
| 3315 | + } |
|
| 2707 | 3316 | return ''; |
| 2708 | 3317 | } |
| 2709 | 3318 | |
| 2710 | 3319 | public static function update_geoid_fam() { |
| 2711 | 3320 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2712 | 3321 | $error = ''; |
| 2713 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
| 3322 | + if ($globalDebug) { |
|
| 3323 | + echo "Geoid from FlightAirMap website : Download..."; |
|
| 3324 | + } |
|
| 2714 | 3325 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
| 2715 | 3326 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2716 | 3327 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2719,80 +3330,126 @@ discard block |
||
| 2719 | 3330 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
| 2720 | 3331 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2721 | 3332 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2722 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3333 | + if ($globalDebug) { |
|
| 3334 | + echo "Gunzip..."; |
|
| 3335 | + } |
|
| 2723 | 3336 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
| 2724 | 3337 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2725 | 3338 | update_db::insert_geoid_version($geoid_md5); |
| 2726 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 2727 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 2728 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 2729 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
| 2730 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3339 | + } else { |
|
| 3340 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 3341 | + } |
|
| 3342 | + } else { |
|
| 3343 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 3344 | + } |
|
| 3345 | + } else { |
|
| 3346 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 3347 | + } |
|
| 3348 | + } elseif ($globalDebug) { |
|
| 3349 | + echo 'No new version'."\n"; |
|
| 3350 | + } |
|
| 3351 | + } else { |
|
| 3352 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3353 | + } |
|
| 2731 | 3354 | if ($error != '') { |
| 2732 | 3355 | return $error; |
| 2733 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3356 | + } elseif ($globalDebug) { |
|
| 3357 | + echo "Done\n"; |
|
| 3358 | + } |
|
| 2734 | 3359 | return ''; |
| 2735 | 3360 | } |
| 2736 | 3361 | |
| 2737 | 3362 | public static function update_tle() { |
| 2738 | 3363 | global $tmp_dir, $globalDebug; |
| 2739 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
| 3364 | + if ($globalDebug) { |
|
| 3365 | + echo "Download TLE : Download..."; |
|
| 3366 | + } |
|
| 2740 | 3367 | $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
| 2741 | 3368 | 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
| 2742 | 3369 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
| 2743 | 3370 | foreach ($alltle as $filename) { |
| 2744 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
| 3371 | + if ($globalDebug) { |
|
| 3372 | + echo "downloading ".$filename.'...'; |
|
| 3373 | + } |
|
| 2745 | 3374 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
| 2746 | 3375 | if (file_exists($tmp_dir.$filename)) { |
| 2747 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
| 3376 | + if ($globalDebug) { |
|
| 3377 | + echo "Add to DB ".$filename."..."; |
|
| 3378 | + } |
|
| 2748 | 3379 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
| 2749 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3380 | + } else { |
|
| 3381 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3382 | + } |
|
| 2750 | 3383 | if ($error != '') { |
| 2751 | 3384 | echo $error."\n"; |
| 2752 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3385 | + } elseif ($globalDebug) { |
|
| 3386 | + echo "Done\n"; |
|
| 3387 | + } |
|
| 2753 | 3388 | } |
| 2754 | 3389 | return ''; |
| 2755 | 3390 | } |
| 2756 | 3391 | |
| 2757 | 3392 | public static function update_ucsdb() { |
| 2758 | 3393 | global $tmp_dir, $globalDebug; |
| 2759 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
| 3394 | + if ($globalDebug) { |
|
| 3395 | + echo "Download UCS DB : Download..."; |
|
| 3396 | + } |
|
| 2760 | 3397 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
| 2761 | 3398 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2762 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3399 | + if ($globalDebug) { |
|
| 3400 | + echo "Add to DB..."; |
|
| 3401 | + } |
|
| 2763 | 3402 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
| 2764 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3403 | + } else { |
|
| 3404 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3405 | + } |
|
| 2765 | 3406 | if ($error != '') { |
| 2766 | 3407 | echo $error."\n"; |
| 2767 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3408 | + } elseif ($globalDebug) { |
|
| 3409 | + echo "Done\n"; |
|
| 3410 | + } |
|
| 2768 | 3411 | return ''; |
| 2769 | 3412 | } |
| 2770 | 3413 | |
| 2771 | 3414 | public static function update_celestrak() { |
| 2772 | 3415 | global $tmp_dir, $globalDebug; |
| 2773 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
| 3416 | + if ($globalDebug) { |
|
| 3417 | + echo "Download Celestrak DB : Download..."; |
|
| 3418 | + } |
|
| 2774 | 3419 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
| 2775 | 3420 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2776 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3421 | + if ($globalDebug) { |
|
| 3422 | + echo "Add to DB..."; |
|
| 3423 | + } |
|
| 2777 | 3424 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
| 2778 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3425 | + } else { |
|
| 3426 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3427 | + } |
|
| 2779 | 3428 | if ($error != '') { |
| 2780 | 3429 | echo $error."\n"; |
| 2781 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3430 | + } elseif ($globalDebug) { |
|
| 3431 | + echo "Done\n"; |
|
| 3432 | + } |
|
| 2782 | 3433 | return ''; |
| 2783 | 3434 | } |
| 2784 | 3435 | |
| 2785 | 3436 | public static function update_models() { |
| 2786 | 3437 | global $tmp_dir, $globalDebug; |
| 2787 | 3438 | $error = ''; |
| 2788 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3439 | + if ($globalDebug) { |
|
| 3440 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3441 | + } |
|
| 2789 | 3442 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2790 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3443 | + if ($globalDebug) { |
|
| 3444 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3445 | + } |
|
| 2791 | 3446 | return ''; |
| 2792 | 3447 | } |
| 2793 | 3448 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
| 2794 | 3449 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2795 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3450 | + if ($globalDebug) { |
|
| 3451 | + echo "Check files...\n"; |
|
| 3452 | + } |
|
| 2796 | 3453 | $newmodelsdb = array(); |
| 2797 | 3454 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
| 2798 | 3455 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2811,18 +3468,28 @@ discard block |
||
| 2811 | 3468 | } |
| 2812 | 3469 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2813 | 3470 | foreach ($diff as $key => $value) { |
| 2814 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3471 | + if ($globalDebug) { |
|
| 3472 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3473 | + } |
|
| 2815 | 3474 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
| 2816 | 3475 | } |
| 2817 | 3476 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
| 2818 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3477 | + } else { |
|
| 3478 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3479 | + } |
|
| 2819 | 3480 | if ($error != '') { |
| 2820 | 3481 | return $error; |
| 2821 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2822 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3482 | + } elseif ($globalDebug) { |
|
| 3483 | + echo "Done\n"; |
|
| 3484 | + } |
|
| 3485 | + if ($globalDebug) { |
|
| 3486 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3487 | + } |
|
| 2823 | 3488 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
| 2824 | 3489 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2825 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3490 | + if ($globalDebug) { |
|
| 3491 | + echo "Check files...\n"; |
|
| 3492 | + } |
|
| 2826 | 3493 | $newmodelsdb = array(); |
| 2827 | 3494 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
| 2828 | 3495 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2841,29 +3508,43 @@ discard block |
||
| 2841 | 3508 | } |
| 2842 | 3509 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2843 | 3510 | foreach ($diff as $key => $value) { |
| 2844 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3511 | + if ($globalDebug) { |
|
| 3512 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3513 | + } |
|
| 2845 | 3514 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
| 2846 | 3515 | |
| 2847 | 3516 | } |
| 2848 | 3517 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
| 2849 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3518 | + } else { |
|
| 3519 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3520 | + } |
|
| 2850 | 3521 | if ($error != '') { |
| 2851 | 3522 | return $error; |
| 2852 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3523 | + } elseif ($globalDebug) { |
|
| 3524 | + echo "Done\n"; |
|
| 3525 | + } |
|
| 2853 | 3526 | return ''; |
| 2854 | 3527 | } |
| 2855 | 3528 | public static function update_weather_models() { |
| 2856 | 3529 | global $tmp_dir, $globalDebug; |
| 2857 | 3530 | $error = ''; |
| 2858 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3531 | + if ($globalDebug) { |
|
| 3532 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3533 | + } |
|
| 2859 | 3534 | if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) { |
| 2860 | - if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3535 | + if ($globalDebug) { |
|
| 3536 | + echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3537 | + } |
|
| 2861 | 3538 | return ''; |
| 2862 | 3539 | } |
| 2863 | - if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3540 | + if ($globalDebug) { |
|
| 3541 | + echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3542 | + } |
|
| 2864 | 3543 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
| 2865 | 3544 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
| 2866 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3545 | + if ($globalDebug) { |
|
| 3546 | + echo "Check files...\n"; |
|
| 3547 | + } |
|
| 2867 | 3548 | $newmodelsdb = array(); |
| 2868 | 3549 | if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
| 2869 | 3550 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2882,25 +3563,35 @@ discard block |
||
| 2882 | 3563 | } |
| 2883 | 3564 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2884 | 3565 | foreach ($diff as $key => $value) { |
| 2885 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3566 | + if ($globalDebug) { |
|
| 3567 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3568 | + } |
|
| 2886 | 3569 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
| 2887 | 3570 | |
| 2888 | 3571 | } |
| 2889 | 3572 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
| 2890 | - } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3573 | + } else { |
|
| 3574 | + $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3575 | + } |
|
| 2891 | 3576 | if ($error != '') { |
| 2892 | 3577 | return $error; |
| 2893 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3578 | + } elseif ($globalDebug) { |
|
| 3579 | + echo "Done\n"; |
|
| 3580 | + } |
|
| 2894 | 3581 | return ''; |
| 2895 | 3582 | } |
| 2896 | 3583 | |
| 2897 | 3584 | public static function update_liveries() { |
| 2898 | 3585 | global $tmp_dir, $globalDebug; |
| 2899 | 3586 | $error = ''; |
| 2900 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
| 3587 | + if ($globalDebug) { |
|
| 3588 | + echo "Liveries from FlightAirMap website : Download..."; |
|
| 3589 | + } |
|
| 2901 | 3590 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
| 2902 | 3591 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2903 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3592 | + if ($globalDebug) { |
|
| 3593 | + echo "Check files...\n"; |
|
| 3594 | + } |
|
| 2904 | 3595 | $newmodelsdb = array(); |
| 2905 | 3596 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
| 2906 | 3597 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2919,15 +3610,21 @@ discard block |
||
| 2919 | 3610 | } |
| 2920 | 3611 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2921 | 3612 | foreach ($diff as $key => $value) { |
| 2922 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3613 | + if ($globalDebug) { |
|
| 3614 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3615 | + } |
|
| 2923 | 3616 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
| 2924 | 3617 | |
| 2925 | 3618 | } |
| 2926 | 3619 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
| 2927 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3620 | + } else { |
|
| 3621 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3622 | + } |
|
| 2928 | 3623 | if ($error != '') { |
| 2929 | 3624 | return $error; |
| 2930 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3625 | + } elseif ($globalDebug) { |
|
| 3626 | + echo "Done\n"; |
|
| 3627 | + } |
|
| 2931 | 3628 | return ''; |
| 2932 | 3629 | } |
| 2933 | 3630 | |
@@ -2935,13 +3632,19 @@ discard block |
||
| 2935 | 3632 | global $tmp_dir, $globalDebug; |
| 2936 | 3633 | $error = ''; |
| 2937 | 3634 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2938 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3635 | + if ($globalDebug) { |
|
| 3636 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3637 | + } |
|
| 2939 | 3638 | return ''; |
| 2940 | 3639 | } |
| 2941 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
| 3640 | + if ($globalDebug) { |
|
| 3641 | + echo "Space models from FlightAirMap website : Download..."; |
|
| 3642 | + } |
|
| 2942 | 3643 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
| 2943 | 3644 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2944 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3645 | + if ($globalDebug) { |
|
| 3646 | + echo "Check files...\n"; |
|
| 3647 | + } |
|
| 2945 | 3648 | $newmodelsdb = array(); |
| 2946 | 3649 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
| 2947 | 3650 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2960,15 +3663,21 @@ discard block |
||
| 2960 | 3663 | } |
| 2961 | 3664 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2962 | 3665 | foreach ($diff as $key => $value) { |
| 2963 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3666 | + if ($globalDebug) { |
|
| 3667 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3668 | + } |
|
| 2964 | 3669 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
| 2965 | 3670 | |
| 2966 | 3671 | } |
| 2967 | 3672 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
| 2968 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3673 | + } else { |
|
| 3674 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3675 | + } |
|
| 2969 | 3676 | if ($error != '') { |
| 2970 | 3677 | return $error; |
| 2971 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3678 | + } elseif ($globalDebug) { |
|
| 3679 | + echo "Done\n"; |
|
| 3680 | + } |
|
| 2972 | 3681 | return ''; |
| 2973 | 3682 | } |
| 2974 | 3683 | |
@@ -2976,13 +3685,19 @@ discard block |
||
| 2976 | 3685 | global $tmp_dir, $globalDebug; |
| 2977 | 3686 | $error = ''; |
| 2978 | 3687 | if (!is_writable(dirname(__FILE__).'/../models/vehicules')) { |
| 2979 | - if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3688 | + if ($globalDebug) { |
|
| 3689 | + echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3690 | + } |
|
| 2980 | 3691 | return ''; |
| 2981 | 3692 | } |
| 2982 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3693 | + if ($globalDebug) { |
|
| 3694 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3695 | + } |
|
| 2983 | 3696 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
| 2984 | 3697 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2985 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3698 | + if ($globalDebug) { |
|
| 3699 | + echo "Check files...\n"; |
|
| 3700 | + } |
|
| 2986 | 3701 | $newmodelsdb = array(); |
| 2987 | 3702 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
| 2988 | 3703 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -3001,15 +3716,21 @@ discard block |
||
| 3001 | 3716 | } |
| 3002 | 3717 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 3003 | 3718 | foreach ($diff as $key => $value) { |
| 3004 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3719 | + if ($globalDebug) { |
|
| 3720 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3721 | + } |
|
| 3005 | 3722 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
| 3006 | 3723 | |
| 3007 | 3724 | } |
| 3008 | 3725 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
| 3009 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3726 | + } else { |
|
| 3727 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3728 | + } |
|
| 3010 | 3729 | if ($error != '') { |
| 3011 | 3730 | return $error; |
| 3012 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3731 | + } elseif ($globalDebug) { |
|
| 3732 | + echo "Done\n"; |
|
| 3733 | + } |
|
| 3013 | 3734 | return ''; |
| 3014 | 3735 | } |
| 3015 | 3736 | |
@@ -3082,7 +3803,9 @@ discard block |
||
| 3082 | 3803 | } |
| 3083 | 3804 | |
| 3084 | 3805 | $error = ''; |
| 3085 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 3806 | + if ($globalDebug) { |
|
| 3807 | + echo "Notam : Download..."; |
|
| 3808 | + } |
|
| 3086 | 3809 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 3087 | 3810 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3088 | 3811 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3097,14 +3820,30 @@ discard block |
||
| 3097 | 3820 | $data['fir'] = $q[0]; |
| 3098 | 3821 | $data['code'] = $q[1]; |
| 3099 | 3822 | $ifrvfr = $q[2]; |
| 3100 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 3101 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 3102 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 3103 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 3104 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 3105 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 3106 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 3107 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 3823 | + if ($ifrvfr == 'IV') { |
|
| 3824 | + $data['rules'] = 'IFR/VFR'; |
|
| 3825 | + } |
|
| 3826 | + if ($ifrvfr == 'I') { |
|
| 3827 | + $data['rules'] = 'IFR'; |
|
| 3828 | + } |
|
| 3829 | + if ($ifrvfr == 'V') { |
|
| 3830 | + $data['rules'] = 'VFR'; |
|
| 3831 | + } |
|
| 3832 | + if ($q[4] == 'A') { |
|
| 3833 | + $data['scope'] = 'Airport warning'; |
|
| 3834 | + } |
|
| 3835 | + if ($q[4] == 'E') { |
|
| 3836 | + $data['scope'] = 'Enroute warning'; |
|
| 3837 | + } |
|
| 3838 | + if ($q[4] == 'W') { |
|
| 3839 | + $data['scope'] = 'Navigation warning'; |
|
| 3840 | + } |
|
| 3841 | + if ($q[4] == 'AE') { |
|
| 3842 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 3843 | + } |
|
| 3844 | + if ($q[4] == 'AW') { |
|
| 3845 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 3846 | + } |
|
| 3108 | 3847 | //$data['scope'] = $q[4]; |
| 3109 | 3848 | $data['lower_limit'] = $q[5]; |
| 3110 | 3849 | $data['upper_limit'] = $q[6]; |
@@ -3112,8 +3851,12 @@ discard block |
||
| 3112 | 3851 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 3113 | 3852 | $latitude = $Common->convertDec($las,'latitude'); |
| 3114 | 3853 | $longitude = $Common->convertDec($lns,'longitude'); |
| 3115 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 3116 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 3854 | + if ($lac == 'S') { |
|
| 3855 | + $latitude = '-'.$latitude; |
|
| 3856 | + } |
|
| 3857 | + if ($lnc == 'W') { |
|
| 3858 | + $longitude = '-'.$longitude; |
|
| 3859 | + } |
|
| 3117 | 3860 | $data['center_latitude'] = $latitude; |
| 3118 | 3861 | $data['center_longitude'] = $longitude; |
| 3119 | 3862 | $data['radius'] = intval($radius); |
@@ -3143,10 +3886,14 @@ discard block |
||
| 3143 | 3886 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
| 3144 | 3887 | unset($data); |
| 3145 | 3888 | } |
| 3146 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3889 | + } else { |
|
| 3890 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3891 | + } |
|
| 3147 | 3892 | if ($error != '') { |
| 3148 | 3893 | return $error; |
| 3149 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3894 | + } elseif ($globalDebug) { |
|
| 3895 | + echo "Done\n"; |
|
| 3896 | + } |
|
| 3150 | 3897 | return ''; |
| 3151 | 3898 | } |
| 3152 | 3899 | |
@@ -3171,7 +3918,9 @@ discard block |
||
| 3171 | 3918 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3172 | 3919 | $airspace_json = json_decode($airspace_lst,true); |
| 3173 | 3920 | foreach ($airspace_json['records'] as $airspace) { |
| 3174 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
| 3921 | + if ($globalDebug) { |
|
| 3922 | + echo $airspace['name']."...\n"; |
|
| 3923 | + } |
|
| 3175 | 3924 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
| 3176 | 3925 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3177 | 3926 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3215,8 +3964,11 @@ discard block |
||
| 3215 | 3964 | return "error : ".$e->getMessage(); |
| 3216 | 3965 | } |
| 3217 | 3966 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3218 | - if ($row['nb'] > 0) return false; |
|
| 3219 | - else return true; |
|
| 3967 | + if ($row['nb'] > 0) { |
|
| 3968 | + return false; |
|
| 3969 | + } else { |
|
| 3970 | + return true; |
|
| 3971 | + } |
|
| 3220 | 3972 | } |
| 3221 | 3973 | |
| 3222 | 3974 | public static function insert_last_update() { |
@@ -3241,8 +3993,11 @@ discard block |
||
| 3241 | 3993 | return "error : ".$e->getMessage(); |
| 3242 | 3994 | } |
| 3243 | 3995 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3244 | - if ($row['nb'] > 0) return true; |
|
| 3245 | - else return false; |
|
| 3996 | + if ($row['nb'] > 0) { |
|
| 3997 | + return true; |
|
| 3998 | + } else { |
|
| 3999 | + return false; |
|
| 4000 | + } |
|
| 3246 | 4001 | } |
| 3247 | 4002 | |
| 3248 | 4003 | public static function check_geoid_version($version) { |
@@ -3255,8 +4010,11 @@ discard block |
||
| 3255 | 4010 | return "error : ".$e->getMessage(); |
| 3256 | 4011 | } |
| 3257 | 4012 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3258 | - if ($row['nb'] > 0) return true; |
|
| 3259 | - else return false; |
|
| 4013 | + if ($row['nb'] > 0) { |
|
| 4014 | + return true; |
|
| 4015 | + } else { |
|
| 4016 | + return false; |
|
| 4017 | + } |
|
| 3260 | 4018 | } |
| 3261 | 4019 | |
| 3262 | 4020 | public static function check_marine_identity_version($version) { |
@@ -3269,8 +4027,11 @@ discard block |
||
| 3269 | 4027 | return "error : ".$e->getMessage(); |
| 3270 | 4028 | } |
| 3271 | 4029 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3272 | - if ($row['nb'] > 0) return true; |
|
| 3273 | - else return false; |
|
| 4030 | + if ($row['nb'] > 0) { |
|
| 4031 | + return true; |
|
| 4032 | + } else { |
|
| 4033 | + return false; |
|
| 4034 | + } |
|
| 3274 | 4035 | } |
| 3275 | 4036 | |
| 3276 | 4037 | public static function check_satellite_version($version) { |
@@ -3283,8 +4044,11 @@ discard block |
||
| 3283 | 4044 | return "error : ".$e->getMessage(); |
| 3284 | 4045 | } |
| 3285 | 4046 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3286 | - if ($row['nb'] > 0) return true; |
|
| 3287 | - else return false; |
|
| 4047 | + if ($row['nb'] > 0) { |
|
| 4048 | + return true; |
|
| 4049 | + } else { |
|
| 4050 | + return false; |
|
| 4051 | + } |
|
| 3288 | 4052 | } |
| 3289 | 4053 | |
| 3290 | 4054 | public static function check_airlines_version($version) { |
@@ -3297,8 +4061,11 @@ discard block |
||
| 3297 | 4061 | return "error : ".$e->getMessage(); |
| 3298 | 4062 | } |
| 3299 | 4063 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3300 | - if ($row['nb'] > 0) return true; |
|
| 3301 | - else return false; |
|
| 4064 | + if ($row['nb'] > 0) { |
|
| 4065 | + return true; |
|
| 4066 | + } else { |
|
| 4067 | + return false; |
|
| 4068 | + } |
|
| 3302 | 4069 | } |
| 3303 | 4070 | |
| 3304 | 4071 | public static function check_notam_version($version) { |
@@ -3311,8 +4078,11 @@ discard block |
||
| 3311 | 4078 | return "error : ".$e->getMessage(); |
| 3312 | 4079 | } |
| 3313 | 4080 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3314 | - if ($row['nb'] > 0) return true; |
|
| 3315 | - else return false; |
|
| 4081 | + if ($row['nb'] > 0) { |
|
| 4082 | + return true; |
|
| 4083 | + } else { |
|
| 4084 | + return false; |
|
| 4085 | + } |
|
| 3316 | 4086 | } |
| 3317 | 4087 | |
| 3318 | 4088 | public static function insert_airlines_version($version) { |
@@ -3402,8 +4172,11 @@ discard block |
||
| 3402 | 4172 | return "error : ".$e->getMessage(); |
| 3403 | 4173 | } |
| 3404 | 4174 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3405 | - if ($row['nb'] > 0) return false; |
|
| 3406 | - else return true; |
|
| 4175 | + if ($row['nb'] > 0) { |
|
| 4176 | + return false; |
|
| 4177 | + } else { |
|
| 4178 | + return true; |
|
| 4179 | + } |
|
| 3407 | 4180 | } |
| 3408 | 4181 | |
| 3409 | 4182 | public static function insert_last_notam_update() { |
@@ -3433,8 +4206,11 @@ discard block |
||
| 3433 | 4206 | return "error : ".$e->getMessage(); |
| 3434 | 4207 | } |
| 3435 | 4208 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3436 | - if ($row['nb'] > 0) return false; |
|
| 3437 | - else return true; |
|
| 4209 | + if ($row['nb'] > 0) { |
|
| 4210 | + return false; |
|
| 4211 | + } else { |
|
| 4212 | + return true; |
|
| 4213 | + } |
|
| 3438 | 4214 | } |
| 3439 | 4215 | |
| 3440 | 4216 | public static function insert_last_airspace_update() { |
@@ -3464,8 +4240,11 @@ discard block |
||
| 3464 | 4240 | return "error : ".$e->getMessage(); |
| 3465 | 4241 | } |
| 3466 | 4242 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3467 | - if ($row['nb'] > 0) return false; |
|
| 3468 | - else return true; |
|
| 4243 | + if ($row['nb'] > 0) { |
|
| 4244 | + return false; |
|
| 4245 | + } else { |
|
| 4246 | + return true; |
|
| 4247 | + } |
|
| 3469 | 4248 | } |
| 3470 | 4249 | |
| 3471 | 4250 | public static function insert_last_geoid_update() { |
@@ -3495,8 +4274,11 @@ discard block |
||
| 3495 | 4274 | return "error : ".$e->getMessage(); |
| 3496 | 4275 | } |
| 3497 | 4276 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3498 | - if ($row['nb'] > 0) return false; |
|
| 3499 | - else return true; |
|
| 4277 | + if ($row['nb'] > 0) { |
|
| 4278 | + return false; |
|
| 4279 | + } else { |
|
| 4280 | + return true; |
|
| 4281 | + } |
|
| 3500 | 4282 | } |
| 3501 | 4283 | |
| 3502 | 4284 | public static function insert_last_owner_update() { |
@@ -3526,8 +4308,11 @@ discard block |
||
| 3526 | 4308 | return "error : ".$e->getMessage(); |
| 3527 | 4309 | } |
| 3528 | 4310 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3529 | - if ($row['nb'] > 0) return false; |
|
| 3530 | - else return true; |
|
| 4311 | + if ($row['nb'] > 0) { |
|
| 4312 | + return false; |
|
| 4313 | + } else { |
|
| 4314 | + return true; |
|
| 4315 | + } |
|
| 3531 | 4316 | } |
| 3532 | 4317 | |
| 3533 | 4318 | public static function insert_last_fires_update() { |
@@ -3557,8 +4342,11 @@ discard block |
||
| 3557 | 4342 | return "error : ".$e->getMessage(); |
| 3558 | 4343 | } |
| 3559 | 4344 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3560 | - if ($row['nb'] > 0) return false; |
|
| 3561 | - else return true; |
|
| 4345 | + if ($row['nb'] > 0) { |
|
| 4346 | + return false; |
|
| 4347 | + } else { |
|
| 4348 | + return true; |
|
| 4349 | + } |
|
| 3562 | 4350 | } |
| 3563 | 4351 | |
| 3564 | 4352 | public static function insert_last_airlines_update() { |
@@ -3588,8 +4376,11 @@ discard block |
||
| 3588 | 4376 | return "error : ".$e->getMessage(); |
| 3589 | 4377 | } |
| 3590 | 4378 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3591 | - if ($row['nb'] > 0) return false; |
|
| 3592 | - else return true; |
|
| 4379 | + if ($row['nb'] > 0) { |
|
| 4380 | + return false; |
|
| 4381 | + } else { |
|
| 4382 | + return true; |
|
| 4383 | + } |
|
| 3593 | 4384 | } |
| 3594 | 4385 | |
| 3595 | 4386 | public static function insert_last_schedules_update() { |
@@ -3619,8 +4410,11 @@ discard block |
||
| 3619 | 4410 | return "error : ".$e->getMessage(); |
| 3620 | 4411 | } |
| 3621 | 4412 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3622 | - if ($row['nb'] > 0) return false; |
|
| 3623 | - else return true; |
|
| 4413 | + if ($row['nb'] > 0) { |
|
| 4414 | + return false; |
|
| 4415 | + } else { |
|
| 4416 | + return true; |
|
| 4417 | + } |
|
| 3624 | 4418 | } |
| 3625 | 4419 | |
| 3626 | 4420 | public static function insert_last_tle_update() { |
@@ -3650,8 +4444,11 @@ discard block |
||
| 3650 | 4444 | return "error : ".$e->getMessage(); |
| 3651 | 4445 | } |
| 3652 | 4446 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3653 | - if ($row['nb'] > 0) return false; |
|
| 3654 | - else return true; |
|
| 4447 | + if ($row['nb'] > 0) { |
|
| 4448 | + return false; |
|
| 4449 | + } else { |
|
| 4450 | + return true; |
|
| 4451 | + } |
|
| 3655 | 4452 | } |
| 3656 | 4453 | |
| 3657 | 4454 | public static function insert_last_ucsdb_update() { |
@@ -3681,8 +4478,11 @@ discard block |
||
| 3681 | 4478 | return "error : ".$e->getMessage(); |
| 3682 | 4479 | } |
| 3683 | 4480 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3684 | - if ($row['nb'] > 0) return false; |
|
| 3685 | - else return true; |
|
| 4481 | + if ($row['nb'] > 0) { |
|
| 4482 | + return false; |
|
| 4483 | + } else { |
|
| 4484 | + return true; |
|
| 4485 | + } |
|
| 3686 | 4486 | } |
| 3687 | 4487 | |
| 3688 | 4488 | public static function insert_last_celestrak_update() { |
@@ -3712,8 +4512,11 @@ discard block |
||
| 3712 | 4512 | return "error : ".$e->getMessage(); |
| 3713 | 4513 | } |
| 3714 | 4514 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3715 | - if ($row['nb'] > 0) return false; |
|
| 3716 | - else return true; |
|
| 4515 | + if ($row['nb'] > 0) { |
|
| 4516 | + return false; |
|
| 4517 | + } else { |
|
| 4518 | + return true; |
|
| 4519 | + } |
|
| 3717 | 4520 | } |
| 3718 | 4521 | |
| 3719 | 4522 | public static function check_last_satellite_update() { |
@@ -3731,8 +4534,11 @@ discard block |
||
| 3731 | 4534 | return "error : ".$e->getMessage(); |
| 3732 | 4535 | } |
| 3733 | 4536 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3734 | - if ($row['nb'] > 0) return false; |
|
| 3735 | - else return true; |
|
| 4537 | + if ($row['nb'] > 0) { |
|
| 4538 | + return false; |
|
| 4539 | + } else { |
|
| 4540 | + return true; |
|
| 4541 | + } |
|
| 3736 | 4542 | } |
| 3737 | 4543 | |
| 3738 | 4544 | public static function insert_last_marine_identity_update() { |
@@ -4,11 +4,19 @@ discard block |
||
| 4 | 4 | if (isset($_SESSION['error'])) { |
| 5 | 5 | header('Content-Encoding: none;'); |
| 6 | 6 | echo 'Error : '.$_SESSION['error'].' - Resetting install... You need to fix the problem and run install again.'; |
| 7 | - if (isset($_SESSION['error'])) unset($_SESSION['error']); |
|
| 8 | - if (isset($_SESSION['errorlst'])) unset($_SESSION['errorlst']); |
|
| 9 | - if (isset($_SESSION['next'])) unset($_SESSION['next']); |
|
| 10 | - if (isset($_SESSION['install'])) unset($_SESSION['install']); |
|
| 11 | -} |
|
| 7 | + if (isset($_SESSION['error'])) { |
|
| 8 | + unset($_SESSION['error']); |
|
| 9 | + } |
|
| 10 | + if (isset($_SESSION['errorlst'])) { |
|
| 11 | + unset($_SESSION['errorlst']); |
|
| 12 | + } |
|
| 13 | + if (isset($_SESSION['next'])) { |
|
| 14 | + unset($_SESSION['next']); |
|
| 15 | + } |
|
| 16 | + if (isset($_SESSION['install'])) { |
|
| 17 | + unset($_SESSION['install']); |
|
| 18 | + } |
|
| 19 | + } |
|
| 12 | 20 | /* |
| 13 | 21 | if (isset($_SESSION['errorlst'])) { |
| 14 | 22 | header('Content-Encoding: none;'); |
@@ -114,7 +122,9 @@ discard block |
||
| 114 | 122 | if (count($alllng) != count($availablelng)) { |
| 115 | 123 | $notavailable = array(); |
| 116 | 124 | foreach($alllng as $lng) { |
| 117 | - if (!isset($availablelng[$lng])) $notavailable[] = $lng; |
|
| 125 | + if (!isset($availablelng[$lng])) { |
|
| 126 | + $notavailable[] = $lng; |
|
| 127 | + } |
|
| 118 | 128 | } |
| 119 | 129 | print '<div class="alert alert-warning">The following translation can\'t be used on your system: '.implode(', ',$notavailable).'. You need to add the system locales: <a href="https://github.com/Ysurac/FlightAirMap/wiki/Translation">documentation</a>.</div>'; |
| 120 | 130 | } |
@@ -175,31 +185,49 @@ discard block |
||
| 175 | 185 | </div> |
| 176 | 186 | <p> |
| 177 | 187 | <label for="dbhost">Database hostname</label> |
| 178 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 188 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 189 | + print $globalDBhost; |
|
| 190 | +} |
|
| 191 | +?>" /> |
|
| 179 | 192 | </p> |
| 180 | 193 | <p> |
| 181 | 194 | <label for="dbport">Database port</label> |
| 182 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 195 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 196 | + print $globalDBport; |
|
| 197 | +} |
|
| 198 | +?>" /> |
|
| 183 | 199 | <p class="help-block">Default is 3306 for MariaDB/MySQL, 5432 for PostgreSQL</p> |
| 184 | 200 | </p> |
| 185 | 201 | <p> |
| 186 | 202 | <label for="dbname">Database name</label> |
| 187 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 203 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 204 | + print $globalDBname; |
|
| 205 | +} |
|
| 206 | +?>" /> |
|
| 188 | 207 | </p> |
| 189 | 208 | <p> |
| 190 | 209 | <label for="dbuser">Database user</label> |
| 191 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 210 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 211 | + print $globalDBuser; |
|
| 212 | +} |
|
| 213 | +?>" /> |
|
| 192 | 214 | </p> |
| 193 | 215 | <p> |
| 194 | 216 | <label for="dbuserpass">Database user password</label> |
| 195 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 217 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 218 | + print $globalDBpass; |
|
| 219 | +} |
|
| 220 | +?>" /> |
|
| 196 | 221 | </p> |
| 197 | 222 | </fieldset> |
| 198 | 223 | <fieldset id="site"> |
| 199 | 224 | <legend>Site configuration</legend> |
| 200 | 225 | <p> |
| 201 | 226 | <label for="sitename">Site name</label> |
| 202 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 227 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 228 | + print $globalName; |
|
| 229 | +} |
|
| 230 | +?>" /> |
|
| 203 | 231 | </p> |
| 204 | 232 | <p> |
| 205 | 233 | <label for="siteurl">Site directory</label> |
@@ -212,18 +240,27 @@ discard block |
||
| 212 | 240 | } |
| 213 | 241 | } |
| 214 | 242 | ?> |
| 215 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 243 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 244 | + print $globalURL; |
|
| 245 | +} |
|
| 246 | +?>" /> |
|
| 216 | 247 | <p class="help-block">ex : <i>/flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 217 | 248 | <p class="help-block">Can be empty</p> |
| 218 | 249 | </p> |
| 219 | 250 | <p> |
| 220 | 251 | <label for="timezone">Timezone</label> |
| 221 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 252 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 253 | + print $globalTimezone; |
|
| 254 | +} |
|
| 255 | +?>" /> |
|
| 222 | 256 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 223 | 257 | </p> |
| 224 | 258 | <p> |
| 225 | 259 | <label for="language">Language</label> |
| 226 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 260 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 261 | + print $globalLanguage; |
|
| 262 | +} |
|
| 263 | +?>" /> |
|
| 227 | 264 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 228 | 265 | </p> |
| 229 | 266 | </fieldset> |
@@ -243,11 +280,17 @@ discard block |
||
| 243 | 280 | <div id="mapbox_data"> |
| 244 | 281 | <p> |
| 245 | 282 | <label for="mapboxid">Mapbox id</label> |
| 246 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 283 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 284 | + print $globalMapboxId; |
|
| 285 | +} |
|
| 286 | +?>" /> |
|
| 247 | 287 | </p> |
| 248 | 288 | <p> |
| 249 | 289 | <label for="mapboxtoken">Mapbox token</label> |
| 250 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 290 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 291 | + print $globalMapboxToken; |
|
| 292 | +} |
|
| 293 | +?>" /> |
|
| 251 | 294 | </p> |
| 252 | 295 | <p class="help-block">Get a key <a href="https://www.mapbox.com/developers/">here</a></p> |
| 253 | 296 | </div> |
@@ -255,7 +298,10 @@ discard block |
||
| 255 | 298 | <div id="google_data"> |
| 256 | 299 | <p> |
| 257 | 300 | <label for="googlekey">Google API key</label> |
| 258 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 301 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 302 | + print $globalGoogleAPIKey; |
|
| 303 | +} |
|
| 304 | +?>" /> |
|
| 259 | 305 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 260 | 306 | </p> |
| 261 | 307 | </div> |
@@ -263,7 +309,10 @@ discard block |
||
| 263 | 309 | <div id="bing_data"> |
| 264 | 310 | <p> |
| 265 | 311 | <label for="bingkey">Bing Map key</label> |
| 266 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 312 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 313 | + print $globalBingMapKey; |
|
| 314 | +} |
|
| 315 | +?>" /> |
|
| 267 | 316 | <p class="help-block">Get a key <a href="https://www.bingmapsportal.com/">here</a></p> |
| 268 | 317 | </p> |
| 269 | 318 | </div> |
@@ -271,7 +320,10 @@ discard block |
||
| 271 | 320 | <div id="mapquest_data"> |
| 272 | 321 | <p> |
| 273 | 322 | <label for="mapquestkey">MapQuest key</label> |
| 274 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 323 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 324 | + print $globalMapQuestKey; |
|
| 325 | +} |
|
| 326 | +?>" /> |
|
| 275 | 327 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 276 | 328 | </p> |
| 277 | 329 | </div> |
@@ -279,11 +331,17 @@ discard block |
||
| 279 | 331 | <div id="here_data"> |
| 280 | 332 | <p> |
| 281 | 333 | <label for="hereappid">Here App_Id</label> |
| 282 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 334 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 335 | + print $globalHereappId; |
|
| 336 | +} |
|
| 337 | +?>" /> |
|
| 283 | 338 | </p> |
| 284 | 339 | <p> |
| 285 | 340 | <label for="hereappcode">Here App_Code</label> |
| 286 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 341 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 342 | + print $globalHereappCode; |
|
| 343 | +} |
|
| 344 | +?>" /> |
|
| 287 | 345 | </p> |
| 288 | 346 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 289 | 347 | </div> |
@@ -291,7 +349,10 @@ discard block |
||
| 291 | 349 | <div id="openweathermap_data"> |
| 292 | 350 | <p> |
| 293 | 351 | <label for="openweathermapkey">OpenWeatherMap key (weather layer)</label> |
| 294 | - <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) print $globalOpenWeatherMapKey; ?>" /> |
|
| 352 | + <input type="text" name="openweathermapkey" id="openweathermapkey" value="<?php if (isset($globalOpenWeatherMapKey)) { |
|
| 353 | + print $globalOpenWeatherMapKey; |
|
| 354 | +} |
|
| 355 | +?>" /> |
|
| 295 | 356 | <p class="help-block">Get a key <a href="https://openweathermap.org/">here</a></p> |
| 296 | 357 | </p> |
| 297 | 358 | </div> |
@@ -320,42 +381,86 @@ discard block |
||
| 320 | 381 | <legend>Coverage area</legend> |
| 321 | 382 | <p> |
| 322 | 383 | <label for="latitudemax">The maximum latitude (north)</label> |
| 323 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 384 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 385 | + print $globalLatitudeMax; |
|
| 386 | +} |
|
| 387 | +?>" /> |
|
| 324 | 388 | </p> |
| 325 | 389 | <p> |
| 326 | 390 | <label for="latitudemin">The minimum latitude (south)</label> |
| 327 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 391 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 392 | + print $globalLatitudeMin; |
|
| 393 | +} |
|
| 394 | +?>" /> |
|
| 328 | 395 | </p> |
| 329 | 396 | <p> |
| 330 | 397 | <label for="longitudemax">The maximum longitude (west)</label> |
| 331 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 398 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 399 | + print $globalLongitudeMax; |
|
| 400 | +} |
|
| 401 | +?>" /> |
|
| 332 | 402 | </p> |
| 333 | 403 | <p> |
| 334 | 404 | <label for="longitudemin">The minimum longitude (east)</label> |
| 335 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 405 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 406 | + print $globalLongitudeMin; |
|
| 407 | +} |
|
| 408 | +?>" /> |
|
| 336 | 409 | </p> |
| 337 | 410 | <p> |
| 338 | 411 | <label for="latitudecenter">The latitude center</label> |
| 339 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 412 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 413 | + print $globalCenterLatitude; |
|
| 414 | +} |
|
| 415 | +?>" /> |
|
| 340 | 416 | </p> |
| 341 | 417 | <p> |
| 342 | 418 | <label for="longitudecenter">The longitude center</label> |
| 343 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 419 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 420 | + print $globalCenterLongitude; |
|
| 421 | +} |
|
| 422 | +?>" /> |
|
| 344 | 423 | </p> |
| 345 | 424 | <p> |
| 346 | 425 | <label for="livezoom">Default Zoom on live map</label> |
| 347 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 426 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 427 | + print $globalLiveZoom; |
|
| 428 | +} else { |
|
| 429 | + print '9'; |
|
| 430 | +} |
|
| 431 | +?>" /> |
|
| 348 | 432 | </p> |
| 349 | 433 | <p> |
| 350 | 434 | <label for="squawk_country">Country for squawk usage</label> |
| 351 | 435 | <select name="squawk_country" id="squawk_country"> |
| 352 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 353 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 354 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 355 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 356 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 357 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 358 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 436 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 437 | + print ' selected '; |
|
| 438 | +} |
|
| 439 | +?>>UK</option> |
|
| 440 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 441 | + print ' selected '; |
|
| 442 | +} |
|
| 443 | +?>>NZ</option> |
|
| 444 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 445 | + print ' selected '; |
|
| 446 | +} |
|
| 447 | +?>>US</option> |
|
| 448 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 449 | + print ' selected '; |
|
| 450 | +} |
|
| 451 | +?>>AU</option> |
|
| 452 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 453 | + print ' selected '; |
|
| 454 | +} |
|
| 455 | +?>>NL</option> |
|
| 456 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 457 | + print ' selected '; |
|
| 458 | +} |
|
| 459 | +?>>FR</option> |
|
| 460 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 461 | + print ' selected '; |
|
| 462 | +} |
|
| 463 | +?>>TR</option> |
|
| 359 | 464 | </select> |
| 360 | 465 | </p> |
| 361 | 466 | </fieldset> |
@@ -364,15 +469,24 @@ discard block |
||
| 364 | 469 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 365 | 470 | <p> |
| 366 | 471 | <label for="latitude">Center latitude</label> |
| 367 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 472 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 473 | + echo $globalDistanceIgnore['latitude']; |
|
| 474 | +} |
|
| 475 | +?>" /> |
|
| 368 | 476 | </p> |
| 369 | 477 | <p> |
| 370 | 478 | <label for="longitude">Center longitude</label> |
| 371 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 479 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 480 | + echo $globalDistanceIgnore['longitude']; |
|
| 481 | +} |
|
| 482 | +?>" /> |
|
| 372 | 483 | </p> |
| 373 | 484 | <p> |
| 374 | 485 | <label for="Distance">Distance (in km)</label> |
| 375 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 486 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 487 | + echo $globalDistanceIgnore['distance']; |
|
| 488 | +} |
|
| 489 | +?>" /> |
|
| 376 | 490 | </p> |
| 377 | 491 | </fieldset> |
| 378 | 492 | <fieldset id="sourceloc"> |
@@ -495,22 +609,34 @@ discard block |
||
| 495 | 609 | <div id="flightaware_data"> |
| 496 | 610 | <p> |
| 497 | 611 | <label for="flightawareusername">FlightAware username</label> |
| 498 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 612 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 613 | + print $globalFlightAwareUsername; |
|
| 614 | +} |
|
| 615 | +?>" /> |
|
| 499 | 616 | </p> |
| 500 | 617 | <p> |
| 501 | 618 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 502 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 619 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 620 | + print $globalFlightAwarePassword; |
|
| 621 | +} |
|
| 622 | +?>" /> |
|
| 503 | 623 | </p> |
| 504 | 624 | </div> |
| 505 | 625 | --> |
| 506 | 626 | <div id="sailaway_data"> |
| 507 | 627 | <p> |
| 508 | 628 | <label for="sailawayemail">Sailaway email</label> |
| 509 | - <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) print $globalSailaway['email']; ?>" /> |
|
| 629 | + <input type="text" name="sailawayemail" id="sailawayemail" value="<?php if (isset($globalSailaway['email'])) { |
|
| 630 | + print $globalSailaway['email']; |
|
| 631 | +} |
|
| 632 | +?>" /> |
|
| 510 | 633 | </p> |
| 511 | 634 | <p> |
| 512 | 635 | <label for="sailawaypassword">Sailaway password</label> |
| 513 | - <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) print $globalSailaway['password']; ?>" /> |
|
| 636 | + <input type="text" name="sailawaypassword" id="sailawaypassword" value="<?php if (isset($globalSailaway['password'])) { |
|
| 637 | + print $globalSailaway['password']; |
|
| 638 | +} |
|
| 639 | +?>" /> |
|
| 514 | 640 | </p> |
| 515 | 641 | </div> |
| 516 | 642 | |
@@ -552,7 +678,10 @@ discard block |
||
| 552 | 678 | if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
| 553 | 679 | ?> |
| 554 | 680 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 555 | - <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) print $source['port']; ?>" /></td> |
|
| 681 | + <td><input type="text" name="port[]" class="col-xs-2" id="port" value="<?php if (isset($source['port'])) { |
|
| 682 | + print $source['port']; |
|
| 683 | +} |
|
| 684 | +?>" /></td> |
|
| 556 | 685 | <?php |
| 557 | 686 | } else { |
| 558 | 687 | $hostport = explode(':',$source['host']); |
@@ -571,37 +700,118 @@ discard block |
||
| 571 | 700 | ?> |
| 572 | 701 | <td> |
| 573 | 702 | <select name="format[]" id="format"> |
| 574 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 575 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 576 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 577 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 578 | - <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') print 'selected'; ?>>Dump1090 aircraft.json</option> |
|
| 579 | - <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') print 'selected'; ?>>Planefinder client</option> |
|
| 580 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 581 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 582 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 583 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server AircraftList.json</option> |
|
| 584 | - <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') print 'selected'; ?>>Virtual Radar Server TCP</option> |
|
| 585 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 586 | - <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>Virtual Airline Operations System (VAOS)</option> |
|
| 587 | - <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') print 'selected'; ?>>Virtual Airlines Manager</option> |
|
| 588 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 589 | - <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') print 'selected'; ?>>FlightGear Multiplayer</option> |
|
| 590 | - <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') print 'selected'; ?>>FlightGear Singleplayer</option> |
|
| 591 | - <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') print 'selected'; ?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 592 | - <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') print 'selected'; ?>>ACARS SBS-3 over TCP</option> |
|
| 593 | - <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') print 'selected'; ?>>NMEA AIS over TCP</option> |
|
| 594 | - <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') print 'selected'; ?>>AirWhere website</option> |
|
| 595 | - <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') print 'selected'; ?>>HidnSeek Callback</option> |
|
| 596 | - <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') print 'selected'; ?>>Blitzortung</option> |
|
| 597 | - <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') print 'selected'; ?>>Sailaway</option> |
|
| 703 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 704 | + print 'selected'; |
|
| 705 | +} |
|
| 706 | +?>>Auto</option> |
|
| 707 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 708 | + print 'selected'; |
|
| 709 | +} |
|
| 710 | +?>>SBS</option> |
|
| 711 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 712 | + print 'selected'; |
|
| 713 | +} |
|
| 714 | +?>>TSV</option> |
|
| 715 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 716 | + print 'selected'; |
|
| 717 | +} |
|
| 718 | +?>>Raw</option> |
|
| 719 | + <option value="aircraftjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftjson') { |
|
| 720 | + print 'selected'; |
|
| 721 | +} |
|
| 722 | +?>>Dump1090 aircraft.json</option> |
|
| 723 | + <option value="planefinderclient" <?php if (isset($source['format']) && $source['format'] == 'planefinderclient') { |
|
| 724 | + print 'selected'; |
|
| 725 | +} |
|
| 726 | +?>>Planefinder client</option> |
|
| 727 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 728 | + print 'selected'; |
|
| 729 | +} |
|
| 730 | +?>>APRS</option> |
|
| 731 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 732 | + print 'selected'; |
|
| 733 | +} |
|
| 734 | +?>>Radarcape deltadb.txt</option> |
|
| 735 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 736 | + print 'selected'; |
|
| 737 | +} |
|
| 738 | +?>>Vatsim</option> |
|
| 739 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 740 | + print 'selected'; |
|
| 741 | +} |
|
| 742 | +?>>Virtual Radar Server AircraftList.json</option> |
|
| 743 | + <option value="vrstcp" <?php if (isset($source['format']) && $source['format'] == 'vrstcp') { |
|
| 744 | + print 'selected'; |
|
| 745 | +} |
|
| 746 | +?>>Virtual Radar Server TCP</option> |
|
| 747 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 748 | + print 'selected'; |
|
| 749 | +} |
|
| 750 | +?>>phpVMS</option> |
|
| 751 | + <option value="vaos" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 752 | + print 'selected'; |
|
| 753 | +} |
|
| 754 | +?>>Virtual Airline Operations System (VAOS)</option> |
|
| 755 | + <option value="vam" <?php if (isset($source['format']) && $source['format'] == 'vam') { |
|
| 756 | + print 'selected'; |
|
| 757 | +} |
|
| 758 | +?>>Virtual Airlines Manager</option> |
|
| 759 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 760 | + print 'selected'; |
|
| 761 | +} |
|
| 762 | +?>>IVAO</option> |
|
| 763 | + <option value="flightgearmp" <?php if (isset($source['format']) && $source['format'] == 'flightgearmp') { |
|
| 764 | + print 'selected'; |
|
| 765 | +} |
|
| 766 | +?>>FlightGear Multiplayer</option> |
|
| 767 | + <option value="flightgearsp" <?php if (isset($source['format']) && $source['format'] == 'flightgearsp') { |
|
| 768 | + print 'selected'; |
|
| 769 | +} |
|
| 770 | +?>>FlightGear Singleplayer</option> |
|
| 771 | + <option value="acars" <?php if (isset($source['format']) && $source['format'] == 'acars') { |
|
| 772 | + print 'selected'; |
|
| 773 | +} |
|
| 774 | +?>>ACARS from acarsdec/acarsdeco2 over UDP</option> |
|
| 775 | + <option value="acarssbs3" <?php if (isset($source['format']) && $source['format'] == 'acarssbs3') { |
|
| 776 | + print 'selected'; |
|
| 777 | +} |
|
| 778 | +?>>ACARS SBS-3 over TCP</option> |
|
| 779 | + <option value="ais" <?php if (isset($source['format']) && $source['format'] == 'ais') { |
|
| 780 | + print 'selected'; |
|
| 781 | +} |
|
| 782 | +?>>NMEA AIS over TCP</option> |
|
| 783 | + <option value="airwhere" <?php if (isset($source['format']) && $source['format'] == 'airwhere') { |
|
| 784 | + print 'selected'; |
|
| 785 | +} |
|
| 786 | +?>>AirWhere website</option> |
|
| 787 | + <option value="hidnseek_callback" <?php if (isset($source['format']) && $source['format'] == 'hidnseek_callback') { |
|
| 788 | + print 'selected'; |
|
| 789 | +} |
|
| 790 | +?>>HidnSeek Callback</option> |
|
| 791 | + <option value="blitzortung" <?php if (isset($source['format']) && $source['format'] == 'blitzortung') { |
|
| 792 | + print 'selected'; |
|
| 793 | +} |
|
| 794 | +?>>Blitzortung</option> |
|
| 795 | + <option value="sailaway" <?php if (isset($source['format']) && $source['format'] == 'sailaway') { |
|
| 796 | + print 'selected'; |
|
| 797 | +} |
|
| 798 | +?>>Sailaway</option> |
|
| 598 | 799 | </select> |
| 599 | 800 | </td> |
| 600 | 801 | <td> |
| 601 | - <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /> |
|
| 802 | + <input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 803 | + print $source['name']; |
|
| 804 | +} |
|
| 805 | +?>" /> |
|
| 602 | 806 | </td> |
| 603 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 604 | - <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) print 'checked'; ?> /></td> |
|
| 807 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 808 | + print 'checked'; |
|
| 809 | +} |
|
| 810 | +?> /></td> |
|
| 811 | + <td><input type="checkbox" name="noarchive[]" id="noarchive" title="Don't archive this source" value="1" <?php if (isset($source['noarchive']) && $source['noarchive']) { |
|
| 812 | + print 'checked'; |
|
| 813 | +} |
|
| 814 | +?> /></td> |
|
| 605 | 815 | <td> |
| 606 | 816 | <select name="timezones[]" id="timezones"> |
| 607 | 817 | <?php |
@@ -611,7 +821,9 @@ discard block |
||
| 611 | 821 | print '<option selected>'.$timezones.'</option>'; |
| 612 | 822 | } elseif (!isset($source['timezone']) && $timezones == 'UTC') { |
| 613 | 823 | print '<option selected>'.$timezones.'</option>'; |
| 614 | - } else print '<option>'.$timezones.'</option>'; |
|
| 824 | + } else { |
|
| 825 | + print '<option>'.$timezones.'</option>'; |
|
| 826 | + } |
|
| 615 | 827 | } |
| 616 | 828 | ?> |
| 617 | 829 | </select> |
@@ -665,7 +877,9 @@ discard block |
||
| 665 | 877 | foreach($timezonelist as $timezones){ |
| 666 | 878 | if ($timezones == 'UTC') { |
| 667 | 879 | print '<option selected>'.$timezones.'</option>'; |
| 668 | - } else print '<option>'.$timezones.'</option>'; |
|
| 880 | + } else { |
|
| 881 | + print '<option>'.$timezones.'</option>'; |
|
| 882 | + } |
|
| 669 | 883 | } |
| 670 | 884 | ?> |
| 671 | 885 | </select> |
@@ -690,11 +904,17 @@ discard block |
||
| 690 | 904 | <p>Listen UDP server for acarsdec/acarsdeco2/... with <i>daemon-acars.php</i> script</p> |
| 691 | 905 | <p> |
| 692 | 906 | <label for="acarshost">ACARS UDP host</label> |
| 693 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 907 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 908 | + print $globalACARSHost; |
|
| 909 | +} |
|
| 910 | +?>" /> |
|
| 694 | 911 | </p> |
| 695 | 912 | <p> |
| 696 | 913 | <label for="acarsport">ACARS UDP port</label> |
| 697 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 914 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 915 | + print $globalACARSPort; |
|
| 916 | +} |
|
| 917 | +?>" /> |
|
| 698 | 918 | </p> |
| 699 | 919 | <p class="help-block"><i>daemon-acars.php</i> can only be run as daemon. It's an alternate script for ACARS data, <i>daemon-spotter.php</i> may be better.</p> |
| 700 | 920 | </fieldset> |
@@ -721,17 +941,38 @@ discard block |
||
| 721 | 941 | <td><input type="url" name="newsurl[]" value="<?php print $feed; ?>"/></td> |
| 722 | 942 | <td> |
| 723 | 943 | <select name="newslang[]"> |
| 724 | - <option value="en"<?php if ($lng == 'en') print ' selected'; ?>>English</option> |
|
| 725 | - <option value="fr"<?php if ($lng == 'fr') print ' selected'; ?>>French</option> |
|
| 944 | + <option value="en"<?php if ($lng == 'en') { |
|
| 945 | + print ' selected'; |
|
| 946 | +} |
|
| 947 | +?>>English</option> |
|
| 948 | + <option value="fr"<?php if ($lng == 'fr') { |
|
| 949 | + print ' selected'; |
|
| 950 | +} |
|
| 951 | +?>>French</option> |
|
| 726 | 952 | </select> |
| 727 | 953 | </td> |
| 728 | 954 | <td> |
| 729 | 955 | <select name="newstype[]"> |
| 730 | - <option value="global"<?php if ($type == 'global') print ' selected'; ?>>Global</option> |
|
| 731 | - <option value="aircraft"<?php if ($type == 'aircraft') print ' selected'; ?>>Aircraft</option> |
|
| 732 | - <option value="marine"<?php if ($type == 'marine') print ' selected'; ?>>Marine</option> |
|
| 733 | - <option value="tracker"<?php if ($type == 'tracker') print ' selected'; ?>>Tracker</option> |
|
| 734 | - <option value="satellite"<?php if ($type == 'Satellite') print ' selected'; ?>>Satellite</option> |
|
| 956 | + <option value="global"<?php if ($type == 'global') { |
|
| 957 | + print ' selected'; |
|
| 958 | +} |
|
| 959 | +?>>Global</option> |
|
| 960 | + <option value="aircraft"<?php if ($type == 'aircraft') { |
|
| 961 | + print ' selected'; |
|
| 962 | +} |
|
| 963 | +?>>Aircraft</option> |
|
| 964 | + <option value="marine"<?php if ($type == 'marine') { |
|
| 965 | + print ' selected'; |
|
| 966 | +} |
|
| 967 | +?>>Marine</option> |
|
| 968 | + <option value="tracker"<?php if ($type == 'tracker') { |
|
| 969 | + print ' selected'; |
|
| 970 | +} |
|
| 971 | +?>>Tracker</option> |
|
| 972 | + <option value="satellite"<?php if ($type == 'Satellite') { |
|
| 973 | + print ' selected'; |
|
| 974 | +} |
|
| 975 | +?>>Satellite</option> |
|
| 735 | 976 | </select> |
| 736 | 977 | </td> |
| 737 | 978 | <td><input type="button" value="Delete" onclick="deleteRowNews(this)" /> <input type="button" value="Add" onclick="insRowNews()" /></td> |
@@ -815,7 +1056,10 @@ discard block |
||
| 815 | 1056 | </p> |
| 816 | 1057 | <p> |
| 817 | 1058 | <label for="corsproxy">CORS proxy</label> |
| 818 | - <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) print $globalCORSproxy; else print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
| 1059 | + <input type="text" name="corsproxy" id="corsproxy" value="<?php if (isset($globalCORSproxy)) { |
|
| 1060 | + print $globalCORSproxy; |
|
| 1061 | +} else { |
|
| 1062 | + print 'https://galvanize-cors-proxy.herokuapp.com/' ?>" /> |
|
| 819 | 1063 | <p class="help-block">CORS proxy used for some WMS servers</p> |
| 820 | 1064 | </p> |
| 821 | 1065 | <!-- |
@@ -878,13 +1122,18 @@ discard block |
||
| 878 | 1122 | <div id="schedules_options"> |
| 879 | 1123 | <p> |
| 880 | 1124 | <label for="britishairways">British Airways API Key</label> |
| 881 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 1125 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; |
|
| 1126 | +} |
|
| 1127 | +?>" /> |
|
| 882 | 1128 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 883 | 1129 | </p> |
| 884 | 1130 | <!-- |
| 885 | 1131 | <p> |
| 886 | 1132 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 887 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 1133 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 1134 | + print $globalTransaviaKey; |
|
| 1135 | +} |
|
| 1136 | +?>" /> |
|
| 888 | 1137 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 889 | 1138 | </p> |
| 890 | 1139 | --> |
@@ -893,10 +1142,16 @@ discard block |
||
| 893 | 1142 | <b>Lufthansa API Key</b> |
| 894 | 1143 | <p> |
| 895 | 1144 | <label for="lufthansakey">Key</label> |
| 896 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 1145 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 1146 | + print $globalLufthansaKey['key']; |
|
| 1147 | +} |
|
| 1148 | +?>" /> |
|
| 897 | 1149 | </p><p> |
| 898 | 1150 | <label for="lufthansasecret">Secret</label> |
| 899 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 1151 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 1152 | + print $globalLufthansaKey['secret']; |
|
| 1153 | +} |
|
| 1154 | +?>" /> |
|
| 900 | 1155 | </p> |
| 901 | 1156 | </div> |
| 902 | 1157 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -906,11 +1161,17 @@ discard block |
||
| 906 | 1161 | <b>FlightAware API Key</b> |
| 907 | 1162 | <p> |
| 908 | 1163 | <label for="flightawareusername">Username</label> |
| 909 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 1164 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 1165 | + print $globalFlightAwareUsername; |
|
| 1166 | +} |
|
| 1167 | +?>" /> |
|
| 910 | 1168 | </p> |
| 911 | 1169 | <p> |
| 912 | 1170 | <label for="flightawarepassword">API key</label> |
| 913 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 1171 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 1172 | + print $globalFlightAwarePassword; |
|
| 1173 | +} |
|
| 1174 | +?>" /> |
|
| 914 | 1175 | </p> |
| 915 | 1176 | </div> |
| 916 | 1177 | <p class="help-block">Register an account on <a href="https://www.flightaware.com/">https://www.flightaware.com/</a></p> |
@@ -927,10 +1188,22 @@ discard block |
||
| 927 | 1188 | <p> |
| 928 | 1189 | <label for="mapmatchingsource">Map Matching source</label> |
| 929 | 1190 | <select name="mapmatchingsource" id="mapmatchingsource"> |
| 930 | - <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) print 'selected="selected" '; ?>>FlightAirMap Map Matching</option> |
|
| 931 | - <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') print 'selected="selected" '; ?>>GraphHopper</option> |
|
| 932 | - <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') print 'selected="selected" '; ?>>OSMR</option> |
|
| 933 | - <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') print 'selected="selected" '; ?>>Mapbox</option> |
|
| 1191 | + <option value="fam" <?php if ((isset($globalMapMatchingSource) && $globalMapMatchingSource == 'fam') || !isset($globalMatchingSource)) { |
|
| 1192 | + print 'selected="selected" '; |
|
| 1193 | +} |
|
| 1194 | +?>>FlightAirMap Map Matching</option> |
|
| 1195 | + <option value="graphhopper" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'graphhopper') { |
|
| 1196 | + print 'selected="selected" '; |
|
| 1197 | +} |
|
| 1198 | +?>>GraphHopper</option> |
|
| 1199 | + <option value="osmr" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'osmr') { |
|
| 1200 | + print 'selected="selected" '; |
|
| 1201 | +} |
|
| 1202 | +?>>OSMR</option> |
|
| 1203 | + <option value="mapbox" <?php if (isset($globalMapMatchingSource) && $globalMapMatchingSource == 'mapbox') { |
|
| 1204 | + print 'selected="selected" '; |
|
| 1205 | +} |
|
| 1206 | +?>>Mapbox</option> |
|
| 934 | 1207 | </select> |
| 935 | 1208 | <p class="help-block">Mapbox need the API Key defined in map section.</p> |
| 936 | 1209 | <p class="help-block">FlightAirMap Map Matching is free, without API key but limited to about 100 input points to keep fast results.</p> |
@@ -938,7 +1211,10 @@ discard block |
||
| 938 | 1211 | <br /> |
| 939 | 1212 | <p> |
| 940 | 1213 | <label for="graphhopper">GraphHopper API Key</label> |
| 941 | - <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) print $globalGraphHopperKey; ?>" /> |
|
| 1214 | + <input type="text" name="graphhopper" id="graphhopper" value="<?php if (isset($globalGraphHopperKey)) { |
|
| 1215 | + print $globalGraphHopperKey; |
|
| 1216 | +} |
|
| 1217 | +?>" /> |
|
| 942 | 1218 | <p class="help-block">Register an account on <a href="https://www.graphhopper.com/">https://www.graphhopper.com/</a></p> |
| 943 | 1219 | </p> |
| 944 | 1220 | </div> |
@@ -956,7 +1232,10 @@ discard block |
||
| 956 | 1232 | </p> |
| 957 | 1233 | <p> |
| 958 | 1234 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 959 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 1235 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 1236 | + print $globalNOTAMSource; |
|
| 1237 | +} |
|
| 1238 | +?>" /> |
|
| 960 | 1239 | <p class="help-block">If you want to use world NOTAM from FlightAirMap website, leave it blank</p> |
| 961 | 1240 | </p> |
| 962 | 1241 | <br /> |
@@ -972,14 +1251,20 @@ discard block |
||
| 972 | 1251 | <div id="metarsrc"> |
| 973 | 1252 | <p> |
| 974 | 1253 | <label for="metarsource">URL of your METAR source</label> |
| 975 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 1254 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 1255 | + print $globalMETARurl; |
|
| 1256 | +} |
|
| 1257 | +?>" /> |
|
| 976 | 1258 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 977 | 1259 | </p> |
| 978 | 1260 | </div> |
| 979 | 1261 | <br /> |
| 980 | 1262 | <p> |
| 981 | 1263 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 982 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 1264 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 1265 | + print $globalBitlyAccessToken; |
|
| 1266 | +} |
|
| 1267 | +?>" /> |
|
| 983 | 1268 | </p> |
| 984 | 1269 | <br /> |
| 985 | 1270 | <p> |
@@ -995,11 +1280,26 @@ discard block |
||
| 995 | 1280 | <p> |
| 996 | 1281 | <label for="geoid_source">Geoid Source</label> |
| 997 | 1282 | <select name="geoid_source" id="geoid_source"> |
| 998 | - <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') print ' selected="selected"'; ?>>EGM96 15' (2.1MB)</option> |
|
| 999 | - <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') print ' selected="selected"'; ?>>EGM96 5' (19MB)</option> |
|
| 1000 | - <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') print ' selected="selected"'; ?>>EGM2008 5' (19MB)</option> |
|
| 1001 | - <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') print ' selected="selected"'; ?>>EGM2008 2.5' (75MB)</option> |
|
| 1002 | - <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') print ' selected="selected"'; ?>>EGM2008 1' (470MB)</option> |
|
| 1283 | + <option value="egm96-15"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-15') { |
|
| 1284 | + print ' selected="selected"'; |
|
| 1285 | +} |
|
| 1286 | +?>>EGM96 15' (2.1MB)</option> |
|
| 1287 | + <option value="egm96-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm96-5') { |
|
| 1288 | + print ' selected="selected"'; |
|
| 1289 | +} |
|
| 1290 | +?>>EGM96 5' (19MB)</option> |
|
| 1291 | + <option value="egm2008-5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-5') { |
|
| 1292 | + print ' selected="selected"'; |
|
| 1293 | +} |
|
| 1294 | +?>>EGM2008 5' (19MB)</option> |
|
| 1295 | + <option value="egm2008-2_5"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-2_5') { |
|
| 1296 | + print ' selected="selected"'; |
|
| 1297 | +} |
|
| 1298 | +?>>EGM2008 2.5' (75MB)</option> |
|
| 1299 | + <option value="egm2008-1"<?php if (isset($globalGeoidSource) && $globalGeoidSource == 'egm2008-1') { |
|
| 1300 | + print ' selected="selected"'; |
|
| 1301 | +} |
|
| 1302 | +?>>EGM2008 1' (470MB)</option> |
|
| 1003 | 1303 | </select> |
| 1004 | 1304 | <p class="help-block">The geoid is approximated by an "earth gravity model" (EGM).</p> |
| 1005 | 1305 | </p> |
@@ -1021,7 +1321,12 @@ discard block |
||
| 1021 | 1321 | </p> |
| 1022 | 1322 | <p> |
| 1023 | 1323 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 1024 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '1'; ?>" /> |
|
| 1324 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 1325 | + print $globalArchiveMonths; |
|
| 1326 | +} else { |
|
| 1327 | + echo '1'; |
|
| 1328 | +} |
|
| 1329 | +?>" /> |
|
| 1025 | 1330 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 1026 | 1331 | </p> |
| 1027 | 1332 | <p> |
@@ -1031,12 +1336,22 @@ discard block |
||
| 1031 | 1336 | </p> |
| 1032 | 1337 | <p> |
| 1033 | 1338 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 1034 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '1'; ?>" /> |
|
| 1339 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 1340 | + print $globalArchiveKeepMonths; |
|
| 1341 | +} else { |
|
| 1342 | + echo '1'; |
|
| 1343 | +} |
|
| 1344 | +?>" /> |
|
| 1035 | 1345 | <p class="help-block">0 to disable</p> |
| 1036 | 1346 | </p> |
| 1037 | 1347 | <p> |
| 1038 | 1348 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 1039 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '1'; ?>" /> |
|
| 1349 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 1350 | + print $globalArchiveKeepTrackMonths; |
|
| 1351 | +} else { |
|
| 1352 | + echo '1'; |
|
| 1353 | +} |
|
| 1354 | +?>" /> |
|
| 1040 | 1355 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 1041 | 1356 | </p> |
| 1042 | 1357 | <br /> |
@@ -1046,7 +1361,12 @@ discard block |
||
| 1046 | 1361 | <p class="help-block">Uncheck if the script is running as cron job. You should always run it as daemon when it's possible.</p> |
| 1047 | 1362 | <div id="cronends"> |
| 1048 | 1363 | <label for="cronend">Run script for xx seconds</label> |
| 1049 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 1364 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 1365 | + print $globalCronEnd; |
|
| 1366 | +} else { |
|
| 1367 | + print '0'; |
|
| 1368 | +} |
|
| 1369 | +?>" /> |
|
| 1050 | 1370 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 1051 | 1371 | </div> |
| 1052 | 1372 | </p> |
@@ -1105,20 +1425,40 @@ discard block |
||
| 1105 | 1425 | <br /> |
| 1106 | 1426 | <p> |
| 1107 | 1427 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 1108 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 1428 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 1429 | + echo $globalLiveInterval; |
|
| 1430 | +} else { |
|
| 1431 | + echo '200'; |
|
| 1432 | +} |
|
| 1433 | +?>" /> |
|
| 1109 | 1434 | </p> |
| 1110 | 1435 | <p> |
| 1111 | 1436 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 1112 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 1437 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 1438 | + echo $globalMapRefresh; |
|
| 1439 | +} else { |
|
| 1440 | + echo '30'; |
|
| 1441 | +} |
|
| 1442 | +?>" /> |
|
| 1113 | 1443 | </p> |
| 1114 | 1444 | <p> |
| 1115 | 1445 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 1116 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 1446 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 1447 | + echo $globalMapIdleTimeout; |
|
| 1448 | +} else { |
|
| 1449 | + echo '30'; |
|
| 1450 | +} |
|
| 1451 | +?>" /> |
|
| 1117 | 1452 | <p class="help-block">0 to disable</p> |
| 1118 | 1453 | </p> |
| 1119 | 1454 | <p> |
| 1120 | 1455 | <label for="minfetch">HTTP/file source fetch every xxx seconds</label> |
| 1121 | - <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) echo $globalMinFetch; else echo '20'; ?>" /> |
|
| 1456 | + <input type="number" name="minfetch" id="minfetch" value="<?php if (isset($globalMinFetch)) { |
|
| 1457 | + echo $globalMinFetch; |
|
| 1458 | +} else { |
|
| 1459 | + echo '20'; |
|
| 1460 | +} |
|
| 1461 | +?>" /> |
|
| 1122 | 1462 | </p> |
| 1123 | 1463 | <p> |
| 1124 | 1464 | <label for="bbox">Only display flights that we can see on screen (bounding box)</label> |
@@ -1137,12 +1477,20 @@ discard block |
||
| 1137 | 1477 | <br /> |
| 1138 | 1478 | <p> |
| 1139 | 1479 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 1140 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 1480 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 1481 | + echo $globalClosestMinDist; |
|
| 1482 | +} else { |
|
| 1483 | + echo '50'; |
|
| 1484 | +} |
|
| 1485 | +?>" /> |
|
| 1141 | 1486 | </p> |
| 1142 | 1487 | <br /> |
| 1143 | 1488 | <p> |
| 1144 | 1489 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 1145 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1490 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1491 | + echo $globalAircraftSize; |
|
| 1492 | +} |
|
| 1493 | +?>" /> |
|
| 1146 | 1494 | </p> |
| 1147 | 1495 | <br /> |
| 1148 | 1496 | <p> |
@@ -1161,22 +1509,42 @@ discard block |
||
| 1161 | 1509 | <br /> |
| 1162 | 1510 | <p> |
| 1163 | 1511 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 1164 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1512 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1513 | + echo $globalAircraftIconColor; |
|
| 1514 | +} else { |
|
| 1515 | + echo '1a3151'; |
|
| 1516 | +} |
|
| 1517 | +?>" /> |
|
| 1165 | 1518 | </p> |
| 1166 | 1519 | <br /> |
| 1167 | 1520 | <p> |
| 1168 | 1521 | <label for="marineiconcolor">Color of marine icon on map</label> |
| 1169 | - <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) echo $globalMarineIconColor; else echo '43d1d8'; ?>" /> |
|
| 1522 | + <input type="color" name="marineiconcolor" id="marineiconcolor" value="#<?php if (isset($globalMarineIconColor)) { |
|
| 1523 | + echo $globalMarineIconColor; |
|
| 1524 | +} else { |
|
| 1525 | + echo '43d1d8'; |
|
| 1526 | +} |
|
| 1527 | +?>" /> |
|
| 1170 | 1528 | </p> |
| 1171 | 1529 | <br /> |
| 1172 | 1530 | <p> |
| 1173 | 1531 | <label for="trackericoncolor">Color of tracker icon on map</label> |
| 1174 | - <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) echo $globalTrackerIconColor; else echo '1a3151'; ?>" /> |
|
| 1532 | + <input type="color" name="trackericoncolor" id="trackericoncolor" value="#<?php if (isset($globalTrackerIconColor)) { |
|
| 1533 | + echo $globalTrackerIconColor; |
|
| 1534 | +} else { |
|
| 1535 | + echo '1a3151'; |
|
| 1536 | +} |
|
| 1537 | +?>" /> |
|
| 1175 | 1538 | </p> |
| 1176 | 1539 | <br /> |
| 1177 | 1540 | <p> |
| 1178 | 1541 | <label for="satelliteiconcolor">Color of satellite icon on map</label> |
| 1179 | - <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) echo $globalSatelliteIconColor; else echo '1a3151'; ?>" /> |
|
| 1542 | + <input type="color" name="satelliteiconcolor" id="satelliteiconcolor" value="#<?php if (isset($globalSatelliteIconColor)) { |
|
| 1543 | + echo $globalSatelliteIconColor; |
|
| 1544 | +} else { |
|
| 1545 | + echo '1a3151'; |
|
| 1546 | +} |
|
| 1547 | +?>" /> |
|
| 1180 | 1548 | </p> |
| 1181 | 1549 | <?php |
| 1182 | 1550 | if (!is_writable('../cache')) { |
@@ -1200,14 +1568,27 @@ discard block |
||
| 1200 | 1568 | <p> |
| 1201 | 1569 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 1202 | 1570 | <div class="range"> |
| 1203 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 1204 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1571 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1572 | + echo $globalAirportZoom; |
|
| 1573 | +} else { |
|
| 1574 | + echo '7'; |
|
| 1575 | +} |
|
| 1576 | +?>" /> |
|
| 1577 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1578 | + echo $globalAirportZoom; |
|
| 1579 | +} else { |
|
| 1580 | + echo '7'; |
|
| 1581 | +} |
|
| 1582 | +?></output> |
|
| 1205 | 1583 | </div> |
| 1206 | 1584 | </p> |
| 1207 | 1585 | <br /> |
| 1208 | 1586 | <p> |
| 1209 | 1587 | <label for="customcss">Custom CSS web path</label> |
| 1210 | - <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) echo $globalCustomCSS; ?>" /> |
|
| 1588 | + <input type="text" name="customcss" id="customcss" value="<?php if (isset($globalCustomCSS)) { |
|
| 1589 | + echo $globalCustomCSS; |
|
| 1590 | +} |
|
| 1591 | +?>" /> |
|
| 1211 | 1592 | </p> |
| 1212 | 1593 | </fieldset> |
| 1213 | 1594 | <input type="submit" name="submit" value="Create/Update database & write setup" /> |
@@ -1234,8 +1615,12 @@ discard block |
||
| 1234 | 1615 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 1235 | 1616 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 1236 | 1617 | |
| 1237 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1238 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1618 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1619 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1620 | + } |
|
| 1621 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1622 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1623 | + } |
|
| 1239 | 1624 | |
| 1240 | 1625 | $_SESSION['database_root'] = $dbroot; |
| 1241 | 1626 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -1313,15 +1698,23 @@ discard block |
||
| 1313 | 1698 | $source_city = $_POST['source_city']; |
| 1314 | 1699 | $source_country = $_POST['source_country']; |
| 1315 | 1700 | $source_ref = $_POST['source_ref']; |
| 1316 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 1317 | - else $source_id = array(); |
|
| 1701 | + if (isset($source_id)) { |
|
| 1702 | + $source_id = $_POST['source_id']; |
|
| 1703 | + } else { |
|
| 1704 | + $source_id = array(); |
|
| 1705 | + } |
|
| 1318 | 1706 | |
| 1319 | 1707 | $sources = array(); |
| 1320 | 1708 | foreach ($source_name as $keys => $name) { |
| 1321 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1322 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1709 | + if (isset($source_id[$keys])) { |
|
| 1710 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1711 | + } else { |
|
| 1712 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1713 | + } |
|
| 1714 | + } |
|
| 1715 | + if (count($sources) > 0) { |
|
| 1716 | + $_SESSION['sources'] = $sources; |
|
| 1323 | 1717 | } |
| 1324 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 1325 | 1718 | |
| 1326 | 1719 | $newsurl = $_POST['newsurl']; |
| 1327 | 1720 | $newslng = $_POST['newslang']; |
@@ -1334,7 +1727,9 @@ discard block |
||
| 1334 | 1727 | $lng = $newslng[$newskey]; |
| 1335 | 1728 | if (isset($newsfeeds[$type][$lng])) { |
| 1336 | 1729 | $newsfeeds[$type][$lng] = array_merge($newsfeeds[$type][$lng],array($url)); |
| 1337 | - } else $newsfeeds[$type][$lng] = array($url); |
|
| 1730 | + } else { |
|
| 1731 | + $newsfeeds[$type][$lng] = array($url); |
|
| 1732 | + } |
|
| 1338 | 1733 | } |
| 1339 | 1734 | } |
| 1340 | 1735 | $settings = array_merge($settings,array('globalNewsFeeds' => $newsfeeds)); |
@@ -1359,17 +1754,29 @@ discard block |
||
| 1359 | 1754 | $datasource = filter_input(INPUT_POST,'datasource',FILTER_SANITIZE_STRING); |
| 1360 | 1755 | |
| 1361 | 1756 | $globalaircraft = filter_input(INPUT_POST,'globalaircraft',FILTER_SANITIZE_STRING); |
| 1362 | - if ($globalaircraft == 'aircraft') $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1363 | - else $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1757 | + if ($globalaircraft == 'aircraft') { |
|
| 1758 | + $settings = array_merge($settings,array('globalAircraft' => 'TRUE')); |
|
| 1759 | + } else { |
|
| 1760 | + $settings = array_merge($settings,array('globalAircraft' => 'FALSE')); |
|
| 1761 | + } |
|
| 1364 | 1762 | $globaltracker = filter_input(INPUT_POST,'globaltracker',FILTER_SANITIZE_STRING); |
| 1365 | - if ($globaltracker == 'tracker') $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1366 | - else $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1763 | + if ($globaltracker == 'tracker') { |
|
| 1764 | + $settings = array_merge($settings,array('globalTracker' => 'TRUE')); |
|
| 1765 | + } else { |
|
| 1766 | + $settings = array_merge($settings,array('globalTracker' => 'FALSE')); |
|
| 1767 | + } |
|
| 1367 | 1768 | $globalmarine = filter_input(INPUT_POST,'globalmarine',FILTER_SANITIZE_STRING); |
| 1368 | - if ($globalmarine == 'marine') $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1369 | - else $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1769 | + if ($globalmarine == 'marine') { |
|
| 1770 | + $settings = array_merge($settings,array('globalMarine' => 'TRUE')); |
|
| 1771 | + } else { |
|
| 1772 | + $settings = array_merge($settings,array('globalMarine' => 'FALSE')); |
|
| 1773 | + } |
|
| 1370 | 1774 | $globalsatellite = filter_input(INPUT_POST,'globalsatellite',FILTER_SANITIZE_STRING); |
| 1371 | - if ($globalsatellite == 'satellite') $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1372 | - else $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1775 | + if ($globalsatellite == 'satellite') { |
|
| 1776 | + $settings = array_merge($settings,array('globalSatellite' => 'TRUE')); |
|
| 1777 | + } else { |
|
| 1778 | + $settings = array_merge($settings,array('globalSatellite' => 'FALSE')); |
|
| 1779 | + } |
|
| 1373 | 1780 | |
| 1374 | 1781 | /* |
| 1375 | 1782 | $globalSBS1Hosts = array(); |
@@ -1391,23 +1798,37 @@ discard block |
||
| 1391 | 1798 | $name = $_POST['name']; |
| 1392 | 1799 | $format = $_POST['format']; |
| 1393 | 1800 | $timezones = $_POST['timezones']; |
| 1394 | - if (isset($_POST['sourcestats'])) $sourcestats = $_POST['sourcestats']; |
|
| 1395 | - else $sourcestats = array(); |
|
| 1396 | - if (isset($_POST['noarchive'])) $noarchive = $_POST['noarchive']; |
|
| 1397 | - else $noarchive = array(); |
|
| 1801 | + if (isset($_POST['sourcestats'])) { |
|
| 1802 | + $sourcestats = $_POST['sourcestats']; |
|
| 1803 | + } else { |
|
| 1804 | + $sourcestats = array(); |
|
| 1805 | + } |
|
| 1806 | + if (isset($_POST['noarchive'])) { |
|
| 1807 | + $noarchive = $_POST['noarchive']; |
|
| 1808 | + } else { |
|
| 1809 | + $noarchive = array(); |
|
| 1810 | + } |
|
| 1398 | 1811 | $gSources = array(); |
| 1399 | 1812 | $forcepilots = false; |
| 1400 | 1813 | foreach ($host as $key => $h) { |
| 1401 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 1402 | - else $cov = 'FALSE'; |
|
| 1403 | - if (isset($noarchive[$key]) && $noarchive[$key] == 1) $arch = 'TRUE'; |
|
| 1404 | - else $arch = 'FALSE'; |
|
| 1814 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1815 | + $cov = 'TRUE'; |
|
| 1816 | + } else { |
|
| 1817 | + $cov = 'FALSE'; |
|
| 1818 | + } |
|
| 1819 | + if (isset($noarchive[$key]) && $noarchive[$key] == 1) { |
|
| 1820 | + $arch = 'TRUE'; |
|
| 1821 | + } else { |
|
| 1822 | + $arch = 'FALSE'; |
|
| 1823 | + } |
|
| 1405 | 1824 | if (strpos($format[$key],'_callback')) { |
| 1406 | 1825 | $gSources[] = array('host' => $h, 'pass' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'TRUE'); |
| 1407 | 1826 | } elseif ($format[$key] != 'auto' || ($h != '' || $name[$key] != '')) { |
| 1408 | 1827 | $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov,'noarchive' => $arch,'timezone' => $timezones[$key],'callback' => 'FALSE'); |
| 1409 | 1828 | } |
| 1410 | - if ($format[$key] == 'airwhere') $forcepilots = true; |
|
| 1829 | + if ($format[$key] == 'airwhere') { |
|
| 1830 | + $forcepilots = true; |
|
| 1831 | + } |
|
| 1411 | 1832 | } |
| 1412 | 1833 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 1413 | 1834 | |
@@ -1438,7 +1859,9 @@ discard block |
||
| 1438 | 1859 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 1439 | 1860 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 1440 | 1861 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 1441 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1862 | + } else { |
|
| 1863 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1864 | + } |
|
| 1442 | 1865 | |
| 1443 | 1866 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 1444 | 1867 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1479,7 +1902,9 @@ discard block |
||
| 1479 | 1902 | |
| 1480 | 1903 | // Create in settings.php keys not yet configurable if not already here |
| 1481 | 1904 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1482 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1905 | + if (!isset($globalDebug)) { |
|
| 1906 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1907 | + } |
|
| 1483 | 1908 | |
| 1484 | 1909 | $resetyearstats = filter_input(INPUT_POST,'resetyearstats',FILTER_SANITIZE_STRING); |
| 1485 | 1910 | if ($resetyearstats == 'resetyearstats') { |
@@ -1522,37 +1947,56 @@ discard block |
||
| 1522 | 1947 | } |
| 1523 | 1948 | */ |
| 1524 | 1949 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1525 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1526 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1527 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1528 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1950 | + if ($globalsbs == 'sbs') { |
|
| 1951 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1952 | + } else { |
|
| 1953 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1954 | + } |
|
| 1955 | + if ($globalaprs == 'aprs') { |
|
| 1956 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1957 | + } else { |
|
| 1958 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1959 | + } |
|
| 1529 | 1960 | $va = false; |
| 1530 | 1961 | if ($globalivao == 'ivao') { |
| 1531 | 1962 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1532 | 1963 | $va = true; |
| 1533 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1964 | + } else { |
|
| 1965 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1966 | + } |
|
| 1534 | 1967 | if ($globalvatsim == 'vatsim') { |
| 1535 | 1968 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1536 | 1969 | $va = true; |
| 1537 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1970 | + } else { |
|
| 1971 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1972 | + } |
|
| 1538 | 1973 | if ($globalphpvms == 'phpvms') { |
| 1539 | 1974 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1540 | 1975 | $va = true; |
| 1541 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1976 | + } else { |
|
| 1977 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1978 | + } |
|
| 1542 | 1979 | if ($globalvam == 'vam') { |
| 1543 | 1980 | $settings = array_merge($settings,array('globalVAM' => 'TRUE')); |
| 1544 | 1981 | $va = true; |
| 1545 | - } else $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1982 | + } else { |
|
| 1983 | + $settings = array_merge($settings,array('globalVAM' => 'FALSE')); |
|
| 1984 | + } |
|
| 1546 | 1985 | if ($va) { |
| 1547 | 1986 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1548 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1987 | + } else { |
|
| 1988 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1989 | + } |
|
| 1549 | 1990 | if ($globalva == 'va' || $va) { |
| 1550 | 1991 | $settings = array_merge($settings,array('globalVA' => 'TRUE')); |
| 1551 | 1992 | $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
| 1552 | 1993 | } else { |
| 1553 | 1994 | $settings = array_merge($settings,array('globalVA' => 'FALSE')); |
| 1554 | - if ($forcepilots) $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1555 | - else $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1995 | + if ($forcepilots) { |
|
| 1996 | + $settings = array_merge($settings,array('globalUsePilot' => 'TRUE','globalUseOwner' => 'FALSE')); |
|
| 1997 | + } else { |
|
| 1998 | + $settings = array_merge($settings,array('globalUsePilot' => 'FALSE','globalUseOwner' => 'TRUE')); |
|
| 1999 | + } |
|
| 1556 | 2000 | } |
| 1557 | 2001 | if ($globalvm == 'vm') { |
| 1558 | 2002 | $settings = array_merge($settings,array('globalVM' => 'TRUE')); |
@@ -1812,7 +2256,9 @@ discard block |
||
| 1812 | 2256 | $graphhopper = filter_input(INPUT_POST,'graphhopper',FILTER_SANITIZE_STRING); |
| 1813 | 2257 | $settings = array_merge($settings,array('globalGraphHopperKey' => $graphhopper)); |
| 1814 | 2258 | |
| 1815 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2259 | + if (!isset($globalTransaction)) { |
|
| 2260 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 2261 | + } |
|
| 1816 | 2262 | |
| 1817 | 2263 | // Set some defaults values... |
| 1818 | 2264 | if (!isset($globalAircraftImageSources)) { |
@@ -1827,15 +2273,23 @@ discard block |
||
| 1827 | 2273 | |
| 1828 | 2274 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1829 | 2275 | |
| 1830 | - if ($error == '') settings::modify_settings($settings); |
|
| 1831 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 2276 | + if ($error == '') { |
|
| 2277 | + settings::modify_settings($settings); |
|
| 2278 | + } |
|
| 2279 | + if ($error == '') { |
|
| 2280 | + settings::comment_settings($settings_comment); |
|
| 2281 | + } |
|
| 1832 | 2282 | if ($error != '') { |
| 1833 | 2283 | print '<div class="info column">'.$error.'</div>'; |
| 1834 | 2284 | require('../footer.php'); |
| 1835 | 2285 | exit; |
| 1836 | 2286 | } else { |
| 1837 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1838 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 2287 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 2288 | + $_SESSION['waypoints'] = 1; |
|
| 2289 | + } |
|
| 2290 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 2291 | + $_SESSION['owner'] = 1; |
|
| 2292 | + } |
|
| 1839 | 2293 | if (isset($_POST['createdb'])) { |
| 1840 | 2294 | $_SESSION['install'] = 'database_create'; |
| 1841 | 2295 | } else { |
@@ -1872,10 +2326,18 @@ discard block |
||
| 1872 | 2326 | $popw = false; |
| 1873 | 2327 | foreach ($_SESSION['done'] as $done) { |
| 1874 | 2328 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1875 | - if ($done == 'Create database') $pop = true; |
|
| 1876 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1877 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1878 | - if ($_SESSION['install'] == 'waypoints') $popw = true; |
|
| 2329 | + if ($done == 'Create database') { |
|
| 2330 | + $pop = true; |
|
| 2331 | + } |
|
| 2332 | + if ($_SESSION['install'] == 'database_create') { |
|
| 2333 | + $pop = true; |
|
| 2334 | + } |
|
| 2335 | + if ($_SESSION['install'] == 'database_import') { |
|
| 2336 | + $popi = true; |
|
| 2337 | + } |
|
| 2338 | + if ($_SESSION['install'] == 'waypoints') { |
|
| 2339 | + $popw = true; |
|
| 2340 | + } |
|
| 1879 | 2341 | } |
| 1880 | 2342 | if ($pop) { |
| 1881 | 2343 | sleep(5); |
@@ -1886,7 +2348,9 @@ discard block |
||
| 1886 | 2348 | } else if ($popw) { |
| 1887 | 2349 | sleep(5); |
| 1888 | 2350 | print '<li>Populate waypoints database....<img src="../images/loading.gif" /></li>'; |
| 1889 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2351 | + } else { |
|
| 2352 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 2353 | + } |
|
| 1890 | 2354 | print '</div></ul>'; |
| 1891 | 2355 | print '<div id="error"></div>'; |
| 1892 | 2356 | /* foreach ($_SESSION['done'] as $done) { |