@@ -95,38 +95,38 @@ discard block |
||
| 95 | 95 | try { |
| 96 | 96 | //$Connection = new Connection(); |
| 97 | 97 | $sth = $Connection->db->prepare($query); |
| 98 | - $sth->execute(array(':source' => $database_file)); |
|
| 99 | - } catch(PDOException $e) { |
|
| 100 | - return "error : ".$e->getMessage(); |
|
| 101 | - } |
|
| 98 | + $sth->execute(array(':source' => $database_file)); |
|
| 99 | + } catch(PDOException $e) { |
|
| 100 | + return "error : ".$e->getMessage(); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 104 | - update_db::connect_sqlite($database_file); |
|
| 103 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 104 | + update_db::connect_sqlite($database_file); |
|
| 105 | 105 | //$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'; |
| 106 | 106 | $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"; |
| 107 | 107 | try { |
| 108 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 109 | - $sth->execute(); |
|
| 110 | - } catch(PDOException $e) { |
|
| 111 | - return "error : ".$e->getMessage(); |
|
| 112 | - } |
|
| 108 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 109 | + $sth->execute(); |
|
| 110 | + } catch(PDOException $e) { |
|
| 111 | + return "error : ".$e->getMessage(); |
|
| 112 | + } |
|
| 113 | 113 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
| 114 | 114 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
| 115 | 115 | $Connection = new Connection(); |
| 116 | 116 | $sth_dest = $Connection->db->prepare($query_dest); |
| 117 | 117 | try { |
| 118 | 118 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 119 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 119 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 120 | 120 | //$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); |
| 121 | 121 | $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); |
| 122 | 122 | $sth_dest->execute($query_dest_values); |
| 123 | - } |
|
| 123 | + } |
|
| 124 | 124 | if ($globalTransaction) $Connection->db->commit(); |
| 125 | 125 | } catch(PDOException $e) { |
| 126 | 126 | if ($globalTransaction) $Connection->db->rollBack(); |
| 127 | 127 | return "error : ".$e->getMessage(); |
| 128 | 128 | } |
| 129 | - return ''; |
|
| 129 | + return ''; |
|
| 130 | 130 | } |
| 131 | 131 | public static function retrieve_route_oneworld($database_file) { |
| 132 | 132 | global $globalDebug, $globalTransaction; |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | try { |
| 138 | 138 | //$Connection = new Connection(); |
| 139 | 139 | $sth = $Connection->db->prepare($query); |
| 140 | - $sth->execute(array(':source' => 'oneworld')); |
|
| 141 | - } catch(PDOException $e) { |
|
| 142 | - return "error : ".$e->getMessage(); |
|
| 143 | - } |
|
| 140 | + $sth->execute(array(':source' => 'oneworld')); |
|
| 141 | + } catch(PDOException $e) { |
|
| 142 | + return "error : ".$e->getMessage(); |
|
| 143 | + } |
|
| 144 | 144 | |
| 145 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 145 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 146 | 146 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 147 | 147 | $Spotter = new Spotter(); |
| 148 | 148 | if ($fh = fopen($database_file,"r")) { |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | } |
| 167 | 167 | if ($globalTransaction) $Connection->db->commit(); |
| 168 | 168 | } |
| 169 | - return ''; |
|
| 169 | + return ''; |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | public static function retrieve_route_skyteam($database_file) { |
@@ -178,12 +178,12 @@ discard block |
||
| 178 | 178 | try { |
| 179 | 179 | //$Connection = new Connection(); |
| 180 | 180 | $sth = $Connection->db->prepare($query); |
| 181 | - $sth->execute(array(':source' => 'skyteam')); |
|
| 182 | - } catch(PDOException $e) { |
|
| 183 | - return "error : ".$e->getMessage(); |
|
| 184 | - } |
|
| 181 | + $sth->execute(array(':source' => 'skyteam')); |
|
| 182 | + } catch(PDOException $e) { |
|
| 183 | + return "error : ".$e->getMessage(); |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 186 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 187 | 187 | |
| 188 | 188 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 189 | 189 | $Spotter = new Spotter(); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | return "error : ".$e->getMessage(); |
| 210 | 210 | } |
| 211 | 211 | } |
| 212 | - return ''; |
|
| 212 | + return ''; |
|
| 213 | 213 | } |
| 214 | 214 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
| 215 | 215 | global $globalTransaction; |
@@ -218,27 +218,27 @@ discard block |
||
| 218 | 218 | try { |
| 219 | 219 | $Connection = new Connection(); |
| 220 | 220 | $sth = $Connection->db->prepare($query); |
| 221 | - $sth->execute(array(':source' => $database_file)); |
|
| 222 | - } catch(PDOException $e) { |
|
| 223 | - return "error : ".$e->getMessage(); |
|
| 224 | - } |
|
| 221 | + $sth->execute(array(':source' => $database_file)); |
|
| 222 | + } catch(PDOException $e) { |
|
| 223 | + return "error : ".$e->getMessage(); |
|
| 224 | + } |
|
| 225 | 225 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
| 226 | 226 | try { |
| 227 | 227 | $Connection = new Connection(); |
| 228 | 228 | $sth = $Connection->db->prepare($query); |
| 229 | - $sth->execute(array(':source' => $database_file)); |
|
| 230 | - } catch(PDOException $e) { |
|
| 231 | - return "error : ".$e->getMessage(); |
|
| 232 | - } |
|
| 229 | + $sth->execute(array(':source' => $database_file)); |
|
| 230 | + } catch(PDOException $e) { |
|
| 231 | + return "error : ".$e->getMessage(); |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - update_db::connect_sqlite($database_file); |
|
| 234 | + update_db::connect_sqlite($database_file); |
|
| 235 | 235 | $query = 'select * from Aircraft'; |
| 236 | 236 | try { |
| 237 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 238 | - $sth->execute(); |
|
| 239 | - } catch(PDOException $e) { |
|
| 240 | - return "error : ".$e->getMessage(); |
|
| 241 | - } |
|
| 237 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 238 | + $sth->execute(); |
|
| 239 | + } catch(PDOException $e) { |
|
| 240 | + return "error : ".$e->getMessage(); |
|
| 241 | + } |
|
| 242 | 242 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 243 | 243 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
| 244 | 244 | |
@@ -249,17 +249,17 @@ discard block |
||
| 249 | 249 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 250 | 250 | try { |
| 251 | 251 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 252 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 252 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 253 | 253 | //$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']); |
| 254 | 254 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 255 | 255 | else $type = null; |
| 256 | 256 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 257 | 257 | $sth_dest->execute($query_dest_values); |
| 258 | 258 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 259 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 260 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
| 259 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 260 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
| 261 | 261 | } |
| 262 | - } |
|
| 262 | + } |
|
| 263 | 263 | if ($globalTransaction) $Connection->db->commit(); |
| 264 | 264 | } catch(PDOException $e) { |
| 265 | 265 | return "error : ".$e->getMessage(); |
@@ -270,10 +270,10 @@ discard block |
||
| 270 | 270 | try { |
| 271 | 271 | $Connection = new Connection(); |
| 272 | 272 | $sth = $Connection->db->prepare($query); |
| 273 | - $sth->execute(array(':source' => $database_file)); |
|
| 274 | - } catch(PDOException $e) { |
|
| 275 | - return "error : ".$e->getMessage(); |
|
| 276 | - } |
|
| 273 | + $sth->execute(array(':source' => $database_file)); |
|
| 274 | + } catch(PDOException $e) { |
|
| 275 | + return "error : ".$e->getMessage(); |
|
| 276 | + } |
|
| 277 | 277 | return ''; |
| 278 | 278 | } |
| 279 | 279 | |
@@ -285,10 +285,10 @@ discard block |
||
| 285 | 285 | try { |
| 286 | 286 | $Connection = new Connection(); |
| 287 | 287 | $sth = $Connection->db->prepare($query); |
| 288 | - $sth->execute(array(':source' => $database_file)); |
|
| 289 | - } catch(PDOException $e) { |
|
| 290 | - return "error : ".$e->getMessage(); |
|
| 291 | - } |
|
| 288 | + $sth->execute(array(':source' => $database_file)); |
|
| 289 | + } catch(PDOException $e) { |
|
| 290 | + return "error : ".$e->getMessage(); |
|
| 291 | + } |
|
| 292 | 292 | |
| 293 | 293 | if ($fh = fopen($database_file,"r")) { |
| 294 | 294 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -298,26 +298,26 @@ discard block |
||
| 298 | 298 | $sth_dest = $Connection->db->prepare($query_dest); |
| 299 | 299 | try { |
| 300 | 300 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 301 | - while (!feof($fh)) { |
|
| 302 | - $values = array(); |
|
| 303 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 301 | + while (!feof($fh)) { |
|
| 302 | + $values = array(); |
|
| 303 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
| 304 | 304 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 305 | - $values['ModeS'] = substr($line,0,6); |
|
| 306 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 307 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 308 | - // Check if we can find ICAO, else set it to GLID |
|
| 309 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 310 | - $search_more = ''; |
|
| 311 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 312 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 313 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 305 | + $values['ModeS'] = substr($line,0,6); |
|
| 306 | + $values['Registration'] = trim(substr($line,69,6)); |
|
| 307 | + $aircraft_name = trim(substr($line,48,6)); |
|
| 308 | + // Check if we can find ICAO, else set it to GLID |
|
| 309 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 310 | + $search_more = ''; |
|
| 311 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 312 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 313 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 314 | 314 | try { |
| 315 | - $sth_search->execute(); |
|
| 316 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 317 | - //if (count($result) > 0) { |
|
| 318 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
| 319 | - $values['ICAOTypeCode'] = $result['icao']; |
|
| 320 | - } |
|
| 315 | + $sth_search->execute(); |
|
| 316 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 317 | + //if (count($result) > 0) { |
|
| 318 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 319 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 320 | + } |
|
| 321 | 321 | } catch(PDOException $e) { |
| 322 | 322 | return "error : ".$e->getMessage(); |
| 323 | 323 | } |
@@ -340,10 +340,10 @@ discard block |
||
| 340 | 340 | try { |
| 341 | 341 | $Connection = new Connection(); |
| 342 | 342 | $sth = $Connection->db->prepare($query); |
| 343 | - $sth->execute(array(':source' => $database_file)); |
|
| 344 | - } catch(PDOException $e) { |
|
| 345 | - return "error : ".$e->getMessage(); |
|
| 346 | - } |
|
| 343 | + $sth->execute(array(':source' => $database_file)); |
|
| 344 | + } catch(PDOException $e) { |
|
| 345 | + return "error : ".$e->getMessage(); |
|
| 346 | + } |
|
| 347 | 347 | return ''; |
| 348 | 348 | } |
| 349 | 349 | |
@@ -354,10 +354,10 @@ discard block |
||
| 354 | 354 | try { |
| 355 | 355 | $Connection = new Connection(); |
| 356 | 356 | $sth = $Connection->db->prepare($query); |
| 357 | - $sth->execute(array(':source' => $database_file)); |
|
| 358 | - } catch(PDOException $e) { |
|
| 359 | - return "error : ".$e->getMessage(); |
|
| 360 | - } |
|
| 357 | + $sth->execute(array(':source' => $database_file)); |
|
| 358 | + } catch(PDOException $e) { |
|
| 359 | + return "error : ".$e->getMessage(); |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | 362 | if ($fh = fopen($database_file,"r")) { |
| 363 | 363 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -368,25 +368,25 @@ discard block |
||
| 368 | 368 | try { |
| 369 | 369 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 370 | 370 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 371 | - while (!feof($fh)) { |
|
| 372 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 371 | + while (!feof($fh)) { |
|
| 372 | + $line = fgetcsv($fh,9999,',',"'"); |
|
| 373 | 373 | |
| 374 | 374 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 375 | 375 | //print_r($line); |
| 376 | - $values['ModeS'] = $line[1]; |
|
| 377 | - $values['Registration'] = $line[3]; |
|
| 378 | - $values['ICAOTypeCode'] = ''; |
|
| 379 | - $aircraft_name = $line[2]; |
|
| 380 | - // Check if we can find ICAO, else set it to GLID |
|
| 381 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 382 | - $search_more = ''; |
|
| 383 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 384 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 385 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 376 | + $values['ModeS'] = $line[1]; |
|
| 377 | + $values['Registration'] = $line[3]; |
|
| 378 | + $values['ICAOTypeCode'] = ''; |
|
| 379 | + $aircraft_name = $line[2]; |
|
| 380 | + // Check if we can find ICAO, else set it to GLID |
|
| 381 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 382 | + $search_more = ''; |
|
| 383 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 384 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 385 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 386 | 386 | try { |
| 387 | - $sth_search->execute(); |
|
| 388 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 389 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 387 | + $sth_search->execute(); |
|
| 388 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 389 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 390 | 390 | } catch(PDOException $e) { |
| 391 | 391 | return "error : ".$e->getMessage(); |
| 392 | 392 | } |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | try { |
| 410 | 410 | $Connection = new Connection(); |
| 411 | 411 | $sth = $Connection->db->prepare($query); |
| 412 | - $sth->execute(array(':source' => $database_file)); |
|
| 413 | - } catch(PDOException $e) { |
|
| 414 | - return "error : ".$e->getMessage(); |
|
| 415 | - } |
|
| 412 | + $sth->execute(array(':source' => $database_file)); |
|
| 413 | + } catch(PDOException $e) { |
|
| 414 | + return "error : ".$e->getMessage(); |
|
| 415 | + } |
|
| 416 | 416 | return ''; |
| 417 | 417 | } |
| 418 | 418 | |
@@ -423,16 +423,16 @@ discard block |
||
| 423 | 423 | try { |
| 424 | 424 | $Connection = new Connection(); |
| 425 | 425 | $sth = $Connection->db->prepare($query); |
| 426 | - $sth->execute(array(':source' => $database_file)); |
|
| 427 | - } catch(PDOException $e) { |
|
| 428 | - return "error : ".$e->getMessage(); |
|
| 429 | - } |
|
| 426 | + $sth->execute(array(':source' => $database_file)); |
|
| 427 | + } catch(PDOException $e) { |
|
| 428 | + return "error : ".$e->getMessage(); |
|
| 429 | + } |
|
| 430 | 430 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 431 | 431 | $Spotter = new Spotter(); |
| 432 | 432 | if ($fh = fopen($database_file,"r")) { |
| 433 | 433 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 434 | 434 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 435 | - $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
| 435 | + $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
|
| 436 | 436 | |
| 437 | 437 | $Connection = new Connection(); |
| 438 | 438 | $sth_dest = $Connection->db->prepare($query_dest); |
@@ -440,126 +440,126 @@ discard block |
||
| 440 | 440 | try { |
| 441 | 441 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 442 | 442 | $tmp = fgetcsv($fh,9999,',','"'); |
| 443 | - while (!feof($fh)) { |
|
| 444 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 445 | - $values = array(); |
|
| 446 | - //print_r($line); |
|
| 447 | - if ($country == 'F') { |
|
| 448 | - $values['registration'] = $line[0]; |
|
| 449 | - $values['base'] = $line[4]; |
|
| 450 | - $values['owner'] = $line[5]; |
|
| 451 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 452 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 453 | - $values['cancel'] = $line[7]; |
|
| 443 | + while (!feof($fh)) { |
|
| 444 | + $line = fgetcsv($fh,9999,',','"'); |
|
| 445 | + $values = array(); |
|
| 446 | + //print_r($line); |
|
| 447 | + if ($country == 'F') { |
|
| 448 | + $values['registration'] = $line[0]; |
|
| 449 | + $values['base'] = $line[4]; |
|
| 450 | + $values['owner'] = $line[5]; |
|
| 451 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 452 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 453 | + $values['cancel'] = $line[7]; |
|
| 454 | 454 | } elseif ($country == 'EI') { |
| 455 | - // TODO : add modeS & reg to aircraft_modes |
|
| 456 | - $values['registration'] = $line[0]; |
|
| 457 | - $values['base'] = $line[3]; |
|
| 458 | - $values['owner'] = $line[2]; |
|
| 459 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 460 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 461 | - $values['cancel'] = ''; |
|
| 462 | - $values['modes'] = $line[7]; |
|
| 463 | - $values['icao'] = $line[8]; |
|
| 455 | + // TODO : add modeS & reg to aircraft_modes |
|
| 456 | + $values['registration'] = $line[0]; |
|
| 457 | + $values['base'] = $line[3]; |
|
| 458 | + $values['owner'] = $line[2]; |
|
| 459 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 460 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 461 | + $values['cancel'] = ''; |
|
| 462 | + $values['modes'] = $line[7]; |
|
| 463 | + $values['icao'] = $line[8]; |
|
| 464 | 464 | |
| 465 | 465 | } elseif ($country == 'HB') { |
| 466 | - // TODO : add modeS & reg to aircraft_modes |
|
| 467 | - $values['registration'] = $line[0]; |
|
| 468 | - $values['base'] = null; |
|
| 469 | - $values['owner'] = $line[5]; |
|
| 470 | - $values['date_first_reg'] = null; |
|
| 471 | - $values['cancel'] = ''; |
|
| 472 | - $values['modes'] = $line[4]; |
|
| 473 | - $values['icao'] = $line[7]; |
|
| 466 | + // TODO : add modeS & reg to aircraft_modes |
|
| 467 | + $values['registration'] = $line[0]; |
|
| 468 | + $values['base'] = null; |
|
| 469 | + $values['owner'] = $line[5]; |
|
| 470 | + $values['date_first_reg'] = null; |
|
| 471 | + $values['cancel'] = ''; |
|
| 472 | + $values['modes'] = $line[4]; |
|
| 473 | + $values['icao'] = $line[7]; |
|
| 474 | 474 | } elseif ($country == 'OK') { |
| 475 | - // TODO : add modeS & reg to aircraft_modes |
|
| 476 | - $values['registration'] = $line[3]; |
|
| 477 | - $values['base'] = null; |
|
| 478 | - $values['owner'] = $line[5]; |
|
| 479 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 480 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 481 | - $values['cancel'] = ''; |
|
| 475 | + // TODO : add modeS & reg to aircraft_modes |
|
| 476 | + $values['registration'] = $line[3]; |
|
| 477 | + $values['base'] = null; |
|
| 478 | + $values['owner'] = $line[5]; |
|
| 479 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 480 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 481 | + $values['cancel'] = ''; |
|
| 482 | 482 | } elseif ($country == 'VH') { |
| 483 | - // TODO : add modeS & reg to aircraft_modes |
|
| 484 | - $values['registration'] = $line[0]; |
|
| 485 | - $values['base'] = null; |
|
| 486 | - $values['owner'] = $line[12]; |
|
| 487 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 488 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 489 | - |
|
| 490 | - $values['cancel'] = $line[39]; |
|
| 483 | + // TODO : add modeS & reg to aircraft_modes |
|
| 484 | + $values['registration'] = $line[0]; |
|
| 485 | + $values['base'] = null; |
|
| 486 | + $values['owner'] = $line[12]; |
|
| 487 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 488 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 489 | + |
|
| 490 | + $values['cancel'] = $line[39]; |
|
| 491 | 491 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
| 492 | - $values['registration'] = $line[0]; |
|
| 493 | - $values['base'] = null; |
|
| 494 | - $values['owner'] = $line[4]; |
|
| 495 | - $values['date_first_reg'] = null; |
|
| 496 | - $values['cancel'] = ''; |
|
| 492 | + $values['registration'] = $line[0]; |
|
| 493 | + $values['base'] = null; |
|
| 494 | + $values['owner'] = $line[4]; |
|
| 495 | + $values['date_first_reg'] = null; |
|
| 496 | + $values['cancel'] = ''; |
|
| 497 | 497 | } elseif ($country == 'CC') { |
| 498 | - $values['registration'] = $line[0]; |
|
| 499 | - $values['base'] = null; |
|
| 500 | - $values['owner'] = $line[6]; |
|
| 501 | - $values['date_first_reg'] = null; |
|
| 502 | - $values['cancel'] = ''; |
|
| 498 | + $values['registration'] = $line[0]; |
|
| 499 | + $values['base'] = null; |
|
| 500 | + $values['owner'] = $line[6]; |
|
| 501 | + $values['date_first_reg'] = null; |
|
| 502 | + $values['cancel'] = ''; |
|
| 503 | 503 | } elseif ($country == 'HJ') { |
| 504 | - $values['registration'] = $line[0]; |
|
| 505 | - $values['base'] = null; |
|
| 506 | - $values['owner'] = $line[8]; |
|
| 507 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 509 | - $values['cancel'] = ''; |
|
| 504 | + $values['registration'] = $line[0]; |
|
| 505 | + $values['base'] = null; |
|
| 506 | + $values['owner'] = $line[8]; |
|
| 507 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 508 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 509 | + $values['cancel'] = ''; |
|
| 510 | 510 | } elseif ($country == 'PP') { |
| 511 | - $values['registration'] = $line[0]; |
|
| 512 | - $values['base'] = null; |
|
| 513 | - $values['owner'] = $line[4]; |
|
| 514 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 515 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 516 | - $values['cancel'] = $line[7]; |
|
| 511 | + $values['registration'] = $line[0]; |
|
| 512 | + $values['base'] = null; |
|
| 513 | + $values['owner'] = $line[4]; |
|
| 514 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 515 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 516 | + $values['cancel'] = $line[7]; |
|
| 517 | 517 | } elseif ($country == 'E7') { |
| 518 | - $values['registration'] = $line[0]; |
|
| 519 | - $values['base'] = null; |
|
| 520 | - $values['owner'] = $line[4]; |
|
| 521 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 522 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 523 | - $values['cancel'] = ''; |
|
| 518 | + $values['registration'] = $line[0]; |
|
| 519 | + $values['base'] = null; |
|
| 520 | + $values['owner'] = $line[4]; |
|
| 521 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 522 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 523 | + $values['cancel'] = ''; |
|
| 524 | 524 | } elseif ($country == '8Q') { |
| 525 | - $values['registration'] = $line[0]; |
|
| 526 | - $values['base'] = null; |
|
| 527 | - $values['owner'] = $line[3]; |
|
| 528 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 529 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 530 | - $values['cancel'] = ''; |
|
| 525 | + $values['registration'] = $line[0]; |
|
| 526 | + $values['base'] = null; |
|
| 527 | + $values['owner'] = $line[3]; |
|
| 528 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 529 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 530 | + $values['cancel'] = ''; |
|
| 531 | 531 | } elseif ($country == 'ZK') { |
| 532 | - $values['registration'] = $line[0]; |
|
| 533 | - $values['base'] = null; |
|
| 534 | - $values['owner'] = $line[3]; |
|
| 535 | - $values['date_first_reg'] = null; |
|
| 536 | - $values['cancel'] = ''; |
|
| 537 | - $values['modes'] = $line[5]; |
|
| 538 | - $values['icao'] = $line[9]; |
|
| 532 | + $values['registration'] = $line[0]; |
|
| 533 | + $values['base'] = null; |
|
| 534 | + $values['owner'] = $line[3]; |
|
| 535 | + $values['date_first_reg'] = null; |
|
| 536 | + $values['cancel'] = ''; |
|
| 537 | + $values['modes'] = $line[5]; |
|
| 538 | + $values['icao'] = $line[9]; |
|
| 539 | 539 | } elseif ($country == 'M') { |
| 540 | - $values['registration'] = $line[0]; |
|
| 541 | - $values['base'] = null; |
|
| 542 | - $values['owner'] = $line[6]; |
|
| 543 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 544 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 545 | - $values['modes'] = $line[4]; |
|
| 546 | - $values['icao'] = $line[10]; |
|
| 540 | + $values['registration'] = $line[0]; |
|
| 541 | + $values['base'] = null; |
|
| 542 | + $values['owner'] = $line[6]; |
|
| 543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 544 | + $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 545 | + $values['modes'] = $line[4]; |
|
| 546 | + $values['icao'] = $line[10]; |
|
| 547 | 547 | } elseif ($country == 'OY') { |
| 548 | - $values['registration'] = $line[0]; |
|
| 549 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 550 | - $values['modes'] = $line[5]; |
|
| 551 | - $values['icao'] = $line[6]; |
|
| 548 | + $values['registration'] = $line[0]; |
|
| 549 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 550 | + $values['modes'] = $line[5]; |
|
| 551 | + $values['icao'] = $line[6]; |
|
| 552 | 552 | } elseif ($country == 'PH') { |
| 553 | - $values['registration'] = $line[0]; |
|
| 554 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 555 | - $values['modes'] = $line[4]; |
|
| 556 | - $values['icao'] = $line[5]; |
|
| 553 | + $values['registration'] = $line[0]; |
|
| 554 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 555 | + $values['modes'] = $line[4]; |
|
| 556 | + $values['icao'] = $line[5]; |
|
| 557 | 557 | } elseif ($country == 'OM' || $country == 'TF') { |
| 558 | - $values['registration'] = $line[0]; |
|
| 559 | - $values['base'] = null; |
|
| 560 | - $values['owner'] = $line[3]; |
|
| 561 | - $values['date_first_reg'] = null; |
|
| 562 | - $values['cancel'] = ''; |
|
| 558 | + $values['registration'] = $line[0]; |
|
| 559 | + $values['base'] = null; |
|
| 560 | + $values['owner'] = $line[3]; |
|
| 561 | + $values['date_first_reg'] = null; |
|
| 562 | + $values['cancel'] = ''; |
|
| 563 | 563 | } |
| 564 | 564 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
| 565 | 565 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | return "error : ".$e->getMessage(); |
| 693 | 693 | } |
| 694 | 694 | */ |
| 695 | - /* |
|
| 695 | + /* |
|
| 696 | 696 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
| 697 | 697 | try { |
| 698 | 698 | $Connection = new Connection(); |
@@ -937,10 +937,10 @@ discard block |
||
| 937 | 937 | try { |
| 938 | 938 | $Connection = new Connection(); |
| 939 | 939 | $sth = $Connection->db->prepare($query); |
| 940 | - $sth->execute(array(':source' => 'translation.csv')); |
|
| 941 | - } catch(PDOException $e) { |
|
| 942 | - return "error : ".$e->getMessage(); |
|
| 943 | - } |
|
| 940 | + $sth->execute(array(':source' => 'translation.csv')); |
|
| 941 | + } catch(PDOException $e) { |
|
| 942 | + return "error : ".$e->getMessage(); |
|
| 943 | + } |
|
| 944 | 944 | |
| 945 | 945 | |
| 946 | 946 | //update_db::unzip($out_file); |
@@ -959,21 +959,21 @@ discard block |
||
| 959 | 959 | $data = $row; |
| 960 | 960 | $operator = $data[2]; |
| 961 | 961 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
| 962 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 963 | - //echo substr($operator, 0, 2)."\n";; |
|
| 964 | - if (count($airline_array) > 0) { |
|
| 962 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 963 | + //echo substr($operator, 0, 2)."\n";; |
|
| 964 | + if (count($airline_array) > 0) { |
|
| 965 | 965 | //print_r($airline_array); |
| 966 | 966 | $operator = $airline_array[0]['icao'].substr($operator,2); |
| 967 | - } |
|
| 968 | - } |
|
| 967 | + } |
|
| 968 | + } |
|
| 969 | 969 | |
| 970 | 970 | $operator_correct = $data[3]; |
| 971 | 971 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 972 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 973 | - if (count($airline_array) > 0) { |
|
| 974 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 975 | - } |
|
| 976 | - } |
|
| 972 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 973 | + if (count($airline_array) > 0) { |
|
| 974 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 975 | + } |
|
| 976 | + } |
|
| 977 | 977 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 978 | 978 | try { |
| 979 | 979 | $sth = $Connection->db->prepare($query); |
@@ -987,7 +987,7 @@ discard block |
||
| 987 | 987 | //$Connection->db->commit(); |
| 988 | 988 | } |
| 989 | 989 | return ''; |
| 990 | - } |
|
| 990 | + } |
|
| 991 | 991 | |
| 992 | 992 | public static function translation_fam() { |
| 993 | 993 | global $tmp_dir, $globalTransaction; |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | //$Connection->db->commit(); |
| 1026 | 1026 | } |
| 1027 | 1027 | return ''; |
| 1028 | - } |
|
| 1028 | + } |
|
| 1029 | 1029 | |
| 1030 | 1030 | public static function diagrams_fam() { |
| 1031 | 1031 | global $tmp_dir, $globalTransaction; |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | $Connection->db->commit(); |
| 1052 | 1052 | } |
| 1053 | 1053 | return ''; |
| 1054 | - } |
|
| 1054 | + } |
|
| 1055 | 1055 | |
| 1056 | 1056 | /* |
| 1057 | 1057 | * This function use FAA public data. |
@@ -1063,19 +1063,19 @@ discard block |
||
| 1063 | 1063 | try { |
| 1064 | 1064 | $Connection = new Connection(); |
| 1065 | 1065 | $sth = $Connection->db->prepare($query); |
| 1066 | - $sth->execute(array(':source' => 'website_faa')); |
|
| 1067 | - } catch(PDOException $e) { |
|
| 1068 | - return "error : ".$e->getMessage(); |
|
| 1069 | - } |
|
| 1066 | + $sth->execute(array(':source' => 'website_faa')); |
|
| 1067 | + } catch(PDOException $e) { |
|
| 1068 | + return "error : ".$e->getMessage(); |
|
| 1069 | + } |
|
| 1070 | 1070 | |
| 1071 | 1071 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
| 1072 | 1072 | try { |
| 1073 | 1073 | $Connection = new Connection(); |
| 1074 | 1074 | $sth = $Connection->db->prepare($query); |
| 1075 | - $sth->execute(array(':source' => 'website_faa')); |
|
| 1076 | - } catch(PDOException $e) { |
|
| 1077 | - return "error : ".$e->getMessage(); |
|
| 1078 | - } |
|
| 1075 | + $sth->execute(array(':source' => 'website_faa')); |
|
| 1076 | + } catch(PDOException $e) { |
|
| 1077 | + return "error : ".$e->getMessage(); |
|
| 1078 | + } |
|
| 1079 | 1079 | |
| 1080 | 1080 | $delimiter = ","; |
| 1081 | 1081 | $mfr = array(); |
@@ -1243,7 +1243,7 @@ discard block |
||
| 1243 | 1243 | } |
| 1244 | 1244 | */ |
| 1245 | 1245 | return ''; |
| 1246 | - } |
|
| 1246 | + } |
|
| 1247 | 1247 | |
| 1248 | 1248 | public static function owner_fam() { |
| 1249 | 1249 | global $tmp_dir, $globalTransaction; |
@@ -1251,10 +1251,10 @@ discard block |
||
| 1251 | 1251 | try { |
| 1252 | 1252 | $Connection = new Connection(); |
| 1253 | 1253 | $sth = $Connection->db->prepare($query); |
| 1254 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 1255 | - } catch(PDOException $e) { |
|
| 1256 | - return "error : ".$e->getMessage(); |
|
| 1257 | - } |
|
| 1254 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 1255 | + } catch(PDOException $e) { |
|
| 1256 | + return "error : ".$e->getMessage(); |
|
| 1257 | + } |
|
| 1258 | 1258 | |
| 1259 | 1259 | $delimiter = "\t"; |
| 1260 | 1260 | $Connection = new Connection(); |
@@ -1280,7 +1280,7 @@ discard block |
||
| 1280 | 1280 | if ($globalTransaction) $Connection->db->commit(); |
| 1281 | 1281 | } |
| 1282 | 1282 | return ''; |
| 1283 | - } |
|
| 1283 | + } |
|
| 1284 | 1284 | |
| 1285 | 1285 | public static function routes_fam() { |
| 1286 | 1286 | global $tmp_dir, $globalTransaction, $globalDebug; |
@@ -1360,7 +1360,7 @@ discard block |
||
| 1360 | 1360 | if ($globalTransaction) $Connection->db->commit(); |
| 1361 | 1361 | } |
| 1362 | 1362 | return ''; |
| 1363 | - } |
|
| 1363 | + } |
|
| 1364 | 1364 | |
| 1365 | 1365 | public static function marine_identity_fam() { |
| 1366 | 1366 | global $tmp_dir, $globalTransaction; |
@@ -1368,10 +1368,10 @@ discard block |
||
| 1368 | 1368 | try { |
| 1369 | 1369 | $Connection = new Connection(); |
| 1370 | 1370 | $sth = $Connection->db->prepare($query); |
| 1371 | - $sth->execute(); |
|
| 1372 | - } catch(PDOException $e) { |
|
| 1373 | - return "error : ".$e->getMessage(); |
|
| 1374 | - } |
|
| 1371 | + $sth->execute(); |
|
| 1372 | + } catch(PDOException $e) { |
|
| 1373 | + return "error : ".$e->getMessage(); |
|
| 1374 | + } |
|
| 1375 | 1375 | |
| 1376 | 1376 | |
| 1377 | 1377 | //update_db::unzip($out_file); |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | if ($globalTransaction) $Connection->db->commit(); |
| 1402 | 1402 | } |
| 1403 | 1403 | return ''; |
| 1404 | - } |
|
| 1404 | + } |
|
| 1405 | 1405 | |
| 1406 | 1406 | public static function satellite_fam() { |
| 1407 | 1407 | global $tmp_dir, $globalTransaction; |
@@ -1472,7 +1472,7 @@ discard block |
||
| 1472 | 1472 | if ($globalTransaction) $Connection->db->commit(); |
| 1473 | 1473 | } |
| 1474 | 1474 | return ''; |
| 1475 | - } |
|
| 1475 | + } |
|
| 1476 | 1476 | |
| 1477 | 1477 | public static function tle($filename,$tletype) { |
| 1478 | 1478 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1483,10 +1483,10 @@ discard block |
||
| 1483 | 1483 | try { |
| 1484 | 1484 | $Connection = new Connection(); |
| 1485 | 1485 | $sth = $Connection->db->prepare($query); |
| 1486 | - $sth->execute(array(':source' => $filename)); |
|
| 1487 | - } catch(PDOException $e) { |
|
| 1488 | - return "error : ".$e->getMessage(); |
|
| 1489 | - } |
|
| 1486 | + $sth->execute(array(':source' => $filename)); |
|
| 1487 | + } catch(PDOException $e) { |
|
| 1488 | + return "error : ".$e->getMessage(); |
|
| 1489 | + } |
|
| 1490 | 1490 | |
| 1491 | 1491 | $Connection = new Connection(); |
| 1492 | 1492 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1521,7 +1521,7 @@ discard block |
||
| 1521 | 1521 | //$Connection->db->commit(); |
| 1522 | 1522 | } |
| 1523 | 1523 | return ''; |
| 1524 | - } |
|
| 1524 | + } |
|
| 1525 | 1525 | |
| 1526 | 1526 | public static function satellite_ucsdb($filename) { |
| 1527 | 1527 | global $tmp_dir, $globalTransaction; |
@@ -1781,11 +1781,11 @@ discard block |
||
| 1781 | 1781 | try { |
| 1782 | 1782 | $sth = $Connection->db->prepare($query); |
| 1783 | 1783 | $sth->execute(array( |
| 1784 | - ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
| 1785 | - ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
| 1786 | - ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
| 1787 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1788 | - ) |
|
| 1784 | + ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
|
| 1785 | + ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
|
| 1786 | + ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
|
| 1787 | + ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1788 | + ) |
|
| 1789 | 1789 | ); |
| 1790 | 1790 | } catch(PDOException $e) { |
| 1791 | 1791 | return "error : ".$e->getMessage(); |
@@ -1809,13 +1809,13 @@ discard block |
||
| 1809 | 1809 | //$Connection->db->commit(); |
| 1810 | 1810 | } |
| 1811 | 1811 | return ''; |
| 1812 | - } |
|
| 1812 | + } |
|
| 1813 | 1813 | |
| 1814 | 1814 | /** |
| 1815 | - * Convert a HTML table to an array |
|
| 1816 | - * @param String $data HTML page |
|
| 1817 | - * @return Array array of the tables in HTML page |
|
| 1818 | - */ |
|
| 1815 | + * Convert a HTML table to an array |
|
| 1816 | + * @param String $data HTML page |
|
| 1817 | + * @return Array array of the tables in HTML page |
|
| 1818 | + */ |
|
| 1819 | 1819 | /* |
| 1820 | 1820 | private static function table2array($data) { |
| 1821 | 1821 | $html = str_get_html($data); |
@@ -1845,11 +1845,11 @@ discard block |
||
| 1845 | 1845 | return(array_filter($tabledata)); |
| 1846 | 1846 | } |
| 1847 | 1847 | */ |
| 1848 | - /** |
|
| 1849 | - * Get data from form result |
|
| 1850 | - * @param String $url form URL |
|
| 1851 | - * @return String the result |
|
| 1852 | - */ |
|
| 1848 | + /** |
|
| 1849 | + * Get data from form result |
|
| 1850 | + * @param String $url form URL |
|
| 1851 | + * @return String the result |
|
| 1852 | + */ |
|
| 1853 | 1853 | /* |
| 1854 | 1854 | private static function getData($url) { |
| 1855 | 1855 | $ch = curl_init(); |
@@ -2008,7 +2008,7 @@ discard block |
||
| 2008 | 2008 | if ($globalTransaction) $Connection->db->commit(); |
| 2009 | 2009 | } |
| 2010 | 2010 | return ''; |
| 2011 | - } |
|
| 2011 | + } |
|
| 2012 | 2012 | |
| 2013 | 2013 | public static function update_airspace() { |
| 2014 | 2014 | global $tmp_dir, $globalDBdriver; |
@@ -2018,11 +2018,11 @@ discard block |
||
| 2018 | 2018 | $query = 'DROP TABLE airspace'; |
| 2019 | 2019 | try { |
| 2020 | 2020 | $sth = $Connection->db->prepare($query); |
| 2021 | - $sth->execute(); |
|
| 2022 | - } catch(PDOException $e) { |
|
| 2021 | + $sth->execute(); |
|
| 2022 | + } catch(PDOException $e) { |
|
| 2023 | 2023 | return "error : ".$e->getMessage(); |
| 2024 | - } |
|
| 2025 | - } |
|
| 2024 | + } |
|
| 2025 | + } |
|
| 2026 | 2026 | |
| 2027 | 2027 | |
| 2028 | 2028 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -2087,10 +2087,10 @@ discard block |
||
| 2087 | 2087 | $query = 'DROP TABLE countries'; |
| 2088 | 2088 | try { |
| 2089 | 2089 | $sth = $Connection->db->prepare($query); |
| 2090 | - $sth->execute(); |
|
| 2091 | - } catch(PDOException $e) { |
|
| 2092 | - echo "error : ".$e->getMessage(); |
|
| 2093 | - } |
|
| 2090 | + $sth->execute(); |
|
| 2091 | + } catch(PDOException $e) { |
|
| 2092 | + echo "error : ".$e->getMessage(); |
|
| 2093 | + } |
|
| 2094 | 2094 | } |
| 2095 | 2095 | if ($globalDBdriver == 'mysql') { |
| 2096 | 2096 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -2549,7 +2549,7 @@ discard block |
||
| 2549 | 2549 | $error = update_db::airlines_fam(); |
| 2550 | 2550 | update_db::insert_airlines_version($airlines_md5); |
| 2551 | 2551 | } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
| 2552 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2552 | + } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2553 | 2553 | } elseif ($globalDebug) echo "No update."; |
| 2554 | 2554 | } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
| 2555 | 2555 | if ($error != '') { |
@@ -3137,10 +3137,10 @@ discard block |
||
| 3137 | 3137 | try { |
| 3138 | 3138 | $Connection = new Connection(); |
| 3139 | 3139 | $sth = $Connection->db->prepare($query); |
| 3140 | - $sth->execute(); |
|
| 3141 | - } catch(PDOException $e) { |
|
| 3142 | - return "error : ".$e->getMessage(); |
|
| 3143 | - } |
|
| 3140 | + $sth->execute(); |
|
| 3141 | + } catch(PDOException $e) { |
|
| 3142 | + return "error : ".$e->getMessage(); |
|
| 3143 | + } |
|
| 3144 | 3144 | |
| 3145 | 3145 | $error = ''; |
| 3146 | 3146 | if ($globalDebug) echo "Notam : Download..."; |
@@ -3196,8 +3196,8 @@ discard block |
||
| 3196 | 3196 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
| 3197 | 3197 | $data['permanent'] = 0; |
| 3198 | 3198 | } else { |
| 3199 | - $data['date_end'] = NULL; |
|
| 3200 | - $data['permanent'] = 1; |
|
| 3199 | + $data['date_end'] = NULL; |
|
| 3200 | + $data['permanent'] = 1; |
|
| 3201 | 3201 | } |
| 3202 | 3202 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 3203 | 3203 | $NOTAM = new NOTAM(); |
@@ -3271,13 +3271,13 @@ discard block |
||
| 3271 | 3271 | try { |
| 3272 | 3272 | $Connection = new Connection(); |
| 3273 | 3273 | $sth = $Connection->db->prepare($query); |
| 3274 | - $sth->execute(); |
|
| 3275 | - } catch(PDOException $e) { |
|
| 3276 | - return "error : ".$e->getMessage(); |
|
| 3277 | - } |
|
| 3278 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3279 | - if ($row['nb'] > 0) return false; |
|
| 3280 | - else return true; |
|
| 3274 | + $sth->execute(); |
|
| 3275 | + } catch(PDOException $e) { |
|
| 3276 | + return "error : ".$e->getMessage(); |
|
| 3277 | + } |
|
| 3278 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3279 | + if ($row['nb'] > 0) return false; |
|
| 3280 | + else return true; |
|
| 3281 | 3281 | } |
| 3282 | 3282 | |
| 3283 | 3283 | public static function insert_last_update() { |
@@ -3286,10 +3286,10 @@ discard block |
||
| 3286 | 3286 | try { |
| 3287 | 3287 | $Connection = new Connection(); |
| 3288 | 3288 | $sth = $Connection->db->prepare($query); |
| 3289 | - $sth->execute(); |
|
| 3290 | - } catch(PDOException $e) { |
|
| 3291 | - return "error : ".$e->getMessage(); |
|
| 3292 | - } |
|
| 3289 | + $sth->execute(); |
|
| 3290 | + } catch(PDOException $e) { |
|
| 3291 | + return "error : ".$e->getMessage(); |
|
| 3292 | + } |
|
| 3293 | 3293 | } |
| 3294 | 3294 | |
| 3295 | 3295 | public static function check_airspace_version($version) { |
@@ -3297,13 +3297,13 @@ discard block |
||
| 3297 | 3297 | try { |
| 3298 | 3298 | $Connection = new Connection(); |
| 3299 | 3299 | $sth = $Connection->db->prepare($query); |
| 3300 | - $sth->execute(array(':version' => $version)); |
|
| 3301 | - } catch(PDOException $e) { |
|
| 3302 | - return "error : ".$e->getMessage(); |
|
| 3303 | - } |
|
| 3304 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3305 | - if ($row['nb'] > 0) return true; |
|
| 3306 | - else return false; |
|
| 3300 | + $sth->execute(array(':version' => $version)); |
|
| 3301 | + } catch(PDOException $e) { |
|
| 3302 | + return "error : ".$e->getMessage(); |
|
| 3303 | + } |
|
| 3304 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3305 | + if ($row['nb'] > 0) return true; |
|
| 3306 | + else return false; |
|
| 3307 | 3307 | } |
| 3308 | 3308 | |
| 3309 | 3309 | public static function check_geoid_version($version) { |
@@ -3311,13 +3311,13 @@ discard block |
||
| 3311 | 3311 | try { |
| 3312 | 3312 | $Connection = new Connection(); |
| 3313 | 3313 | $sth = $Connection->db->prepare($query); |
| 3314 | - $sth->execute(array(':version' => $version)); |
|
| 3315 | - } catch(PDOException $e) { |
|
| 3316 | - return "error : ".$e->getMessage(); |
|
| 3317 | - } |
|
| 3318 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3319 | - if ($row['nb'] > 0) return true; |
|
| 3320 | - else return false; |
|
| 3314 | + $sth->execute(array(':version' => $version)); |
|
| 3315 | + } catch(PDOException $e) { |
|
| 3316 | + return "error : ".$e->getMessage(); |
|
| 3317 | + } |
|
| 3318 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3319 | + if ($row['nb'] > 0) return true; |
|
| 3320 | + else return false; |
|
| 3321 | 3321 | } |
| 3322 | 3322 | |
| 3323 | 3323 | public static function check_marine_identity_version($version) { |
@@ -3431,10 +3431,10 @@ discard block |
||
| 3431 | 3431 | try { |
| 3432 | 3432 | $Connection = new Connection(); |
| 3433 | 3433 | $sth = $Connection->db->prepare($query); |
| 3434 | - $sth->execute(array(':version' => $version)); |
|
| 3435 | - } catch(PDOException $e) { |
|
| 3436 | - return "error : ".$e->getMessage(); |
|
| 3437 | - } |
|
| 3434 | + $sth->execute(array(':version' => $version)); |
|
| 3435 | + } catch(PDOException $e) { |
|
| 3436 | + return "error : ".$e->getMessage(); |
|
| 3437 | + } |
|
| 3438 | 3438 | } |
| 3439 | 3439 | |
| 3440 | 3440 | public static function insert_marine_identity_version($version) { |
@@ -3482,13 +3482,13 @@ discard block |
||
| 3482 | 3482 | try { |
| 3483 | 3483 | $Connection = new Connection(); |
| 3484 | 3484 | $sth = $Connection->db->prepare($query); |
| 3485 | - $sth->execute(); |
|
| 3486 | - } catch(PDOException $e) { |
|
| 3487 | - return "error : ".$e->getMessage(); |
|
| 3488 | - } |
|
| 3489 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3490 | - if ($row['nb'] > 0) return false; |
|
| 3491 | - else return true; |
|
| 3485 | + $sth->execute(); |
|
| 3486 | + } catch(PDOException $e) { |
|
| 3487 | + return "error : ".$e->getMessage(); |
|
| 3488 | + } |
|
| 3489 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3490 | + if ($row['nb'] > 0) return false; |
|
| 3491 | + else return true; |
|
| 3492 | 3492 | } |
| 3493 | 3493 | |
| 3494 | 3494 | public static function insert_last_notam_update() { |
@@ -3497,10 +3497,10 @@ discard block |
||
| 3497 | 3497 | try { |
| 3498 | 3498 | $Connection = new Connection(); |
| 3499 | 3499 | $sth = $Connection->db->prepare($query); |
| 3500 | - $sth->execute(); |
|
| 3501 | - } catch(PDOException $e) { |
|
| 3502 | - return "error : ".$e->getMessage(); |
|
| 3503 | - } |
|
| 3500 | + $sth->execute(); |
|
| 3501 | + } catch(PDOException $e) { |
|
| 3502 | + return "error : ".$e->getMessage(); |
|
| 3503 | + } |
|
| 3504 | 3504 | } |
| 3505 | 3505 | |
| 3506 | 3506 | public static function check_last_airspace_update() { |
@@ -3513,13 +3513,13 @@ discard block |
||
| 3513 | 3513 | try { |
| 3514 | 3514 | $Connection = new Connection(); |
| 3515 | 3515 | $sth = $Connection->db->prepare($query); |
| 3516 | - $sth->execute(); |
|
| 3517 | - } catch(PDOException $e) { |
|
| 3518 | - return "error : ".$e->getMessage(); |
|
| 3519 | - } |
|
| 3520 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3521 | - if ($row['nb'] > 0) return false; |
|
| 3522 | - else return true; |
|
| 3516 | + $sth->execute(); |
|
| 3517 | + } catch(PDOException $e) { |
|
| 3518 | + return "error : ".$e->getMessage(); |
|
| 3519 | + } |
|
| 3520 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3521 | + if ($row['nb'] > 0) return false; |
|
| 3522 | + else return true; |
|
| 3523 | 3523 | } |
| 3524 | 3524 | |
| 3525 | 3525 | public static function insert_last_airspace_update() { |
@@ -3528,10 +3528,10 @@ discard block |
||
| 3528 | 3528 | try { |
| 3529 | 3529 | $Connection = new Connection(); |
| 3530 | 3530 | $sth = $Connection->db->prepare($query); |
| 3531 | - $sth->execute(); |
|
| 3532 | - } catch(PDOException $e) { |
|
| 3533 | - return "error : ".$e->getMessage(); |
|
| 3534 | - } |
|
| 3531 | + $sth->execute(); |
|
| 3532 | + } catch(PDOException $e) { |
|
| 3533 | + return "error : ".$e->getMessage(); |
|
| 3534 | + } |
|
| 3535 | 3535 | } |
| 3536 | 3536 | |
| 3537 | 3537 | public static function check_last_geoid_update() { |
@@ -3544,13 +3544,13 @@ discard block |
||
| 3544 | 3544 | try { |
| 3545 | 3545 | $Connection = new Connection(); |
| 3546 | 3546 | $sth = $Connection->db->prepare($query); |
| 3547 | - $sth->execute(); |
|
| 3548 | - } catch(PDOException $e) { |
|
| 3549 | - return "error : ".$e->getMessage(); |
|
| 3550 | - } |
|
| 3551 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3552 | - if ($row['nb'] > 0) return false; |
|
| 3553 | - else return true; |
|
| 3547 | + $sth->execute(); |
|
| 3548 | + } catch(PDOException $e) { |
|
| 3549 | + return "error : ".$e->getMessage(); |
|
| 3550 | + } |
|
| 3551 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3552 | + if ($row['nb'] > 0) return false; |
|
| 3553 | + else return true; |
|
| 3554 | 3554 | } |
| 3555 | 3555 | |
| 3556 | 3556 | public static function insert_last_geoid_update() { |
@@ -3559,10 +3559,10 @@ discard block |
||
| 3559 | 3559 | try { |
| 3560 | 3560 | $Connection = new Connection(); |
| 3561 | 3561 | $sth = $Connection->db->prepare($query); |
| 3562 | - $sth->execute(); |
|
| 3563 | - } catch(PDOException $e) { |
|
| 3564 | - return "error : ".$e->getMessage(); |
|
| 3565 | - } |
|
| 3562 | + $sth->execute(); |
|
| 3563 | + } catch(PDOException $e) { |
|
| 3564 | + return "error : ".$e->getMessage(); |
|
| 3565 | + } |
|
| 3566 | 3566 | } |
| 3567 | 3567 | |
| 3568 | 3568 | public static function check_last_owner_update() { |
@@ -3668,13 +3668,13 @@ discard block |
||
| 3668 | 3668 | try { |
| 3669 | 3669 | $Connection = new Connection(); |
| 3670 | 3670 | $sth = $Connection->db->prepare($query); |
| 3671 | - $sth->execute(); |
|
| 3672 | - } catch(PDOException $e) { |
|
| 3673 | - return "error : ".$e->getMessage(); |
|
| 3674 | - } |
|
| 3675 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3676 | - if ($row['nb'] > 0) return false; |
|
| 3677 | - else return true; |
|
| 3671 | + $sth->execute(); |
|
| 3672 | + } catch(PDOException $e) { |
|
| 3673 | + return "error : ".$e->getMessage(); |
|
| 3674 | + } |
|
| 3675 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 3676 | + if ($row['nb'] > 0) return false; |
|
| 3677 | + else return true; |
|
| 3678 | 3678 | } |
| 3679 | 3679 | |
| 3680 | 3680 | public static function insert_last_schedules_update() { |
@@ -3854,10 +3854,10 @@ discard block |
||
| 3854 | 3854 | try { |
| 3855 | 3855 | $Connection = new Connection(); |
| 3856 | 3856 | $sth = $Connection->db->prepare($query); |
| 3857 | - $sth->execute(); |
|
| 3858 | - } catch(PDOException $e) { |
|
| 3859 | - return "error : ".$e->getMessage(); |
|
| 3860 | - } |
|
| 3857 | + $sth->execute(); |
|
| 3858 | + } catch(PDOException $e) { |
|
| 3859 | + return "error : ".$e->getMessage(); |
|
| 3860 | + } |
|
| 3861 | 3861 | } |
| 3862 | 3862 | public static function delete_duplicateowner() { |
| 3863 | 3863 | global $globalDBdriver; |
@@ -3869,10 +3869,10 @@ discard block |
||
| 3869 | 3869 | try { |
| 3870 | 3870 | $Connection = new Connection(); |
| 3871 | 3871 | $sth = $Connection->db->prepare($query); |
| 3872 | - $sth->execute(); |
|
| 3873 | - } catch(PDOException $e) { |
|
| 3874 | - return "error : ".$e->getMessage(); |
|
| 3875 | - } |
|
| 3872 | + $sth->execute(); |
|
| 3873 | + } catch(PDOException $e) { |
|
| 3874 | + return "error : ".$e->getMessage(); |
|
| 3875 | + } |
|
| 3876 | 3876 | } |
| 3877 | 3877 | |
| 3878 | 3878 | public static function update_all() { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | $ch = curl_init(); |
| 27 | 27 | curl_setopt($ch, CURLOPT_URL, $url); |
| 28 | 28 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 29 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
| 29 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
| 30 | 30 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
| 31 | 31 | } |
| 32 | 32 | } |
@@ -44,20 +44,20 @@ discard block |
||
| 44 | 44 | fclose($fp); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 47 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 48 | 48 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 49 | 49 | $buffer_size = 4096; // read 4kb at a time |
| 50 | 50 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 51 | 51 | if ($in_file != '' && file_exists($in_file)) { |
| 52 | 52 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 53 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 54 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 53 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 54 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 55 | 55 | else { |
| 56 | 56 | echo 'gzopen not available'; |
| 57 | 57 | die; |
| 58 | 58 | } |
| 59 | 59 | $out_file = fopen($out_file_name, 'wb'); |
| 60 | - while(!gzeof($file)) { |
|
| 60 | + while (!gzeof($file)) { |
|
| 61 | 61 | fwrite($out_file, gzread($file, $buffer_size)); |
| 62 | 62 | } |
| 63 | 63 | fclose($out_file); |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | try { |
| 82 | 82 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 83 | 83 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 84 | - } catch(PDOException $e) { |
|
| 84 | + } catch (PDOException $e) { |
|
| 85 | 85 | return "error : ".$e->getMessage(); |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | //$Connection = new Connection(); |
| 97 | 97 | $sth = $Connection->db->prepare($query); |
| 98 | 98 | $sth->execute(array(':source' => $database_file)); |
| 99 | - } catch(PDOException $e) { |
|
| 99 | + } catch (PDOException $e) { |
|
| 100 | 100 | return "error : ".$e->getMessage(); |
| 101 | 101 | } |
| 102 | 102 | |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | try { |
| 108 | 108 | $sth = update_db::$db_sqlite->prepare($query); |
| 109 | 109 | $sth->execute(); |
| 110 | - } catch(PDOException $e) { |
|
| 110 | + } catch (PDOException $e) { |
|
| 111 | 111 | return "error : ".$e->getMessage(); |
| 112 | 112 | } |
| 113 | 113 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -118,11 +118,11 @@ discard block |
||
| 118 | 118 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 119 | 119 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 120 | 120 | //$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); |
| 121 | - $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); |
|
| 121 | + $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); |
|
| 122 | 122 | $sth_dest->execute($query_dest_values); |
| 123 | 123 | } |
| 124 | 124 | if ($globalTransaction) $Connection->db->commit(); |
| 125 | - } catch(PDOException $e) { |
|
| 125 | + } catch (PDOException $e) { |
|
| 126 | 126 | if ($globalTransaction) $Connection->db->rollBack(); |
| 127 | 127 | return "error : ".$e->getMessage(); |
| 128 | 128 | } |
@@ -138,26 +138,26 @@ discard block |
||
| 138 | 138 | //$Connection = new Connection(); |
| 139 | 139 | $sth = $Connection->db->prepare($query); |
| 140 | 140 | $sth->execute(array(':source' => 'oneworld')); |
| 141 | - } catch(PDOException $e) { |
|
| 141 | + } catch (PDOException $e) { |
|
| 142 | 142 | return "error : ".$e->getMessage(); |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | if ($globalDebug) echo " - Add routes to DB -"; |
| 146 | 146 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 147 | 147 | $Spotter = new Spotter(); |
| 148 | - if ($fh = fopen($database_file,"r")) { |
|
| 148 | + if ($fh = fopen($database_file, "r")) { |
|
| 149 | 149 | $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)'; |
| 150 | 150 | $Connection = new Connection(); |
| 151 | 151 | $sth_dest = $Connection->db->prepare($query_dest); |
| 152 | 152 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 153 | 153 | while (!feof($fh)) { |
| 154 | - $line = fgetcsv($fh,9999,','); |
|
| 154 | + $line = fgetcsv($fh, 9999, ','); |
|
| 155 | 155 | if ($line[0] != '') { |
| 156 | 156 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
| 157 | 157 | try { |
| 158 | - $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'); |
|
| 158 | + $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'); |
|
| 159 | 159 | $sth_dest->execute($query_dest_values); |
| 160 | - } catch(PDOException $e) { |
|
| 160 | + } catch (PDOException $e) { |
|
| 161 | 161 | if ($globalTransaction) $Connection->db->rollBack(); |
| 162 | 162 | return "error : ".$e->getMessage(); |
| 163 | 163 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | //$Connection = new Connection(); |
| 180 | 180 | $sth = $Connection->db->prepare($query); |
| 181 | 181 | $sth->execute(array(':source' => 'skyteam')); |
| 182 | - } catch(PDOException $e) { |
|
| 182 | + } catch (PDOException $e) { |
|
| 183 | 183 | return "error : ".$e->getMessage(); |
| 184 | 184 | } |
| 185 | 185 | |
@@ -187,24 +187,24 @@ discard block |
||
| 187 | 187 | |
| 188 | 188 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 189 | 189 | $Spotter = new Spotter(); |
| 190 | - if ($fh = fopen($database_file,"r")) { |
|
| 190 | + if ($fh = fopen($database_file, "r")) { |
|
| 191 | 191 | $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)'; |
| 192 | 192 | $Connection = new Connection(); |
| 193 | 193 | $sth_dest = $Connection->db->prepare($query_dest); |
| 194 | 194 | try { |
| 195 | 195 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 196 | 196 | while (!feof($fh)) { |
| 197 | - $line = fgetcsv($fh,9999,','); |
|
| 197 | + $line = fgetcsv($fh, 9999, ','); |
|
| 198 | 198 | if ($line[0] != '') { |
| 199 | - $datebe = explode(' - ',$line[2]); |
|
| 199 | + $datebe = explode(' - ', $line[2]); |
|
| 200 | 200 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
| 201 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
| 201 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
| 202 | 202 | $sth_dest->execute($query_dest_values); |
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | if ($globalTransaction) $Connection->db->commit(); |
| 207 | - } catch(PDOException $e) { |
|
| 207 | + } catch (PDOException $e) { |
|
| 208 | 208 | if ($globalTransaction) $Connection->db->rollBack(); |
| 209 | 209 | return "error : ".$e->getMessage(); |
| 210 | 210 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | $Connection = new Connection(); |
| 220 | 220 | $sth = $Connection->db->prepare($query); |
| 221 | 221 | $sth->execute(array(':source' => $database_file)); |
| 222 | - } catch(PDOException $e) { |
|
| 222 | + } catch (PDOException $e) { |
|
| 223 | 223 | return "error : ".$e->getMessage(); |
| 224 | 224 | } |
| 225 | 225 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $Connection = new Connection(); |
| 228 | 228 | $sth = $Connection->db->prepare($query); |
| 229 | 229 | $sth->execute(array(':source' => $database_file)); |
| 230 | - } catch(PDOException $e) { |
|
| 230 | + } catch (PDOException $e) { |
|
| 231 | 231 | return "error : ".$e->getMessage(); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | try { |
| 237 | 237 | $sth = update_db::$db_sqlite->prepare($query); |
| 238 | 238 | $sth->execute(); |
| 239 | - } catch(PDOException $e) { |
|
| 239 | + } catch (PDOException $e) { |
|
| 240 | 240 | return "error : ".$e->getMessage(); |
| 241 | 241 | } |
| 242 | 242 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | //$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']); |
| 254 | 254 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 255 | 255 | else $type = null; |
| 256 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 256 | + $query_dest_values = array(':LastModified' => $values['LastModified'], ':ModeS' => $values['ModeS'], ':ModeSCountry' => $values['ModeSCountry'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':type' => $type); |
|
| 257 | 257 | $sth_dest->execute($query_dest_values); |
| 258 | 258 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 259 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 259 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 260 | 260 | $sth_dest_owner->execute($query_dest_owner_values); |
| 261 | 261 | } |
| 262 | 262 | } |
| 263 | 263 | if ($globalTransaction) $Connection->db->commit(); |
| 264 | - } catch(PDOException $e) { |
|
| 264 | + } catch (PDOException $e) { |
|
| 265 | 265 | return "error : ".$e->getMessage(); |
| 266 | 266 | } |
| 267 | 267 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | $Connection = new Connection(); |
| 272 | 272 | $sth = $Connection->db->prepare($query); |
| 273 | 273 | $sth->execute(array(':source' => $database_file)); |
| 274 | - } catch(PDOException $e) { |
|
| 274 | + } catch (PDOException $e) { |
|
| 275 | 275 | return "error : ".$e->getMessage(); |
| 276 | 276 | } |
| 277 | 277 | return ''; |
@@ -286,11 +286,11 @@ discard block |
||
| 286 | 286 | $Connection = new Connection(); |
| 287 | 287 | $sth = $Connection->db->prepare($query); |
| 288 | 288 | $sth->execute(array(':source' => $database_file)); |
| 289 | - } catch(PDOException $e) { |
|
| 289 | + } catch (PDOException $e) { |
|
| 290 | 290 | return "error : ".$e->getMessage(); |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if ($fh = fopen($database_file,"r")) { |
|
| 293 | + if ($fh = fopen($database_file, "r")) { |
|
| 294 | 294 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 295 | 295 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 296 | 296 | |
@@ -300,13 +300,13 @@ discard block |
||
| 300 | 300 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 301 | 301 | while (!feof($fh)) { |
| 302 | 302 | $values = array(); |
| 303 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 303 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 304 | 304 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 305 | - $values['ModeS'] = substr($line,0,6); |
|
| 306 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 307 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 305 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 306 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 307 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 308 | 308 | // Check if we can find ICAO, else set it to GLID |
| 309 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 309 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 310 | 310 | $search_more = ''; |
| 311 | 311 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 312 | 312 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -318,20 +318,20 @@ discard block |
||
| 318 | 318 | if (isset($result['icao']) && $result['icao'] != '') { |
| 319 | 319 | $values['ICAOTypeCode'] = $result['icao']; |
| 320 | 320 | } |
| 321 | - } catch(PDOException $e) { |
|
| 321 | + } catch (PDOException $e) { |
|
| 322 | 322 | return "error : ".$e->getMessage(); |
| 323 | 323 | } |
| 324 | 324 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 325 | 325 | // Add data to db |
| 326 | 326 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 327 | 327 | //$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']); |
| 328 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 328 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 329 | 329 | //print_r($query_dest_values); |
| 330 | 330 | $sth_dest->execute($query_dest_values); |
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | if ($globalTransaction) $Connection->db->commit(); |
| 334 | - } catch(PDOException $e) { |
|
| 334 | + } catch (PDOException $e) { |
|
| 335 | 335 | return "error : ".$e->getMessage(); |
| 336 | 336 | } |
| 337 | 337 | } |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | $Connection = new Connection(); |
| 342 | 342 | $sth = $Connection->db->prepare($query); |
| 343 | 343 | $sth->execute(array(':source' => $database_file)); |
| 344 | - } catch(PDOException $e) { |
|
| 344 | + } catch (PDOException $e) { |
|
| 345 | 345 | return "error : ".$e->getMessage(); |
| 346 | 346 | } |
| 347 | 347 | return ''; |
@@ -355,11 +355,11 @@ discard block |
||
| 355 | 355 | $Connection = new Connection(); |
| 356 | 356 | $sth = $Connection->db->prepare($query); |
| 357 | 357 | $sth->execute(array(':source' => $database_file)); |
| 358 | - } catch(PDOException $e) { |
|
| 358 | + } catch (PDOException $e) { |
|
| 359 | 359 | return "error : ".$e->getMessage(); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - if ($fh = fopen($database_file,"r")) { |
|
| 362 | + if ($fh = fopen($database_file, "r")) { |
|
| 363 | 363 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 364 | 364 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 365 | 365 | |
@@ -367,9 +367,9 @@ discard block |
||
| 367 | 367 | $sth_dest = $Connection->db->prepare($query_dest); |
| 368 | 368 | try { |
| 369 | 369 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 370 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 370 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 371 | 371 | while (!feof($fh)) { |
| 372 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 372 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 373 | 373 | |
| 374 | 374 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 375 | 375 | //print_r($line); |
@@ -378,7 +378,7 @@ discard block |
||
| 378 | 378 | $values['ICAOTypeCode'] = ''; |
| 379 | 379 | $aircraft_name = $line[2]; |
| 380 | 380 | // Check if we can find ICAO, else set it to GLID |
| 381 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 381 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 382 | 382 | $search_more = ''; |
| 383 | 383 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 384 | 384 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -387,20 +387,20 @@ discard block |
||
| 387 | 387 | $sth_search->execute(); |
| 388 | 388 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 389 | 389 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 390 | - } catch(PDOException $e) { |
|
| 390 | + } catch (PDOException $e) { |
|
| 391 | 391 | return "error : ".$e->getMessage(); |
| 392 | 392 | } |
| 393 | 393 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 394 | 394 | // Add data to db |
| 395 | 395 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 396 | 396 | //$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']); |
| 397 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 397 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 398 | 398 | //print_r($query_dest_values); |
| 399 | 399 | $sth_dest->execute($query_dest_values); |
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | if ($globalTransaction) $Connection->db->commit(); |
| 403 | - } catch(PDOException $e) { |
|
| 403 | + } catch (PDOException $e) { |
|
| 404 | 404 | return "error : ".$e->getMessage(); |
| 405 | 405 | } |
| 406 | 406 | } |
@@ -410,13 +410,13 @@ discard block |
||
| 410 | 410 | $Connection = new Connection(); |
| 411 | 411 | $sth = $Connection->db->prepare($query); |
| 412 | 412 | $sth->execute(array(':source' => $database_file)); |
| 413 | - } catch(PDOException $e) { |
|
| 413 | + } catch (PDOException $e) { |
|
| 414 | 414 | return "error : ".$e->getMessage(); |
| 415 | 415 | } |
| 416 | 416 | return ''; |
| 417 | 417 | } |
| 418 | 418 | |
| 419 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 419 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 420 | 420 | global $globalTransaction, $globalMasterSource; |
| 421 | 421 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 422 | 422 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -424,12 +424,12 @@ discard block |
||
| 424 | 424 | $Connection = new Connection(); |
| 425 | 425 | $sth = $Connection->db->prepare($query); |
| 426 | 426 | $sth->execute(array(':source' => $database_file)); |
| 427 | - } catch(PDOException $e) { |
|
| 427 | + } catch (PDOException $e) { |
|
| 428 | 428 | return "error : ".$e->getMessage(); |
| 429 | 429 | } |
| 430 | 430 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 431 | 431 | $Spotter = new Spotter(); |
| 432 | - if ($fh = fopen($database_file,"r")) { |
|
| 432 | + if ($fh = fopen($database_file, "r")) { |
|
| 433 | 433 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 434 | 434 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 435 | 435 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | $sth_modes = $Connection->db->prepare($query_modes); |
| 440 | 440 | try { |
| 441 | 441 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 442 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 442 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 443 | 443 | while (!feof($fh)) { |
| 444 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 444 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 445 | 445 | $values = array(); |
| 446 | 446 | //print_r($line); |
| 447 | 447 | if ($country == 'F') { |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | $values['base'] = $line[4]; |
| 450 | 450 | $values['owner'] = $line[5]; |
| 451 | 451 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 452 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 452 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 453 | 453 | $values['cancel'] = $line[7]; |
| 454 | 454 | } elseif ($country == 'EI') { |
| 455 | 455 | // TODO : add modeS & reg to aircraft_modes |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $values['base'] = $line[3]; |
| 458 | 458 | $values['owner'] = $line[2]; |
| 459 | 459 | if ($line[1] == '') $values['date_first_reg'] = null; |
| 460 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 460 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 461 | 461 | $values['cancel'] = ''; |
| 462 | 462 | $values['modes'] = $line[7]; |
| 463 | 463 | $values['icao'] = $line[8]; |
@@ -477,7 +477,7 @@ discard block |
||
| 477 | 477 | $values['base'] = null; |
| 478 | 478 | $values['owner'] = $line[5]; |
| 479 | 479 | if ($line[18] == '') $values['date_first_reg'] = null; |
| 480 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 480 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 481 | 481 | $values['cancel'] = ''; |
| 482 | 482 | } elseif ($country == 'VH') { |
| 483 | 483 | // TODO : add modeS & reg to aircraft_modes |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | $values['base'] = null; |
| 486 | 486 | $values['owner'] = $line[12]; |
| 487 | 487 | if ($line[28] == '') $values['date_first_reg'] = null; |
| 488 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 488 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 489 | 489 | |
| 490 | 490 | $values['cancel'] = $line[39]; |
| 491 | 491 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -505,28 +505,28 @@ discard block |
||
| 505 | 505 | $values['base'] = null; |
| 506 | 506 | $values['owner'] = $line[8]; |
| 507 | 507 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 508 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 509 | 509 | $values['cancel'] = ''; |
| 510 | 510 | } elseif ($country == 'PP') { |
| 511 | 511 | $values['registration'] = $line[0]; |
| 512 | 512 | $values['base'] = null; |
| 513 | 513 | $values['owner'] = $line[4]; |
| 514 | 514 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 515 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 515 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 516 | 516 | $values['cancel'] = $line[7]; |
| 517 | 517 | } elseif ($country == 'E7') { |
| 518 | 518 | $values['registration'] = $line[0]; |
| 519 | 519 | $values['base'] = null; |
| 520 | 520 | $values['owner'] = $line[4]; |
| 521 | 521 | if ($line[5] == '') $values['date_first_reg'] = null; |
| 522 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 522 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 523 | 523 | $values['cancel'] = ''; |
| 524 | 524 | } elseif ($country == '8Q') { |
| 525 | 525 | $values['registration'] = $line[0]; |
| 526 | 526 | $values['base'] = null; |
| 527 | 527 | $values['owner'] = $line[3]; |
| 528 | 528 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 529 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 529 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 530 | 530 | $values['cancel'] = ''; |
| 531 | 531 | } elseif ($country == 'ZK') { |
| 532 | 532 | $values['registration'] = $line[0]; |
@@ -540,18 +540,18 @@ discard block |
||
| 540 | 540 | $values['registration'] = $line[0]; |
| 541 | 541 | $values['base'] = null; |
| 542 | 542 | $values['owner'] = $line[6]; |
| 543 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 544 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 543 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 544 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
| 545 | 545 | $values['modes'] = $line[4]; |
| 546 | 546 | $values['icao'] = $line[10]; |
| 547 | 547 | } elseif ($country == 'OY') { |
| 548 | 548 | $values['registration'] = $line[0]; |
| 549 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 549 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
| 550 | 550 | $values['modes'] = $line[5]; |
| 551 | 551 | $values['icao'] = $line[6]; |
| 552 | 552 | } elseif ($country == 'PH') { |
| 553 | 553 | $values['registration'] = $line[0]; |
| 554 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 554 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
| 555 | 555 | $values['modes'] = $line[4]; |
| 556 | 556 | $values['icao'] = $line[5]; |
| 557 | 557 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -562,17 +562,17 @@ discard block |
||
| 562 | 562 | $values['cancel'] = ''; |
| 563 | 563 | } |
| 564 | 564 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
| 565 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 565 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 566 | 566 | $sth_dest->execute($query_dest_values); |
| 567 | 567 | } |
| 568 | 568 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
| 569 | 569 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
| 570 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
| 570 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
| 571 | 571 | $sth_modes->execute($query_modes_values); |
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | if ($globalTransaction) $Connection->db->commit(); |
| 575 | - } catch(PDOException $e) { |
|
| 575 | + } catch (PDOException $e) { |
|
| 576 | 576 | return "error : ".$e->getMessage(); |
| 577 | 577 | } |
| 578 | 578 | } |
@@ -710,7 +710,7 @@ discard block |
||
| 710 | 710 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 711 | 711 | |
| 712 | 712 | $i = 0; |
| 713 | - while($row = sparql_fetch_array($result)) |
|
| 713 | + while ($row = sparql_fetch_array($result)) |
|
| 714 | 714 | { |
| 715 | 715 | if ($i >= 1) { |
| 716 | 716 | //print_r($row); |
@@ -730,33 +730,33 @@ discard block |
||
| 730 | 730 | $row['image'] = ''; |
| 731 | 731 | $row['image_thumb'] = ''; |
| 732 | 732 | } else { |
| 733 | - $image = str_replace(' ','_',$row['image']); |
|
| 733 | + $image = str_replace(' ', '_', $row['image']); |
|
| 734 | 734 | $digest = md5($image); |
| 735 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 736 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 737 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 738 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 735 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 736 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 737 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 738 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $country = explode('-',$row['country']); |
|
| 741 | + $country = explode('-', $row['country']); |
|
| 742 | 742 | $row['country'] = $country[0]; |
| 743 | 743 | |
| 744 | 744 | $row['type'] = trim($row['type']); |
| 745 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
| 745 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
| 746 | 746 | $row['type'] = 'military'; |
| 747 | 747 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
| 748 | 748 | $row['type'] = 'small_airport'; |
| 749 | 749 | } |
| 750 | 750 | |
| 751 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 752 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 751 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 752 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
| 753 | 753 | //print_r($query_dest_values); |
| 754 | 754 | |
| 755 | 755 | if ($row['icao'] != '') { |
| 756 | 756 | try { |
| 757 | 757 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 758 | 758 | $sth->execute(array(':icao' => $row['icao'])); |
| 759 | - } catch(PDOException $e) { |
|
| 759 | + } catch (PDOException $e) { |
|
| 760 | 760 | return "error : ".$e->getMessage(); |
| 761 | 761 | } |
| 762 | 762 | if ($sth->fetchColumn() > 0) { |
@@ -764,15 +764,15 @@ discard block |
||
| 764 | 764 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 765 | 765 | try { |
| 766 | 766 | $sth = $Connection->db->prepare($query); |
| 767 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
| 768 | - } catch(PDOException $e) { |
|
| 767 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
| 768 | + } catch (PDOException $e) { |
|
| 769 | 769 | return "error : ".$e->getMessage(); |
| 770 | 770 | } |
| 771 | 771 | echo $row['icao'].' : '.$row['type']."\n"; |
| 772 | 772 | } else { |
| 773 | 773 | try { |
| 774 | 774 | $sth_dest->execute($query_dest_values); |
| 775 | - } catch(PDOException $e) { |
|
| 775 | + } catch (PDOException $e) { |
|
| 776 | 776 | return "error : ".$e->getMessage(); |
| 777 | 777 | } |
| 778 | 778 | } |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | echo "Download data from ourairports.com...\n"; |
| 824 | 824 | $delimiter = ','; |
| 825 | 825 | $out_file = $tmp_dir.'airports.csv'; |
| 826 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 826 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 827 | 827 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 828 | 828 | echo "Add data from ourairports.com...\n"; |
| 829 | 829 | |
@@ -834,33 +834,33 @@ discard block |
||
| 834 | 834 | //$Connection->db->beginTransaction(); |
| 835 | 835 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 836 | 836 | { |
| 837 | - if(!$header) $header = $row; |
|
| 837 | + if (!$header) $header = $row; |
|
| 838 | 838 | else { |
| 839 | 839 | $data = array(); |
| 840 | 840 | $data = array_combine($header, $row); |
| 841 | 841 | try { |
| 842 | 842 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 843 | 843 | $sth->execute(array(':icao' => $data['ident'])); |
| 844 | - } catch(PDOException $e) { |
|
| 844 | + } catch (PDOException $e) { |
|
| 845 | 845 | return "error : ".$e->getMessage(); |
| 846 | 846 | } |
| 847 | 847 | if ($sth->fetchColumn() > 0) { |
| 848 | 848 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 849 | 849 | try { |
| 850 | 850 | $sth = $Connection->db->prepare($query); |
| 851 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
| 852 | - } catch(PDOException $e) { |
|
| 851 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
| 852 | + } catch (PDOException $e) { |
|
| 853 | 853 | return "error : ".$e->getMessage(); |
| 854 | 854 | } |
| 855 | 855 | } else { |
| 856 | 856 | if ($data['gps_code'] == $data['ident']) { |
| 857 | 857 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
| 858 | 858 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 859 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
| 859 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
| 860 | 860 | try { |
| 861 | 861 | $sth = $Connection->db->prepare($query); |
| 862 | 862 | $sth->execute($query_values); |
| 863 | - } catch(PDOException $e) { |
|
| 863 | + } catch (PDOException $e) { |
|
| 864 | 864 | return "error : ".$e->getMessage(); |
| 865 | 865 | } |
| 866 | 866 | $i++; |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | |
| 876 | 876 | echo "Download data from another free database...\n"; |
| 877 | 877 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 878 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 878 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 879 | 879 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 880 | 880 | update_db::unzip($out_file); |
| 881 | 881 | $header = NULL; |
@@ -887,15 +887,15 @@ discard block |
||
| 887 | 887 | //$Connection->db->beginTransaction(); |
| 888 | 888 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 889 | 889 | { |
| 890 | - if(!$header) $header = $row; |
|
| 890 | + if (!$header) $header = $row; |
|
| 891 | 891 | else { |
| 892 | 892 | $data = $row; |
| 893 | 893 | |
| 894 | 894 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
| 895 | 895 | try { |
| 896 | 896 | $sth = $Connection->db->prepare($query); |
| 897 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 898 | - } catch(PDOException $e) { |
|
| 897 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 898 | + } catch (PDOException $e) { |
|
| 899 | 899 | return "error : ".$e->getMessage(); |
| 900 | 900 | } |
| 901 | 901 | } |
@@ -909,15 +909,15 @@ discard block |
||
| 909 | 909 | try { |
| 910 | 910 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
| 911 | 911 | $sth->execute(); |
| 912 | - } catch(PDOException $e) { |
|
| 912 | + } catch (PDOException $e) { |
|
| 913 | 913 | return "error : ".$e->getMessage(); |
| 914 | 914 | } |
| 915 | 915 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 916 | 916 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 917 | 917 | try { |
| 918 | 918 | $sth2 = $Connection->db->prepare($query2); |
| 919 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 920 | - } catch(PDOException $e) { |
|
| 919 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 920 | + } catch (PDOException $e) { |
|
| 921 | 921 | return "error : ".$e->getMessage(); |
| 922 | 922 | } |
| 923 | 923 | } |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | $Connection = new Connection(); |
| 939 | 939 | $sth = $Connection->db->prepare($query); |
| 940 | 940 | $sth->execute(array(':source' => 'translation.csv')); |
| 941 | - } catch(PDOException $e) { |
|
| 941 | + } catch (PDOException $e) { |
|
| 942 | 942 | return "error : ".$e->getMessage(); |
| 943 | 943 | } |
| 944 | 944 | |
@@ -955,7 +955,7 @@ discard block |
||
| 955 | 955 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 956 | 956 | { |
| 957 | 957 | $i++; |
| 958 | - if($i > 12) { |
|
| 958 | + if ($i > 12) { |
|
| 959 | 959 | $data = $row; |
| 960 | 960 | $operator = $data[2]; |
| 961 | 961 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -963,7 +963,7 @@ discard block |
||
| 963 | 963 | //echo substr($operator, 0, 2)."\n";; |
| 964 | 964 | if (count($airline_array) > 0) { |
| 965 | 965 | //print_r($airline_array); |
| 966 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 966 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 967 | 967 | } |
| 968 | 968 | } |
| 969 | 969 | |
@@ -971,14 +971,14 @@ discard block |
||
| 971 | 971 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 972 | 972 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 973 | 973 | if (count($airline_array) > 0) { |
| 974 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 974 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 975 | 975 | } |
| 976 | 976 | } |
| 977 | 977 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 978 | 978 | try { |
| 979 | 979 | $sth = $Connection->db->prepare($query); |
| 980 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 981 | - } catch(PDOException $e) { |
|
| 980 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 981 | + } catch (PDOException $e) { |
|
| 982 | 982 | return "error : ".$e->getMessage(); |
| 983 | 983 | } |
| 984 | 984 | } |
@@ -996,7 +996,7 @@ discard block |
||
| 996 | 996 | $Connection = new Connection(); |
| 997 | 997 | $sth = $Connection->db->prepare($query); |
| 998 | 998 | $sth->execute(array(':source' => 'website_fam')); |
| 999 | - } catch(PDOException $e) { |
|
| 999 | + } catch (PDOException $e) { |
|
| 1000 | 1000 | return "error : ".$e->getMessage(); |
| 1001 | 1001 | } |
| 1002 | 1002 | //update_db::unzip($out_file); |
@@ -1014,8 +1014,8 @@ discard block |
||
| 1014 | 1014 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 1015 | 1015 | try { |
| 1016 | 1016 | $sth = $Connection->db->prepare($query); |
| 1017 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1018 | - } catch(PDOException $e) { |
|
| 1017 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1018 | + } catch (PDOException $e) { |
|
| 1019 | 1019 | return "error : ".$e->getMessage(); |
| 1020 | 1020 | } |
| 1021 | 1021 | } |
@@ -1038,11 +1038,11 @@ discard block |
||
| 1038 | 1038 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1039 | 1039 | { |
| 1040 | 1040 | $query = 'UPDATE airport SET diagram_pdf = :diagrampdf, diagram_png = :diagrampng WHERE icao = :icao'; |
| 1041 | - $icao = str_replace('.pdf','',$data[2]); |
|
| 1041 | + $icao = str_replace('.pdf', '', $data[2]); |
|
| 1042 | 1042 | try { |
| 1043 | 1043 | $sth = $Connection->db->prepare($query); |
| 1044 | - $sth->execute(array(':icao' => $icao,':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf',':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png')); |
|
| 1045 | - } catch(PDOException $e) { |
|
| 1044 | + $sth->execute(array(':icao' => $icao, ':diagrampdf' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.pdf', ':diagrampng' => 'https://data.flightairmap.com/data/diagrams/'.$icao.'.png')); |
|
| 1045 | + } catch (PDOException $e) { |
|
| 1046 | 1046 | echo "error : ".$e->getMessage(); |
| 1047 | 1047 | return "error : ".$e->getMessage(); |
| 1048 | 1048 | } |
@@ -1064,7 +1064,7 @@ discard block |
||
| 1064 | 1064 | $Connection = new Connection(); |
| 1065 | 1065 | $sth = $Connection->db->prepare($query); |
| 1066 | 1066 | $sth->execute(array(':source' => 'website_faa')); |
| 1067 | - } catch(PDOException $e) { |
|
| 1067 | + } catch (PDOException $e) { |
|
| 1068 | 1068 | return "error : ".$e->getMessage(); |
| 1069 | 1069 | } |
| 1070 | 1070 | |
@@ -1073,7 +1073,7 @@ discard block |
||
| 1073 | 1073 | $Connection = new Connection(); |
| 1074 | 1074 | $sth = $Connection->db->prepare($query); |
| 1075 | 1075 | $sth->execute(array(':source' => 'website_faa')); |
| 1076 | - } catch(PDOException $e) { |
|
| 1076 | + } catch (PDOException $e) { |
|
| 1077 | 1077 | return "error : ".$e->getMessage(); |
| 1078 | 1078 | } |
| 1079 | 1079 | |
@@ -1090,8 +1090,8 @@ discard block |
||
| 1090 | 1090 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
| 1091 | 1091 | try { |
| 1092 | 1092 | $sths = $Connection->db->prepare($query_search); |
| 1093 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
| 1094 | - } catch(PDOException $e) { |
|
| 1093 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
| 1094 | + } catch (PDOException $e) { |
|
| 1095 | 1095 | return "error s : ".$e->getMessage(); |
| 1096 | 1096 | } |
| 1097 | 1097 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1104,8 +1104,8 @@ discard block |
||
| 1104 | 1104 | //} |
| 1105 | 1105 | try { |
| 1106 | 1106 | $sthi = $Connection->db->prepare($queryi); |
| 1107 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
| 1108 | - } catch(PDOException $e) { |
|
| 1107 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
| 1108 | + } catch (PDOException $e) { |
|
| 1109 | 1109 | return "error u : ".$e->getMessage(); |
| 1110 | 1110 | } |
| 1111 | 1111 | } else { |
@@ -1113,7 +1113,7 @@ discard block |
||
| 1113 | 1113 | try { |
| 1114 | 1114 | $sthsm = $Connection->db->prepare($query_search_mfr); |
| 1115 | 1115 | $sthsm->execute(array(':mfr' => $data[2])); |
| 1116 | - } catch(PDOException $e) { |
|
| 1116 | + } catch (PDOException $e) { |
|
| 1117 | 1117 | return "error mfr : ".$e->getMessage(); |
| 1118 | 1118 | } |
| 1119 | 1119 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1123,8 +1123,8 @@ discard block |
||
| 1123 | 1123 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1124 | 1124 | try { |
| 1125 | 1125 | $sthf = $Connection->db->prepare($queryf); |
| 1126 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
| 1127 | - } catch(PDOException $e) { |
|
| 1126 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
| 1127 | + } catch (PDOException $e) { |
|
| 1128 | 1128 | return "error f : ".$e->getMessage(); |
| 1129 | 1129 | } |
| 1130 | 1130 | } |
@@ -1134,13 +1134,13 @@ discard block |
||
| 1134 | 1134 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1135 | 1135 | try { |
| 1136 | 1136 | $sth = $Connection->db->prepare($query); |
| 1137 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1138 | - } catch(PDOException $e) { |
|
| 1137 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1138 | + } catch (PDOException $e) { |
|
| 1139 | 1139 | return "error i : ".$e->getMessage(); |
| 1140 | 1140 | } |
| 1141 | 1141 | } |
| 1142 | 1142 | } |
| 1143 | - if ($i % 90 == 0) { |
|
| 1143 | + if ($i%90 == 0) { |
|
| 1144 | 1144 | if ($globalTransaction) $Connection->db->commit(); |
| 1145 | 1145 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1146 | 1146 | } |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | $Connection = new Connection(); |
| 1160 | 1160 | $sth = $Connection->db->prepare($query); |
| 1161 | 1161 | $sth->execute(array(':source' => 'website_fam')); |
| 1162 | - } catch(PDOException $e) { |
|
| 1162 | + } catch (PDOException $e) { |
|
| 1163 | 1163 | return "error : ".$e->getMessage(); |
| 1164 | 1164 | } |
| 1165 | 1165 | $delimiter = "\t"; |
@@ -1175,8 +1175,8 @@ discard block |
||
| 1175 | 1175 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1176 | 1176 | try { |
| 1177 | 1177 | $sth = $Connection->db->prepare($query); |
| 1178 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
| 1179 | - } catch(PDOException $e) { |
|
| 1178 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
| 1179 | + } catch (PDOException $e) { |
|
| 1180 | 1180 | return "error : ".$e->getMessage(); |
| 1181 | 1181 | } |
| 1182 | 1182 | } |
@@ -1208,7 +1208,7 @@ discard block |
||
| 1208 | 1208 | try { |
| 1209 | 1209 | $sth = $Connection->db->prepare($query); |
| 1210 | 1210 | $sth->execute(); |
| 1211 | - } catch(PDOException $e) { |
|
| 1211 | + } catch (PDOException $e) { |
|
| 1212 | 1212 | return "error : ".$e->getMessage(); |
| 1213 | 1213 | } |
| 1214 | 1214 | $delimiter = "\t"; |
@@ -1223,8 +1223,8 @@ discard block |
||
| 1223 | 1223 | $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)'; |
| 1224 | 1224 | try { |
| 1225 | 1225 | $sth = $Connection->db->prepare($query); |
| 1226 | - $sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11])); |
|
| 1227 | - } catch(PDOException $e) { |
|
| 1226 | + $sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11])); |
|
| 1227 | + } catch (PDOException $e) { |
|
| 1228 | 1228 | return "error : ".$e->getMessage(); |
| 1229 | 1229 | } |
| 1230 | 1230 | } |
@@ -1252,7 +1252,7 @@ discard block |
||
| 1252 | 1252 | $Connection = new Connection(); |
| 1253 | 1253 | $sth = $Connection->db->prepare($query); |
| 1254 | 1254 | $sth->execute(array(':source' => 'website_fam')); |
| 1255 | - } catch(PDOException $e) { |
|
| 1255 | + } catch (PDOException $e) { |
|
| 1256 | 1256 | return "error : ".$e->getMessage(); |
| 1257 | 1257 | } |
| 1258 | 1258 | |
@@ -1268,8 +1268,8 @@ discard block |
||
| 1268 | 1268 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
| 1269 | 1269 | try { |
| 1270 | 1270 | $sth = $Connection->db->prepare($query); |
| 1271 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1272 | - } catch(PDOException $e) { |
|
| 1271 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1272 | + } catch (PDOException $e) { |
|
| 1273 | 1273 | //print_r($data); |
| 1274 | 1274 | return "error : ".$e->getMessage(); |
| 1275 | 1275 | } |
@@ -1289,7 +1289,7 @@ discard block |
||
| 1289 | 1289 | $Connection = new Connection(); |
| 1290 | 1290 | $sth = $Connection->db->prepare($query); |
| 1291 | 1291 | $sth->execute(array(':source' => 'website_fam')); |
| 1292 | - } catch(PDOException $e) { |
|
| 1292 | + } catch (PDOException $e) { |
|
| 1293 | 1293 | return "error : ".$e->getMessage(); |
| 1294 | 1294 | } |
| 1295 | 1295 | $delimiter = "\t"; |
@@ -1305,13 +1305,13 @@ discard block |
||
| 1305 | 1305 | $query = '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)'; |
| 1306 | 1306 | try { |
| 1307 | 1307 | $sth = $Connection->db->prepare($query); |
| 1308 | - $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')); |
|
| 1309 | - } catch(PDOException $e) { |
|
| 1310 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1308 | + $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')); |
|
| 1309 | + } catch (PDOException $e) { |
|
| 1310 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
| 1311 | 1311 | die(); |
| 1312 | 1312 | } |
| 1313 | 1313 | } |
| 1314 | - if ($globalTransaction && $i % 2000 == 0) { |
|
| 1314 | + if ($globalTransaction && $i%2000 == 0) { |
|
| 1315 | 1315 | $Connection->db->commit(); |
| 1316 | 1316 | if ($globalDebug) echo '.'; |
| 1317 | 1317 | $Connection->db->beginTransaction(); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | $Connection = new Connection(); |
| 1332 | 1332 | $sth = $Connection->db->prepare($query); |
| 1333 | 1333 | $sth->execute(array(':source' => 'website_fam')); |
| 1334 | - } catch(PDOException $e) { |
|
| 1334 | + } catch (PDOException $e) { |
|
| 1335 | 1335 | return "error : ".$e->getMessage(); |
| 1336 | 1336 | } |
| 1337 | 1337 | $Connection = new Connection(); |
@@ -1344,12 +1344,12 @@ discard block |
||
| 1344 | 1344 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
| 1345 | 1345 | try { |
| 1346 | 1346 | $sth = $Connection->db->prepare($query); |
| 1347 | - $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
|
| 1348 | - } catch(PDOException $e) { |
|
| 1347 | + $sth->execute(array(':callSign' => trim($data), ':source' => 'website_fam')); |
|
| 1348 | + } catch (PDOException $e) { |
|
| 1349 | 1349 | if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
| 1350 | 1350 | die(); |
| 1351 | 1351 | } |
| 1352 | - if ($globalTransaction && $i % 2000 == 0) { |
|
| 1352 | + if ($globalTransaction && $i%2000 == 0) { |
|
| 1353 | 1353 | $Connection->db->commit(); |
| 1354 | 1354 | if ($globalDebug) echo '.'; |
| 1355 | 1355 | $Connection->db->beginTransaction(); |
@@ -1369,7 +1369,7 @@ discard block |
||
| 1369 | 1369 | $Connection = new Connection(); |
| 1370 | 1370 | $sth = $Connection->db->prepare($query); |
| 1371 | 1371 | $sth->execute(); |
| 1372 | - } catch(PDOException $e) { |
|
| 1372 | + } catch (PDOException $e) { |
|
| 1373 | 1373 | return "error : ".$e->getMessage(); |
| 1374 | 1374 | } |
| 1375 | 1375 | |
@@ -1390,8 +1390,8 @@ discard block |
||
| 1390 | 1390 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
| 1391 | 1391 | try { |
| 1392 | 1392 | $sth = $Connection->db->prepare($query); |
| 1393 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
| 1394 | - } catch(PDOException $e) { |
|
| 1393 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
| 1394 | + } catch (PDOException $e) { |
|
| 1395 | 1395 | return "error : ".$e->getMessage(); |
| 1396 | 1396 | } |
| 1397 | 1397 | } |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | $Connection = new Connection(); |
| 1411 | 1411 | $sth = $Connection->db->prepare($query); |
| 1412 | 1412 | $sth->execute(); |
| 1413 | - } catch(PDOException $e) { |
|
| 1413 | + } catch (PDOException $e) { |
|
| 1414 | 1414 | return "error : ".$e->getMessage(); |
| 1415 | 1415 | } |
| 1416 | 1416 | $delimiter = "\t"; |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1428 | 1428 | try { |
| 1429 | 1429 | $sth = $Connection->db->prepare($query); |
| 1430 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1431 | - } catch(PDOException $e) { |
|
| 1430 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1431 | + } catch (PDOException $e) { |
|
| 1432 | 1432 | return "error : ".$e->getMessage(); |
| 1433 | 1433 | } |
| 1434 | 1434 | } |
@@ -1447,7 +1447,7 @@ discard block |
||
| 1447 | 1447 | $Connection = new Connection(); |
| 1448 | 1448 | $sth = $Connection->db->prepare($query); |
| 1449 | 1449 | $sth->execute(); |
| 1450 | - } catch(PDOException $e) { |
|
| 1450 | + } catch (PDOException $e) { |
|
| 1451 | 1451 | return "error : ".$e->getMessage(); |
| 1452 | 1452 | } |
| 1453 | 1453 | |
@@ -1463,7 +1463,7 @@ discard block |
||
| 1463 | 1463 | try { |
| 1464 | 1464 | $sth = $Connection->db->prepare($query); |
| 1465 | 1465 | $sth->execute(array(':icao' => $icao)); |
| 1466 | - } catch(PDOException $e) { |
|
| 1466 | + } catch (PDOException $e) { |
|
| 1467 | 1467 | return "error : ".$e->getMessage(); |
| 1468 | 1468 | } |
| 1469 | 1469 | } |
@@ -1474,7 +1474,7 @@ discard block |
||
| 1474 | 1474 | return ''; |
| 1475 | 1475 | } |
| 1476 | 1476 | |
| 1477 | - public static function tle($filename,$tletype) { |
|
| 1477 | + public static function tle($filename, $tletype) { |
|
| 1478 | 1478 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1479 | 1479 | global $tmp_dir, $globalTransaction; |
| 1480 | 1480 | //$Spotter = new Spotter(); |
@@ -1484,7 +1484,7 @@ discard block |
||
| 1484 | 1484 | $Connection = new Connection(); |
| 1485 | 1485 | $sth = $Connection->db->prepare($query); |
| 1486 | 1486 | $sth->execute(array(':source' => $filename)); |
| 1487 | - } catch(PDOException $e) { |
|
| 1487 | + } catch (PDOException $e) { |
|
| 1488 | 1488 | return "error : ".$e->getMessage(); |
| 1489 | 1489 | } |
| 1490 | 1490 | |
@@ -1509,8 +1509,8 @@ discard block |
||
| 1509 | 1509 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
| 1510 | 1510 | try { |
| 1511 | 1511 | $sth = $Connection->db->prepare($query); |
| 1512 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
| 1513 | - } catch(PDOException $e) { |
|
| 1512 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
| 1513 | + } catch (PDOException $e) { |
|
| 1514 | 1514 | return "error : ".$e->getMessage(); |
| 1515 | 1515 | } |
| 1516 | 1516 | |
@@ -1531,7 +1531,7 @@ discard block |
||
| 1531 | 1531 | $Connection = new Connection(); |
| 1532 | 1532 | $sth = $Connection->db->prepare($query); |
| 1533 | 1533 | $sth->execute(array(':source' => $filename)); |
| 1534 | - } catch(PDOException $e) { |
|
| 1534 | + } catch (PDOException $e) { |
|
| 1535 | 1535 | return "error : ".$e->getMessage(); |
| 1536 | 1536 | } |
| 1537 | 1537 | |
@@ -1542,13 +1542,13 @@ discard block |
||
| 1542 | 1542 | $i = 0; |
| 1543 | 1543 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1544 | 1544 | //$Connection->db->beginTransaction(); |
| 1545 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
| 1545 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
| 1546 | 1546 | { |
| 1547 | 1547 | if ($i > 0 && $data[0] != '') { |
| 1548 | 1548 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1549 | - $period = str_replace(',','',$data[14]); |
|
| 1550 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1551 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1549 | + $period = str_replace(',', '', $data[14]); |
|
| 1550 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
| 1551 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
| 1552 | 1552 | else $launch_date = NULL; |
| 1553 | 1553 | $data = array_map(function($value) { |
| 1554 | 1554 | return trim($value) === '' ? null : $value; |
@@ -1558,8 +1558,8 @@ discard block |
||
| 1558 | 1558 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1559 | 1559 | try { |
| 1560 | 1560 | $sth = $Connection->db->prepare($query); |
| 1561 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1562 | - } catch(PDOException $e) { |
|
| 1561 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1562 | + } catch (PDOException $e) { |
|
| 1563 | 1563 | return "error : ".$e->getMessage(); |
| 1564 | 1564 | } |
| 1565 | 1565 | } |
@@ -1599,7 +1599,7 @@ discard block |
||
| 1599 | 1599 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
| 1600 | 1600 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
| 1601 | 1601 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
| 1602 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
| 1602 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
| 1603 | 1603 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
| 1604 | 1604 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
| 1605 | 1605 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1723,10 +1723,10 @@ discard block |
||
| 1723 | 1723 | { |
| 1724 | 1724 | if ($data != '') { |
| 1725 | 1725 | $result = array(); |
| 1726 | - $result['cospar'] = trim(substr($data,0,11)); |
|
| 1727 | - $result['norad'] = trim(substr($data,13,6)); |
|
| 1728 | - $result['operational'] = trim(substr($data,21,1)); |
|
| 1729 | - $result['name'] = trim(substr($data,23,24)); |
|
| 1726 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
| 1727 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
| 1728 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
| 1729 | + $result['name'] = trim(substr($data, 23, 24)); |
|
| 1730 | 1730 | /* |
| 1731 | 1731 | * R/B(1) = Rocket body, first stage |
| 1732 | 1732 | * R/B(2) = Rocket body, second stage |
@@ -1738,28 +1738,28 @@ discard block |
||
| 1738 | 1738 | * An ampersand (&) indicates two or more objects are attached |
| 1739 | 1739 | */ |
| 1740 | 1740 | |
| 1741 | - $owner_code = trim(substr($data,49,5)); |
|
| 1741 | + $owner_code = trim(substr($data, 49, 5)); |
|
| 1742 | 1742 | |
| 1743 | 1743 | if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
| 1744 | 1744 | if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
| 1745 | 1745 | } |
| 1746 | - if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
| 1747 | - if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1746 | + if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
| 1747 | + if ($globalDebug) echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n"; |
|
| 1748 | 1748 | } |
| 1749 | 1749 | |
| 1750 | - if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
| 1750 | + if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
| 1751 | 1751 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
| 1752 | 1752 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
| 1753 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
| 1754 | - $launch_site_code = trim(substr($data,68,5)); |
|
| 1753 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
| 1754 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
| 1755 | 1755 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
| 1756 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
| 1757 | - $result['period'] = trim(substr($data,87,7)); |
|
| 1758 | - $result['inclination'] = trim(substr($data,96,5)); |
|
| 1759 | - $result['apogee'] = trim(substr($data,103,6)); |
|
| 1760 | - $result['perigee'] = trim(substr($data,111,6)); |
|
| 1756 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
| 1757 | + $result['period'] = trim(substr($data, 87, 7)); |
|
| 1758 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
| 1759 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
| 1760 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
| 1761 | 1761 | //$result['radarcross'] = trim(substr($data,119,8)); |
| 1762 | - $result['status'] = trim(substr($data,129,3)); |
|
| 1762 | + $result['status'] = trim(substr($data, 129, 3)); |
|
| 1763 | 1763 | //print_r($result); |
| 1764 | 1764 | $result = array_map(function($value) { |
| 1765 | 1765 | return trim($value) === '' ? null : $value; |
@@ -1772,7 +1772,7 @@ discard block |
||
| 1772 | 1772 | $sth = $Connection->db->prepare($query); |
| 1773 | 1773 | $sth->execute(array(':cospar' => $result['cospar'])); |
| 1774 | 1774 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1775 | - } catch(PDOException $e) { |
|
| 1775 | + } catch (PDOException $e) { |
|
| 1776 | 1776 | return "error : ".$e->getMessage(); |
| 1777 | 1777 | } |
| 1778 | 1778 | if (empty($exist)) { |
@@ -1784,10 +1784,10 @@ discard block |
||
| 1784 | 1784 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
| 1785 | 1785 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
| 1786 | 1786 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
| 1787 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1787 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1788 | 1788 | ) |
| 1789 | 1789 | ); |
| 1790 | - } catch(PDOException $e) { |
|
| 1790 | + } catch (PDOException $e) { |
|
| 1791 | 1791 | return "error : ".$e->getMessage(); |
| 1792 | 1792 | } |
| 1793 | 1793 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1795,8 +1795,8 @@ discard block |
||
| 1795 | 1795 | try { |
| 1796 | 1796 | $Connection = new Connection(); |
| 1797 | 1797 | $sth = $Connection->db->prepare($query); |
| 1798 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
| 1799 | - } catch(PDOException $e) { |
|
| 1798 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
| 1799 | + } catch (PDOException $e) { |
|
| 1800 | 1800 | return "error : ".$e->getMessage(); |
| 1801 | 1801 | } |
| 1802 | 1802 | } |
@@ -1915,13 +1915,13 @@ discard block |
||
| 1915 | 1915 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1916 | 1916 | { |
| 1917 | 1917 | $i++; |
| 1918 | - if($i > 3 && count($row) > 2) { |
|
| 1918 | + if ($i > 3 && count($row) > 2) { |
|
| 1919 | 1919 | $data = array_values(array_filter($row)); |
| 1920 | 1920 | $cntdata = count($data); |
| 1921 | 1921 | if ($cntdata > 10) { |
| 1922 | 1922 | $value = $data[9]; |
| 1923 | 1923 | |
| 1924 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 1924 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 1925 | 1925 | $value .= ' '.$data[$i]; |
| 1926 | 1926 | } |
| 1927 | 1927 | $data[9] = $value; |
@@ -1931,8 +1931,8 @@ discard block |
||
| 1931 | 1931 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
| 1932 | 1932 | try { |
| 1933 | 1933 | $sth = $Connection->db->prepare($query); |
| 1934 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1935 | - } catch(PDOException $e) { |
|
| 1934 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1935 | + } catch (PDOException $e) { |
|
| 1936 | 1936 | return "error : ".$e->getMessage(); |
| 1937 | 1937 | } |
| 1938 | 1938 | } |
@@ -1949,22 +1949,22 @@ discard block |
||
| 1949 | 1949 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 1950 | 1950 | $delimiter = ','; |
| 1951 | 1951 | $Common = new Common(); |
| 1952 | - $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv'); |
|
| 1952 | + $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv'); |
|
| 1953 | 1953 | $Connection = new Connection(); |
| 1954 | 1954 | $Source = new Source(); |
| 1955 | 1955 | $Source->deleteLocationByType('fires'); |
| 1956 | 1956 | $i = 0; |
| 1957 | - if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
|
| 1957 | + if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) { |
|
| 1958 | 1958 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1959 | - while (($row = fgetcsv($handle,1000)) !== false) { |
|
| 1959 | + while (($row = fgetcsv($handle, 1000)) !== false) { |
|
| 1960 | 1960 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
| 1961 | - $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]); |
|
| 1961 | + $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]); |
|
| 1962 | 1962 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
| 1963 | - $query_values = array(':name' => '',':latitude' => $row[0], ':longitude' => $row[1],':altitude' => null,':city' => '',':country' => '',':logo' => 'fire.png',':source' => 'NASA',':type' => 'fires',':source_id' => 0,':last_seen' => $row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),':location_id' => 0,':description' => json_encode($description)); |
|
| 1963 | + $query_values = array(':name' => '', ':latitude' => $row[0], ':longitude' => $row[1], ':altitude' => null, ':city' => '', ':country' => '', ':logo' => 'fire.png', ':source' => 'NASA', ':type' => 'fires', ':source_id' => 0, ':last_seen' => $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), ':location_id' => 0, ':description' => json_encode($description)); |
|
| 1964 | 1964 | try { |
| 1965 | 1965 | $sth = $Connection->db->prepare($query); |
| 1966 | 1966 | $sth->execute($query_values); |
| 1967 | - } catch(PDOException $e) { |
|
| 1967 | + } catch (PDOException $e) { |
|
| 1968 | 1968 | echo "error : ".$e->getMessage(); |
| 1969 | 1969 | } |
| 1970 | 1970 | } |
@@ -1983,7 +1983,7 @@ discard block |
||
| 1983 | 1983 | $Connection = new Connection(); |
| 1984 | 1984 | $sth = $Connection->db->prepare($query); |
| 1985 | 1985 | $sth->execute(); |
| 1986 | - } catch(PDOException $e) { |
|
| 1986 | + } catch (PDOException $e) { |
|
| 1987 | 1987 | return "error : ".$e->getMessage(); |
| 1988 | 1988 | } |
| 1989 | 1989 | $header = NULL; |
@@ -1994,12 +1994,12 @@ discard block |
||
| 1994 | 1994 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1995 | 1995 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1996 | 1996 | { |
| 1997 | - if(count($row) > 1) { |
|
| 1997 | + if (count($row) > 1) { |
|
| 1998 | 1998 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
| 1999 | 1999 | try { |
| 2000 | 2000 | $sth = $Connection->db->prepare($query); |
| 2001 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 2002 | - } catch(PDOException $e) { |
|
| 2001 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 2002 | + } catch (PDOException $e) { |
|
| 2003 | 2003 | return "error : ".$e->getMessage(); |
| 2004 | 2004 | } |
| 2005 | 2005 | } |
@@ -2019,21 +2019,21 @@ discard block |
||
| 2019 | 2019 | try { |
| 2020 | 2020 | $sth = $Connection->db->prepare($query); |
| 2021 | 2021 | $sth->execute(); |
| 2022 | - } catch(PDOException $e) { |
|
| 2022 | + } catch (PDOException $e) { |
|
| 2023 | 2023 | return "error : ".$e->getMessage(); |
| 2024 | 2024 | } |
| 2025 | 2025 | } |
| 2026 | 2026 | |
| 2027 | 2027 | |
| 2028 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2028 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 2029 | 2029 | else { |
| 2030 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2030 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 2031 | 2031 | $query = "CREATE EXTENSION postgis"; |
| 2032 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 2032 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 2033 | 2033 | try { |
| 2034 | 2034 | $sth = $Connection->db->prepare($query); |
| 2035 | 2035 | $sth->execute(); |
| 2036 | - } catch(PDOException $e) { |
|
| 2036 | + } catch (PDOException $e) { |
|
| 2037 | 2037 | return "error : ".$e->getMessage(); |
| 2038 | 2038 | } |
| 2039 | 2039 | } |
@@ -2046,13 +2046,13 @@ discard block |
||
| 2046 | 2046 | include_once('class.create_db.php'); |
| 2047 | 2047 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2048 | 2048 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
| 2049 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
| 2049 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
| 2050 | 2050 | $error = ''; |
| 2051 | 2051 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
| 2052 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 2052 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 2053 | 2053 | $notam_md5 = $notam_md5_file[0]; |
| 2054 | 2054 | if (!update_db::check_notam_version($notam_md5)) { |
| 2055 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
| 2055 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
| 2056 | 2056 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2057 | 2057 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2058 | 2058 | if ($globalDebug) echo "Gunzip..."; |
@@ -2088,14 +2088,14 @@ discard block |
||
| 2088 | 2088 | try { |
| 2089 | 2089 | $sth = $Connection->db->prepare($query); |
| 2090 | 2090 | $sth->execute(); |
| 2091 | - } catch(PDOException $e) { |
|
| 2091 | + } catch (PDOException $e) { |
|
| 2092 | 2092 | echo "error : ".$e->getMessage(); |
| 2093 | 2093 | } |
| 2094 | 2094 | } |
| 2095 | 2095 | if ($globalDBdriver == 'mysql') { |
| 2096 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 2096 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 2097 | 2097 | } else { |
| 2098 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 2098 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 2099 | 2099 | } |
| 2100 | 2100 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 2101 | 2101 | return $error; |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 2109 | 2109 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 2110 | 2110 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
| 2111 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
| 2111 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
| 2112 | 2112 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 2113 | 2113 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 2114 | 2114 | return $error; |
@@ -2129,7 +2129,7 @@ discard block |
||
| 2129 | 2129 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2130 | 2130 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 2131 | 2131 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2132 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2132 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2133 | 2133 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 2134 | 2134 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 2135 | 2135 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -2143,7 +2143,7 @@ discard block |
||
| 2143 | 2143 | global $tmp_dir, $globalDebug; |
| 2144 | 2144 | $error = ''; |
| 2145 | 2145 | if ($globalDebug) echo "Routes : Download..."; |
| 2146 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 2146 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 2147 | 2147 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2148 | 2148 | if ($globalDebug) echo "Gunzip..."; |
| 2149 | 2149 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -2159,7 +2159,7 @@ discard block |
||
| 2159 | 2159 | global $tmp_dir, $globalDebug; |
| 2160 | 2160 | $error = ''; |
| 2161 | 2161 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
| 2162 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
| 2162 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
| 2163 | 2163 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2164 | 2164 | if ($globalDebug) echo "Gunzip..."; |
| 2165 | 2165 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -2175,7 +2175,7 @@ discard block |
||
| 2175 | 2175 | global $tmp_dir, $globalDebug; |
| 2176 | 2176 | $error = ''; |
| 2177 | 2177 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
| 2178 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
| 2178 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
| 2179 | 2179 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2180 | 2180 | if ($globalDebug) echo "Gunzip..."; |
| 2181 | 2181 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2203,7 +2203,7 @@ discard block |
||
| 2203 | 2203 | */ |
| 2204 | 2204 | if ($globalDebug) echo "Modes : Download..."; |
| 2205 | 2205 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 2206 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
| 2206 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
| 2207 | 2207 | |
| 2208 | 2208 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2209 | 2209 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2223,7 +2223,7 @@ discard block |
||
| 2223 | 2223 | public static function update_ModeS_faa() { |
| 2224 | 2224 | global $tmp_dir, $globalDebug; |
| 2225 | 2225 | if ($globalDebug) echo "Modes FAA: Download..."; |
| 2226 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
| 2226 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
| 2227 | 2227 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2228 | 2228 | if ($globalDebug) echo "Unzip..."; |
| 2229 | 2229 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2239,7 +2239,7 @@ discard block |
||
| 2239 | 2239 | public static function update_ModeS_flarm() { |
| 2240 | 2240 | global $tmp_dir, $globalDebug; |
| 2241 | 2241 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 2242 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 2242 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 2243 | 2243 | if (file_exists($tmp_dir.'data.fln')) { |
| 2244 | 2244 | if ($globalDebug) echo "Add to DB..."; |
| 2245 | 2245 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2253,7 +2253,7 @@ discard block |
||
| 2253 | 2253 | public static function update_ModeS_ogn() { |
| 2254 | 2254 | global $tmp_dir, $globalDebug; |
| 2255 | 2255 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 2256 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 2256 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 2257 | 2257 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2258 | 2258 | if ($globalDebug) echo "Add to DB..."; |
| 2259 | 2259 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2268,201 +2268,201 @@ discard block |
||
| 2268 | 2268 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2269 | 2269 | |
| 2270 | 2270 | if ($globalDebug) echo "Owner France: Download..."; |
| 2271 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 2271 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 2272 | 2272 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2273 | 2273 | if ($globalDebug) echo "Add to DB..."; |
| 2274 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 2274 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 2275 | 2275 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 2276 | 2276 | if ($error != '') { |
| 2277 | 2277 | return $error; |
| 2278 | 2278 | } elseif ($globalDebug) echo "Done\n"; |
| 2279 | 2279 | |
| 2280 | 2280 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 2281 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 2281 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 2282 | 2282 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2283 | 2283 | if ($globalDebug) echo "Add to DB..."; |
| 2284 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 2284 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 2285 | 2285 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 2286 | 2286 | if ($error != '') { |
| 2287 | 2287 | return $error; |
| 2288 | 2288 | } elseif ($globalDebug) echo "Done\n"; |
| 2289 | 2289 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 2290 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 2290 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 2291 | 2291 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2292 | 2292 | if ($globalDebug) echo "Add to DB..."; |
| 2293 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 2293 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 2294 | 2294 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 2295 | 2295 | if ($error != '') { |
| 2296 | 2296 | return $error; |
| 2297 | 2297 | } elseif ($globalDebug) echo "Done\n"; |
| 2298 | 2298 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 2299 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 2299 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 2300 | 2300 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2301 | 2301 | if ($globalDebug) echo "Add to DB..."; |
| 2302 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 2302 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 2303 | 2303 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 2304 | 2304 | if ($error != '') { |
| 2305 | 2305 | return $error; |
| 2306 | 2306 | } elseif ($globalDebug) echo "Done\n"; |
| 2307 | 2307 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 2308 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 2308 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 2309 | 2309 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2310 | 2310 | if ($globalDebug) echo "Add to DB..."; |
| 2311 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 2311 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 2312 | 2312 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 2313 | 2313 | if ($error != '') { |
| 2314 | 2314 | return $error; |
| 2315 | 2315 | } elseif ($globalDebug) echo "Done\n"; |
| 2316 | 2316 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 2317 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 2317 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 2318 | 2318 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2319 | 2319 | if ($globalDebug) echo "Add to DB..."; |
| 2320 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 2320 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 2321 | 2321 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 2322 | 2322 | if ($error != '') { |
| 2323 | 2323 | return $error; |
| 2324 | 2324 | } elseif ($globalDebug) echo "Done\n"; |
| 2325 | 2325 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 2326 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 2326 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 2327 | 2327 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2328 | 2328 | if ($globalDebug) echo "Add to DB..."; |
| 2329 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 2329 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 2330 | 2330 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 2331 | 2331 | if ($error != '') { |
| 2332 | 2332 | return $error; |
| 2333 | 2333 | } elseif ($globalDebug) echo "Done\n"; |
| 2334 | 2334 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 2335 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 2335 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 2336 | 2336 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2337 | 2337 | if ($globalDebug) echo "Add to DB..."; |
| 2338 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 2338 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 2339 | 2339 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 2340 | 2340 | if ($error != '') { |
| 2341 | 2341 | return $error; |
| 2342 | 2342 | } elseif ($globalDebug) echo "Done\n"; |
| 2343 | 2343 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 2344 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 2344 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 2345 | 2345 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2346 | 2346 | if ($globalDebug) echo "Add to DB..."; |
| 2347 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 2347 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 2348 | 2348 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 2349 | 2349 | if ($error != '') { |
| 2350 | 2350 | return $error; |
| 2351 | 2351 | } elseif ($globalDebug) echo "Done\n"; |
| 2352 | 2352 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 2353 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 2353 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 2354 | 2354 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2355 | 2355 | if ($globalDebug) echo "Add to DB..."; |
| 2356 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 2356 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 2357 | 2357 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 2358 | 2358 | if ($error != '') { |
| 2359 | 2359 | return $error; |
| 2360 | 2360 | } elseif ($globalDebug) echo "Done\n"; |
| 2361 | 2361 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 2362 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 2362 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 2363 | 2363 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2364 | 2364 | if ($globalDebug) echo "Add to DB..."; |
| 2365 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 2365 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 2366 | 2366 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 2367 | 2367 | if ($error != '') { |
| 2368 | 2368 | return $error; |
| 2369 | 2369 | } elseif ($globalDebug) echo "Done\n"; |
| 2370 | 2370 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 2371 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 2371 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 2372 | 2372 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2373 | 2373 | if ($globalDebug) echo "Add to DB..."; |
| 2374 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 2374 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 2375 | 2375 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 2376 | 2376 | if ($error != '') { |
| 2377 | 2377 | return $error; |
| 2378 | 2378 | } elseif ($globalDebug) echo "Done\n"; |
| 2379 | 2379 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 2380 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 2380 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 2381 | 2381 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2382 | 2382 | if ($globalDebug) echo "Add to DB..."; |
| 2383 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 2383 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 2384 | 2384 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 2385 | 2385 | if ($error != '') { |
| 2386 | 2386 | return $error; |
| 2387 | 2387 | } elseif ($globalDebug) echo "Done\n"; |
| 2388 | 2388 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 2389 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 2389 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 2390 | 2390 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2391 | 2391 | if ($globalDebug) echo "Add to DB..."; |
| 2392 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 2392 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 2393 | 2393 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 2394 | 2394 | if ($error != '') { |
| 2395 | 2395 | return $error; |
| 2396 | 2396 | } elseif ($globalDebug) echo "Done\n"; |
| 2397 | 2397 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 2398 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 2398 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 2399 | 2399 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2400 | 2400 | if ($globalDebug) echo "Add to DB..."; |
| 2401 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 2401 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 2402 | 2402 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 2403 | 2403 | if ($error != '') { |
| 2404 | 2404 | return $error; |
| 2405 | 2405 | } elseif ($globalDebug) echo "Done\n"; |
| 2406 | 2406 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 2407 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 2407 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 2408 | 2408 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2409 | 2409 | if ($globalDebug) echo "Add to DB..."; |
| 2410 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 2410 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 2411 | 2411 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 2412 | 2412 | if ($error != '') { |
| 2413 | 2413 | return $error; |
| 2414 | 2414 | } elseif ($globalDebug) echo "Done\n"; |
| 2415 | 2415 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 2416 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 2416 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 2417 | 2417 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2418 | 2418 | if ($globalDebug) echo "Add to DB..."; |
| 2419 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 2419 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 2420 | 2420 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 2421 | 2421 | if ($error != '') { |
| 2422 | 2422 | return $error; |
| 2423 | 2423 | } elseif ($globalDebug) echo "Done\n"; |
| 2424 | 2424 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 2425 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 2425 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 2426 | 2426 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2427 | 2427 | if ($globalDebug) echo "Add to DB..."; |
| 2428 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 2428 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 2429 | 2429 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 2430 | 2430 | if ($error != '') { |
| 2431 | 2431 | return $error; |
| 2432 | 2432 | } elseif ($globalDebug) echo "Done\n"; |
| 2433 | 2433 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 2434 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 2434 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 2435 | 2435 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2436 | 2436 | if ($globalDebug) echo "Add to DB..."; |
| 2437 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 2437 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 2438 | 2438 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 2439 | 2439 | if ($error != '') { |
| 2440 | 2440 | return $error; |
| 2441 | 2441 | } elseif ($globalDebug) echo "Done\n"; |
| 2442 | 2442 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
| 2443 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
| 2443 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
| 2444 | 2444 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2445 | 2445 | if ($globalDebug) echo "Add to DB..."; |
| 2446 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
| 2446 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
| 2447 | 2447 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
| 2448 | 2448 | if ($error != '') { |
| 2449 | 2449 | return $error; |
| 2450 | 2450 | } elseif ($globalDebug) echo "Done\n"; |
| 2451 | 2451 | if ($globalMasterSource) { |
| 2452 | 2452 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
| 2453 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
| 2453 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
| 2454 | 2454 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2455 | 2455 | if ($globalDebug) echo "Add to DB..."; |
| 2456 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
| 2456 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
| 2457 | 2457 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
| 2458 | 2458 | if ($error != '') { |
| 2459 | 2459 | return $error; |
| 2460 | 2460 | } elseif ($globalDebug) echo "Done\n"; |
| 2461 | 2461 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
| 2462 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
| 2462 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
| 2463 | 2463 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2464 | 2464 | if ($globalDebug) echo "Add to DB..."; |
| 2465 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
| 2465 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
| 2466 | 2466 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
| 2467 | 2467 | if ($error != '') { |
| 2468 | 2468 | return $error; |
@@ -2475,7 +2475,7 @@ discard block |
||
| 2475 | 2475 | global $tmp_dir, $globalDebug; |
| 2476 | 2476 | $error = ''; |
| 2477 | 2477 | if ($globalDebug) echo "Translation : Download..."; |
| 2478 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 2478 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 2479 | 2479 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2480 | 2480 | if ($globalDebug) echo "Unzip..."; |
| 2481 | 2481 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2492,10 +2492,10 @@ discard block |
||
| 2492 | 2492 | global $tmp_dir, $globalDebug; |
| 2493 | 2493 | $error = ''; |
| 2494 | 2494 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 2495 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 2496 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
| 2495 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 2496 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
| 2497 | 2497 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2498 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2498 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2499 | 2499 | $translation_md5 = $translation_md5_file[0]; |
| 2500 | 2500 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2501 | 2501 | if ($globalDebug) echo "Gunzip..."; |
@@ -2513,10 +2513,10 @@ discard block |
||
| 2513 | 2513 | global $tmp_dir, $globalDebug; |
| 2514 | 2514 | $error = ''; |
| 2515 | 2515 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
| 2516 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
| 2517 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
| 2516 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
| 2517 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
| 2518 | 2518 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2519 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2519 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2520 | 2520 | $modes_md5 = $modes_md5_file[0]; |
| 2521 | 2521 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2522 | 2522 | if ($globalDebug) echo "Gunzip..."; |
@@ -2535,12 +2535,12 @@ discard block |
||
| 2535 | 2535 | global $tmp_dir, $globalDebug; |
| 2536 | 2536 | $error = ''; |
| 2537 | 2537 | if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
| 2538 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
| 2538 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
|
| 2539 | 2539 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2540 | - $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
| 2540 | + $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
| 2541 | 2541 | $airlines_md5 = $airlines_md5_file[0]; |
| 2542 | 2542 | if (!update_db::check_airlines_version($airlines_md5)) { |
| 2543 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
| 2543 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
|
| 2544 | 2544 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2545 | 2545 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2546 | 2546 | if ($globalDebug) echo "Gunzip..."; |
@@ -2565,14 +2565,14 @@ discard block |
||
| 2565 | 2565 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
| 2566 | 2566 | $error = ''; |
| 2567 | 2567 | if ($globalOwner === TRUE) { |
| 2568 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2569 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2568 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2569 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2570 | 2570 | } else { |
| 2571 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2572 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2571 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2572 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2573 | 2573 | } |
| 2574 | 2574 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
| 2575 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2575 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2576 | 2576 | $owners_md5 = $owners_md5_file[0]; |
| 2577 | 2577 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2578 | 2578 | if ($globalDebug) echo "Gunzip..."; |
@@ -2589,10 +2589,10 @@ discard block |
||
| 2589 | 2589 | public static function update_routes_fam() { |
| 2590 | 2590 | global $tmp_dir, $globalDebug; |
| 2591 | 2591 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
| 2592 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
| 2593 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
| 2592 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
| 2593 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
| 2594 | 2594 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2595 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2595 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2596 | 2596 | $routes_md5 = $routes_md5_file[0]; |
| 2597 | 2597 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2598 | 2598 | if ($globalDebug) echo "Gunzip..."; |
@@ -2609,10 +2609,10 @@ discard block |
||
| 2609 | 2609 | public static function update_block_fam() { |
| 2610 | 2610 | global $tmp_dir, $globalDebug; |
| 2611 | 2611 | if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
| 2612 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
|
| 2613 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
|
| 2612 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz'); |
|
| 2613 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5'); |
|
| 2614 | 2614 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2615 | - $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
| 2615 | + $block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
| 2616 | 2616 | $block_md5 = $block_md5_file[0]; |
| 2617 | 2617 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2618 | 2618 | if ($globalDebug) echo "Gunzip..."; |
@@ -2628,13 +2628,13 @@ discard block |
||
| 2628 | 2628 | } |
| 2629 | 2629 | public static function update_marine_identity_fam() { |
| 2630 | 2630 | global $tmp_dir, $globalDebug; |
| 2631 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2631 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2632 | 2632 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
| 2633 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2633 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2634 | 2634 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2635 | 2635 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2636 | 2636 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
| 2637 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
| 2637 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
| 2638 | 2638 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2639 | 2639 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2640 | 2640 | if ($globalDebug) echo "Gunzip..."; |
@@ -2656,13 +2656,13 @@ discard block |
||
| 2656 | 2656 | |
| 2657 | 2657 | public static function update_satellite_fam() { |
| 2658 | 2658 | global $tmp_dir, $globalDebug; |
| 2659 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2659 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2660 | 2660 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
| 2661 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2661 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2662 | 2662 | $satellite_md5 = $satellite_md5_file[0]; |
| 2663 | 2663 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2664 | 2664 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
| 2665 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
| 2665 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
| 2666 | 2666 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2667 | 2667 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2668 | 2668 | if ($globalDebug) echo "Gunzip..."; |
@@ -2683,13 +2683,13 @@ discard block |
||
| 2683 | 2683 | } |
| 2684 | 2684 | public static function update_diagrams_fam() { |
| 2685 | 2685 | global $tmp_dir, $globalDebug; |
| 2686 | - update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5',$tmp_dir.'diagramspdf.md5'); |
|
| 2686 | + update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf.md5', $tmp_dir.'diagramspdf.md5'); |
|
| 2687 | 2687 | if (file_exists($tmp_dir.'diagramspdf.md5')) { |
| 2688 | - $diagrams_md5_file = explode(' ',file_get_contents($tmp_dir.'diagramspdf.md5')); |
|
| 2688 | + $diagrams_md5_file = explode(' ', file_get_contents($tmp_dir.'diagramspdf.md5')); |
|
| 2689 | 2689 | $diagrams_md5 = $diagrams_md5_file[0]; |
| 2690 | 2690 | if (!update_db::check_diagrams_version($diagrams_md5)) { |
| 2691 | 2691 | if ($globalDebug) echo "Airports diagrams from FlightAirMap website : Download..."; |
| 2692 | - update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf',$tmp_dir.'diagramspdf'); |
|
| 2692 | + update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf', $tmp_dir.'diagramspdf'); |
|
| 2693 | 2693 | if (file_exists($tmp_dir.'diagramspdf')) { |
| 2694 | 2694 | if (md5_file($tmp_dir.'diagramspdf') == $diagrams_md5) { |
| 2695 | 2695 | if ($globalDebug) echo "Add to DB..."; |
@@ -2709,7 +2709,7 @@ discard block |
||
| 2709 | 2709 | public static function update_banned_fam() { |
| 2710 | 2710 | global $tmp_dir, $globalDebug; |
| 2711 | 2711 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
| 2712 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
| 2712 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
| 2713 | 2713 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2714 | 2714 | //if ($globalDebug) echo "Gunzip..."; |
| 2715 | 2715 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2728,18 +2728,18 @@ discard block |
||
| 2728 | 2728 | $error = ''; |
| 2729 | 2729 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
| 2730 | 2730 | if ($globalDBdriver == 'mysql') { |
| 2731 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2731 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2732 | 2732 | } else { |
| 2733 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2733 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2734 | 2734 | } |
| 2735 | 2735 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
| 2736 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2736 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2737 | 2737 | $airspace_md5 = $airspace_md5_file[0]; |
| 2738 | 2738 | if (!update_db::check_airspace_version($airspace_md5)) { |
| 2739 | 2739 | if ($globalDBdriver == 'mysql') { |
| 2740 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2740 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2741 | 2741 | } else { |
| 2742 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2742 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2743 | 2743 | } |
| 2744 | 2744 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2745 | 2745 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2752,7 +2752,7 @@ discard block |
||
| 2752 | 2752 | try { |
| 2753 | 2753 | $sth = $Connection->db->prepare($query); |
| 2754 | 2754 | $sth->execute(); |
| 2755 | - } catch(PDOException $e) { |
|
| 2755 | + } catch (PDOException $e) { |
|
| 2756 | 2756 | return "error : ".$e->getMessage(); |
| 2757 | 2757 | } |
| 2758 | 2758 | } |
@@ -2772,16 +2772,16 @@ discard block |
||
| 2772 | 2772 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2773 | 2773 | $error = ''; |
| 2774 | 2774 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
| 2775 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2775 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2776 | 2776 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2777 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2777 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2778 | 2778 | $geoid_md5 = $geoid_md5_file[0]; |
| 2779 | 2779 | if (!update_db::check_geoid_version($geoid_md5)) { |
| 2780 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2780 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2781 | 2781 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2782 | 2782 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2783 | 2783 | if ($globalDebug) echo "Gunzip..."; |
| 2784 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2784 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2785 | 2785 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2786 | 2786 | update_db::insert_geoid_version($geoid_md5); |
| 2787 | 2787 | } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
@@ -2798,15 +2798,15 @@ discard block |
||
| 2798 | 2798 | public static function update_tle() { |
| 2799 | 2799 | global $tmp_dir, $globalDebug; |
| 2800 | 2800 | if ($globalDebug) echo "Download TLE : Download..."; |
| 2801 | - $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', |
|
| 2802 | - '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', |
|
| 2803 | - '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'); |
|
| 2801 | + $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', |
|
| 2802 | + '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', |
|
| 2803 | + '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'); |
|
| 2804 | 2804 | foreach ($alltle as $filename) { |
| 2805 | 2805 | if ($globalDebug) echo "downloading ".$filename.'...'; |
| 2806 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
| 2806 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
| 2807 | 2807 | if (file_exists($tmp_dir.$filename)) { |
| 2808 | 2808 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
| 2809 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
| 2809 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
| 2810 | 2810 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
| 2811 | 2811 | if ($error != '') { |
| 2812 | 2812 | echo $error."\n"; |
@@ -2818,7 +2818,7 @@ discard block |
||
| 2818 | 2818 | public static function update_ucsdb() { |
| 2819 | 2819 | global $tmp_dir, $globalDebug; |
| 2820 | 2820 | if ($globalDebug) echo "Download UCS DB : Download..."; |
| 2821 | - 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'); |
|
| 2821 | + 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'); |
|
| 2822 | 2822 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2823 | 2823 | if ($globalDebug) echo "Add to DB..."; |
| 2824 | 2824 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
@@ -2832,7 +2832,7 @@ discard block |
||
| 2832 | 2832 | public static function update_celestrak() { |
| 2833 | 2833 | global $tmp_dir, $globalDebug; |
| 2834 | 2834 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
| 2835 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
| 2835 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
| 2836 | 2836 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2837 | 2837 | if ($globalDebug) echo "Add to DB..."; |
| 2838 | 2838 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2851,62 +2851,62 @@ discard block |
||
| 2851 | 2851 | if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
| 2852 | 2852 | return ''; |
| 2853 | 2853 | } |
| 2854 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
| 2854 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
| 2855 | 2855 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2856 | 2856 | if ($globalDebug) echo "Check files...\n"; |
| 2857 | 2857 | $newmodelsdb = array(); |
| 2858 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
| 2859 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2858 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
| 2859 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2860 | 2860 | $model = trim($row[2]); |
| 2861 | 2861 | $newmodelsdb[$model] = trim($row[0]); |
| 2862 | 2862 | } |
| 2863 | 2863 | } |
| 2864 | 2864 | $modelsdb = array(); |
| 2865 | 2865 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
| 2866 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
| 2867 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2866 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
| 2867 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2868 | 2868 | $model = trim($row[2]); |
| 2869 | 2869 | $modelsdb[$model] = trim($row[0]); |
| 2870 | 2870 | } |
| 2871 | 2871 | } |
| 2872 | 2872 | } |
| 2873 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2873 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2874 | 2874 | foreach ($diff as $key => $value) { |
| 2875 | 2875 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2876 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
| 2876 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
| 2877 | 2877 | } |
| 2878 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2878 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2879 | 2879 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2880 | 2880 | if ($error != '') { |
| 2881 | 2881 | return $error; |
| 2882 | 2882 | } elseif ($globalDebug) echo "Done\n"; |
| 2883 | 2883 | if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
| 2884 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
|
| 2884 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum'); |
|
| 2885 | 2885 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2886 | 2886 | if ($globalDebug) echo "Check files...\n"; |
| 2887 | 2887 | $newmodelsdb = array(); |
| 2888 | - if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
|
| 2889 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2888 | + if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) { |
|
| 2889 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2890 | 2890 | $model = trim($row[2]); |
| 2891 | 2891 | $newmodelsdb[$model] = trim($row[0]); |
| 2892 | 2892 | } |
| 2893 | 2893 | } |
| 2894 | 2894 | $modelsdb = array(); |
| 2895 | 2895 | if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) { |
| 2896 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) { |
|
| 2897 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2896 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) { |
|
| 2897 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2898 | 2898 | $model = trim($row[2]); |
| 2899 | 2899 | $modelsdb[$model] = trim($row[0]); |
| 2900 | 2900 | } |
| 2901 | 2901 | } |
| 2902 | 2902 | } |
| 2903 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2903 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2904 | 2904 | foreach ($diff as $key => $value) { |
| 2905 | 2905 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2906 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
|
| 2906 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key); |
|
| 2907 | 2907 | |
| 2908 | 2908 | } |
| 2909 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
| 2909 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
| 2910 | 2910 | } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
| 2911 | 2911 | if ($error != '') { |
| 2912 | 2912 | return $error; |
@@ -2922,32 +2922,32 @@ discard block |
||
| 2922 | 2922 | return ''; |
| 2923 | 2923 | } |
| 2924 | 2924 | if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
| 2925 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
|
| 2925 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum'); |
|
| 2926 | 2926 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
| 2927 | 2927 | if ($globalDebug) echo "Check files...\n"; |
| 2928 | 2928 | $newmodelsdb = array(); |
| 2929 | - if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
|
| 2930 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2929 | + if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) { |
|
| 2930 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2931 | 2931 | $model = trim($row[2]); |
| 2932 | 2932 | $newmodelsdb[$model] = trim($row[0]); |
| 2933 | 2933 | } |
| 2934 | 2934 | } |
| 2935 | 2935 | $modelsdb = array(); |
| 2936 | 2936 | if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) { |
| 2937 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) { |
|
| 2938 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2937 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) { |
|
| 2938 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2939 | 2939 | $model = trim($row[2]); |
| 2940 | 2940 | $modelsdb[$model] = trim($row[0]); |
| 2941 | 2941 | } |
| 2942 | 2942 | } |
| 2943 | 2943 | } |
| 2944 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2944 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2945 | 2945 | foreach ($diff as $key => $value) { |
| 2946 | 2946 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2947 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
| 2947 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
| 2948 | 2948 | |
| 2949 | 2949 | } |
| 2950 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
| 2950 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
| 2951 | 2951 | } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
| 2952 | 2952 | if ($error != '') { |
| 2953 | 2953 | return $error; |
@@ -2959,32 +2959,32 @@ discard block |
||
| 2959 | 2959 | global $tmp_dir, $globalDebug; |
| 2960 | 2960 | $error = ''; |
| 2961 | 2961 | if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
| 2962 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
|
| 2962 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum'); |
|
| 2963 | 2963 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2964 | 2964 | if ($globalDebug) echo "Check files...\n"; |
| 2965 | 2965 | $newmodelsdb = array(); |
| 2966 | - if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
|
| 2967 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2966 | + if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) { |
|
| 2967 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2968 | 2968 | $model = trim($row[2]); |
| 2969 | 2969 | $newmodelsdb[$model] = trim($row[0]); |
| 2970 | 2970 | } |
| 2971 | 2971 | } |
| 2972 | 2972 | $modelsdb = array(); |
| 2973 | 2973 | if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) { |
| 2974 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) { |
|
| 2975 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2974 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) { |
|
| 2975 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2976 | 2976 | $model = trim($row[2]); |
| 2977 | 2977 | $modelsdb[$model] = trim($row[0]); |
| 2978 | 2978 | } |
| 2979 | 2979 | } |
| 2980 | 2980 | } |
| 2981 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2981 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2982 | 2982 | foreach ($diff as $key => $value) { |
| 2983 | 2983 | if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
| 2984 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
| 2984 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
| 2985 | 2985 | |
| 2986 | 2986 | } |
| 2987 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
| 2987 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
| 2988 | 2988 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2989 | 2989 | if ($error != '') { |
| 2990 | 2990 | return $error; |
@@ -3000,32 +3000,32 @@ discard block |
||
| 3000 | 3000 | return ''; |
| 3001 | 3001 | } |
| 3002 | 3002 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
| 3003 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
| 3003 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
| 3004 | 3004 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 3005 | 3005 | if ($globalDebug) echo "Check files...\n"; |
| 3006 | 3006 | $newmodelsdb = array(); |
| 3007 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
| 3008 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 3007 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
| 3008 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 3009 | 3009 | $model = trim($row[2]); |
| 3010 | 3010 | $newmodelsdb[$model] = trim($row[0]); |
| 3011 | 3011 | } |
| 3012 | 3012 | } |
| 3013 | 3013 | $modelsdb = array(); |
| 3014 | 3014 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
| 3015 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
| 3016 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 3015 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
| 3016 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 3017 | 3017 | $model = trim($row[2]); |
| 3018 | 3018 | $modelsdb[$model] = trim($row[0]); |
| 3019 | 3019 | } |
| 3020 | 3020 | } |
| 3021 | 3021 | } |
| 3022 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 3022 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 3023 | 3023 | foreach ($diff as $key => $value) { |
| 3024 | 3024 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
| 3025 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
| 3025 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
| 3026 | 3026 | |
| 3027 | 3027 | } |
| 3028 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 3028 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 3029 | 3029 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 3030 | 3030 | if ($error != '') { |
| 3031 | 3031 | return $error; |
@@ -3041,32 +3041,32 @@ discard block |
||
| 3041 | 3041 | return ''; |
| 3042 | 3042 | } |
| 3043 | 3043 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
| 3044 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
| 3044 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
| 3045 | 3045 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 3046 | 3046 | if ($globalDebug) echo "Check files...\n"; |
| 3047 | 3047 | $newmodelsdb = array(); |
| 3048 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
| 3049 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 3048 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 3049 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 3050 | 3050 | $model = trim($row[2]); |
| 3051 | 3051 | $newmodelsdb[$model] = trim($row[0]); |
| 3052 | 3052 | } |
| 3053 | 3053 | } |
| 3054 | 3054 | $modelsdb = array(); |
| 3055 | 3055 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
| 3056 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
| 3057 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 3056 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 3057 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 3058 | 3058 | $model = trim($row[2]); |
| 3059 | 3059 | $modelsdb[$model] = trim($row[0]); |
| 3060 | 3060 | } |
| 3061 | 3061 | } |
| 3062 | 3062 | } |
| 3063 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 3063 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 3064 | 3064 | foreach ($diff as $key => $value) { |
| 3065 | 3065 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
| 3066 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 3066 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 3067 | 3067 | |
| 3068 | 3068 | } |
| 3069 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 3069 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 3070 | 3070 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 3071 | 3071 | if ($error != '') { |
| 3072 | 3072 | return $error; |
@@ -3078,8 +3078,8 @@ discard block |
||
| 3078 | 3078 | global $tmp_dir, $globalDebug; |
| 3079 | 3079 | date_default_timezone_set('UTC'); |
| 3080 | 3080 | $Common = new Common(); |
| 3081 | - $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes','post',array('X-Requested-With: XMLHttpRequest','Accept: application/json, text/javascript, */*; q=0.01','Host: www4.icao.int','Origin: https://www.icao.int','Content-Length: 0'),'','','https://www.icao.int/publications/DOC8643/Pages/Search.aspx',60); |
|
| 3082 | - $all = json_decode($data,true); |
|
| 3081 | + $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes', 'post', array('X-Requested-With: XMLHttpRequest', 'Accept: application/json, text/javascript, */*; q=0.01', 'Host: www4.icao.int', 'Origin: https://www.icao.int', 'Content-Length: 0'), '', '', 'https://www.icao.int/publications/DOC8643/Pages/Search.aspx', 60); |
|
| 3082 | + $all = json_decode($data, true); |
|
| 3083 | 3083 | $Connection = new Connection(); |
| 3084 | 3084 | $querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao"; |
| 3085 | 3085 | $sth = $Connection->db->prepare($querychk); |
@@ -3091,8 +3091,8 @@ discard block |
||
| 3091 | 3091 | foreach ($all as $model) { |
| 3092 | 3092 | $icao = $model['Designator']; |
| 3093 | 3093 | if (!isset($allicao[$icao])) { |
| 3094 | - $aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png'; |
|
| 3095 | - $allicao[$icao] = array(':icao' => $icao,':type' => $model['ModelFullName'],':manufacturer' => $model['ManufacturerCode'],':aircraft_shadow' => $aircraft_shadow,':aircraft_description' => $model['AircraftDescription'],':engine_type' => $model['EngineType'],':engine_count' => $model['EngineCount'],':wake_category' => $model['WTC']); |
|
| 3094 | + $aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png'; |
|
| 3095 | + $allicao[$icao] = array(':icao' => $icao, ':type' => $model['ModelFullName'], ':manufacturer' => $model['ManufacturerCode'], ':aircraft_shadow' => $aircraft_shadow, ':aircraft_description' => $model['AircraftDescription'], ':engine_type' => $model['EngineType'], ':engine_count' => $model['EngineCount'], ':wake_category' => $model['WTC']); |
|
| 3096 | 3096 | } else { |
| 3097 | 3097 | $allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName']; |
| 3098 | 3098 | } |
@@ -3104,9 +3104,9 @@ discard block |
||
| 3104 | 3104 | if ($exist[0]['nb'] == 0) { |
| 3105 | 3105 | $sthins->execute($airdata); |
| 3106 | 3106 | } else { |
| 3107 | - $sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao)); |
|
| 3107 | + $sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao)); |
|
| 3108 | 3108 | } |
| 3109 | - } catch(PDOException $e) { |
|
| 3109 | + } catch (PDOException $e) { |
|
| 3110 | 3110 | return "error : ".$e->getMessage(); |
| 3111 | 3111 | } |
| 3112 | 3112 | } |
@@ -3138,23 +3138,23 @@ discard block |
||
| 3138 | 3138 | $Connection = new Connection(); |
| 3139 | 3139 | $sth = $Connection->db->prepare($query); |
| 3140 | 3140 | $sth->execute(); |
| 3141 | - } catch(PDOException $e) { |
|
| 3141 | + } catch (PDOException $e) { |
|
| 3142 | 3142 | return "error : ".$e->getMessage(); |
| 3143 | 3143 | } |
| 3144 | 3144 | |
| 3145 | 3145 | $error = ''; |
| 3146 | 3146 | if ($globalDebug) echo "Notam : Download..."; |
| 3147 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 3147 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 3148 | 3148 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3149 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 3149 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 3150 | 3150 | foreach ($notams['channel']['item'] as $notam) { |
| 3151 | - $title = explode(':',$notam['title']); |
|
| 3151 | + $title = explode(':', $notam['title']); |
|
| 3152 | 3152 | $data['ref'] = trim($title[0]); |
| 3153 | 3153 | unset($title[0]); |
| 3154 | - $data['title'] = trim(implode(':',$title)); |
|
| 3155 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 3156 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 3157 | - $q = explode('/',$match[1]); |
|
| 3154 | + $data['title'] = trim(implode(':', $title)); |
|
| 3155 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 3156 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 3157 | + $q = explode('/', $match[1]); |
|
| 3158 | 3158 | $data['fir'] = $q[0]; |
| 3159 | 3159 | $data['code'] = $q[1]; |
| 3160 | 3160 | $ifrvfr = $q[2]; |
@@ -3170,30 +3170,30 @@ discard block |
||
| 3170 | 3170 | $data['lower_limit'] = $q[5]; |
| 3171 | 3171 | $data['upper_limit'] = $q[6]; |
| 3172 | 3172 | $latlonrad = $q[7]; |
| 3173 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 3174 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 3175 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 3173 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 3174 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 3175 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 3176 | 3176 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 3177 | 3177 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 3178 | 3178 | $data['center_latitude'] = $latitude; |
| 3179 | 3179 | $data['center_longitude'] = $longitude; |
| 3180 | 3180 | $data['radius'] = intval($radius); |
| 3181 | 3181 | |
| 3182 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 3182 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 3183 | 3183 | $data['text'] = $match[1]; |
| 3184 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 3184 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 3185 | 3185 | $fromto = $match[1]; |
| 3186 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 3186 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 3187 | 3187 | $fromall = trim($match[1]); |
| 3188 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 3188 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 3189 | 3189 | $from = trim($match[1]); |
| 3190 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 3191 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 3190 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 3191 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 3192 | 3192 | $toall = trim($match[1]); |
| 3193 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 3194 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 3193 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 3194 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 3195 | 3195 | $to = trim($match[1]); |
| 3196 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 3196 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 3197 | 3197 | $data['permanent'] = 0; |
| 3198 | 3198 | } else { |
| 3199 | 3199 | $data['date_end'] = NULL; |
@@ -3201,7 +3201,7 @@ discard block |
||
| 3201 | 3201 | } |
| 3202 | 3202 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 3203 | 3203 | $NOTAM = new NOTAM(); |
| 3204 | - $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']); |
|
| 3204 | + $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']); |
|
| 3205 | 3205 | unset($data); |
| 3206 | 3206 | } |
| 3207 | 3207 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -3224,16 +3224,16 @@ discard block |
||
| 3224 | 3224 | $Connection = new Connection(); |
| 3225 | 3225 | $sth = $Connection->db->prepare($query); |
| 3226 | 3226 | $sth->execute(); |
| 3227 | - } catch(PDOException $e) { |
|
| 3227 | + } catch (PDOException $e) { |
|
| 3228 | 3228 | return "error : ".$e->getMessage(); |
| 3229 | 3229 | } |
| 3230 | 3230 | } |
| 3231 | 3231 | $Common = new Common(); |
| 3232 | 3232 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3233 | - $airspace_json = json_decode($airspace_lst,true); |
|
| 3233 | + $airspace_json = json_decode($airspace_lst, true); |
|
| 3234 | 3234 | foreach ($airspace_json['records'] as $airspace) { |
| 3235 | 3235 | if ($globalDebug) echo $airspace['name']."...\n"; |
| 3236 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
| 3236 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
| 3237 | 3237 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3238 | 3238 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
| 3239 | 3239 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -3255,7 +3255,7 @@ discard block |
||
| 3255 | 3255 | $Connection = new Connection(); |
| 3256 | 3256 | $sth = $Connection->db->prepare($query); |
| 3257 | 3257 | $sth->execute(array(':new' => $new, ':old' => $old)); |
| 3258 | - } catch(PDOException $e) { |
|
| 3258 | + } catch (PDOException $e) { |
|
| 3259 | 3259 | return "error : ".$e->getMessage(); |
| 3260 | 3260 | } |
| 3261 | 3261 | } |
@@ -3272,7 +3272,7 @@ discard block |
||
| 3272 | 3272 | $Connection = new Connection(); |
| 3273 | 3273 | $sth = $Connection->db->prepare($query); |
| 3274 | 3274 | $sth->execute(); |
| 3275 | - } catch(PDOException $e) { |
|
| 3275 | + } catch (PDOException $e) { |
|
| 3276 | 3276 | return "error : ".$e->getMessage(); |
| 3277 | 3277 | } |
| 3278 | 3278 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3287,7 +3287,7 @@ discard block |
||
| 3287 | 3287 | $Connection = new Connection(); |
| 3288 | 3288 | $sth = $Connection->db->prepare($query); |
| 3289 | 3289 | $sth->execute(); |
| 3290 | - } catch(PDOException $e) { |
|
| 3290 | + } catch (PDOException $e) { |
|
| 3291 | 3291 | return "error : ".$e->getMessage(); |
| 3292 | 3292 | } |
| 3293 | 3293 | } |
@@ -3298,7 +3298,7 @@ discard block |
||
| 3298 | 3298 | $Connection = new Connection(); |
| 3299 | 3299 | $sth = $Connection->db->prepare($query); |
| 3300 | 3300 | $sth->execute(array(':version' => $version)); |
| 3301 | - } catch(PDOException $e) { |
|
| 3301 | + } catch (PDOException $e) { |
|
| 3302 | 3302 | return "error : ".$e->getMessage(); |
| 3303 | 3303 | } |
| 3304 | 3304 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3312,7 +3312,7 @@ discard block |
||
| 3312 | 3312 | $Connection = new Connection(); |
| 3313 | 3313 | $sth = $Connection->db->prepare($query); |
| 3314 | 3314 | $sth->execute(array(':version' => $version)); |
| 3315 | - } catch(PDOException $e) { |
|
| 3315 | + } catch (PDOException $e) { |
|
| 3316 | 3316 | return "error : ".$e->getMessage(); |
| 3317 | 3317 | } |
| 3318 | 3318 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3326,7 +3326,7 @@ discard block |
||
| 3326 | 3326 | $Connection = new Connection(); |
| 3327 | 3327 | $sth = $Connection->db->prepare($query); |
| 3328 | 3328 | $sth->execute(array(':version' => $version)); |
| 3329 | - } catch(PDOException $e) { |
|
| 3329 | + } catch (PDOException $e) { |
|
| 3330 | 3330 | return "error : ".$e->getMessage(); |
| 3331 | 3331 | } |
| 3332 | 3332 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3340,7 +3340,7 @@ discard block |
||
| 3340 | 3340 | $Connection = new Connection(); |
| 3341 | 3341 | $sth = $Connection->db->prepare($query); |
| 3342 | 3342 | $sth->execute(array(':version' => $version)); |
| 3343 | - } catch(PDOException $e) { |
|
| 3343 | + } catch (PDOException $e) { |
|
| 3344 | 3344 | return "error : ".$e->getMessage(); |
| 3345 | 3345 | } |
| 3346 | 3346 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3353,7 +3353,7 @@ discard block |
||
| 3353 | 3353 | $Connection = new Connection(); |
| 3354 | 3354 | $sth = $Connection->db->prepare($query); |
| 3355 | 3355 | $sth->execute(array(':version' => $version)); |
| 3356 | - } catch(PDOException $e) { |
|
| 3356 | + } catch (PDOException $e) { |
|
| 3357 | 3357 | return "error : ".$e->getMessage(); |
| 3358 | 3358 | } |
| 3359 | 3359 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3367,7 +3367,7 @@ discard block |
||
| 3367 | 3367 | $Connection = new Connection(); |
| 3368 | 3368 | $sth = $Connection->db->prepare($query); |
| 3369 | 3369 | $sth->execute(array(':version' => $version)); |
| 3370 | - } catch(PDOException $e) { |
|
| 3370 | + } catch (PDOException $e) { |
|
| 3371 | 3371 | return "error : ".$e->getMessage(); |
| 3372 | 3372 | } |
| 3373 | 3373 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3381,7 +3381,7 @@ discard block |
||
| 3381 | 3381 | $Connection = new Connection(); |
| 3382 | 3382 | $sth = $Connection->db->prepare($query); |
| 3383 | 3383 | $sth->execute(array(':version' => $version)); |
| 3384 | - } catch(PDOException $e) { |
|
| 3384 | + } catch (PDOException $e) { |
|
| 3385 | 3385 | return "error : ".$e->getMessage(); |
| 3386 | 3386 | } |
| 3387 | 3387 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3396,7 +3396,7 @@ discard block |
||
| 3396 | 3396 | $Connection = new Connection(); |
| 3397 | 3397 | $sth = $Connection->db->prepare($query); |
| 3398 | 3398 | $sth->execute(array(':version' => $version)); |
| 3399 | - } catch(PDOException $e) { |
|
| 3399 | + } catch (PDOException $e) { |
|
| 3400 | 3400 | return "error : ".$e->getMessage(); |
| 3401 | 3401 | } |
| 3402 | 3402 | } |
@@ -3408,7 +3408,7 @@ discard block |
||
| 3408 | 3408 | $Connection = new Connection(); |
| 3409 | 3409 | $sth = $Connection->db->prepare($query); |
| 3410 | 3410 | $sth->execute(array(':version' => $version)); |
| 3411 | - } catch(PDOException $e) { |
|
| 3411 | + } catch (PDOException $e) { |
|
| 3412 | 3412 | return "error : ".$e->getMessage(); |
| 3413 | 3413 | } |
| 3414 | 3414 | } |
@@ -3420,7 +3420,7 @@ discard block |
||
| 3420 | 3420 | $Connection = new Connection(); |
| 3421 | 3421 | $sth = $Connection->db->prepare($query); |
| 3422 | 3422 | $sth->execute(array(':version' => $version)); |
| 3423 | - } catch(PDOException $e) { |
|
| 3423 | + } catch (PDOException $e) { |
|
| 3424 | 3424 | return "error : ".$e->getMessage(); |
| 3425 | 3425 | } |
| 3426 | 3426 | } |
@@ -3432,7 +3432,7 @@ discard block |
||
| 3432 | 3432 | $Connection = new Connection(); |
| 3433 | 3433 | $sth = $Connection->db->prepare($query); |
| 3434 | 3434 | $sth->execute(array(':version' => $version)); |
| 3435 | - } catch(PDOException $e) { |
|
| 3435 | + } catch (PDOException $e) { |
|
| 3436 | 3436 | return "error : ".$e->getMessage(); |
| 3437 | 3437 | } |
| 3438 | 3438 | } |
@@ -3444,7 +3444,7 @@ discard block |
||
| 3444 | 3444 | $Connection = new Connection(); |
| 3445 | 3445 | $sth = $Connection->db->prepare($query); |
| 3446 | 3446 | $sth->execute(array(':version' => $version)); |
| 3447 | - } catch(PDOException $e) { |
|
| 3447 | + } catch (PDOException $e) { |
|
| 3448 | 3448 | return "error : ".$e->getMessage(); |
| 3449 | 3449 | } |
| 3450 | 3450 | } |
@@ -3456,7 +3456,7 @@ discard block |
||
| 3456 | 3456 | $Connection = new Connection(); |
| 3457 | 3457 | $sth = $Connection->db->prepare($query); |
| 3458 | 3458 | $sth->execute(array(':version' => $version)); |
| 3459 | - } catch(PDOException $e) { |
|
| 3459 | + } catch (PDOException $e) { |
|
| 3460 | 3460 | return "error : ".$e->getMessage(); |
| 3461 | 3461 | } |
| 3462 | 3462 | } |
@@ -3467,7 +3467,7 @@ discard block |
||
| 3467 | 3467 | $Connection = new Connection(); |
| 3468 | 3468 | $sth = $Connection->db->prepare($query); |
| 3469 | 3469 | $sth->execute(array(':version' => $version)); |
| 3470 | - } catch(PDOException $e) { |
|
| 3470 | + } catch (PDOException $e) { |
|
| 3471 | 3471 | return "error : ".$e->getMessage(); |
| 3472 | 3472 | } |
| 3473 | 3473 | } |
@@ -3483,7 +3483,7 @@ discard block |
||
| 3483 | 3483 | $Connection = new Connection(); |
| 3484 | 3484 | $sth = $Connection->db->prepare($query); |
| 3485 | 3485 | $sth->execute(); |
| 3486 | - } catch(PDOException $e) { |
|
| 3486 | + } catch (PDOException $e) { |
|
| 3487 | 3487 | return "error : ".$e->getMessage(); |
| 3488 | 3488 | } |
| 3489 | 3489 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3498,7 +3498,7 @@ discard block |
||
| 3498 | 3498 | $Connection = new Connection(); |
| 3499 | 3499 | $sth = $Connection->db->prepare($query); |
| 3500 | 3500 | $sth->execute(); |
| 3501 | - } catch(PDOException $e) { |
|
| 3501 | + } catch (PDOException $e) { |
|
| 3502 | 3502 | return "error : ".$e->getMessage(); |
| 3503 | 3503 | } |
| 3504 | 3504 | } |
@@ -3514,7 +3514,7 @@ discard block |
||
| 3514 | 3514 | $Connection = new Connection(); |
| 3515 | 3515 | $sth = $Connection->db->prepare($query); |
| 3516 | 3516 | $sth->execute(); |
| 3517 | - } catch(PDOException $e) { |
|
| 3517 | + } catch (PDOException $e) { |
|
| 3518 | 3518 | return "error : ".$e->getMessage(); |
| 3519 | 3519 | } |
| 3520 | 3520 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3529,7 +3529,7 @@ discard block |
||
| 3529 | 3529 | $Connection = new Connection(); |
| 3530 | 3530 | $sth = $Connection->db->prepare($query); |
| 3531 | 3531 | $sth->execute(); |
| 3532 | - } catch(PDOException $e) { |
|
| 3532 | + } catch (PDOException $e) { |
|
| 3533 | 3533 | return "error : ".$e->getMessage(); |
| 3534 | 3534 | } |
| 3535 | 3535 | } |
@@ -3545,7 +3545,7 @@ discard block |
||
| 3545 | 3545 | $Connection = new Connection(); |
| 3546 | 3546 | $sth = $Connection->db->prepare($query); |
| 3547 | 3547 | $sth->execute(); |
| 3548 | - } catch(PDOException $e) { |
|
| 3548 | + } catch (PDOException $e) { |
|
| 3549 | 3549 | return "error : ".$e->getMessage(); |
| 3550 | 3550 | } |
| 3551 | 3551 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3560,7 +3560,7 @@ discard block |
||
| 3560 | 3560 | $Connection = new Connection(); |
| 3561 | 3561 | $sth = $Connection->db->prepare($query); |
| 3562 | 3562 | $sth->execute(); |
| 3563 | - } catch(PDOException $e) { |
|
| 3563 | + } catch (PDOException $e) { |
|
| 3564 | 3564 | return "error : ".$e->getMessage(); |
| 3565 | 3565 | } |
| 3566 | 3566 | } |
@@ -3576,7 +3576,7 @@ discard block |
||
| 3576 | 3576 | $Connection = new Connection(); |
| 3577 | 3577 | $sth = $Connection->db->prepare($query); |
| 3578 | 3578 | $sth->execute(); |
| 3579 | - } catch(PDOException $e) { |
|
| 3579 | + } catch (PDOException $e) { |
|
| 3580 | 3580 | return "error : ".$e->getMessage(); |
| 3581 | 3581 | } |
| 3582 | 3582 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3591,7 +3591,7 @@ discard block |
||
| 3591 | 3591 | $Connection = new Connection(); |
| 3592 | 3592 | $sth = $Connection->db->prepare($query); |
| 3593 | 3593 | $sth->execute(); |
| 3594 | - } catch(PDOException $e) { |
|
| 3594 | + } catch (PDOException $e) { |
|
| 3595 | 3595 | return "error : ".$e->getMessage(); |
| 3596 | 3596 | } |
| 3597 | 3597 | } |
@@ -3607,7 +3607,7 @@ discard block |
||
| 3607 | 3607 | $Connection = new Connection(); |
| 3608 | 3608 | $sth = $Connection->db->prepare($query); |
| 3609 | 3609 | $sth->execute(); |
| 3610 | - } catch(PDOException $e) { |
|
| 3610 | + } catch (PDOException $e) { |
|
| 3611 | 3611 | return "error : ".$e->getMessage(); |
| 3612 | 3612 | } |
| 3613 | 3613 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3622,7 +3622,7 @@ discard block |
||
| 3622 | 3622 | $Connection = new Connection(); |
| 3623 | 3623 | $sth = $Connection->db->prepare($query); |
| 3624 | 3624 | $sth->execute(); |
| 3625 | - } catch(PDOException $e) { |
|
| 3625 | + } catch (PDOException $e) { |
|
| 3626 | 3626 | return "error : ".$e->getMessage(); |
| 3627 | 3627 | } |
| 3628 | 3628 | } |
@@ -3638,7 +3638,7 @@ discard block |
||
| 3638 | 3638 | $Connection = new Connection(); |
| 3639 | 3639 | $sth = $Connection->db->prepare($query); |
| 3640 | 3640 | $sth->execute(); |
| 3641 | - } catch(PDOException $e) { |
|
| 3641 | + } catch (PDOException $e) { |
|
| 3642 | 3642 | return "error : ".$e->getMessage(); |
| 3643 | 3643 | } |
| 3644 | 3644 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3653,7 +3653,7 @@ discard block |
||
| 3653 | 3653 | $Connection = new Connection(); |
| 3654 | 3654 | $sth = $Connection->db->prepare($query); |
| 3655 | 3655 | $sth->execute(); |
| 3656 | - } catch(PDOException $e) { |
|
| 3656 | + } catch (PDOException $e) { |
|
| 3657 | 3657 | return "error : ".$e->getMessage(); |
| 3658 | 3658 | } |
| 3659 | 3659 | } |
@@ -3669,7 +3669,7 @@ discard block |
||
| 3669 | 3669 | $Connection = new Connection(); |
| 3670 | 3670 | $sth = $Connection->db->prepare($query); |
| 3671 | 3671 | $sth->execute(); |
| 3672 | - } catch(PDOException $e) { |
|
| 3672 | + } catch (PDOException $e) { |
|
| 3673 | 3673 | return "error : ".$e->getMessage(); |
| 3674 | 3674 | } |
| 3675 | 3675 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3684,7 +3684,7 @@ discard block |
||
| 3684 | 3684 | $Connection = new Connection(); |
| 3685 | 3685 | $sth = $Connection->db->prepare($query); |
| 3686 | 3686 | $sth->execute(); |
| 3687 | - } catch(PDOException $e) { |
|
| 3687 | + } catch (PDOException $e) { |
|
| 3688 | 3688 | return "error : ".$e->getMessage(); |
| 3689 | 3689 | } |
| 3690 | 3690 | } |
@@ -3700,7 +3700,7 @@ discard block |
||
| 3700 | 3700 | $Connection = new Connection(); |
| 3701 | 3701 | $sth = $Connection->db->prepare($query); |
| 3702 | 3702 | $sth->execute(); |
| 3703 | - } catch(PDOException $e) { |
|
| 3703 | + } catch (PDOException $e) { |
|
| 3704 | 3704 | return "error : ".$e->getMessage(); |
| 3705 | 3705 | } |
| 3706 | 3706 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3715,7 +3715,7 @@ discard block |
||
| 3715 | 3715 | $Connection = new Connection(); |
| 3716 | 3716 | $sth = $Connection->db->prepare($query); |
| 3717 | 3717 | $sth->execute(); |
| 3718 | - } catch(PDOException $e) { |
|
| 3718 | + } catch (PDOException $e) { |
|
| 3719 | 3719 | return "error : ".$e->getMessage(); |
| 3720 | 3720 | } |
| 3721 | 3721 | } |
@@ -3731,7 +3731,7 @@ discard block |
||
| 3731 | 3731 | $Connection = new Connection(); |
| 3732 | 3732 | $sth = $Connection->db->prepare($query); |
| 3733 | 3733 | $sth->execute(); |
| 3734 | - } catch(PDOException $e) { |
|
| 3734 | + } catch (PDOException $e) { |
|
| 3735 | 3735 | return "error : ".$e->getMessage(); |
| 3736 | 3736 | } |
| 3737 | 3737 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3746,7 +3746,7 @@ discard block |
||
| 3746 | 3746 | $Connection = new Connection(); |
| 3747 | 3747 | $sth = $Connection->db->prepare($query); |
| 3748 | 3748 | $sth->execute(); |
| 3749 | - } catch(PDOException $e) { |
|
| 3749 | + } catch (PDOException $e) { |
|
| 3750 | 3750 | return "error : ".$e->getMessage(); |
| 3751 | 3751 | } |
| 3752 | 3752 | } |
@@ -3762,7 +3762,7 @@ discard block |
||
| 3762 | 3762 | $Connection = new Connection(); |
| 3763 | 3763 | $sth = $Connection->db->prepare($query); |
| 3764 | 3764 | $sth->execute(); |
| 3765 | - } catch(PDOException $e) { |
|
| 3765 | + } catch (PDOException $e) { |
|
| 3766 | 3766 | return "error : ".$e->getMessage(); |
| 3767 | 3767 | } |
| 3768 | 3768 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3777,7 +3777,7 @@ discard block |
||
| 3777 | 3777 | $Connection = new Connection(); |
| 3778 | 3778 | $sth = $Connection->db->prepare($query); |
| 3779 | 3779 | $sth->execute(); |
| 3780 | - } catch(PDOException $e) { |
|
| 3780 | + } catch (PDOException $e) { |
|
| 3781 | 3781 | return "error : ".$e->getMessage(); |
| 3782 | 3782 | } |
| 3783 | 3783 | } |
@@ -3793,7 +3793,7 @@ discard block |
||
| 3793 | 3793 | $Connection = new Connection(); |
| 3794 | 3794 | $sth = $Connection->db->prepare($query); |
| 3795 | 3795 | $sth->execute(); |
| 3796 | - } catch(PDOException $e) { |
|
| 3796 | + } catch (PDOException $e) { |
|
| 3797 | 3797 | return "error : ".$e->getMessage(); |
| 3798 | 3798 | } |
| 3799 | 3799 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3812,7 +3812,7 @@ discard block |
||
| 3812 | 3812 | $Connection = new Connection(); |
| 3813 | 3813 | $sth = $Connection->db->prepare($query); |
| 3814 | 3814 | $sth->execute(); |
| 3815 | - } catch(PDOException $e) { |
|
| 3815 | + } catch (PDOException $e) { |
|
| 3816 | 3816 | return "error : ".$e->getMessage(); |
| 3817 | 3817 | } |
| 3818 | 3818 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3827,7 +3827,7 @@ discard block |
||
| 3827 | 3827 | $Connection = new Connection(); |
| 3828 | 3828 | $sth = $Connection->db->prepare($query); |
| 3829 | 3829 | $sth->execute(); |
| 3830 | - } catch(PDOException $e) { |
|
| 3830 | + } catch (PDOException $e) { |
|
| 3831 | 3831 | return "error : ".$e->getMessage(); |
| 3832 | 3832 | } |
| 3833 | 3833 | } |
@@ -3839,7 +3839,7 @@ discard block |
||
| 3839 | 3839 | $Connection = new Connection(); |
| 3840 | 3840 | $sth = $Connection->db->prepare($query); |
| 3841 | 3841 | $sth->execute(); |
| 3842 | - } catch(PDOException $e) { |
|
| 3842 | + } catch (PDOException $e) { |
|
| 3843 | 3843 | return "error : ".$e->getMessage(); |
| 3844 | 3844 | } |
| 3845 | 3845 | } |
@@ -3855,7 +3855,7 @@ discard block |
||
| 3855 | 3855 | $Connection = new Connection(); |
| 3856 | 3856 | $sth = $Connection->db->prepare($query); |
| 3857 | 3857 | $sth->execute(); |
| 3858 | - } catch(PDOException $e) { |
|
| 3858 | + } catch (PDOException $e) { |
|
| 3859 | 3859 | return "error : ".$e->getMessage(); |
| 3860 | 3860 | } |
| 3861 | 3861 | } |
@@ -3870,7 +3870,7 @@ discard block |
||
| 3870 | 3870 | $Connection = new Connection(); |
| 3871 | 3871 | $sth = $Connection->db->prepare($query); |
| 3872 | 3872 | $sth->execute(); |
| 3873 | - } catch(PDOException $e) { |
|
| 3873 | + } catch (PDOException $e) { |
|
| 3874 | 3874 | return "error : ".$e->getMessage(); |
| 3875 | 3875 | } |
| 3876 | 3876 | } |
@@ -36,7 +36,9 @@ discard block |
||
| 36 | 36 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 37 | 37 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 38 | 38 | curl_setopt($ch, CURLOPT_TIMEOUT, 200); |
| 39 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 39 | + if ($referer != '') { |
|
| 40 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 41 | + } |
|
| 40 | 42 | 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'); |
| 41 | 43 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 42 | 44 | curl_exec($ch); |
@@ -47,12 +49,16 @@ discard block |
||
| 47 | 49 | public static function gunzip($in_file,$out_file_name = '') { |
| 48 | 50 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 49 | 51 | $buffer_size = 4096; // read 4kb at a time |
| 50 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 52 | + if ($out_file_name == '') { |
|
| 53 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 54 | + } |
|
| 51 | 55 | if ($in_file != '' && file_exists($in_file)) { |
| 52 | 56 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 53 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 54 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 55 | - else { |
|
| 57 | + if (function_exists('gzopen')) { |
|
| 58 | + $file = gzopen($in_file,'rb'); |
|
| 59 | + } elseif (function_exists('gzopen64')) { |
|
| 60 | + $file = gzopen64($in_file,'rb'); |
|
| 61 | + } else { |
|
| 56 | 62 | echo 'gzopen not available'; |
| 57 | 63 | die; |
| 58 | 64 | } |
@@ -73,8 +79,12 @@ discard block |
||
| 73 | 79 | if ($res === TRUE) { |
| 74 | 80 | $zip->extractTo($path); |
| 75 | 81 | $zip->close(); |
| 76 | - } else return false; |
|
| 77 | - } else return false; |
|
| 82 | + } else { |
|
| 83 | + return false; |
|
| 84 | + } |
|
| 85 | + } else { |
|
| 86 | + return false; |
|
| 87 | + } |
|
| 78 | 88 | } |
| 79 | 89 | |
| 80 | 90 | public static function connect_sqlite($database) { |
@@ -89,7 +99,9 @@ discard block |
||
| 89 | 99 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 90 | 100 | global $globalDebug, $globalTransaction; |
| 91 | 101 | //$query = 'TRUNCATE TABLE routes'; |
| 92 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo " - Delete previous routes from DB -"; |
|
| 104 | + } |
|
| 93 | 105 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 94 | 106 | $Connection = new Connection(); |
| 95 | 107 | try { |
@@ -100,7 +112,9 @@ discard block |
||
| 100 | 112 | return "error : ".$e->getMessage(); |
| 101 | 113 | } |
| 102 | 114 | |
| 103 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 115 | + if ($globalDebug) { |
|
| 116 | + echo " - Add routes to DB -"; |
|
| 117 | + } |
|
| 104 | 118 | update_db::connect_sqlite($database_file); |
| 105 | 119 | //$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'; |
| 106 | 120 | $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"; |
@@ -115,15 +129,21 @@ discard block |
||
| 115 | 129 | $Connection = new Connection(); |
| 116 | 130 | $sth_dest = $Connection->db->prepare($query_dest); |
| 117 | 131 | try { |
| 118 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 132 | + if ($globalTransaction) { |
|
| 133 | + $Connection->db->beginTransaction(); |
|
| 134 | + } |
|
| 119 | 135 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 120 | 136 | //$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); |
| 121 | 137 | $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); |
| 122 | 138 | $sth_dest->execute($query_dest_values); |
| 123 | 139 | } |
| 124 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 140 | + if ($globalTransaction) { |
|
| 141 | + $Connection->db->commit(); |
|
| 142 | + } |
|
| 125 | 143 | } catch(PDOException $e) { |
| 126 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 144 | + if ($globalTransaction) { |
|
| 145 | + $Connection->db->rollBack(); |
|
| 146 | + } |
|
| 127 | 147 | return "error : ".$e->getMessage(); |
| 128 | 148 | } |
| 129 | 149 | return ''; |
@@ -131,7 +151,9 @@ discard block |
||
| 131 | 151 | public static function retrieve_route_oneworld($database_file) { |
| 132 | 152 | global $globalDebug, $globalTransaction; |
| 133 | 153 | //$query = 'TRUNCATE TABLE routes'; |
| 134 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 154 | + if ($globalDebug) { |
|
| 155 | + echo " - Delete previous routes from DB -"; |
|
| 156 | + } |
|
| 135 | 157 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 136 | 158 | $Connection = new Connection(); |
| 137 | 159 | try { |
@@ -142,14 +164,18 @@ discard block |
||
| 142 | 164 | return "error : ".$e->getMessage(); |
| 143 | 165 | } |
| 144 | 166 | |
| 145 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 167 | + if ($globalDebug) { |
|
| 168 | + echo " - Add routes to DB -"; |
|
| 169 | + } |
|
| 146 | 170 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 147 | 171 | $Spotter = new Spotter(); |
| 148 | 172 | if ($fh = fopen($database_file,"r")) { |
| 149 | 173 | $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)'; |
| 150 | 174 | $Connection = new Connection(); |
| 151 | 175 | $sth_dest = $Connection->db->prepare($query_dest); |
| 152 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 176 | + if ($globalTransaction) { |
|
| 177 | + $Connection->db->beginTransaction(); |
|
| 178 | + } |
|
| 153 | 179 | while (!feof($fh)) { |
| 154 | 180 | $line = fgetcsv($fh,9999,','); |
| 155 | 181 | if ($line[0] != '') { |
@@ -158,13 +184,17 @@ discard block |
||
| 158 | 184 | $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'); |
| 159 | 185 | $sth_dest->execute($query_dest_values); |
| 160 | 186 | } catch(PDOException $e) { |
| 161 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 187 | + if ($globalTransaction) { |
|
| 188 | + $Connection->db->rollBack(); |
|
| 189 | + } |
|
| 162 | 190 | return "error : ".$e->getMessage(); |
| 163 | 191 | } |
| 164 | 192 | } |
| 165 | 193 | } |
| 166 | 194 | } |
| 167 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 195 | + if ($globalTransaction) { |
|
| 196 | + $Connection->db->commit(); |
|
| 197 | + } |
|
| 168 | 198 | } |
| 169 | 199 | return ''; |
| 170 | 200 | } |
@@ -172,7 +202,9 @@ discard block |
||
| 172 | 202 | public static function retrieve_route_skyteam($database_file) { |
| 173 | 203 | global $globalDebug, $globalTransaction; |
| 174 | 204 | //$query = 'TRUNCATE TABLE routes'; |
| 175 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 205 | + if ($globalDebug) { |
|
| 206 | + echo " - Delete previous routes from DB -"; |
|
| 207 | + } |
|
| 176 | 208 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 177 | 209 | $Connection = new Connection(); |
| 178 | 210 | try { |
@@ -183,7 +215,9 @@ discard block |
||
| 183 | 215 | return "error : ".$e->getMessage(); |
| 184 | 216 | } |
| 185 | 217 | |
| 186 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 218 | + if ($globalDebug) { |
|
| 219 | + echo " - Add routes to DB -"; |
|
| 220 | + } |
|
| 187 | 221 | |
| 188 | 222 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 189 | 223 | $Spotter = new Spotter(); |
@@ -192,7 +226,9 @@ discard block |
||
| 192 | 226 | $Connection = new Connection(); |
| 193 | 227 | $sth_dest = $Connection->db->prepare($query_dest); |
| 194 | 228 | try { |
| 195 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 229 | + if ($globalTransaction) { |
|
| 230 | + $Connection->db->beginTransaction(); |
|
| 231 | + } |
|
| 196 | 232 | while (!feof($fh)) { |
| 197 | 233 | $line = fgetcsv($fh,9999,','); |
| 198 | 234 | if ($line[0] != '') { |
@@ -203,9 +239,13 @@ discard block |
||
| 203 | 239 | } |
| 204 | 240 | } |
| 205 | 241 | } |
| 206 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 242 | + if ($globalTransaction) { |
|
| 243 | + $Connection->db->commit(); |
|
| 244 | + } |
|
| 207 | 245 | } catch(PDOException $e) { |
| 208 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 246 | + if ($globalTransaction) { |
|
| 247 | + $Connection->db->rollBack(); |
|
| 248 | + } |
|
| 209 | 249 | return "error : ".$e->getMessage(); |
| 210 | 250 | } |
| 211 | 251 | } |
@@ -248,11 +288,16 @@ discard block |
||
| 248 | 288 | $sth_dest = $Connection->db->prepare($query_dest); |
| 249 | 289 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 250 | 290 | try { |
| 251 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 291 | + if ($globalTransaction) { |
|
| 292 | + $Connection->db->beginTransaction(); |
|
| 293 | + } |
|
| 252 | 294 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 253 | 295 | //$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']); |
| 254 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
| 255 | - else $type = null; |
|
| 296 | + if ($values['UserString4'] == 'M') { |
|
| 297 | + $type = 'military'; |
|
| 298 | + } else { |
|
| 299 | + $type = null; |
|
| 300 | + } |
|
| 256 | 301 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 257 | 302 | $sth_dest->execute($query_dest_values); |
| 258 | 303 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -260,7 +305,9 @@ discard block |
||
| 260 | 305 | $sth_dest_owner->execute($query_dest_owner_values); |
| 261 | 306 | } |
| 262 | 307 | } |
| 263 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 308 | + if ($globalTransaction) { |
|
| 309 | + $Connection->db->commit(); |
|
| 310 | + } |
|
| 264 | 311 | } catch(PDOException $e) { |
| 265 | 312 | return "error : ".$e->getMessage(); |
| 266 | 313 | } |
@@ -297,7 +344,9 @@ discard block |
||
| 297 | 344 | $Connection = new Connection(); |
| 298 | 345 | $sth_dest = $Connection->db->prepare($query_dest); |
| 299 | 346 | try { |
| 300 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 347 | + if ($globalTransaction) { |
|
| 348 | + $Connection->db->beginTransaction(); |
|
| 349 | + } |
|
| 301 | 350 | while (!feof($fh)) { |
| 302 | 351 | $values = array(); |
| 303 | 352 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -308,7 +357,9 @@ discard block |
||
| 308 | 357 | // Check if we can find ICAO, else set it to GLID |
| 309 | 358 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 310 | 359 | $search_more = ''; |
| 311 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 360 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 361 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 362 | + } |
|
| 312 | 363 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 313 | 364 | $sth_search = $Connection->db->prepare($query_search); |
| 314 | 365 | try { |
@@ -321,7 +372,9 @@ discard block |
||
| 321 | 372 | } catch(PDOException $e) { |
| 322 | 373 | return "error : ".$e->getMessage(); |
| 323 | 374 | } |
| 324 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
| 375 | + if (!isset($values['ICAOTypeCode'])) { |
|
| 376 | + $values['ICAOTypeCode'] = 'GLID'; |
|
| 377 | + } |
|
| 325 | 378 | // Add data to db |
| 326 | 379 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 327 | 380 | //$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']); |
@@ -330,7 +383,9 @@ discard block |
||
| 330 | 383 | $sth_dest->execute($query_dest_values); |
| 331 | 384 | } |
| 332 | 385 | } |
| 333 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 386 | + if ($globalTransaction) { |
|
| 387 | + $Connection->db->commit(); |
|
| 388 | + } |
|
| 334 | 389 | } catch(PDOException $e) { |
| 335 | 390 | return "error : ".$e->getMessage(); |
| 336 | 391 | } |
@@ -366,7 +421,9 @@ discard block |
||
| 366 | 421 | $Connection = new Connection(); |
| 367 | 422 | $sth_dest = $Connection->db->prepare($query_dest); |
| 368 | 423 | try { |
| 369 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 424 | + if ($globalTransaction) { |
|
| 425 | + $Connection->db->beginTransaction(); |
|
| 426 | + } |
|
| 370 | 427 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 371 | 428 | while (!feof($fh)) { |
| 372 | 429 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -380,13 +437,17 @@ discard block |
||
| 380 | 437 | // Check if we can find ICAO, else set it to GLID |
| 381 | 438 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 382 | 439 | $search_more = ''; |
| 383 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 440 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 441 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 442 | + } |
|
| 384 | 443 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 385 | 444 | $sth_search = $Connection->db->prepare($query_search); |
| 386 | 445 | try { |
| 387 | 446 | $sth_search->execute(); |
| 388 | 447 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 389 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 448 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 449 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 450 | + } |
|
| 390 | 451 | } catch(PDOException $e) { |
| 391 | 452 | return "error : ".$e->getMessage(); |
| 392 | 453 | } |
@@ -399,7 +460,9 @@ discard block |
||
| 399 | 460 | $sth_dest->execute($query_dest_values); |
| 400 | 461 | } |
| 401 | 462 | } |
| 402 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 463 | + if ($globalTransaction) { |
|
| 464 | + $Connection->db->commit(); |
|
| 465 | + } |
|
| 403 | 466 | } catch(PDOException $e) { |
| 404 | 467 | return "error : ".$e->getMessage(); |
| 405 | 468 | } |
@@ -438,7 +501,9 @@ discard block |
||
| 438 | 501 | $sth_dest = $Connection->db->prepare($query_dest); |
| 439 | 502 | $sth_modes = $Connection->db->prepare($query_modes); |
| 440 | 503 | try { |
| 441 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 504 | + if ($globalTransaction) { |
|
| 505 | + $Connection->db->beginTransaction(); |
|
| 506 | + } |
|
| 442 | 507 | $tmp = fgetcsv($fh,9999,',','"'); |
| 443 | 508 | while (!feof($fh)) { |
| 444 | 509 | $line = fgetcsv($fh,9999,',','"'); |
@@ -448,16 +513,22 @@ discard block |
||
| 448 | 513 | $values['registration'] = $line[0]; |
| 449 | 514 | $values['base'] = $line[4]; |
| 450 | 515 | $values['owner'] = $line[5]; |
| 451 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 452 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 516 | + if ($line[6] == '') { |
|
| 517 | + $values['date_first_reg'] = null; |
|
| 518 | + } else { |
|
| 519 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 520 | + } |
|
| 453 | 521 | $values['cancel'] = $line[7]; |
| 454 | 522 | } elseif ($country == 'EI') { |
| 455 | 523 | // TODO : add modeS & reg to aircraft_modes |
| 456 | 524 | $values['registration'] = $line[0]; |
| 457 | 525 | $values['base'] = $line[3]; |
| 458 | 526 | $values['owner'] = $line[2]; |
| 459 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 460 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 527 | + if ($line[1] == '') { |
|
| 528 | + $values['date_first_reg'] = null; |
|
| 529 | + } else { |
|
| 530 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 531 | + } |
|
| 461 | 532 | $values['cancel'] = ''; |
| 462 | 533 | $values['modes'] = $line[7]; |
| 463 | 534 | $values['icao'] = $line[8]; |
@@ -476,16 +547,22 @@ discard block |
||
| 476 | 547 | $values['registration'] = $line[3]; |
| 477 | 548 | $values['base'] = null; |
| 478 | 549 | $values['owner'] = $line[5]; |
| 479 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 480 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 550 | + if ($line[18] == '') { |
|
| 551 | + $values['date_first_reg'] = null; |
|
| 552 | + } else { |
|
| 553 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 554 | + } |
|
| 481 | 555 | $values['cancel'] = ''; |
| 482 | 556 | } elseif ($country == 'VH') { |
| 483 | 557 | // TODO : add modeS & reg to aircraft_modes |
| 484 | 558 | $values['registration'] = $line[0]; |
| 485 | 559 | $values['base'] = null; |
| 486 | 560 | $values['owner'] = $line[12]; |
| 487 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 488 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 561 | + if ($line[28] == '') { |
|
| 562 | + $values['date_first_reg'] = null; |
|
| 563 | + } else { |
|
| 564 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 565 | + } |
|
| 489 | 566 | |
| 490 | 567 | $values['cancel'] = $line[39]; |
| 491 | 568 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -504,29 +581,41 @@ discard block |
||
| 504 | 581 | $values['registration'] = $line[0]; |
| 505 | 582 | $values['base'] = null; |
| 506 | 583 | $values['owner'] = $line[8]; |
| 507 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 508 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 584 | + if ($line[7] == '') { |
|
| 585 | + $values['date_first_reg'] = null; |
|
| 586 | + } else { |
|
| 587 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 588 | + } |
|
| 509 | 589 | $values['cancel'] = ''; |
| 510 | 590 | } elseif ($country == 'PP') { |
| 511 | 591 | $values['registration'] = $line[0]; |
| 512 | 592 | $values['base'] = null; |
| 513 | 593 | $values['owner'] = $line[4]; |
| 514 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 515 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 594 | + if ($line[6] == '') { |
|
| 595 | + $values['date_first_reg'] = null; |
|
| 596 | + } else { |
|
| 597 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 598 | + } |
|
| 516 | 599 | $values['cancel'] = $line[7]; |
| 517 | 600 | } elseif ($country == 'E7') { |
| 518 | 601 | $values['registration'] = $line[0]; |
| 519 | 602 | $values['base'] = null; |
| 520 | 603 | $values['owner'] = $line[4]; |
| 521 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 522 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 604 | + if ($line[5] == '') { |
|
| 605 | + $values['date_first_reg'] = null; |
|
| 606 | + } else { |
|
| 607 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 608 | + } |
|
| 523 | 609 | $values['cancel'] = ''; |
| 524 | 610 | } elseif ($country == '8Q') { |
| 525 | 611 | $values['registration'] = $line[0]; |
| 526 | 612 | $values['base'] = null; |
| 527 | 613 | $values['owner'] = $line[3]; |
| 528 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 529 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 614 | + if ($line[7] == '') { |
|
| 615 | + $values['date_first_reg'] = null; |
|
| 616 | + } else { |
|
| 617 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 618 | + } |
|
| 530 | 619 | $values['cancel'] = ''; |
| 531 | 620 | } elseif ($country == 'ZK') { |
| 532 | 621 | $values['registration'] = $line[0]; |
@@ -571,7 +660,9 @@ discard block |
||
| 571 | 660 | $sth_modes->execute($query_modes_values); |
| 572 | 661 | } |
| 573 | 662 | } |
| 574 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 663 | + if ($globalTransaction) { |
|
| 664 | + $Connection->db->commit(); |
|
| 665 | + } |
|
| 575 | 666 | } catch(PDOException $e) { |
| 576 | 667 | return "error : ".$e->getMessage(); |
| 577 | 668 | } |
@@ -707,25 +798,45 @@ discard block |
||
| 707 | 798 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
| 708 | 799 | $Connection = new Connection(); |
| 709 | 800 | $sth_dest = $Connection->db->prepare($query_dest); |
| 710 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 801 | + if ($globalTransaction) { |
|
| 802 | + $Connection->db->beginTransaction(); |
|
| 803 | + } |
|
| 711 | 804 | |
| 712 | 805 | $i = 0; |
| 713 | 806 | while($row = sparql_fetch_array($result)) |
| 714 | 807 | { |
| 715 | 808 | if ($i >= 1) { |
| 716 | 809 | //print_r($row); |
| 717 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
| 718 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
| 719 | - if (!isset($row['type'])) $row['type'] = ''; |
|
| 720 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
| 810 | + if (!isset($row['iata'])) { |
|
| 811 | + $row['iata'] = ''; |
|
| 812 | + } |
|
| 813 | + if (!isset($row['icao'])) { |
|
| 814 | + $row['icao'] = ''; |
|
| 815 | + } |
|
| 816 | + if (!isset($row['type'])) { |
|
| 817 | + $row['type'] = ''; |
|
| 818 | + } |
|
| 819 | + if (!isset($row['altitude'])) { |
|
| 820 | + $row['altitude'] = ''; |
|
| 821 | + } |
|
| 721 | 822 | if (isset($row['city_bis'])) { |
| 722 | 823 | $row['city'] = $row['city_bis']; |
| 723 | 824 | } |
| 724 | - if (!isset($row['city'])) $row['city'] = ''; |
|
| 725 | - if (!isset($row['country'])) $row['country'] = ''; |
|
| 726 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
| 727 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
| 728 | - if (!isset($row['name'])) continue; |
|
| 825 | + if (!isset($row['city'])) { |
|
| 826 | + $row['city'] = ''; |
|
| 827 | + } |
|
| 828 | + if (!isset($row['country'])) { |
|
| 829 | + $row['country'] = ''; |
|
| 830 | + } |
|
| 831 | + if (!isset($row['homepage'])) { |
|
| 832 | + $row['homepage'] = ''; |
|
| 833 | + } |
|
| 834 | + if (!isset($row['wikipedia_page'])) { |
|
| 835 | + $row['wikipedia_page'] = ''; |
|
| 836 | + } |
|
| 837 | + if (!isset($row['name'])) { |
|
| 838 | + continue; |
|
| 839 | + } |
|
| 729 | 840 | if (!isset($row['image'])) { |
| 730 | 841 | $row['image'] = ''; |
| 731 | 842 | $row['image_thumb'] = ''; |
@@ -781,7 +892,9 @@ discard block |
||
| 781 | 892 | |
| 782 | 893 | $i++; |
| 783 | 894 | } |
| 784 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 895 | + if ($globalTransaction) { |
|
| 896 | + $Connection->db->commit(); |
|
| 897 | + } |
|
| 785 | 898 | /* |
| 786 | 899 | echo "Delete duplicate rows...\n"; |
| 787 | 900 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -824,7 +937,9 @@ discard block |
||
| 824 | 937 | $delimiter = ','; |
| 825 | 938 | $out_file = $tmp_dir.'airports.csv'; |
| 826 | 939 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
| 827 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 940 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 941 | + return FALSE; |
|
| 942 | + } |
|
| 828 | 943 | echo "Add data from ourairports.com...\n"; |
| 829 | 944 | |
| 830 | 945 | $header = NULL; |
@@ -834,8 +949,9 @@ discard block |
||
| 834 | 949 | //$Connection->db->beginTransaction(); |
| 835 | 950 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 836 | 951 | { |
| 837 | - if(!$header) $header = $row; |
|
| 838 | - else { |
|
| 952 | + if(!$header) { |
|
| 953 | + $header = $row; |
|
| 954 | + } else { |
|
| 839 | 955 | $data = array(); |
| 840 | 956 | $data = array_combine($header, $row); |
| 841 | 957 | try { |
@@ -876,7 +992,9 @@ discard block |
||
| 876 | 992 | echo "Download data from another free database...\n"; |
| 877 | 993 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 878 | 994 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
| 879 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 995 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 996 | + return FALSE; |
|
| 997 | + } |
|
| 880 | 998 | update_db::unzip($out_file); |
| 881 | 999 | $header = NULL; |
| 882 | 1000 | echo "Add data from another free database...\n"; |
@@ -887,8 +1005,9 @@ discard block |
||
| 887 | 1005 | //$Connection->db->beginTransaction(); |
| 888 | 1006 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 889 | 1007 | { |
| 890 | - if(!$header) $header = $row; |
|
| 891 | - else { |
|
| 1008 | + if(!$header) { |
|
| 1009 | + $header = $row; |
|
| 1010 | + } else { |
|
| 892 | 1011 | $data = $row; |
| 893 | 1012 | |
| 894 | 1013 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1083,7 +1202,9 @@ discard block |
||
| 1083 | 1202 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
| 1084 | 1203 | { |
| 1085 | 1204 | $i = 0; |
| 1086 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1205 | + if ($globalTransaction) { |
|
| 1206 | + $Connection->db->beginTransaction(); |
|
| 1207 | + } |
|
| 1087 | 1208 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1088 | 1209 | { |
| 1089 | 1210 | if ($i > 0) { |
@@ -1096,7 +1217,9 @@ discard block |
||
| 1096 | 1217 | } |
| 1097 | 1218 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
| 1098 | 1219 | if (!empty($result_search)) { |
| 1099 | - if ($globalDebug) echo '.'; |
|
| 1220 | + if ($globalDebug) { |
|
| 1221 | + echo '.'; |
|
| 1222 | + } |
|
| 1100 | 1223 | //if ($globalDBdriver == 'mysql') { |
| 1101 | 1224 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
| 1102 | 1225 | //} else { |
@@ -1118,8 +1241,12 @@ discard block |
||
| 1118 | 1241 | } |
| 1119 | 1242 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
| 1120 | 1243 | if (!empty($result_search_mfr)) { |
| 1121 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
| 1122 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
| 1244 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
| 1245 | + $data[16] = $data[23]; |
|
| 1246 | + } |
|
| 1247 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
| 1248 | + $data[16] = $data[15]; |
|
| 1249 | + } |
|
| 1123 | 1250 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1124 | 1251 | try { |
| 1125 | 1252 | $sthf = $Connection->db->prepare($queryf); |
@@ -1130,7 +1257,9 @@ discard block |
||
| 1130 | 1257 | } |
| 1131 | 1258 | } |
| 1132 | 1259 | if (strtotime($data[29]) > time()) { |
| 1133 | - if ($globalDebug) echo 'i'; |
|
| 1260 | + if ($globalDebug) { |
|
| 1261 | + echo 'i'; |
|
| 1262 | + } |
|
| 1134 | 1263 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1135 | 1264 | try { |
| 1136 | 1265 | $sth = $Connection->db->prepare($query); |
@@ -1141,13 +1270,19 @@ discard block |
||
| 1141 | 1270 | } |
| 1142 | 1271 | } |
| 1143 | 1272 | if ($i % 90 == 0) { |
| 1144 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1145 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1273 | + if ($globalTransaction) { |
|
| 1274 | + $Connection->db->commit(); |
|
| 1275 | + } |
|
| 1276 | + if ($globalTransaction) { |
|
| 1277 | + $Connection->db->beginTransaction(); |
|
| 1278 | + } |
|
| 1146 | 1279 | } |
| 1147 | 1280 | $i++; |
| 1148 | 1281 | } |
| 1149 | 1282 | fclose($handle); |
| 1150 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1283 | + if ($globalTransaction) { |
|
| 1284 | + $Connection->db->commit(); |
|
| 1285 | + } |
|
| 1151 | 1286 | } |
| 1152 | 1287 | return ''; |
| 1153 | 1288 | } |
@@ -1167,11 +1302,15 @@ discard block |
||
| 1167 | 1302 | if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE) |
| 1168 | 1303 | { |
| 1169 | 1304 | $i = 0; |
| 1170 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1305 | + if ($globalTransaction) { |
|
| 1306 | + $Connection->db->beginTransaction(); |
|
| 1307 | + } |
|
| 1171 | 1308 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1172 | 1309 | { |
| 1173 | 1310 | if ($i > 0) { |
| 1174 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1311 | + if ($data[1] == 'NULL') { |
|
| 1312 | + $data[1] = $data[0]; |
|
| 1313 | + } |
|
| 1175 | 1314 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1176 | 1315 | try { |
| 1177 | 1316 | $sth = $Connection->db->prepare($query); |
@@ -1183,7 +1322,9 @@ discard block |
||
| 1183 | 1322 | $i++; |
| 1184 | 1323 | } |
| 1185 | 1324 | fclose($handle); |
| 1186 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1325 | + if ($globalTransaction) { |
|
| 1326 | + $Connection->db->commit(); |
|
| 1327 | + } |
|
| 1187 | 1328 | } |
| 1188 | 1329 | return ''; |
| 1189 | 1330 | } |
@@ -1215,11 +1356,15 @@ discard block |
||
| 1215 | 1356 | if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE) |
| 1216 | 1357 | { |
| 1217 | 1358 | $i = 0; |
| 1218 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1359 | + if ($globalTransaction) { |
|
| 1360 | + $Connection->db->beginTransaction(); |
|
| 1361 | + } |
|
| 1219 | 1362 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1220 | 1363 | { |
| 1221 | 1364 | if ($i > 0) { |
| 1222 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1365 | + if ($data[1] == 'NULL') { |
|
| 1366 | + $data[1] = $data[0]; |
|
| 1367 | + } |
|
| 1223 | 1368 | $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)'; |
| 1224 | 1369 | try { |
| 1225 | 1370 | $sth = $Connection->db->prepare($query); |
@@ -1231,7 +1376,9 @@ discard block |
||
| 1231 | 1376 | $i++; |
| 1232 | 1377 | } |
| 1233 | 1378 | fclose($handle); |
| 1234 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1379 | + if ($globalTransaction) { |
|
| 1380 | + $Connection->db->commit(); |
|
| 1381 | + } |
|
| 1235 | 1382 | } |
| 1236 | 1383 | /* |
| 1237 | 1384 | $query = "UNLOCK TABLES"; |
@@ -1261,7 +1408,9 @@ discard block |
||
| 1261 | 1408 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
| 1262 | 1409 | { |
| 1263 | 1410 | $i = 0; |
| 1264 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1411 | + if ($globalTransaction) { |
|
| 1412 | + $Connection->db->beginTransaction(); |
|
| 1413 | + } |
|
| 1265 | 1414 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1266 | 1415 | { |
| 1267 | 1416 | if ($i > 0) { |
@@ -1277,7 +1426,9 @@ discard block |
||
| 1277 | 1426 | $i++; |
| 1278 | 1427 | } |
| 1279 | 1428 | fclose($handle); |
| 1280 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1429 | + if ($globalTransaction) { |
|
| 1430 | + $Connection->db->commit(); |
|
| 1431 | + } |
|
| 1281 | 1432 | } |
| 1282 | 1433 | return ''; |
| 1283 | 1434 | } |
@@ -1297,7 +1448,9 @@ discard block |
||
| 1297 | 1448 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
| 1298 | 1449 | { |
| 1299 | 1450 | $i = 0; |
| 1300 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1451 | + if ($globalTransaction) { |
|
| 1452 | + $Connection->db->beginTransaction(); |
|
| 1453 | + } |
|
| 1301 | 1454 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1302 | 1455 | { |
| 1303 | 1456 | if ($i > 0) { |
@@ -1307,19 +1460,25 @@ discard block |
||
| 1307 | 1460 | $sth = $Connection->db->prepare($query); |
| 1308 | 1461 | $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')); |
| 1309 | 1462 | } catch(PDOException $e) { |
| 1310 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1463 | + if ($globalDebug) { |
|
| 1464 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1465 | + } |
|
| 1311 | 1466 | die(); |
| 1312 | 1467 | } |
| 1313 | 1468 | } |
| 1314 | 1469 | if ($globalTransaction && $i % 2000 == 0) { |
| 1315 | 1470 | $Connection->db->commit(); |
| 1316 | - if ($globalDebug) echo '.'; |
|
| 1471 | + if ($globalDebug) { |
|
| 1472 | + echo '.'; |
|
| 1473 | + } |
|
| 1317 | 1474 | $Connection->db->beginTransaction(); |
| 1318 | 1475 | } |
| 1319 | 1476 | $i++; |
| 1320 | 1477 | } |
| 1321 | 1478 | fclose($handle); |
| 1322 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1479 | + if ($globalTransaction) { |
|
| 1480 | + $Connection->db->commit(); |
|
| 1481 | + } |
|
| 1323 | 1482 | } |
| 1324 | 1483 | return ''; |
| 1325 | 1484 | } |
@@ -1338,7 +1497,9 @@ discard block |
||
| 1338 | 1497 | if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE) |
| 1339 | 1498 | { |
| 1340 | 1499 | $i = 0; |
| 1341 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1500 | + if ($globalTransaction) { |
|
| 1501 | + $Connection->db->beginTransaction(); |
|
| 1502 | + } |
|
| 1342 | 1503 | while (($data = fgets($handle, 1000)) !== FALSE) |
| 1343 | 1504 | { |
| 1344 | 1505 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
@@ -1346,18 +1507,24 @@ discard block |
||
| 1346 | 1507 | $sth = $Connection->db->prepare($query); |
| 1347 | 1508 | $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
| 1348 | 1509 | } catch(PDOException $e) { |
| 1349 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1510 | + if ($globalDebug) { |
|
| 1511 | + echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1512 | + } |
|
| 1350 | 1513 | die(); |
| 1351 | 1514 | } |
| 1352 | 1515 | if ($globalTransaction && $i % 2000 == 0) { |
| 1353 | 1516 | $Connection->db->commit(); |
| 1354 | - if ($globalDebug) echo '.'; |
|
| 1517 | + if ($globalDebug) { |
|
| 1518 | + echo '.'; |
|
| 1519 | + } |
|
| 1355 | 1520 | $Connection->db->beginTransaction(); |
| 1356 | 1521 | } |
| 1357 | 1522 | $i++; |
| 1358 | 1523 | } |
| 1359 | 1524 | fclose($handle); |
| 1360 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1525 | + if ($globalTransaction) { |
|
| 1526 | + $Connection->db->commit(); |
|
| 1527 | + } |
|
| 1361 | 1528 | } |
| 1362 | 1529 | return ''; |
| 1363 | 1530 | } |
@@ -1382,7 +1549,9 @@ discard block |
||
| 1382 | 1549 | $i = 0; |
| 1383 | 1550 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1384 | 1551 | //$Connection->db->beginTransaction(); |
| 1385 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1552 | + if ($globalTransaction) { |
|
| 1553 | + $Connection->db->beginTransaction(); |
|
| 1554 | + } |
|
| 1386 | 1555 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1387 | 1556 | { |
| 1388 | 1557 | if ($i > 0) { |
@@ -1398,7 +1567,9 @@ discard block |
||
| 1398 | 1567 | $i++; |
| 1399 | 1568 | } |
| 1400 | 1569 | fclose($handle); |
| 1401 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1570 | + if ($globalTransaction) { |
|
| 1571 | + $Connection->db->commit(); |
|
| 1572 | + } |
|
| 1402 | 1573 | } |
| 1403 | 1574 | return ''; |
| 1404 | 1575 | } |
@@ -1418,7 +1589,9 @@ discard block |
||
| 1418 | 1589 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
| 1419 | 1590 | { |
| 1420 | 1591 | $i = 0; |
| 1421 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1592 | + if ($globalTransaction) { |
|
| 1593 | + $Connection->db->beginTransaction(); |
|
| 1594 | + } |
|
| 1422 | 1595 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1423 | 1596 | { |
| 1424 | 1597 | if ($i > 0) { |
@@ -1435,7 +1608,9 @@ discard block |
||
| 1435 | 1608 | $i++; |
| 1436 | 1609 | } |
| 1437 | 1610 | fclose($handle); |
| 1438 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1611 | + if ($globalTransaction) { |
|
| 1612 | + $Connection->db->commit(); |
|
| 1613 | + } |
|
| 1439 | 1614 | } |
| 1440 | 1615 | return ''; |
| 1441 | 1616 | } |
@@ -1454,7 +1629,9 @@ discard block |
||
| 1454 | 1629 | $Connection = new Connection(); |
| 1455 | 1630 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
| 1456 | 1631 | { |
| 1457 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1632 | + if ($globalTransaction) { |
|
| 1633 | + $Connection->db->beginTransaction(); |
|
| 1634 | + } |
|
| 1458 | 1635 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
| 1459 | 1636 | { |
| 1460 | 1637 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1469,7 +1646,9 @@ discard block |
||
| 1469 | 1646 | } |
| 1470 | 1647 | } |
| 1471 | 1648 | fclose($handle); |
| 1472 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1649 | + if ($globalTransaction) { |
|
| 1650 | + $Connection->db->commit(); |
|
| 1651 | + } |
|
| 1473 | 1652 | } |
| 1474 | 1653 | return ''; |
| 1475 | 1654 | } |
@@ -1547,9 +1726,14 @@ discard block |
||
| 1547 | 1726 | if ($i > 0 && $data[0] != '') { |
| 1548 | 1727 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1549 | 1728 | $period = str_replace(',','',$data[14]); |
| 1550 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1551 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1552 | - else $launch_date = NULL; |
|
| 1729 | + if (!empty($period) && strpos($period,'days')) { |
|
| 1730 | + $period = str_replace(' days','',$period)*24*60; |
|
| 1731 | + } |
|
| 1732 | + if ($data[18] != '') { |
|
| 1733 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1734 | + } else { |
|
| 1735 | + $launch_date = NULL; |
|
| 1736 | + } |
|
| 1553 | 1737 | $data = array_map(function($value) { |
| 1554 | 1738 | return trim($value) === '' ? null : $value; |
| 1555 | 1739 | }, $data); |
@@ -1741,10 +1925,14 @@ discard block |
||
| 1741 | 1925 | $owner_code = trim(substr($data,49,5)); |
| 1742 | 1926 | |
| 1743 | 1927 | if (!isset($satcat_sources[$owner_code]) && $satcat_sources[$owner_code] != 'TBD') { |
| 1744 | - if ($globalDebug) echo $data.'owner_code: '.$owner_code."\n"; |
|
| 1928 | + if ($globalDebug) { |
|
| 1929 | + echo $data.'owner_code: '.$owner_code."\n"; |
|
| 1930 | + } |
|
| 1745 | 1931 | } |
| 1746 | 1932 | if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
| 1747 | - if ($globalDebug) echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1933 | + if ($globalDebug) { |
|
| 1934 | + echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1935 | + } |
|
| 1748 | 1936 | } |
| 1749 | 1937 | |
| 1750 | 1938 | if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
@@ -1911,7 +2099,9 @@ discard block |
||
| 1911 | 2099 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1912 | 2100 | { |
| 1913 | 2101 | $i = 0; |
| 1914 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2102 | + if ($globalTransaction) { |
|
| 2103 | + $Connection->db->beginTransaction(); |
|
| 2104 | + } |
|
| 1915 | 2105 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1916 | 2106 | { |
| 1917 | 2107 | $i++; |
@@ -1939,7 +2129,9 @@ discard block |
||
| 1939 | 2129 | } |
| 1940 | 2130 | } |
| 1941 | 2131 | fclose($handle); |
| 1942 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2132 | + if ($globalTransaction) { |
|
| 2133 | + $Connection->db->commit(); |
|
| 2134 | + } |
|
| 1943 | 2135 | } |
| 1944 | 2136 | return ''; |
| 1945 | 2137 | } |
@@ -1955,7 +2147,9 @@ discard block |
||
| 1955 | 2147 | $Source->deleteLocationByType('fires'); |
| 1956 | 2148 | $i = 0; |
| 1957 | 2149 | if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
| 1958 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2150 | + if ($globalTransaction) { |
|
| 2151 | + $Connection->db->beginTransaction(); |
|
| 2152 | + } |
|
| 1959 | 2153 | while (($row = fgetcsv($handle,1000)) !== false) { |
| 1960 | 2154 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
| 1961 | 2155 | $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]); |
@@ -1970,7 +2164,9 @@ discard block |
||
| 1970 | 2164 | } |
| 1971 | 2165 | $i++; |
| 1972 | 2166 | } |
| 1973 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2167 | + if ($globalTransaction) { |
|
| 2168 | + $Connection->db->commit(); |
|
| 2169 | + } |
|
| 1974 | 2170 | } |
| 1975 | 2171 | } |
| 1976 | 2172 | |
@@ -1991,7 +2187,9 @@ discard block |
||
| 1991 | 2187 | $Connection = new Connection(); |
| 1992 | 2188 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1993 | 2189 | { |
| 1994 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2190 | + if ($globalTransaction) { |
|
| 2191 | + $Connection->db->beginTransaction(); |
|
| 2192 | + } |
|
| 1995 | 2193 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1996 | 2194 | { |
| 1997 | 2195 | if(count($row) > 1) { |
@@ -2005,7 +2203,9 @@ discard block |
||
| 2005 | 2203 | } |
| 2006 | 2204 | } |
| 2007 | 2205 | fclose($handle); |
| 2008 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2206 | + if ($globalTransaction) { |
|
| 2207 | + $Connection->db->commit(); |
|
| 2208 | + } |
|
| 2009 | 2209 | } |
| 2010 | 2210 | return ''; |
| 2011 | 2211 | } |
@@ -2025,8 +2225,9 @@ discard block |
||
| 2025 | 2225 | } |
| 2026 | 2226 | |
| 2027 | 2227 | |
| 2028 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2029 | - else { |
|
| 2228 | + if ($globalDBdriver == 'mysql') { |
|
| 2229 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2230 | + } else { |
|
| 2030 | 2231 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 2031 | 2232 | $query = "CREATE EXTENSION postgis"; |
| 2032 | 2233 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -2045,7 +2246,9 @@ discard block |
||
| 2045 | 2246 | global $tmp_dir, $globalDebug; |
| 2046 | 2247 | include_once('class.create_db.php'); |
| 2047 | 2248 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2048 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2249 | + if ($globalDebug) { |
|
| 2250 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2251 | + } |
|
| 2049 | 2252 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
| 2050 | 2253 | $error = ''; |
| 2051 | 2254 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2055,20 +2258,34 @@ discard block |
||
| 2055 | 2258 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
| 2056 | 2259 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2057 | 2260 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2058 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2261 | + if ($globalDebug) { |
|
| 2262 | + echo "Gunzip..."; |
|
| 2263 | + } |
|
| 2059 | 2264 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
| 2060 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2265 | + if ($globalDebug) { |
|
| 2266 | + echo "Add to DB..."; |
|
| 2267 | + } |
|
| 2061 | 2268 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
| 2062 | 2269 | $NOTAM = new NOTAM(); |
| 2063 | 2270 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
| 2064 | 2271 | update_db::insert_notam_version($notam_md5); |
| 2065 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2066 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2067 | - } elseif ($globalDebug) echo "No new version."; |
|
| 2068 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2272 | + } else { |
|
| 2273 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2274 | + } |
|
| 2275 | + } else { |
|
| 2276 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2277 | + } |
|
| 2278 | + } elseif ($globalDebug) { |
|
| 2279 | + echo "No new version."; |
|
| 2280 | + } |
|
| 2281 | + } else { |
|
| 2282 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2283 | + } |
|
| 2069 | 2284 | if ($error != '') { |
| 2070 | 2285 | return $error; |
| 2071 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2286 | + } elseif ($globalDebug) { |
|
| 2287 | + echo "Done\n"; |
|
| 2288 | + } |
|
| 2072 | 2289 | return ''; |
| 2073 | 2290 | } |
| 2074 | 2291 | |
@@ -2123,68 +2340,114 @@ discard block |
||
| 2123 | 2340 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 2124 | 2341 | if (extension_loaded('zip')) { |
| 2125 | 2342 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 2126 | - if ($globalDebug) echo "Unzip..."; |
|
| 2343 | + if ($globalDebug) { |
|
| 2344 | + echo "Unzip..."; |
|
| 2345 | + } |
|
| 2127 | 2346 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 2128 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2347 | + if ($globalDebug) { |
|
| 2348 | + echo "Add to DB..."; |
|
| 2349 | + } |
|
| 2129 | 2350 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2130 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 2351 | + if ($globalDebug) { |
|
| 2352 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 2353 | + } |
|
| 2131 | 2354 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2132 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2133 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2134 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2135 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
| 2355 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 2356 | + $error = "Failed to copy airlines logo."; |
|
| 2357 | + } |
|
| 2358 | + } else { |
|
| 2359 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2360 | + } |
|
| 2361 | + } else { |
|
| 2362 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2363 | + } |
|
| 2364 | + } else { |
|
| 2365 | + $error = "ZIP module not loaded but required for IVAO."; |
|
| 2366 | + } |
|
| 2136 | 2367 | if ($error != '') { |
| 2137 | 2368 | return $error; |
| 2138 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2369 | + } elseif ($globalDebug) { |
|
| 2370 | + echo "Done\n"; |
|
| 2371 | + } |
|
| 2139 | 2372 | return ''; |
| 2140 | 2373 | } |
| 2141 | 2374 | |
| 2142 | 2375 | public static function update_routes() { |
| 2143 | 2376 | global $tmp_dir, $globalDebug; |
| 2144 | 2377 | $error = ''; |
| 2145 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 2378 | + if ($globalDebug) { |
|
| 2379 | + echo "Routes : Download..."; |
|
| 2380 | + } |
|
| 2146 | 2381 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 2147 | 2382 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2148 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2383 | + if ($globalDebug) { |
|
| 2384 | + echo "Gunzip..."; |
|
| 2385 | + } |
|
| 2149 | 2386 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 2150 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2387 | + if ($globalDebug) { |
|
| 2388 | + echo "Add to DB..."; |
|
| 2389 | + } |
|
| 2151 | 2390 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 2152 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2391 | + } else { |
|
| 2392 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2393 | + } |
|
| 2153 | 2394 | if ($error != '') { |
| 2154 | 2395 | return $error; |
| 2155 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2396 | + } elseif ($globalDebug) { |
|
| 2397 | + echo "Done\n"; |
|
| 2398 | + } |
|
| 2156 | 2399 | return ''; |
| 2157 | 2400 | } |
| 2158 | 2401 | public static function update_oneworld() { |
| 2159 | 2402 | global $tmp_dir, $globalDebug; |
| 2160 | 2403 | $error = ''; |
| 2161 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
| 2404 | + if ($globalDebug) { |
|
| 2405 | + echo "Schedules Oneworld : Download..."; |
|
| 2406 | + } |
|
| 2162 | 2407 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
| 2163 | 2408 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2164 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2409 | + if ($globalDebug) { |
|
| 2410 | + echo "Gunzip..."; |
|
| 2411 | + } |
|
| 2165 | 2412 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
| 2166 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2413 | + if ($globalDebug) { |
|
| 2414 | + echo "Add to DB..."; |
|
| 2415 | + } |
|
| 2167 | 2416 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
| 2168 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2417 | + } else { |
|
| 2418 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2419 | + } |
|
| 2169 | 2420 | if ($error != '') { |
| 2170 | 2421 | return $error; |
| 2171 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2422 | + } elseif ($globalDebug) { |
|
| 2423 | + echo "Done\n"; |
|
| 2424 | + } |
|
| 2172 | 2425 | return ''; |
| 2173 | 2426 | } |
| 2174 | 2427 | public static function update_skyteam() { |
| 2175 | 2428 | global $tmp_dir, $globalDebug; |
| 2176 | 2429 | $error = ''; |
| 2177 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
| 2430 | + if ($globalDebug) { |
|
| 2431 | + echo "Schedules Skyteam : Download..."; |
|
| 2432 | + } |
|
| 2178 | 2433 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
| 2179 | 2434 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2180 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2435 | + if ($globalDebug) { |
|
| 2436 | + echo "Gunzip..."; |
|
| 2437 | + } |
|
| 2181 | 2438 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
| 2182 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2439 | + if ($globalDebug) { |
|
| 2440 | + echo "Add to DB..."; |
|
| 2441 | + } |
|
| 2183 | 2442 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
| 2184 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2443 | + } else { |
|
| 2444 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2445 | + } |
|
| 2185 | 2446 | if ($error != '') { |
| 2186 | 2447 | return $error; |
| 2187 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2448 | + } elseif ($globalDebug) { |
|
| 2449 | + echo "Done\n"; |
|
| 2450 | + } |
|
| 2188 | 2451 | return ''; |
| 2189 | 2452 | } |
| 2190 | 2453 | public static function update_ModeS() { |
@@ -2201,340 +2464,590 @@ discard block |
||
| 2201 | 2464 | exit; |
| 2202 | 2465 | } elseif ($globalDebug) echo "Done\n"; |
| 2203 | 2466 | */ |
| 2204 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 2205 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2467 | + if ($globalDebug) { |
|
| 2468 | + echo "Modes : Download..."; |
|
| 2469 | + } |
|
| 2470 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2206 | 2471 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
| 2207 | 2472 | |
| 2208 | 2473 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2209 | 2474 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
| 2210 | - if ($globalDebug) echo "Unzip..."; |
|
| 2211 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2475 | + if ($globalDebug) { |
|
| 2476 | + echo "Unzip..."; |
|
| 2477 | + } |
|
| 2478 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2212 | 2479 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
| 2213 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2480 | + if ($globalDebug) { |
|
| 2481 | + echo "Add to DB..."; |
|
| 2482 | + } |
|
| 2214 | 2483 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 2215 | 2484 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
| 2216 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2485 | + } else { |
|
| 2486 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2487 | + } |
|
| 2217 | 2488 | if ($error != '') { |
| 2218 | 2489 | return $error; |
| 2219 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2490 | + } elseif ($globalDebug) { |
|
| 2491 | + echo "Done\n"; |
|
| 2492 | + } |
|
| 2220 | 2493 | return ''; |
| 2221 | 2494 | } |
| 2222 | 2495 | |
| 2223 | 2496 | public static function update_ModeS_faa() { |
| 2224 | 2497 | global $tmp_dir, $globalDebug; |
| 2225 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
| 2498 | + if ($globalDebug) { |
|
| 2499 | + echo "Modes FAA: Download..."; |
|
| 2500 | + } |
|
| 2226 | 2501 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
| 2227 | 2502 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2228 | - if ($globalDebug) echo "Unzip..."; |
|
| 2503 | + if ($globalDebug) { |
|
| 2504 | + echo "Unzip..."; |
|
| 2505 | + } |
|
| 2229 | 2506 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
| 2230 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2507 | + if ($globalDebug) { |
|
| 2508 | + echo "Add to DB..."; |
|
| 2509 | + } |
|
| 2231 | 2510 | $error = update_db::modes_faa(); |
| 2232 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2511 | + } else { |
|
| 2512 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2513 | + } |
|
| 2233 | 2514 | if ($error != '') { |
| 2234 | 2515 | return $error; |
| 2235 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2516 | + } elseif ($globalDebug) { |
|
| 2517 | + echo "Done\n"; |
|
| 2518 | + } |
|
| 2236 | 2519 | return ''; |
| 2237 | 2520 | } |
| 2238 | 2521 | |
| 2239 | 2522 | public static function update_ModeS_flarm() { |
| 2240 | 2523 | global $tmp_dir, $globalDebug; |
| 2241 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 2524 | + if ($globalDebug) { |
|
| 2525 | + echo "Modes Flarmnet: Download..."; |
|
| 2526 | + } |
|
| 2242 | 2527 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 2243 | 2528 | if (file_exists($tmp_dir.'data.fln')) { |
| 2244 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2529 | + if ($globalDebug) { |
|
| 2530 | + echo "Add to DB..."; |
|
| 2531 | + } |
|
| 2245 | 2532 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 2246 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2533 | + } else { |
|
| 2534 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2535 | + } |
|
| 2247 | 2536 | if ($error != '') { |
| 2248 | 2537 | return $error; |
| 2249 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2538 | + } elseif ($globalDebug) { |
|
| 2539 | + echo "Done\n"; |
|
| 2540 | + } |
|
| 2250 | 2541 | return ''; |
| 2251 | 2542 | } |
| 2252 | 2543 | |
| 2253 | 2544 | public static function update_ModeS_ogn() { |
| 2254 | 2545 | global $tmp_dir, $globalDebug; |
| 2255 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 2546 | + if ($globalDebug) { |
|
| 2547 | + echo "Modes OGN: Download..."; |
|
| 2548 | + } |
|
| 2256 | 2549 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 2257 | 2550 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2258 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2551 | + if ($globalDebug) { |
|
| 2552 | + echo "Add to DB..."; |
|
| 2553 | + } |
|
| 2259 | 2554 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 2260 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2555 | + } else { |
|
| 2556 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2557 | + } |
|
| 2261 | 2558 | if ($error != '') { |
| 2262 | 2559 | return $error; |
| 2263 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2560 | + } elseif ($globalDebug) { |
|
| 2561 | + echo "Done\n"; |
|
| 2562 | + } |
|
| 2264 | 2563 | return ''; |
| 2265 | 2564 | } |
| 2266 | 2565 | |
| 2267 | 2566 | public static function update_owner() { |
| 2268 | 2567 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2269 | 2568 | |
| 2270 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 2569 | + if ($globalDebug) { |
|
| 2570 | + echo "Owner France: Download..."; |
|
| 2571 | + } |
|
| 2271 | 2572 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 2272 | 2573 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2273 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2574 | + if ($globalDebug) { |
|
| 2575 | + echo "Add to DB..."; |
|
| 2576 | + } |
|
| 2274 | 2577 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 2275 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2578 | + } else { |
|
| 2579 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2580 | + } |
|
| 2276 | 2581 | if ($error != '') { |
| 2277 | 2582 | return $error; |
| 2278 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2583 | + } elseif ($globalDebug) { |
|
| 2584 | + echo "Done\n"; |
|
| 2585 | + } |
|
| 2279 | 2586 | |
| 2280 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 2587 | + if ($globalDebug) { |
|
| 2588 | + echo "Owner Ireland: Download..."; |
|
| 2589 | + } |
|
| 2281 | 2590 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 2282 | 2591 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2283 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2592 | + if ($globalDebug) { |
|
| 2593 | + echo "Add to DB..."; |
|
| 2594 | + } |
|
| 2284 | 2595 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 2285 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2596 | + } else { |
|
| 2597 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2598 | + } |
|
| 2286 | 2599 | if ($error != '') { |
| 2287 | 2600 | return $error; |
| 2288 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2289 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 2601 | + } elseif ($globalDebug) { |
|
| 2602 | + echo "Done\n"; |
|
| 2603 | + } |
|
| 2604 | + if ($globalDebug) { |
|
| 2605 | + echo "Owner Switzerland: Download..."; |
|
| 2606 | + } |
|
| 2290 | 2607 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 2291 | 2608 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2292 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2609 | + if ($globalDebug) { |
|
| 2610 | + echo "Add to DB..."; |
|
| 2611 | + } |
|
| 2293 | 2612 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 2294 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2613 | + } else { |
|
| 2614 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2615 | + } |
|
| 2295 | 2616 | if ($error != '') { |
| 2296 | 2617 | return $error; |
| 2297 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2298 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 2618 | + } elseif ($globalDebug) { |
|
| 2619 | + echo "Done\n"; |
|
| 2620 | + } |
|
| 2621 | + if ($globalDebug) { |
|
| 2622 | + echo "Owner Czech Republic: Download..."; |
|
| 2623 | + } |
|
| 2299 | 2624 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 2300 | 2625 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2301 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2626 | + if ($globalDebug) { |
|
| 2627 | + echo "Add to DB..."; |
|
| 2628 | + } |
|
| 2302 | 2629 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 2303 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2630 | + } else { |
|
| 2631 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2632 | + } |
|
| 2304 | 2633 | if ($error != '') { |
| 2305 | 2634 | return $error; |
| 2306 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2307 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 2635 | + } elseif ($globalDebug) { |
|
| 2636 | + echo "Done\n"; |
|
| 2637 | + } |
|
| 2638 | + if ($globalDebug) { |
|
| 2639 | + echo "Owner Australia: Download..."; |
|
| 2640 | + } |
|
| 2308 | 2641 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 2309 | 2642 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2310 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2643 | + if ($globalDebug) { |
|
| 2644 | + echo "Add to DB..."; |
|
| 2645 | + } |
|
| 2311 | 2646 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 2312 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2647 | + } else { |
|
| 2648 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2649 | + } |
|
| 2313 | 2650 | if ($error != '') { |
| 2314 | 2651 | return $error; |
| 2315 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2316 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 2652 | + } elseif ($globalDebug) { |
|
| 2653 | + echo "Done\n"; |
|
| 2654 | + } |
|
| 2655 | + if ($globalDebug) { |
|
| 2656 | + echo "Owner Austria: Download..."; |
|
| 2657 | + } |
|
| 2317 | 2658 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 2318 | 2659 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2319 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2660 | + if ($globalDebug) { |
|
| 2661 | + echo "Add to DB..."; |
|
| 2662 | + } |
|
| 2320 | 2663 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 2321 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2664 | + } else { |
|
| 2665 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2666 | + } |
|
| 2322 | 2667 | if ($error != '') { |
| 2323 | 2668 | return $error; |
| 2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2325 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 2669 | + } elseif ($globalDebug) { |
|
| 2670 | + echo "Done\n"; |
|
| 2671 | + } |
|
| 2672 | + if ($globalDebug) { |
|
| 2673 | + echo "Owner Chile: Download..."; |
|
| 2674 | + } |
|
| 2326 | 2675 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 2327 | 2676 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2328 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2677 | + if ($globalDebug) { |
|
| 2678 | + echo "Add to DB..."; |
|
| 2679 | + } |
|
| 2329 | 2680 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 2330 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2681 | + } else { |
|
| 2682 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2683 | + } |
|
| 2331 | 2684 | if ($error != '') { |
| 2332 | 2685 | return $error; |
| 2333 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2334 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 2686 | + } elseif ($globalDebug) { |
|
| 2687 | + echo "Done\n"; |
|
| 2688 | + } |
|
| 2689 | + if ($globalDebug) { |
|
| 2690 | + echo "Owner Colombia: Download..."; |
|
| 2691 | + } |
|
| 2335 | 2692 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 2336 | 2693 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2337 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2694 | + if ($globalDebug) { |
|
| 2695 | + echo "Add to DB..."; |
|
| 2696 | + } |
|
| 2338 | 2697 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 2339 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2698 | + } else { |
|
| 2699 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2700 | + } |
|
| 2340 | 2701 | if ($error != '') { |
| 2341 | 2702 | return $error; |
| 2342 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2343 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2703 | + } elseif ($globalDebug) { |
|
| 2704 | + echo "Done\n"; |
|
| 2705 | + } |
|
| 2706 | + if ($globalDebug) { |
|
| 2707 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2708 | + } |
|
| 2344 | 2709 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 2345 | 2710 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2346 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2711 | + if ($globalDebug) { |
|
| 2712 | + echo "Add to DB..."; |
|
| 2713 | + } |
|
| 2347 | 2714 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 2348 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2715 | + } else { |
|
| 2716 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2717 | + } |
|
| 2349 | 2718 | if ($error != '') { |
| 2350 | 2719 | return $error; |
| 2351 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2352 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 2720 | + } elseif ($globalDebug) { |
|
| 2721 | + echo "Done\n"; |
|
| 2722 | + } |
|
| 2723 | + if ($globalDebug) { |
|
| 2724 | + echo "Owner Brazil: Download..."; |
|
| 2725 | + } |
|
| 2353 | 2726 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 2354 | 2727 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2355 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2728 | + if ($globalDebug) { |
|
| 2729 | + echo "Add to DB..."; |
|
| 2730 | + } |
|
| 2356 | 2731 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 2357 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2732 | + } else { |
|
| 2733 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2734 | + } |
|
| 2358 | 2735 | if ($error != '') { |
| 2359 | 2736 | return $error; |
| 2360 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2361 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 2737 | + } elseif ($globalDebug) { |
|
| 2738 | + echo "Done\n"; |
|
| 2739 | + } |
|
| 2740 | + if ($globalDebug) { |
|
| 2741 | + echo "Owner Cayman Islands: Download..."; |
|
| 2742 | + } |
|
| 2362 | 2743 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 2363 | 2744 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2364 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2745 | + if ($globalDebug) { |
|
| 2746 | + echo "Add to DB..."; |
|
| 2747 | + } |
|
| 2365 | 2748 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 2366 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2749 | + } else { |
|
| 2750 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2751 | + } |
|
| 2367 | 2752 | if ($error != '') { |
| 2368 | 2753 | return $error; |
| 2369 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2370 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 2754 | + } elseif ($globalDebug) { |
|
| 2755 | + echo "Done\n"; |
|
| 2756 | + } |
|
| 2757 | + if ($globalDebug) { |
|
| 2758 | + echo "Owner Croatia: Download..."; |
|
| 2759 | + } |
|
| 2371 | 2760 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 2372 | 2761 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2373 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2762 | + if ($globalDebug) { |
|
| 2763 | + echo "Add to DB..."; |
|
| 2764 | + } |
|
| 2374 | 2765 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 2375 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2766 | + } else { |
|
| 2767 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2768 | + } |
|
| 2376 | 2769 | if ($error != '') { |
| 2377 | 2770 | return $error; |
| 2378 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2379 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 2771 | + } elseif ($globalDebug) { |
|
| 2772 | + echo "Done\n"; |
|
| 2773 | + } |
|
| 2774 | + if ($globalDebug) { |
|
| 2775 | + echo "Owner Luxembourg: Download..."; |
|
| 2776 | + } |
|
| 2380 | 2777 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 2381 | 2778 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2382 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2779 | + if ($globalDebug) { |
|
| 2780 | + echo "Add to DB..."; |
|
| 2781 | + } |
|
| 2383 | 2782 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 2384 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2783 | + } else { |
|
| 2784 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2785 | + } |
|
| 2385 | 2786 | if ($error != '') { |
| 2386 | 2787 | return $error; |
| 2387 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2388 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 2788 | + } elseif ($globalDebug) { |
|
| 2789 | + echo "Done\n"; |
|
| 2790 | + } |
|
| 2791 | + if ($globalDebug) { |
|
| 2792 | + echo "Owner Maldives: Download..."; |
|
| 2793 | + } |
|
| 2389 | 2794 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 2390 | 2795 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2391 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2796 | + if ($globalDebug) { |
|
| 2797 | + echo "Add to DB..."; |
|
| 2798 | + } |
|
| 2392 | 2799 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 2393 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2800 | + } else { |
|
| 2801 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2802 | + } |
|
| 2394 | 2803 | if ($error != '') { |
| 2395 | 2804 | return $error; |
| 2396 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2397 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 2805 | + } elseif ($globalDebug) { |
|
| 2806 | + echo "Done\n"; |
|
| 2807 | + } |
|
| 2808 | + if ($globalDebug) { |
|
| 2809 | + echo "Owner New Zealand: Download..."; |
|
| 2810 | + } |
|
| 2398 | 2811 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 2399 | 2812 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2400 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2813 | + if ($globalDebug) { |
|
| 2814 | + echo "Add to DB..."; |
|
| 2815 | + } |
|
| 2401 | 2816 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 2402 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2817 | + } else { |
|
| 2818 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2819 | + } |
|
| 2403 | 2820 | if ($error != '') { |
| 2404 | 2821 | return $error; |
| 2405 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2406 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 2822 | + } elseif ($globalDebug) { |
|
| 2823 | + echo "Done\n"; |
|
| 2824 | + } |
|
| 2825 | + if ($globalDebug) { |
|
| 2826 | + echo "Owner Papua New Guinea: Download..."; |
|
| 2827 | + } |
|
| 2407 | 2828 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 2408 | 2829 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2409 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2830 | + if ($globalDebug) { |
|
| 2831 | + echo "Add to DB..."; |
|
| 2832 | + } |
|
| 2410 | 2833 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 2411 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2834 | + } else { |
|
| 2835 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2836 | + } |
|
| 2412 | 2837 | if ($error != '') { |
| 2413 | 2838 | return $error; |
| 2414 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2415 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 2839 | + } elseif ($globalDebug) { |
|
| 2840 | + echo "Done\n"; |
|
| 2841 | + } |
|
| 2842 | + if ($globalDebug) { |
|
| 2843 | + echo "Owner Slovakia: Download..."; |
|
| 2844 | + } |
|
| 2416 | 2845 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 2417 | 2846 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2418 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2847 | + if ($globalDebug) { |
|
| 2848 | + echo "Add to DB..."; |
|
| 2849 | + } |
|
| 2419 | 2850 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 2420 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2851 | + } else { |
|
| 2852 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2853 | + } |
|
| 2421 | 2854 | if ($error != '') { |
| 2422 | 2855 | return $error; |
| 2423 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2424 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 2856 | + } elseif ($globalDebug) { |
|
| 2857 | + echo "Done\n"; |
|
| 2858 | + } |
|
| 2859 | + if ($globalDebug) { |
|
| 2860 | + echo "Owner Ecuador: Download..."; |
|
| 2861 | + } |
|
| 2425 | 2862 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 2426 | 2863 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2427 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2864 | + if ($globalDebug) { |
|
| 2865 | + echo "Add to DB..."; |
|
| 2866 | + } |
|
| 2428 | 2867 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 2429 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2868 | + } else { |
|
| 2869 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2870 | + } |
|
| 2430 | 2871 | if ($error != '') { |
| 2431 | 2872 | return $error; |
| 2432 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2433 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 2873 | + } elseif ($globalDebug) { |
|
| 2874 | + echo "Done\n"; |
|
| 2875 | + } |
|
| 2876 | + if ($globalDebug) { |
|
| 2877 | + echo "Owner Iceland: Download..."; |
|
| 2878 | + } |
|
| 2434 | 2879 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 2435 | 2880 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2436 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2881 | + if ($globalDebug) { |
|
| 2882 | + echo "Add to DB..."; |
|
| 2883 | + } |
|
| 2437 | 2884 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 2438 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2885 | + } else { |
|
| 2886 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2887 | + } |
|
| 2439 | 2888 | if ($error != '') { |
| 2440 | 2889 | return $error; |
| 2441 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2442 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
| 2890 | + } elseif ($globalDebug) { |
|
| 2891 | + echo "Done\n"; |
|
| 2892 | + } |
|
| 2893 | + if ($globalDebug) { |
|
| 2894 | + echo "Owner Isle of Man: Download..."; |
|
| 2895 | + } |
|
| 2443 | 2896 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
| 2444 | 2897 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2445 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2898 | + if ($globalDebug) { |
|
| 2899 | + echo "Add to DB..."; |
|
| 2900 | + } |
|
| 2446 | 2901 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
| 2447 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2902 | + } else { |
|
| 2903 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2904 | + } |
|
| 2448 | 2905 | if ($error != '') { |
| 2449 | 2906 | return $error; |
| 2450 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2907 | + } elseif ($globalDebug) { |
|
| 2908 | + echo "Done\n"; |
|
| 2909 | + } |
|
| 2451 | 2910 | if ($globalMasterSource) { |
| 2452 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
| 2911 | + if ($globalDebug) { |
|
| 2912 | + echo "ModeS Netherlands: Download..."; |
|
| 2913 | + } |
|
| 2453 | 2914 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
| 2454 | 2915 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2455 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2916 | + if ($globalDebug) { |
|
| 2917 | + echo "Add to DB..."; |
|
| 2918 | + } |
|
| 2456 | 2919 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
| 2457 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2920 | + } else { |
|
| 2921 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2922 | + } |
|
| 2458 | 2923 | if ($error != '') { |
| 2459 | 2924 | return $error; |
| 2460 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2461 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
| 2925 | + } elseif ($globalDebug) { |
|
| 2926 | + echo "Done\n"; |
|
| 2927 | + } |
|
| 2928 | + if ($globalDebug) { |
|
| 2929 | + echo "ModeS Denmark: Download..."; |
|
| 2930 | + } |
|
| 2462 | 2931 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
| 2463 | 2932 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2464 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2933 | + if ($globalDebug) { |
|
| 2934 | + echo "Add to DB..."; |
|
| 2935 | + } |
|
| 2465 | 2936 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
| 2466 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2937 | + } else { |
|
| 2938 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2939 | + } |
|
| 2467 | 2940 | if ($error != '') { |
| 2468 | 2941 | return $error; |
| 2469 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2470 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2942 | + } elseif ($globalDebug) { |
|
| 2943 | + echo "Done\n"; |
|
| 2944 | + } |
|
| 2945 | + } elseif ($globalDebug) { |
|
| 2946 | + echo "Done\n"; |
|
| 2947 | + } |
|
| 2471 | 2948 | return ''; |
| 2472 | 2949 | } |
| 2473 | 2950 | |
| 2474 | 2951 | public static function update_translation() { |
| 2475 | 2952 | global $tmp_dir, $globalDebug; |
| 2476 | 2953 | $error = ''; |
| 2477 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 2954 | + if ($globalDebug) { |
|
| 2955 | + echo "Translation : Download..."; |
|
| 2956 | + } |
|
| 2478 | 2957 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 2479 | 2958 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2480 | - if ($globalDebug) echo "Unzip..."; |
|
| 2959 | + if ($globalDebug) { |
|
| 2960 | + echo "Unzip..."; |
|
| 2961 | + } |
|
| 2481 | 2962 | update_db::unzip($tmp_dir.'translation.zip'); |
| 2482 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2963 | + if ($globalDebug) { |
|
| 2964 | + echo "Add to DB..."; |
|
| 2965 | + } |
|
| 2483 | 2966 | $error = update_db::translation(); |
| 2484 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2967 | + } else { |
|
| 2968 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2969 | + } |
|
| 2485 | 2970 | if ($error != '') { |
| 2486 | 2971 | return $error; |
| 2487 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2972 | + } elseif ($globalDebug) { |
|
| 2973 | + echo "Done\n"; |
|
| 2974 | + } |
|
| 2488 | 2975 | return ''; |
| 2489 | 2976 | } |
| 2490 | 2977 | |
| 2491 | 2978 | public static function update_translation_fam() { |
| 2492 | 2979 | global $tmp_dir, $globalDebug; |
| 2493 | 2980 | $error = ''; |
| 2494 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 2981 | + if ($globalDebug) { |
|
| 2982 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 2983 | + } |
|
| 2495 | 2984 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 2496 | 2985 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
| 2497 | 2986 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2498 | 2987 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
| 2499 | 2988 | $translation_md5 = $translation_md5_file[0]; |
| 2500 | 2989 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2501 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2990 | + if ($globalDebug) { |
|
| 2991 | + echo "Gunzip..."; |
|
| 2992 | + } |
|
| 2502 | 2993 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 2503 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2994 | + if ($globalDebug) { |
|
| 2995 | + echo "Add to DB..."; |
|
| 2996 | + } |
|
| 2504 | 2997 | $error = update_db::translation_fam(); |
| 2505 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2506 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2998 | + } else { |
|
| 2999 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 3000 | + } |
|
| 3001 | + } else { |
|
| 3002 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 3003 | + } |
|
| 2507 | 3004 | if ($error != '') { |
| 2508 | 3005 | return $error; |
| 2509 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3006 | + } elseif ($globalDebug) { |
|
| 3007 | + echo "Done\n"; |
|
| 3008 | + } |
|
| 2510 | 3009 | return ''; |
| 2511 | 3010 | } |
| 2512 | 3011 | public static function update_ModeS_fam() { |
| 2513 | 3012 | global $tmp_dir, $globalDebug; |
| 2514 | 3013 | $error = ''; |
| 2515 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
| 3014 | + if ($globalDebug) { |
|
| 3015 | + echo "ModeS from FlightAirMap website : Download..."; |
|
| 3016 | + } |
|
| 2516 | 3017 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
| 2517 | 3018 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
| 2518 | 3019 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2519 | 3020 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
| 2520 | 3021 | $modes_md5 = $modes_md5_file[0]; |
| 2521 | 3022 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2522 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3023 | + if ($globalDebug) { |
|
| 3024 | + echo "Gunzip..."; |
|
| 3025 | + } |
|
| 2523 | 3026 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
| 2524 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3027 | + if ($globalDebug) { |
|
| 3028 | + echo "Add to DB..."; |
|
| 3029 | + } |
|
| 2525 | 3030 | $error = update_db::modes_fam(); |
| 2526 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2527 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3031 | + } else { |
|
| 3032 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 3033 | + } |
|
| 3034 | + } else { |
|
| 3035 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3036 | + } |
|
| 2528 | 3037 | if ($error != '') { |
| 2529 | 3038 | return $error; |
| 2530 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3039 | + } elseif ($globalDebug) { |
|
| 3040 | + echo "Done\n"; |
|
| 3041 | + } |
|
| 2531 | 3042 | return ''; |
| 2532 | 3043 | } |
| 2533 | 3044 | |
| 2534 | 3045 | public static function update_airlines_fam() { |
| 2535 | 3046 | global $tmp_dir, $globalDebug; |
| 2536 | 3047 | $error = ''; |
| 2537 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
| 3048 | + if ($globalDebug) { |
|
| 3049 | + echo "Airlines from FlightAirMap website : Download..."; |
|
| 3050 | + } |
|
| 2538 | 3051 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
| 2539 | 3052 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2540 | 3053 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2543,26 +3056,42 @@ discard block |
||
| 2543 | 3056 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
| 2544 | 3057 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2545 | 3058 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2546 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3059 | + if ($globalDebug) { |
|
| 3060 | + echo "Gunzip..."; |
|
| 3061 | + } |
|
| 2547 | 3062 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
| 2548 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3063 | + if ($globalDebug) { |
|
| 3064 | + echo "Add to DB..."; |
|
| 3065 | + } |
|
| 2549 | 3066 | $error = update_db::airlines_fam(); |
| 2550 | 3067 | update_db::insert_airlines_version($airlines_md5); |
| 2551 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 2552 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2553 | - } elseif ($globalDebug) echo "No update."; |
|
| 2554 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3068 | + } else { |
|
| 3069 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 3070 | + } |
|
| 3071 | + } else { |
|
| 3072 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 3073 | + } |
|
| 3074 | + } elseif ($globalDebug) { |
|
| 3075 | + echo "No update."; |
|
| 3076 | + } |
|
| 3077 | + } else { |
|
| 3078 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3079 | + } |
|
| 2555 | 3080 | if ($error != '') { |
| 2556 | 3081 | return $error; |
| 2557 | 3082 | } else { |
| 2558 | - if ($globalDebug) echo "Done\n"; |
|
| 3083 | + if ($globalDebug) { |
|
| 3084 | + echo "Done\n"; |
|
| 3085 | + } |
|
| 2559 | 3086 | } |
| 2560 | 3087 | return ''; |
| 2561 | 3088 | } |
| 2562 | 3089 | |
| 2563 | 3090 | public static function update_owner_fam() { |
| 2564 | 3091 | global $tmp_dir, $globalDebug, $globalOwner; |
| 2565 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
| 3092 | + if ($globalDebug) { |
|
| 3093 | + echo "owner from FlightAirMap website : Download..."; |
|
| 3094 | + } |
|
| 2566 | 3095 | $error = ''; |
| 2567 | 3096 | if ($globalOwner === TRUE) { |
| 2568 | 3097 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2575,55 +3104,89 @@ discard block |
||
| 2575 | 3104 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
| 2576 | 3105 | $owners_md5 = $owners_md5_file[0]; |
| 2577 | 3106 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2578 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3107 | + if ($globalDebug) { |
|
| 3108 | + echo "Gunzip..."; |
|
| 3109 | + } |
|
| 2579 | 3110 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
| 2580 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3111 | + if ($globalDebug) { |
|
| 3112 | + echo "Add to DB..."; |
|
| 3113 | + } |
|
| 2581 | 3114 | $error = update_db::owner_fam(); |
| 2582 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 2583 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3115 | + } else { |
|
| 3116 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 3117 | + } |
|
| 3118 | + } else { |
|
| 3119 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3120 | + } |
|
| 2584 | 3121 | if ($error != '') { |
| 2585 | 3122 | return $error; |
| 2586 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3123 | + } elseif ($globalDebug) { |
|
| 3124 | + echo "Done\n"; |
|
| 3125 | + } |
|
| 2587 | 3126 | return ''; |
| 2588 | 3127 | } |
| 2589 | 3128 | public static function update_routes_fam() { |
| 2590 | 3129 | global $tmp_dir, $globalDebug; |
| 2591 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
| 3130 | + if ($globalDebug) { |
|
| 3131 | + echo "Routes from FlightAirMap website : Download..."; |
|
| 3132 | + } |
|
| 2592 | 3133 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
| 2593 | 3134 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
| 2594 | 3135 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2595 | 3136 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
| 2596 | 3137 | $routes_md5 = $routes_md5_file[0]; |
| 2597 | 3138 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2598 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3139 | + if ($globalDebug) { |
|
| 3140 | + echo "Gunzip..."; |
|
| 3141 | + } |
|
| 2599 | 3142 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
| 2600 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3143 | + if ($globalDebug) { |
|
| 3144 | + echo "Add to DB..."; |
|
| 3145 | + } |
|
| 2601 | 3146 | $error = update_db::routes_fam(); |
| 2602 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 2603 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3147 | + } else { |
|
| 3148 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 3149 | + } |
|
| 3150 | + } else { |
|
| 3151 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3152 | + } |
|
| 2604 | 3153 | if ($error != '') { |
| 2605 | 3154 | return $error; |
| 2606 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3155 | + } elseif ($globalDebug) { |
|
| 3156 | + echo "Done\n"; |
|
| 3157 | + } |
|
| 2607 | 3158 | return ''; |
| 2608 | 3159 | } |
| 2609 | 3160 | public static function update_block_fam() { |
| 2610 | 3161 | global $tmp_dir, $globalDebug; |
| 2611 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3162 | + if ($globalDebug) { |
|
| 3163 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3164 | + } |
|
| 2612 | 3165 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
| 2613 | 3166 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
| 2614 | 3167 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2615 | 3168 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
| 2616 | 3169 | $block_md5 = $block_md5_file[0]; |
| 2617 | 3170 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2618 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3171 | + if ($globalDebug) { |
|
| 3172 | + echo "Gunzip..."; |
|
| 3173 | + } |
|
| 2619 | 3174 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
| 2620 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3175 | + if ($globalDebug) { |
|
| 3176 | + echo "Add to DB..."; |
|
| 3177 | + } |
|
| 2621 | 3178 | $error = update_db::block_fam(); |
| 2622 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 2623 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3179 | + } else { |
|
| 3180 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 3181 | + } |
|
| 3182 | + } else { |
|
| 3183 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3184 | + } |
|
| 2624 | 3185 | if ($error != '') { |
| 2625 | 3186 | return $error; |
| 2626 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3187 | + } elseif ($globalDebug) { |
|
| 3188 | + echo "Done\n"; |
|
| 3189 | + } |
|
| 2627 | 3190 | return ''; |
| 2628 | 3191 | } |
| 2629 | 3192 | public static function update_marine_identity_fam() { |
@@ -2633,21 +3196,33 @@ discard block |
||
| 2633 | 3196 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
| 2634 | 3197 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2635 | 3198 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2636 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3199 | + if ($globalDebug) { |
|
| 3200 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3201 | + } |
|
| 2637 | 3202 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
| 2638 | 3203 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2639 | 3204 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2640 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3205 | + if ($globalDebug) { |
|
| 3206 | + echo "Gunzip..."; |
|
| 3207 | + } |
|
| 2641 | 3208 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
| 2642 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3209 | + if ($globalDebug) { |
|
| 3210 | + echo "Add to DB..."; |
|
| 3211 | + } |
|
| 2643 | 3212 | $error = update_db::marine_identity_fam(); |
| 2644 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 2645 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3213 | + } else { |
|
| 3214 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 3215 | + } |
|
| 3216 | + } else { |
|
| 3217 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3218 | + } |
|
| 2646 | 3219 | if ($error != '') { |
| 2647 | 3220 | return $error; |
| 2648 | 3221 | } else { |
| 2649 | 3222 | update_db::insert_marine_identity_version($marine_identity_md5); |
| 2650 | - if ($globalDebug) echo "Done\n"; |
|
| 3223 | + if ($globalDebug) { |
|
| 3224 | + echo "Done\n"; |
|
| 3225 | + } |
|
| 2651 | 3226 | } |
| 2652 | 3227 | } |
| 2653 | 3228 | } |
@@ -2661,21 +3236,33 @@ discard block |
||
| 2661 | 3236 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
| 2662 | 3237 | $satellite_md5 = $satellite_md5_file[0]; |
| 2663 | 3238 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2664 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
| 3239 | + if ($globalDebug) { |
|
| 3240 | + echo "Satellite from FlightAirMap website : Download..."; |
|
| 3241 | + } |
|
| 2665 | 3242 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
| 2666 | 3243 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2667 | 3244 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2668 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3245 | + if ($globalDebug) { |
|
| 3246 | + echo "Gunzip..."; |
|
| 3247 | + } |
|
| 2669 | 3248 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
| 2670 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3249 | + if ($globalDebug) { |
|
| 3250 | + echo "Add to DB..."; |
|
| 3251 | + } |
|
| 2671 | 3252 | $error = update_db::satellite_fam(); |
| 2672 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 2673 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3253 | + } else { |
|
| 3254 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 3255 | + } |
|
| 3256 | + } else { |
|
| 3257 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3258 | + } |
|
| 2674 | 3259 | if ($error != '') { |
| 2675 | 3260 | return $error; |
| 2676 | 3261 | } else { |
| 2677 | 3262 | update_db::insert_satellite_version($satellite_md5); |
| 2678 | - if ($globalDebug) echo "Done\n"; |
|
| 3263 | + if ($globalDebug) { |
|
| 3264 | + echo "Done\n"; |
|
| 3265 | + } |
|
| 2679 | 3266 | } |
| 2680 | 3267 | } |
| 2681 | 3268 | } |
@@ -2688,19 +3275,29 @@ discard block |
||
| 2688 | 3275 | $diagrams_md5_file = explode(' ',file_get_contents($tmp_dir.'diagramspdf.md5')); |
| 2689 | 3276 | $diagrams_md5 = $diagrams_md5_file[0]; |
| 2690 | 3277 | if (!update_db::check_diagrams_version($diagrams_md5)) { |
| 2691 | - if ($globalDebug) echo "Airports diagrams from FlightAirMap website : Download..."; |
|
| 3278 | + if ($globalDebug) { |
|
| 3279 | + echo "Airports diagrams from FlightAirMap website : Download..."; |
|
| 3280 | + } |
|
| 2692 | 3281 | update_db::download('http://data.flightairmap.com/data/diagrams/diagramspdf',$tmp_dir.'diagramspdf'); |
| 2693 | 3282 | if (file_exists($tmp_dir.'diagramspdf')) { |
| 2694 | 3283 | if (md5_file($tmp_dir.'diagramspdf') == $diagrams_md5) { |
| 2695 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3284 | + if ($globalDebug) { |
|
| 3285 | + echo "Add to DB..."; |
|
| 3286 | + } |
|
| 2696 | 3287 | $error = update_db::diagrams_fam(); |
| 2697 | - } else $error = "File ".$tmp_dir.'diagramspdf'." md5 failed. Download failed."; |
|
| 2698 | - } else $error = "File ".$tmp_dir.'diagramspdf'." doesn't exist. Download failed."; |
|
| 3288 | + } else { |
|
| 3289 | + $error = "File ".$tmp_dir.'diagramspdf'." md5 failed. Download failed."; |
|
| 3290 | + } |
|
| 3291 | + } else { |
|
| 3292 | + $error = "File ".$tmp_dir.'diagramspdf'." doesn't exist. Download failed."; |
|
| 3293 | + } |
|
| 2699 | 3294 | if ($error != '') { |
| 2700 | 3295 | return $error; |
| 2701 | 3296 | } else { |
| 2702 | 3297 | update_db::insert_diagrams_version($diagrams_md5); |
| 2703 | - if ($globalDebug) echo "Done\n"; |
|
| 3298 | + if ($globalDebug) { |
|
| 3299 | + echo "Done\n"; |
|
| 3300 | + } |
|
| 2704 | 3301 | } |
| 2705 | 3302 | } |
| 2706 | 3303 | } |
@@ -2708,17 +3305,25 @@ discard block |
||
| 2708 | 3305 | } |
| 2709 | 3306 | public static function update_banned_fam() { |
| 2710 | 3307 | global $tmp_dir, $globalDebug; |
| 2711 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3308 | + if ($globalDebug) { |
|
| 3309 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3310 | + } |
|
| 2712 | 3311 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
| 2713 | 3312 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2714 | 3313 | //if ($globalDebug) echo "Gunzip..."; |
| 2715 | 3314 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
| 2716 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3315 | + if ($globalDebug) { |
|
| 3316 | + echo "Add to DB..."; |
|
| 3317 | + } |
|
| 2717 | 3318 | $error = update_db::banned_fam(); |
| 2718 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3319 | + } else { |
|
| 3320 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3321 | + } |
|
| 2719 | 3322 | if ($error != '') { |
| 2720 | 3323 | return $error; |
| 2721 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3324 | + } elseif ($globalDebug) { |
|
| 3325 | + echo "Done\n"; |
|
| 3326 | + } |
|
| 2722 | 3327 | return ''; |
| 2723 | 3328 | } |
| 2724 | 3329 | |
@@ -2726,7 +3331,9 @@ discard block |
||
| 2726 | 3331 | global $tmp_dir, $globalDebug, $globalDBdriver; |
| 2727 | 3332 | include_once('class.create_db.php'); |
| 2728 | 3333 | $error = ''; |
| 2729 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
| 3334 | + if ($globalDebug) { |
|
| 3335 | + echo "Airspace from FlightAirMap website : Download..."; |
|
| 3336 | + } |
|
| 2730 | 3337 | if ($globalDBdriver == 'mysql') { |
| 2731 | 3338 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
| 2732 | 3339 | } else { |
@@ -2743,9 +3350,13 @@ discard block |
||
| 2743 | 3350 | } |
| 2744 | 3351 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2745 | 3352 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
| 2746 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3353 | + if ($globalDebug) { |
|
| 3354 | + echo "Gunzip..."; |
|
| 3355 | + } |
|
| 2747 | 3356 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
| 2748 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3357 | + if ($globalDebug) { |
|
| 3358 | + echo "Add to DB..."; |
|
| 3359 | + } |
|
| 2749 | 3360 | $Connection = new Connection(); |
| 2750 | 3361 | if ($Connection->tableExists('airspace')) { |
| 2751 | 3362 | $query = 'DROP TABLE airspace'; |
@@ -2758,20 +3369,30 @@ discard block |
||
| 2758 | 3369 | } |
| 2759 | 3370 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 2760 | 3371 | update_db::insert_airspace_version($airspace_md5); |
| 2761 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 2762 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3372 | + } else { |
|
| 3373 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 3374 | + } |
|
| 3375 | + } else { |
|
| 3376 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3377 | + } |
|
| 2763 | 3378 | } |
| 2764 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3379 | + } else { |
|
| 3380 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3381 | + } |
|
| 2765 | 3382 | if ($error != '') { |
| 2766 | 3383 | return $error; |
| 2767 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3384 | + } elseif ($globalDebug) { |
|
| 3385 | + echo "Done\n"; |
|
| 3386 | + } |
|
| 2768 | 3387 | return ''; |
| 2769 | 3388 | } |
| 2770 | 3389 | |
| 2771 | 3390 | public static function update_geoid_fam() { |
| 2772 | 3391 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2773 | 3392 | $error = ''; |
| 2774 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
| 3393 | + if ($globalDebug) { |
|
| 3394 | + echo "Geoid from FlightAirMap website : Download..."; |
|
| 3395 | + } |
|
| 2775 | 3396 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
| 2776 | 3397 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2777 | 3398 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2780,80 +3401,126 @@ discard block |
||
| 2780 | 3401 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
| 2781 | 3402 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2782 | 3403 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2783 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3404 | + if ($globalDebug) { |
|
| 3405 | + echo "Gunzip..."; |
|
| 3406 | + } |
|
| 2784 | 3407 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
| 2785 | 3408 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2786 | 3409 | update_db::insert_geoid_version($geoid_md5); |
| 2787 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 2788 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 2789 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 2790 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
| 2791 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3410 | + } else { |
|
| 3411 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 3412 | + } |
|
| 3413 | + } else { |
|
| 3414 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 3415 | + } |
|
| 3416 | + } else { |
|
| 3417 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 3418 | + } |
|
| 3419 | + } elseif ($globalDebug) { |
|
| 3420 | + echo 'No new version'."\n"; |
|
| 3421 | + } |
|
| 3422 | + } else { |
|
| 3423 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3424 | + } |
|
| 2792 | 3425 | if ($error != '') { |
| 2793 | 3426 | return $error; |
| 2794 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3427 | + } elseif ($globalDebug) { |
|
| 3428 | + echo "Done\n"; |
|
| 3429 | + } |
|
| 2795 | 3430 | return ''; |
| 2796 | 3431 | } |
| 2797 | 3432 | |
| 2798 | 3433 | public static function update_tle() { |
| 2799 | 3434 | global $tmp_dir, $globalDebug; |
| 2800 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
| 3435 | + if ($globalDebug) { |
|
| 3436 | + echo "Download TLE : Download..."; |
|
| 3437 | + } |
|
| 2801 | 3438 | $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', |
| 2802 | 3439 | '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', |
| 2803 | 3440 | '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'); |
| 2804 | 3441 | foreach ($alltle as $filename) { |
| 2805 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
| 3442 | + if ($globalDebug) { |
|
| 3443 | + echo "downloading ".$filename.'...'; |
|
| 3444 | + } |
|
| 2806 | 3445 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
| 2807 | 3446 | if (file_exists($tmp_dir.$filename)) { |
| 2808 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
| 3447 | + if ($globalDebug) { |
|
| 3448 | + echo "Add to DB ".$filename."..."; |
|
| 3449 | + } |
|
| 2809 | 3450 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
| 2810 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3451 | + } else { |
|
| 3452 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3453 | + } |
|
| 2811 | 3454 | if ($error != '') { |
| 2812 | 3455 | echo $error."\n"; |
| 2813 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3456 | + } elseif ($globalDebug) { |
|
| 3457 | + echo "Done\n"; |
|
| 3458 | + } |
|
| 2814 | 3459 | } |
| 2815 | 3460 | return ''; |
| 2816 | 3461 | } |
| 2817 | 3462 | |
| 2818 | 3463 | public static function update_ucsdb() { |
| 2819 | 3464 | global $tmp_dir, $globalDebug; |
| 2820 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
| 3465 | + if ($globalDebug) { |
|
| 3466 | + echo "Download UCS DB : Download..."; |
|
| 3467 | + } |
|
| 2821 | 3468 | 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'); |
| 2822 | 3469 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2823 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3470 | + if ($globalDebug) { |
|
| 3471 | + echo "Add to DB..."; |
|
| 3472 | + } |
|
| 2824 | 3473 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
| 2825 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3474 | + } else { |
|
| 3475 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3476 | + } |
|
| 2826 | 3477 | if ($error != '') { |
| 2827 | 3478 | echo $error."\n"; |
| 2828 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3479 | + } elseif ($globalDebug) { |
|
| 3480 | + echo "Done\n"; |
|
| 3481 | + } |
|
| 2829 | 3482 | return ''; |
| 2830 | 3483 | } |
| 2831 | 3484 | |
| 2832 | 3485 | public static function update_celestrak() { |
| 2833 | 3486 | global $tmp_dir, $globalDebug; |
| 2834 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
| 3487 | + if ($globalDebug) { |
|
| 3488 | + echo "Download Celestrak DB : Download..."; |
|
| 3489 | + } |
|
| 2835 | 3490 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
| 2836 | 3491 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2837 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3492 | + if ($globalDebug) { |
|
| 3493 | + echo "Add to DB..."; |
|
| 3494 | + } |
|
| 2838 | 3495 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
| 2839 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3496 | + } else { |
|
| 3497 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3498 | + } |
|
| 2840 | 3499 | if ($error != '') { |
| 2841 | 3500 | echo $error."\n"; |
| 2842 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3501 | + } elseif ($globalDebug) { |
|
| 3502 | + echo "Done\n"; |
|
| 3503 | + } |
|
| 2843 | 3504 | return ''; |
| 2844 | 3505 | } |
| 2845 | 3506 | |
| 2846 | 3507 | public static function update_models() { |
| 2847 | 3508 | global $tmp_dir, $globalDebug; |
| 2848 | 3509 | $error = ''; |
| 2849 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3510 | + if ($globalDebug) { |
|
| 3511 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3512 | + } |
|
| 2850 | 3513 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2851 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3514 | + if ($globalDebug) { |
|
| 3515 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3516 | + } |
|
| 2852 | 3517 | return ''; |
| 2853 | 3518 | } |
| 2854 | 3519 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
| 2855 | 3520 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2856 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3521 | + if ($globalDebug) { |
|
| 3522 | + echo "Check files...\n"; |
|
| 3523 | + } |
|
| 2857 | 3524 | $newmodelsdb = array(); |
| 2858 | 3525 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
| 2859 | 3526 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2872,18 +3539,28 @@ discard block |
||
| 2872 | 3539 | } |
| 2873 | 3540 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2874 | 3541 | foreach ($diff as $key => $value) { |
| 2875 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3542 | + if ($globalDebug) { |
|
| 3543 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3544 | + } |
|
| 2876 | 3545 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
| 2877 | 3546 | } |
| 2878 | 3547 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
| 2879 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3548 | + } else { |
|
| 3549 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3550 | + } |
|
| 2880 | 3551 | if ($error != '') { |
| 2881 | 3552 | return $error; |
| 2882 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2883 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3553 | + } elseif ($globalDebug) { |
|
| 3554 | + echo "Done\n"; |
|
| 3555 | + } |
|
| 3556 | + if ($globalDebug) { |
|
| 3557 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3558 | + } |
|
| 2884 | 3559 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
| 2885 | 3560 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2886 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3561 | + if ($globalDebug) { |
|
| 3562 | + echo "Check files...\n"; |
|
| 3563 | + } |
|
| 2887 | 3564 | $newmodelsdb = array(); |
| 2888 | 3565 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
| 2889 | 3566 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2902,29 +3579,43 @@ discard block |
||
| 2902 | 3579 | } |
| 2903 | 3580 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2904 | 3581 | foreach ($diff as $key => $value) { |
| 2905 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3582 | + if ($globalDebug) { |
|
| 3583 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3584 | + } |
|
| 2906 | 3585 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
| 2907 | 3586 | |
| 2908 | 3587 | } |
| 2909 | 3588 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
| 2910 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3589 | + } else { |
|
| 3590 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3591 | + } |
|
| 2911 | 3592 | if ($error != '') { |
| 2912 | 3593 | return $error; |
| 2913 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3594 | + } elseif ($globalDebug) { |
|
| 3595 | + echo "Done\n"; |
|
| 3596 | + } |
|
| 2914 | 3597 | return ''; |
| 2915 | 3598 | } |
| 2916 | 3599 | public static function update_weather_models() { |
| 2917 | 3600 | global $tmp_dir, $globalDebug; |
| 2918 | 3601 | $error = ''; |
| 2919 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3602 | + if ($globalDebug) { |
|
| 3603 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3604 | + } |
|
| 2920 | 3605 | if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) { |
| 2921 | - if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3606 | + if ($globalDebug) { |
|
| 3607 | + echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3608 | + } |
|
| 2922 | 3609 | return ''; |
| 2923 | 3610 | } |
| 2924 | - if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3611 | + if ($globalDebug) { |
|
| 3612 | + echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3613 | + } |
|
| 2925 | 3614 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
| 2926 | 3615 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
| 2927 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3616 | + if ($globalDebug) { |
|
| 3617 | + echo "Check files...\n"; |
|
| 3618 | + } |
|
| 2928 | 3619 | $newmodelsdb = array(); |
| 2929 | 3620 | if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
| 2930 | 3621 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2943,25 +3634,35 @@ discard block |
||
| 2943 | 3634 | } |
| 2944 | 3635 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2945 | 3636 | foreach ($diff as $key => $value) { |
| 2946 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3637 | + if ($globalDebug) { |
|
| 3638 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3639 | + } |
|
| 2947 | 3640 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
| 2948 | 3641 | |
| 2949 | 3642 | } |
| 2950 | 3643 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
| 2951 | - } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3644 | + } else { |
|
| 3645 | + $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3646 | + } |
|
| 2952 | 3647 | if ($error != '') { |
| 2953 | 3648 | return $error; |
| 2954 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3649 | + } elseif ($globalDebug) { |
|
| 3650 | + echo "Done\n"; |
|
| 3651 | + } |
|
| 2955 | 3652 | return ''; |
| 2956 | 3653 | } |
| 2957 | 3654 | |
| 2958 | 3655 | public static function update_liveries() { |
| 2959 | 3656 | global $tmp_dir, $globalDebug; |
| 2960 | 3657 | $error = ''; |
| 2961 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
| 3658 | + if ($globalDebug) { |
|
| 3659 | + echo "Liveries from FlightAirMap website : Download..."; |
|
| 3660 | + } |
|
| 2962 | 3661 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
| 2963 | 3662 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2964 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3663 | + if ($globalDebug) { |
|
| 3664 | + echo "Check files...\n"; |
|
| 3665 | + } |
|
| 2965 | 3666 | $newmodelsdb = array(); |
| 2966 | 3667 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
| 2967 | 3668 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2980,15 +3681,21 @@ discard block |
||
| 2980 | 3681 | } |
| 2981 | 3682 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2982 | 3683 | foreach ($diff as $key => $value) { |
| 2983 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3684 | + if ($globalDebug) { |
|
| 3685 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3686 | + } |
|
| 2984 | 3687 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
| 2985 | 3688 | |
| 2986 | 3689 | } |
| 2987 | 3690 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
| 2988 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3691 | + } else { |
|
| 3692 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3693 | + } |
|
| 2989 | 3694 | if ($error != '') { |
| 2990 | 3695 | return $error; |
| 2991 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3696 | + } elseif ($globalDebug) { |
|
| 3697 | + echo "Done\n"; |
|
| 3698 | + } |
|
| 2992 | 3699 | return ''; |
| 2993 | 3700 | } |
| 2994 | 3701 | |
@@ -2996,13 +3703,19 @@ discard block |
||
| 2996 | 3703 | global $tmp_dir, $globalDebug; |
| 2997 | 3704 | $error = ''; |
| 2998 | 3705 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2999 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3706 | + if ($globalDebug) { |
|
| 3707 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3708 | + } |
|
| 3000 | 3709 | return ''; |
| 3001 | 3710 | } |
| 3002 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
| 3711 | + if ($globalDebug) { |
|
| 3712 | + echo "Space models from FlightAirMap website : Download..."; |
|
| 3713 | + } |
|
| 3003 | 3714 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
| 3004 | 3715 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 3005 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3716 | + if ($globalDebug) { |
|
| 3717 | + echo "Check files...\n"; |
|
| 3718 | + } |
|
| 3006 | 3719 | $newmodelsdb = array(); |
| 3007 | 3720 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
| 3008 | 3721 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -3021,15 +3734,21 @@ discard block |
||
| 3021 | 3734 | } |
| 3022 | 3735 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 3023 | 3736 | foreach ($diff as $key => $value) { |
| 3024 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3737 | + if ($globalDebug) { |
|
| 3738 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3739 | + } |
|
| 3025 | 3740 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
| 3026 | 3741 | |
| 3027 | 3742 | } |
| 3028 | 3743 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
| 3029 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3744 | + } else { |
|
| 3745 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3746 | + } |
|
| 3030 | 3747 | if ($error != '') { |
| 3031 | 3748 | return $error; |
| 3032 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3749 | + } elseif ($globalDebug) { |
|
| 3750 | + echo "Done\n"; |
|
| 3751 | + } |
|
| 3033 | 3752 | return ''; |
| 3034 | 3753 | } |
| 3035 | 3754 | |
@@ -3037,13 +3756,19 @@ discard block |
||
| 3037 | 3756 | global $tmp_dir, $globalDebug; |
| 3038 | 3757 | $error = ''; |
| 3039 | 3758 | if (!is_writable(dirname(__FILE__).'/../models/vehicules')) { |
| 3040 | - if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3759 | + if ($globalDebug) { |
|
| 3760 | + echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3761 | + } |
|
| 3041 | 3762 | return ''; |
| 3042 | 3763 | } |
| 3043 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3764 | + if ($globalDebug) { |
|
| 3765 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3766 | + } |
|
| 3044 | 3767 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
| 3045 | 3768 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 3046 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3769 | + if ($globalDebug) { |
|
| 3770 | + echo "Check files...\n"; |
|
| 3771 | + } |
|
| 3047 | 3772 | $newmodelsdb = array(); |
| 3048 | 3773 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
| 3049 | 3774 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -3062,15 +3787,21 @@ discard block |
||
| 3062 | 3787 | } |
| 3063 | 3788 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 3064 | 3789 | foreach ($diff as $key => $value) { |
| 3065 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3790 | + if ($globalDebug) { |
|
| 3791 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3792 | + } |
|
| 3066 | 3793 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
| 3067 | 3794 | |
| 3068 | 3795 | } |
| 3069 | 3796 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
| 3070 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3797 | + } else { |
|
| 3798 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3799 | + } |
|
| 3071 | 3800 | if ($error != '') { |
| 3072 | 3801 | return $error; |
| 3073 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3802 | + } elseif ($globalDebug) { |
|
| 3803 | + echo "Done\n"; |
|
| 3804 | + } |
|
| 3074 | 3805 | return ''; |
| 3075 | 3806 | } |
| 3076 | 3807 | |
@@ -3143,7 +3874,9 @@ discard block |
||
| 3143 | 3874 | } |
| 3144 | 3875 | |
| 3145 | 3876 | $error = ''; |
| 3146 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 3877 | + if ($globalDebug) { |
|
| 3878 | + echo "Notam : Download..."; |
|
| 3879 | + } |
|
| 3147 | 3880 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 3148 | 3881 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3149 | 3882 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3158,14 +3891,30 @@ discard block |
||
| 3158 | 3891 | $data['fir'] = $q[0]; |
| 3159 | 3892 | $data['code'] = $q[1]; |
| 3160 | 3893 | $ifrvfr = $q[2]; |
| 3161 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 3162 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 3163 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 3164 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 3165 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 3166 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 3167 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 3168 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 3894 | + if ($ifrvfr == 'IV') { |
|
| 3895 | + $data['rules'] = 'IFR/VFR'; |
|
| 3896 | + } |
|
| 3897 | + if ($ifrvfr == 'I') { |
|
| 3898 | + $data['rules'] = 'IFR'; |
|
| 3899 | + } |
|
| 3900 | + if ($ifrvfr == 'V') { |
|
| 3901 | + $data['rules'] = 'VFR'; |
|
| 3902 | + } |
|
| 3903 | + if ($q[4] == 'A') { |
|
| 3904 | + $data['scope'] = 'Airport warning'; |
|
| 3905 | + } |
|
| 3906 | + if ($q[4] == 'E') { |
|
| 3907 | + $data['scope'] = 'Enroute warning'; |
|
| 3908 | + } |
|
| 3909 | + if ($q[4] == 'W') { |
|
| 3910 | + $data['scope'] = 'Navigation warning'; |
|
| 3911 | + } |
|
| 3912 | + if ($q[4] == 'AE') { |
|
| 3913 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 3914 | + } |
|
| 3915 | + if ($q[4] == 'AW') { |
|
| 3916 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 3917 | + } |
|
| 3169 | 3918 | //$data['scope'] = $q[4]; |
| 3170 | 3919 | $data['lower_limit'] = $q[5]; |
| 3171 | 3920 | $data['upper_limit'] = $q[6]; |
@@ -3173,8 +3922,12 @@ discard block |
||
| 3173 | 3922 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 3174 | 3923 | $latitude = $Common->convertDec($las,'latitude'); |
| 3175 | 3924 | $longitude = $Common->convertDec($lns,'longitude'); |
| 3176 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 3177 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 3925 | + if ($lac == 'S') { |
|
| 3926 | + $latitude = '-'.$latitude; |
|
| 3927 | + } |
|
| 3928 | + if ($lnc == 'W') { |
|
| 3929 | + $longitude = '-'.$longitude; |
|
| 3930 | + } |
|
| 3178 | 3931 | $data['center_latitude'] = $latitude; |
| 3179 | 3932 | $data['center_longitude'] = $longitude; |
| 3180 | 3933 | $data['radius'] = intval($radius); |
@@ -3204,10 +3957,14 @@ discard block |
||
| 3204 | 3957 | $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']); |
| 3205 | 3958 | unset($data); |
| 3206 | 3959 | } |
| 3207 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3960 | + } else { |
|
| 3961 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3962 | + } |
|
| 3208 | 3963 | if ($error != '') { |
| 3209 | 3964 | return $error; |
| 3210 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3965 | + } elseif ($globalDebug) { |
|
| 3966 | + echo "Done\n"; |
|
| 3967 | + } |
|
| 3211 | 3968 | return ''; |
| 3212 | 3969 | } |
| 3213 | 3970 | |
@@ -3232,7 +3989,9 @@ discard block |
||
| 3232 | 3989 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3233 | 3990 | $airspace_json = json_decode($airspace_lst,true); |
| 3234 | 3991 | foreach ($airspace_json['records'] as $airspace) { |
| 3235 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
| 3992 | + if ($globalDebug) { |
|
| 3993 | + echo $airspace['name']."...\n"; |
|
| 3994 | + } |
|
| 3236 | 3995 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
| 3237 | 3996 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3238 | 3997 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3276,8 +4035,11 @@ discard block |
||
| 3276 | 4035 | return "error : ".$e->getMessage(); |
| 3277 | 4036 | } |
| 3278 | 4037 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3279 | - if ($row['nb'] > 0) return false; |
|
| 3280 | - else return true; |
|
| 4038 | + if ($row['nb'] > 0) { |
|
| 4039 | + return false; |
|
| 4040 | + } else { |
|
| 4041 | + return true; |
|
| 4042 | + } |
|
| 3281 | 4043 | } |
| 3282 | 4044 | |
| 3283 | 4045 | public static function insert_last_update() { |
@@ -3302,8 +4064,11 @@ discard block |
||
| 3302 | 4064 | return "error : ".$e->getMessage(); |
| 3303 | 4065 | } |
| 3304 | 4066 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3305 | - if ($row['nb'] > 0) return true; |
|
| 3306 | - else return false; |
|
| 4067 | + if ($row['nb'] > 0) { |
|
| 4068 | + return true; |
|
| 4069 | + } else { |
|
| 4070 | + return false; |
|
| 4071 | + } |
|
| 3307 | 4072 | } |
| 3308 | 4073 | |
| 3309 | 4074 | public static function check_geoid_version($version) { |
@@ -3316,8 +4081,11 @@ discard block |
||
| 3316 | 4081 | return "error : ".$e->getMessage(); |
| 3317 | 4082 | } |
| 3318 | 4083 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3319 | - if ($row['nb'] > 0) return true; |
|
| 3320 | - else return false; |
|
| 4084 | + if ($row['nb'] > 0) { |
|
| 4085 | + return true; |
|
| 4086 | + } else { |
|
| 4087 | + return false; |
|
| 4088 | + } |
|
| 3321 | 4089 | } |
| 3322 | 4090 | |
| 3323 | 4091 | public static function check_marine_identity_version($version) { |
@@ -3330,8 +4098,11 @@ discard block |
||
| 3330 | 4098 | return "error : ".$e->getMessage(); |
| 3331 | 4099 | } |
| 3332 | 4100 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3333 | - if ($row['nb'] > 0) return true; |
|
| 3334 | - else return false; |
|
| 4101 | + if ($row['nb'] > 0) { |
|
| 4102 | + return true; |
|
| 4103 | + } else { |
|
| 4104 | + return false; |
|
| 4105 | + } |
|
| 3335 | 4106 | } |
| 3336 | 4107 | |
| 3337 | 4108 | public static function check_satellite_version($version) { |
@@ -3344,8 +4115,11 @@ discard block |
||
| 3344 | 4115 | return "error : ".$e->getMessage(); |
| 3345 | 4116 | } |
| 3346 | 4117 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3347 | - if ($row['nb'] > 0) return true; |
|
| 3348 | - else return false; |
|
| 4118 | + if ($row['nb'] > 0) { |
|
| 4119 | + return true; |
|
| 4120 | + } else { |
|
| 4121 | + return false; |
|
| 4122 | + } |
|
| 3349 | 4123 | } |
| 3350 | 4124 | public static function check_diagrams_version($version) { |
| 3351 | 4125 | $query = "SELECT COUNT(*) as nb FROM config WHERE name = 'diagrams_version' AND value = :version"; |
@@ -3357,8 +4131,11 @@ discard block |
||
| 3357 | 4131 | return "error : ".$e->getMessage(); |
| 3358 | 4132 | } |
| 3359 | 4133 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3360 | - if ($row['nb'] > 0) return true; |
|
| 3361 | - else return false; |
|
| 4134 | + if ($row['nb'] > 0) { |
|
| 4135 | + return true; |
|
| 4136 | + } else { |
|
| 4137 | + return false; |
|
| 4138 | + } |
|
| 3362 | 4139 | } |
| 3363 | 4140 | |
| 3364 | 4141 | public static function check_airlines_version($version) { |
@@ -3371,8 +4148,11 @@ discard block |
||
| 3371 | 4148 | return "error : ".$e->getMessage(); |
| 3372 | 4149 | } |
| 3373 | 4150 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3374 | - if ($row['nb'] > 0) return true; |
|
| 3375 | - else return false; |
|
| 4151 | + if ($row['nb'] > 0) { |
|
| 4152 | + return true; |
|
| 4153 | + } else { |
|
| 4154 | + return false; |
|
| 4155 | + } |
|
| 3376 | 4156 | } |
| 3377 | 4157 | |
| 3378 | 4158 | public static function check_notam_version($version) { |
@@ -3385,8 +4165,11 @@ discard block |
||
| 3385 | 4165 | return "error : ".$e->getMessage(); |
| 3386 | 4166 | } |
| 3387 | 4167 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3388 | - if ($row['nb'] > 0) return true; |
|
| 3389 | - else return false; |
|
| 4168 | + if ($row['nb'] > 0) { |
|
| 4169 | + return true; |
|
| 4170 | + } else { |
|
| 4171 | + return false; |
|
| 4172 | + } |
|
| 3390 | 4173 | } |
| 3391 | 4174 | |
| 3392 | 4175 | public static function insert_airlines_version($version) { |
@@ -3487,8 +4270,11 @@ discard block |
||
| 3487 | 4270 | return "error : ".$e->getMessage(); |
| 3488 | 4271 | } |
| 3489 | 4272 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3490 | - if ($row['nb'] > 0) return false; |
|
| 3491 | - else return true; |
|
| 4273 | + if ($row['nb'] > 0) { |
|
| 4274 | + return false; |
|
| 4275 | + } else { |
|
| 4276 | + return true; |
|
| 4277 | + } |
|
| 3492 | 4278 | } |
| 3493 | 4279 | |
| 3494 | 4280 | public static function insert_last_notam_update() { |
@@ -3518,8 +4304,11 @@ discard block |
||
| 3518 | 4304 | return "error : ".$e->getMessage(); |
| 3519 | 4305 | } |
| 3520 | 4306 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3521 | - if ($row['nb'] > 0) return false; |
|
| 3522 | - else return true; |
|
| 4307 | + if ($row['nb'] > 0) { |
|
| 4308 | + return false; |
|
| 4309 | + } else { |
|
| 4310 | + return true; |
|
| 4311 | + } |
|
| 3523 | 4312 | } |
| 3524 | 4313 | |
| 3525 | 4314 | public static function insert_last_airspace_update() { |
@@ -3549,8 +4338,11 @@ discard block |
||
| 3549 | 4338 | return "error : ".$e->getMessage(); |
| 3550 | 4339 | } |
| 3551 | 4340 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3552 | - if ($row['nb'] > 0) return false; |
|
| 3553 | - else return true; |
|
| 4341 | + if ($row['nb'] > 0) { |
|
| 4342 | + return false; |
|
| 4343 | + } else { |
|
| 4344 | + return true; |
|
| 4345 | + } |
|
| 3554 | 4346 | } |
| 3555 | 4347 | |
| 3556 | 4348 | public static function insert_last_geoid_update() { |
@@ -3580,8 +4372,11 @@ discard block |
||
| 3580 | 4372 | return "error : ".$e->getMessage(); |
| 3581 | 4373 | } |
| 3582 | 4374 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3583 | - if ($row['nb'] > 0) return false; |
|
| 3584 | - else return true; |
|
| 4375 | + if ($row['nb'] > 0) { |
|
| 4376 | + return false; |
|
| 4377 | + } else { |
|
| 4378 | + return true; |
|
| 4379 | + } |
|
| 3585 | 4380 | } |
| 3586 | 4381 | |
| 3587 | 4382 | public static function insert_last_owner_update() { |
@@ -3611,8 +4406,11 @@ discard block |
||
| 3611 | 4406 | return "error : ".$e->getMessage(); |
| 3612 | 4407 | } |
| 3613 | 4408 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3614 | - if ($row['nb'] > 0) return false; |
|
| 3615 | - else return true; |
|
| 4409 | + if ($row['nb'] > 0) { |
|
| 4410 | + return false; |
|
| 4411 | + } else { |
|
| 4412 | + return true; |
|
| 4413 | + } |
|
| 3616 | 4414 | } |
| 3617 | 4415 | |
| 3618 | 4416 | public static function insert_last_fires_update() { |
@@ -3642,8 +4440,11 @@ discard block |
||
| 3642 | 4440 | return "error : ".$e->getMessage(); |
| 3643 | 4441 | } |
| 3644 | 4442 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3645 | - if ($row['nb'] > 0) return false; |
|
| 3646 | - else return true; |
|
| 4443 | + if ($row['nb'] > 0) { |
|
| 4444 | + return false; |
|
| 4445 | + } else { |
|
| 4446 | + return true; |
|
| 4447 | + } |
|
| 3647 | 4448 | } |
| 3648 | 4449 | |
| 3649 | 4450 | public static function insert_last_airlines_update() { |
@@ -3673,8 +4474,11 @@ discard block |
||
| 3673 | 4474 | return "error : ".$e->getMessage(); |
| 3674 | 4475 | } |
| 3675 | 4476 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3676 | - if ($row['nb'] > 0) return false; |
|
| 3677 | - else return true; |
|
| 4477 | + if ($row['nb'] > 0) { |
|
| 4478 | + return false; |
|
| 4479 | + } else { |
|
| 4480 | + return true; |
|
| 4481 | + } |
|
| 3678 | 4482 | } |
| 3679 | 4483 | |
| 3680 | 4484 | public static function insert_last_schedules_update() { |
@@ -3704,8 +4508,11 @@ discard block |
||
| 3704 | 4508 | return "error : ".$e->getMessage(); |
| 3705 | 4509 | } |
| 3706 | 4510 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3707 | - if ($row['nb'] > 0) return false; |
|
| 3708 | - else return true; |
|
| 4511 | + if ($row['nb'] > 0) { |
|
| 4512 | + return false; |
|
| 4513 | + } else { |
|
| 4514 | + return true; |
|
| 4515 | + } |
|
| 3709 | 4516 | } |
| 3710 | 4517 | |
| 3711 | 4518 | public static function insert_last_tle_update() { |
@@ -3735,8 +4542,11 @@ discard block |
||
| 3735 | 4542 | return "error : ".$e->getMessage(); |
| 3736 | 4543 | } |
| 3737 | 4544 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3738 | - if ($row['nb'] > 0) return false; |
|
| 3739 | - else return true; |
|
| 4545 | + if ($row['nb'] > 0) { |
|
| 4546 | + return false; |
|
| 4547 | + } else { |
|
| 4548 | + return true; |
|
| 4549 | + } |
|
| 3740 | 4550 | } |
| 3741 | 4551 | |
| 3742 | 4552 | public static function insert_last_ucsdb_update() { |
@@ -3766,8 +4576,11 @@ discard block |
||
| 3766 | 4576 | return "error : ".$e->getMessage(); |
| 3767 | 4577 | } |
| 3768 | 4578 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3769 | - if ($row['nb'] > 0) return false; |
|
| 3770 | - else return true; |
|
| 4579 | + if ($row['nb'] > 0) { |
|
| 4580 | + return false; |
|
| 4581 | + } else { |
|
| 4582 | + return true; |
|
| 4583 | + } |
|
| 3771 | 4584 | } |
| 3772 | 4585 | |
| 3773 | 4586 | public static function insert_last_celestrak_update() { |
@@ -3797,8 +4610,11 @@ discard block |
||
| 3797 | 4610 | return "error : ".$e->getMessage(); |
| 3798 | 4611 | } |
| 3799 | 4612 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3800 | - if ($row['nb'] > 0) return false; |
|
| 3801 | - else return true; |
|
| 4613 | + if ($row['nb'] > 0) { |
|
| 4614 | + return false; |
|
| 4615 | + } else { |
|
| 4616 | + return true; |
|
| 4617 | + } |
|
| 3802 | 4618 | } |
| 3803 | 4619 | |
| 3804 | 4620 | public static function check_last_satellite_update() { |
@@ -3816,8 +4632,11 @@ discard block |
||
| 3816 | 4632 | return "error : ".$e->getMessage(); |
| 3817 | 4633 | } |
| 3818 | 4634 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3819 | - if ($row['nb'] > 0) return false; |
|
| 3820 | - else return true; |
|
| 4635 | + if ($row['nb'] > 0) { |
|
| 4636 | + return false; |
|
| 4637 | + } else { |
|
| 4638 | + return true; |
|
| 4639 | + } |
|
| 3821 | 4640 | } |
| 3822 | 4641 | |
| 3823 | 4642 | public static function insert_last_marine_identity_update() { |
@@ -5,17 +5,17 @@ discard block |
||
| 5 | 5 | require_once('require/class.Stats.php'); |
| 6 | 6 | require_once('require/class.METAR.php'); |
| 7 | 7 | |
| 8 | -if (!isset($_GET['airport'])){ |
|
| 8 | +if (!isset($_GET['airport'])) { |
|
| 9 | 9 | header('Location: '.$globalURL.'/airport'); |
| 10 | 10 | } else { |
| 11 | 11 | $Spotter = new Spotter(); |
| 12 | 12 | //calculation for the pagination |
| 13 | - if(!isset($_GET['limit'])) |
|
| 13 | + if (!isset($_GET['limit'])) |
|
| 14 | 14 | { |
| 15 | 15 | $limit_start = 0; |
| 16 | 16 | $limit_end = 25; |
| 17 | 17 | $absolute_difference = 25; |
| 18 | - } else { |
|
| 18 | + } else { |
|
| 19 | 19 | $limit_explode = explode(",", $_GET['limit']); |
| 20 | 20 | $limit_start = $limit_explode[0]; |
| 21 | 21 | $limit_end = $limit_explode[1]; |
@@ -28,18 +28,18 @@ discard block |
||
| 28 | 28 | $limit_next = $limit_end + $absolute_difference; |
| 29 | 29 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 30 | 30 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 31 | - $airport_icao = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 31 | + $airport_icao = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 32 | 32 | $airport = $airport_icao; |
| 33 | 33 | $page_url = $globalURL.'/airport/'.$airport_icao; |
| 34 | 34 | |
| 35 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 35 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 36 | 36 | $airport_array = $Spotter->getAllAirportInfo($airport_icao); |
| 37 | 37 | if (!empty($airport_array)) |
| 38 | 38 | { |
| 39 | 39 | if ($sort != '') { |
| 40 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, $sort); |
|
| 40 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, $sort); |
|
| 41 | 41 | } else { |
| 42 | - $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao,$limit_start.",".$absolute_difference, ''); |
|
| 42 | + $spotter_array = $Spotter->getSpotterDataByAirport($airport_icao, $limit_start.",".$absolute_difference, ''); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | if (isset($globalMETAR) && $globalMETAR) { |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | //print_r($metar_parse); |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | - $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
|
| 53 | + $title = sprintf(_("Detailed View for %s, %s (%s)"), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']); |
|
| 54 | 54 | |
| 55 | 55 | require_once('header.php'); |
| 56 | 56 | |
@@ -62,9 +62,9 @@ discard block |
||
| 62 | 62 | $airport_names = $Stats->getAllAirportNames(); |
| 63 | 63 | if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
| 64 | 64 | ksort($airport_names); |
| 65 | - foreach($airport_names as $airport_name) |
|
| 65 | + foreach ($airport_names as $airport_name) |
|
| 66 | 66 | { |
| 67 | - if($airport_icao == $airport_name['airport_icao']) |
|
| 67 | + if ($airport_icao == $airport_name['airport_icao']) |
|
| 68 | 68 | { |
| 69 | 69 | print '<option value="'.$airport_name['airport_icao'].'" selected="selected">'.$airport_name['airport_city'].', '.$airport_name['airport_name'].', '.$airport_name['airport_country'].' ('.$airport_name['airport_icao'].')</option>'; |
| 70 | 70 | } else { |
@@ -114,15 +114,15 @@ discard block |
||
| 114 | 114 | $date_data = ''; |
| 115 | 115 | $departure_data = ''; |
| 116 | 116 | $arrival_data = ''; |
| 117 | - foreach($all_data as $data) |
|
| 117 | + foreach ($all_data as $data) |
|
| 118 | 118 | { |
| 119 | 119 | $date_data .= '"'.$data['date'].'",'; |
| 120 | 120 | $departure_data .= $data['departure'].','; |
| 121 | 121 | $arrival_data .= $data['arrival'].','; |
| 122 | 122 | } |
| 123 | - $date_data = "['x',".substr($date_data,0,-1)."]"; |
|
| 124 | - $departure_data = "['departure',".substr($departure_data,0,-1)."]"; |
|
| 125 | - $arrival_data = "['arrival',".substr($arrival_data,0,-1)."]"; |
|
| 123 | + $date_data = "['x',".substr($date_data, 0, -1)."]"; |
|
| 124 | + $departure_data = "['departure',".substr($departure_data, 0, -1)."]"; |
|
| 125 | + $arrival_data = "['arrival',".substr($arrival_data, 0, -1)."]"; |
|
| 126 | 126 | print 'c3.generate({ |
| 127 | 127 | bindto: "#chart", |
| 128 | 128 | data: { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | print _("Dew point:").' '.$metar_parse['dew'].' °C'." - "; |
| 180 | 180 | } |
| 181 | 181 | if (isset($metar_parse['temperature']) && isset($metar_parse['dew'])) { |
| 182 | - $humidity = round(100 * pow((112 - (0.1 * $metar_parse['temperature']) + $metar_parse['dew']) / (112 + (0.9 * $metar_parse['temperature'])), 8),1); |
|
| 182 | + $humidity = round(100*pow((112 - (0.1*$metar_parse['temperature']) + $metar_parse['dew'])/(112 + (0.9*$metar_parse['temperature'])), 8), 1); |
|
| 183 | 183 | print _("Humidity:").' '.$humidity.'%'." - "; |
| 184 | 184 | } |
| 185 | 185 | if (isset($metar_parse['QNH'])) { |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | print '<div class="table column">'; |
| 197 | 197 | if ($airport_array[0]['iata'] != "NA") |
| 198 | 198 | { |
| 199 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']).'</p>'; |
|
| 199 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights to/from <strong>%s, %s (%s)</strong>."), $airport_array[0]['city'], $airport_array[0]['name'], $airport_array[0]['icao']).'</p>'; |
|
| 200 | 200 | } |
| 201 | 201 | include('table-output.php'); |
| 202 | 202 | print '<div class="pagination">'; |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | $limit_start = 0; |
| 16 | 16 | $limit_end = 25; |
| 17 | 17 | $absolute_difference = 25; |
| 18 | - } else { |
|
| 18 | + } else { |
|
| 19 | 19 | $limit_explode = explode(",", $_GET['limit']); |
| 20 | 20 | $limit_start = $limit_explode[0]; |
| 21 | 21 | $limit_end = $limit_explode[1]; |
@@ -46,7 +46,9 @@ discard block |
||
| 46 | 46 | $METAR = new METAR(); |
| 47 | 47 | $metar_info = $METAR->getMETAR($airport_icao); |
| 48 | 48 | //print_r($metar_info); |
| 49 | - if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']); |
|
| 49 | + if (isset($metar_info[0]['metar'])) { |
|
| 50 | + $metar_parse = $METAR->parse($metar_info[0]['metar']); |
|
| 51 | + } |
|
| 50 | 52 | //print_r($metar_parse); |
| 51 | 53 | } |
| 52 | 54 | |
@@ -60,7 +62,9 @@ discard block |
||
| 60 | 62 | print '<option></option>'; |
| 61 | 63 | $Stats = new Stats(); |
| 62 | 64 | $airport_names = $Stats->getAllAirportNames(); |
| 63 | - if (empty($airport_names)) $airport_names = $Spotter->getAllAirportNames(); |
|
| 65 | + if (empty($airport_names)) { |
|
| 66 | + $airport_names = $Spotter->getAllAirportNames(); |
|
| 67 | + } |
|
| 64 | 68 | ksort($airport_names); |
| 65 | 69 | foreach($airport_names as $airport_name) |
| 66 | 70 | { |
@@ -95,9 +99,15 @@ discard block |
||
| 95 | 99 | print '</div>'; |
| 96 | 100 | print '<div><span class="label">'._("Coordinates").'</span><a href="http://maps.google.com/maps?z=10&t=k&q='.$airport_array[0]['latitude'].','.$airport_array[0]['longitude'].'" target="_blank">Google Map<i class="fa fa-angle-double-right"></i></a></div>'; |
| 97 | 101 | print '<div><span class="label">'._("Live Air Traffic").'</span><a href="http://www.liveatc.net/search/?icao='.$airport_array[0]['icao'].'" target="_blank">LiveATC.net<i class="fa fa-angle-double-right"></i></a></div>'; |
| 98 | - if (isset($airport_array[0]['home_link']) && $airport_array[0]['home_link'] != '') print '<div><a href="'.$airport_array[0]['home_link'].'"><i class="fa fa-home"></i></a></div>'; |
|
| 99 | - if (isset($airport_array[0]['wikipedia_link']) && $airport_array[0]['wikipedia_link'] != '') print '<div><a href="'.$airport_array[0]['wikipedia_link'].'"><i class="fa fa-wikipedia-w"></i></a></div>'; |
|
| 100 | - if (isset($airport_array[0]['diagram_pdf']) && $airport_array[0]['diagram_pdf'] != '') print '<div><span class="label">'._("Diagram").'</span><a href="'.$airport_array[0]['diagram_pdf'].'" target="_blank">'.$airport_array[0]['icao'].'<i class="fa fa-angle-double-right"></i></a></div>'; |
|
| 102 | + if (isset($airport_array[0]['home_link']) && $airport_array[0]['home_link'] != '') { |
|
| 103 | + print '<div><a href="'.$airport_array[0]['home_link'].'"><i class="fa fa-home"></i></a></div>'; |
|
| 104 | + } |
|
| 105 | + if (isset($airport_array[0]['wikipedia_link']) && $airport_array[0]['wikipedia_link'] != '') { |
|
| 106 | + print '<div><a href="'.$airport_array[0]['wikipedia_link'].'"><i class="fa fa-wikipedia-w"></i></a></div>'; |
|
| 107 | + } |
|
| 108 | + if (isset($airport_array[0]['diagram_pdf']) && $airport_array[0]['diagram_pdf'] != '') { |
|
| 109 | + print '<div><span class="label">'._("Diagram").'</span><a href="'.$airport_array[0]['diagram_pdf'].'" target="_blank">'.$airport_array[0]['icao'].'<i class="fa fa-angle-double-right"></i></a></div>'; |
|
| 110 | + } |
|
| 101 | 111 | print '</div>'; |
| 102 | 112 | |
| 103 | 113 | $Stats = new Stats(); |
@@ -105,7 +115,9 @@ discard block |
||
| 105 | 115 | // Use spotter also |
| 106 | 116 | if (isset($globalTimezone)) { |
| 107 | 117 | date_default_timezone_set($globalTimezone); |
| 108 | - } else date_default_timezone_set('UTC'); |
|
| 118 | + } else { |
|
| 119 | + date_default_timezone_set('UTC'); |
|
| 120 | + } |
|
| 109 | 121 | if (count($all_data) > 0) { |
| 110 | 122 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
| 111 | 123 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -211,7 +223,9 @@ discard block |
||
| 211 | 223 | print '</div>'; |
| 212 | 224 | print '</div>'; |
| 213 | 225 | } else { |
| 214 | - if (isset($airport_array[0]['image']) && $airport_array[0]['image'] != '') print '<center><img src="'.$airport_array[0]['image'].'" /></center>'; |
|
| 226 | + if (isset($airport_array[0]['image']) && $airport_array[0]['image'] != '') { |
|
| 227 | + print '<center><img src="'.$airport_array[0]['image'].'" /></center>'; |
|
| 228 | + } |
|
| 215 | 229 | print '<p>'._("Sorry, no flights used the airport in this database.").'</p>'; |
| 216 | 230 | } |
| 217 | 231 | } else { |