@@ -75,38 +75,38 @@ discard block |
||
| 75 | 75 | try { |
| 76 | 76 | //$Connection = new Connection(); |
| 77 | 77 | $sth = $Connection->db->prepare($query); |
| 78 | - $sth->execute(array(':source' => $database_file)); |
|
| 79 | - } catch(PDOException $e) { |
|
| 80 | - return "error : ".$e->getMessage(); |
|
| 81 | - } |
|
| 78 | + $sth->execute(array(':source' => $database_file)); |
|
| 79 | + } catch(PDOException $e) { |
|
| 80 | + return "error : ".$e->getMessage(); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 84 | - update_db::connect_sqlite($database_file); |
|
| 83 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 84 | + update_db::connect_sqlite($database_file); |
|
| 85 | 85 | //$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'; |
| 86 | 86 | $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"; |
| 87 | 87 | try { |
| 88 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 89 | - $sth->execute(); |
|
| 90 | - } catch(PDOException $e) { |
|
| 91 | - return "error : ".$e->getMessage(); |
|
| 92 | - } |
|
| 88 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 89 | + $sth->execute(); |
|
| 90 | + } catch(PDOException $e) { |
|
| 91 | + return "error : ".$e->getMessage(); |
|
| 92 | + } |
|
| 93 | 93 | //$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)'; |
| 94 | 94 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
| 95 | 95 | $Connection = new Connection(); |
| 96 | 96 | $sth_dest = $Connection->db->prepare($query_dest); |
| 97 | 97 | try { |
| 98 | 98 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 99 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 99 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 100 | 100 | //$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); |
| 101 | 101 | $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); |
| 102 | 102 | $sth_dest->execute($query_dest_values); |
| 103 | - } |
|
| 103 | + } |
|
| 104 | 104 | if ($globalTransaction) $Connection->db->commit(); |
| 105 | 105 | } catch(PDOException $e) { |
| 106 | 106 | if ($globalTransaction) $Connection->db->rollBack(); |
| 107 | 107 | return "error : ".$e->getMessage(); |
| 108 | 108 | } |
| 109 | - return ''; |
|
| 109 | + return ''; |
|
| 110 | 110 | } |
| 111 | 111 | public static function retrieve_route_oneworld($database_file) { |
| 112 | 112 | global $globalDebug, $globalTransaction; |
@@ -117,12 +117,12 @@ discard block |
||
| 117 | 117 | try { |
| 118 | 118 | //$Connection = new Connection(); |
| 119 | 119 | $sth = $Connection->db->prepare($query); |
| 120 | - $sth->execute(array(':source' => 'oneworld')); |
|
| 121 | - } catch(PDOException $e) { |
|
| 122 | - return "error : ".$e->getMessage(); |
|
| 123 | - } |
|
| 120 | + $sth->execute(array(':source' => 'oneworld')); |
|
| 121 | + } catch(PDOException $e) { |
|
| 122 | + return "error : ".$e->getMessage(); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 125 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 126 | 126 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 127 | 127 | $Spotter = new Spotter(); |
| 128 | 128 | if ($fh = fopen($database_file,"r")) { |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | if ($globalTransaction) $Connection->db->commit(); |
| 148 | 148 | } |
| 149 | - return ''; |
|
| 149 | + return ''; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | public static function retrieve_route_skyteam($database_file) { |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | try { |
| 159 | 159 | //$Connection = new Connection(); |
| 160 | 160 | $sth = $Connection->db->prepare($query); |
| 161 | - $sth->execute(array(':source' => 'skyteam')); |
|
| 162 | - } catch(PDOException $e) { |
|
| 163 | - return "error : ".$e->getMessage(); |
|
| 164 | - } |
|
| 161 | + $sth->execute(array(':source' => 'skyteam')); |
|
| 162 | + } catch(PDOException $e) { |
|
| 163 | + return "error : ".$e->getMessage(); |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 166 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 167 | 167 | |
| 168 | 168 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 169 | 169 | $Spotter = new Spotter(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | return "error : ".$e->getMessage(); |
| 190 | 190 | } |
| 191 | 191 | } |
| 192 | - return ''; |
|
| 192 | + return ''; |
|
| 193 | 193 | } |
| 194 | 194 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
| 195 | 195 | global $globalTransaction; |
@@ -198,27 +198,27 @@ discard block |
||
| 198 | 198 | try { |
| 199 | 199 | $Connection = new Connection(); |
| 200 | 200 | $sth = $Connection->db->prepare($query); |
| 201 | - $sth->execute(array(':source' => $database_file)); |
|
| 202 | - } catch(PDOException $e) { |
|
| 203 | - return "error : ".$e->getMessage(); |
|
| 204 | - } |
|
| 201 | + $sth->execute(array(':source' => $database_file)); |
|
| 202 | + } catch(PDOException $e) { |
|
| 203 | + return "error : ".$e->getMessage(); |
|
| 204 | + } |
|
| 205 | 205 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
| 206 | 206 | try { |
| 207 | 207 | $Connection = new Connection(); |
| 208 | 208 | $sth = $Connection->db->prepare($query); |
| 209 | - $sth->execute(array(':source' => $database_file)); |
|
| 210 | - } catch(PDOException $e) { |
|
| 211 | - return "error : ".$e->getMessage(); |
|
| 212 | - } |
|
| 209 | + $sth->execute(array(':source' => $database_file)); |
|
| 210 | + } catch(PDOException $e) { |
|
| 211 | + return "error : ".$e->getMessage(); |
|
| 212 | + } |
|
| 213 | 213 | |
| 214 | - update_db::connect_sqlite($database_file); |
|
| 214 | + update_db::connect_sqlite($database_file); |
|
| 215 | 215 | $query = 'select * from Aircraft'; |
| 216 | 216 | try { |
| 217 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 218 | - $sth->execute(); |
|
| 219 | - } catch(PDOException $e) { |
|
| 220 | - return "error : ".$e->getMessage(); |
|
| 221 | - } |
|
| 217 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 218 | + $sth->execute(); |
|
| 219 | + } catch(PDOException $e) { |
|
| 220 | + return "error : ".$e->getMessage(); |
|
| 221 | + } |
|
| 222 | 222 | //$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)'; |
| 223 | 223 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
| 224 | 224 | |
@@ -229,17 +229,17 @@ discard block |
||
| 229 | 229 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 230 | 230 | try { |
| 231 | 231 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 232 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 232 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 233 | 233 | //$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']); |
| 234 | 234 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 235 | 235 | else $type = null; |
| 236 | 236 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 237 | 237 | $sth_dest->execute($query_dest_values); |
| 238 | 238 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 239 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 240 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
| 239 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 240 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
| 241 | 241 | } |
| 242 | - } |
|
| 242 | + } |
|
| 243 | 243 | if ($globalTransaction) $Connection->db->commit(); |
| 244 | 244 | } catch(PDOException $e) { |
| 245 | 245 | return "error : ".$e->getMessage(); |
@@ -250,10 +250,10 @@ discard block |
||
| 250 | 250 | try { |
| 251 | 251 | $Connection = new Connection(); |
| 252 | 252 | $sth = $Connection->db->prepare($query); |
| 253 | - $sth->execute(array(':source' => $database_file)); |
|
| 254 | - } catch(PDOException $e) { |
|
| 255 | - return "error : ".$e->getMessage(); |
|
| 256 | - } |
|
| 253 | + $sth->execute(array(':source' => $database_file)); |
|
| 254 | + } catch(PDOException $e) { |
|
| 255 | + return "error : ".$e->getMessage(); |
|
| 256 | + } |
|
| 257 | 257 | return ''; |
| 258 | 258 | } |
| 259 | 259 | |
@@ -265,10 +265,10 @@ discard block |
||
| 265 | 265 | try { |
| 266 | 266 | $Connection = new Connection(); |
| 267 | 267 | $sth = $Connection->db->prepare($query); |
| 268 | - $sth->execute(array(':source' => $database_file)); |
|
| 269 | - } catch(PDOException $e) { |
|
| 270 | - return "error : ".$e->getMessage(); |
|
| 271 | - } |
|
| 268 | + $sth->execute(array(':source' => $database_file)); |
|
| 269 | + } catch(PDOException $e) { |
|
| 270 | + return "error : ".$e->getMessage(); |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | 273 | if ($fh = fopen($database_file,"r")) { |
| 274 | 274 | //$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)'; |
@@ -278,26 +278,26 @@ discard block |
||
| 278 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
| 279 | 279 | try { |
| 280 | 280 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 281 | - while (!feof($fh)) { |
|
| 282 | - $values = array(); |
|
| 283 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 281 | + while (!feof($fh)) { |
|
| 282 | + $values = array(); |
|
| 283 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
| 284 | 284 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 285 | - $values['ModeS'] = substr($line,0,6); |
|
| 286 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 287 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 288 | - // Check if we can find ICAO, else set it to GLID |
|
| 289 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 290 | - $search_more = ''; |
|
| 291 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 292 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 293 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 285 | + $values['ModeS'] = substr($line,0,6); |
|
| 286 | + $values['Registration'] = trim(substr($line,69,6)); |
|
| 287 | + $aircraft_name = trim(substr($line,48,6)); |
|
| 288 | + // Check if we can find ICAO, else set it to GLID |
|
| 289 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 290 | + $search_more = ''; |
|
| 291 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 292 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 293 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 294 | 294 | try { |
| 295 | - $sth_search->execute(); |
|
| 296 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 297 | - //if (count($result) > 0) { |
|
| 298 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
| 299 | - $values['ICAOTypeCode'] = $result['icao']; |
|
| 300 | - } |
|
| 295 | + $sth_search->execute(); |
|
| 296 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 297 | + //if (count($result) > 0) { |
|
| 298 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 299 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 300 | + } |
|
| 301 | 301 | } catch(PDOException $e) { |
| 302 | 302 | return "error : ".$e->getMessage(); |
| 303 | 303 | } |
@@ -320,10 +320,10 @@ discard block |
||
| 320 | 320 | try { |
| 321 | 321 | $Connection = new Connection(); |
| 322 | 322 | $sth = $Connection->db->prepare($query); |
| 323 | - $sth->execute(array(':source' => $database_file)); |
|
| 324 | - } catch(PDOException $e) { |
|
| 325 | - return "error : ".$e->getMessage(); |
|
| 326 | - } |
|
| 323 | + $sth->execute(array(':source' => $database_file)); |
|
| 324 | + } catch(PDOException $e) { |
|
| 325 | + return "error : ".$e->getMessage(); |
|
| 326 | + } |
|
| 327 | 327 | return ''; |
| 328 | 328 | } |
| 329 | 329 | |
@@ -334,10 +334,10 @@ discard block |
||
| 334 | 334 | try { |
| 335 | 335 | $Connection = new Connection(); |
| 336 | 336 | $sth = $Connection->db->prepare($query); |
| 337 | - $sth->execute(array(':source' => $database_file)); |
|
| 338 | - } catch(PDOException $e) { |
|
| 339 | - return "error : ".$e->getMessage(); |
|
| 340 | - } |
|
| 337 | + $sth->execute(array(':source' => $database_file)); |
|
| 338 | + } catch(PDOException $e) { |
|
| 339 | + return "error : ".$e->getMessage(); |
|
| 340 | + } |
|
| 341 | 341 | |
| 342 | 342 | if ($fh = fopen($database_file,"r")) { |
| 343 | 343 | //$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)'; |
@@ -348,24 +348,24 @@ discard block |
||
| 348 | 348 | try { |
| 349 | 349 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 350 | 350 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 351 | - while (!feof($fh)) { |
|
| 352 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 351 | + while (!feof($fh)) { |
|
| 352 | + $line = fgetcsv($fh,9999,',',"'"); |
|
| 353 | 353 | |
| 354 | 354 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 355 | 355 | //print_r($line); |
| 356 | - $values['ModeS'] = $line[1]; |
|
| 357 | - $values['Registration'] = $line[3]; |
|
| 358 | - $aircraft_name = $line[2]; |
|
| 359 | - // Check if we can find ICAO, else set it to GLID |
|
| 360 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 361 | - $search_more = ''; |
|
| 362 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 363 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 364 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 356 | + $values['ModeS'] = $line[1]; |
|
| 357 | + $values['Registration'] = $line[3]; |
|
| 358 | + $aircraft_name = $line[2]; |
|
| 359 | + // Check if we can find ICAO, else set it to GLID |
|
| 360 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 361 | + $search_more = ''; |
|
| 362 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 363 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 364 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 365 | 365 | try { |
| 366 | - $sth_search->execute(); |
|
| 367 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 368 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 366 | + $sth_search->execute(); |
|
| 367 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 368 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 369 | 369 | } catch(PDOException $e) { |
| 370 | 370 | return "error : ".$e->getMessage(); |
| 371 | 371 | } |
@@ -388,10 +388,10 @@ discard block |
||
| 388 | 388 | try { |
| 389 | 389 | $Connection = new Connection(); |
| 390 | 390 | $sth = $Connection->db->prepare($query); |
| 391 | - $sth->execute(array(':source' => $database_file)); |
|
| 392 | - } catch(PDOException $e) { |
|
| 393 | - return "error : ".$e->getMessage(); |
|
| 394 | - } |
|
| 391 | + $sth->execute(array(':source' => $database_file)); |
|
| 392 | + } catch(PDOException $e) { |
|
| 393 | + return "error : ".$e->getMessage(); |
|
| 394 | + } |
|
| 395 | 395 | return ''; |
| 396 | 396 | } |
| 397 | 397 | |
@@ -402,10 +402,10 @@ discard block |
||
| 402 | 402 | try { |
| 403 | 403 | $Connection = new Connection(); |
| 404 | 404 | $sth = $Connection->db->prepare($query); |
| 405 | - $sth->execute(array(':source' => $database_file)); |
|
| 406 | - } catch(PDOException $e) { |
|
| 407 | - return "error : ".$e->getMessage(); |
|
| 408 | - } |
|
| 405 | + $sth->execute(array(':source' => $database_file)); |
|
| 406 | + } catch(PDOException $e) { |
|
| 407 | + return "error : ".$e->getMessage(); |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | 410 | if ($fh = fopen($database_file,"r")) { |
| 411 | 411 | //$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)'; |
@@ -416,95 +416,95 @@ discard block |
||
| 416 | 416 | try { |
| 417 | 417 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 418 | 418 | $tmp = fgetcsv($fh,9999,',','"'); |
| 419 | - while (!feof($fh)) { |
|
| 420 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 421 | - $values = array(); |
|
| 422 | - //print_r($line); |
|
| 423 | - if ($country == 'F') { |
|
| 424 | - $values['registration'] = $line[0]; |
|
| 425 | - $values['base'] = $line[4]; |
|
| 426 | - $values['owner'] = $line[5]; |
|
| 427 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 428 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 429 | - $values['cancel'] = $line[7]; |
|
| 419 | + while (!feof($fh)) { |
|
| 420 | + $line = fgetcsv($fh,9999,',','"'); |
|
| 421 | + $values = array(); |
|
| 422 | + //print_r($line); |
|
| 423 | + if ($country == 'F') { |
|
| 424 | + $values['registration'] = $line[0]; |
|
| 425 | + $values['base'] = $line[4]; |
|
| 426 | + $values['owner'] = $line[5]; |
|
| 427 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 428 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 429 | + $values['cancel'] = $line[7]; |
|
| 430 | 430 | } elseif ($country == 'EI') { |
| 431 | - // TODO : add modeS & reg to aircraft_modes |
|
| 432 | - $values['registration'] = $line[0]; |
|
| 433 | - $values['base'] = $line[3]; |
|
| 434 | - $values['owner'] = $line[2]; |
|
| 435 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 436 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 437 | - $values['cancel'] = ''; |
|
| 431 | + // TODO : add modeS & reg to aircraft_modes |
|
| 432 | + $values['registration'] = $line[0]; |
|
| 433 | + $values['base'] = $line[3]; |
|
| 434 | + $values['owner'] = $line[2]; |
|
| 435 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 436 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 437 | + $values['cancel'] = ''; |
|
| 438 | 438 | } elseif ($country == 'HB') { |
| 439 | - // TODO : add modeS & reg to aircraft_modes |
|
| 440 | - $values['registration'] = $line[0]; |
|
| 441 | - $values['base'] = null; |
|
| 442 | - $values['owner'] = $line[5]; |
|
| 443 | - $values['date_first_reg'] = null; |
|
| 444 | - $values['cancel'] = ''; |
|
| 439 | + // TODO : add modeS & reg to aircraft_modes |
|
| 440 | + $values['registration'] = $line[0]; |
|
| 441 | + $values['base'] = null; |
|
| 442 | + $values['owner'] = $line[5]; |
|
| 443 | + $values['date_first_reg'] = null; |
|
| 444 | + $values['cancel'] = ''; |
|
| 445 | 445 | } elseif ($country == 'OK') { |
| 446 | - // TODO : add modeS & reg to aircraft_modes |
|
| 447 | - $values['registration'] = $line[3]; |
|
| 448 | - $values['base'] = null; |
|
| 449 | - $values['owner'] = $line[5]; |
|
| 450 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 451 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 452 | - $values['cancel'] = ''; |
|
| 446 | + // TODO : add modeS & reg to aircraft_modes |
|
| 447 | + $values['registration'] = $line[3]; |
|
| 448 | + $values['base'] = null; |
|
| 449 | + $values['owner'] = $line[5]; |
|
| 450 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 451 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 452 | + $values['cancel'] = ''; |
|
| 453 | 453 | } elseif ($country == 'VH') { |
| 454 | - // TODO : add modeS & reg to aircraft_modes |
|
| 455 | - $values['registration'] = $line[0]; |
|
| 456 | - $values['base'] = null; |
|
| 457 | - $values['owner'] = $line[12]; |
|
| 458 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 460 | - |
|
| 461 | - $values['cancel'] = $line[39]; |
|
| 454 | + // TODO : add modeS & reg to aircraft_modes |
|
| 455 | + $values['registration'] = $line[0]; |
|
| 456 | + $values['base'] = null; |
|
| 457 | + $values['owner'] = $line[12]; |
|
| 458 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 459 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 460 | + |
|
| 461 | + $values['cancel'] = $line[39]; |
|
| 462 | 462 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
| 463 | - $values['registration'] = $line[0]; |
|
| 464 | - $values['base'] = null; |
|
| 465 | - $values['owner'] = $line[4]; |
|
| 466 | - $values['date_first_reg'] = null; |
|
| 467 | - $values['cancel'] = ''; |
|
| 463 | + $values['registration'] = $line[0]; |
|
| 464 | + $values['base'] = null; |
|
| 465 | + $values['owner'] = $line[4]; |
|
| 466 | + $values['date_first_reg'] = null; |
|
| 467 | + $values['cancel'] = ''; |
|
| 468 | 468 | } elseif ($country == 'CC') { |
| 469 | - $values['registration'] = $line[0]; |
|
| 470 | - $values['base'] = null; |
|
| 471 | - $values['owner'] = $line[6]; |
|
| 472 | - $values['date_first_reg'] = null; |
|
| 473 | - $values['cancel'] = ''; |
|
| 469 | + $values['registration'] = $line[0]; |
|
| 470 | + $values['base'] = null; |
|
| 471 | + $values['owner'] = $line[6]; |
|
| 472 | + $values['date_first_reg'] = null; |
|
| 473 | + $values['cancel'] = ''; |
|
| 474 | 474 | } elseif ($country == 'HJ') { |
| 475 | - $values['registration'] = $line[0]; |
|
| 476 | - $values['base'] = null; |
|
| 477 | - $values['owner'] = $line[8]; |
|
| 478 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 479 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 480 | - $values['cancel'] = ''; |
|
| 475 | + $values['registration'] = $line[0]; |
|
| 476 | + $values['base'] = null; |
|
| 477 | + $values['owner'] = $line[8]; |
|
| 478 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 479 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 480 | + $values['cancel'] = ''; |
|
| 481 | 481 | } elseif ($country == 'PP') { |
| 482 | - $values['registration'] = $line[0]; |
|
| 483 | - $values['base'] = null; |
|
| 484 | - $values['owner'] = $line[4]; |
|
| 485 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 486 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 487 | - $values['cancel'] = $line[7]; |
|
| 482 | + $values['registration'] = $line[0]; |
|
| 483 | + $values['base'] = null; |
|
| 484 | + $values['owner'] = $line[4]; |
|
| 485 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 486 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 487 | + $values['cancel'] = $line[7]; |
|
| 488 | 488 | } elseif ($country == 'E7') { |
| 489 | - $values['registration'] = $line[0]; |
|
| 490 | - $values['base'] = null; |
|
| 491 | - $values['owner'] = $line[4]; |
|
| 492 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 493 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 494 | - $values['cancel'] = ''; |
|
| 489 | + $values['registration'] = $line[0]; |
|
| 490 | + $values['base'] = null; |
|
| 491 | + $values['owner'] = $line[4]; |
|
| 492 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 493 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 494 | + $values['cancel'] = ''; |
|
| 495 | 495 | } elseif ($country == '8Q') { |
| 496 | - $values['registration'] = $line[0]; |
|
| 497 | - $values['base'] = null; |
|
| 498 | - $values['owner'] = $line[3]; |
|
| 499 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 500 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 501 | - $values['cancel'] = ''; |
|
| 496 | + $values['registration'] = $line[0]; |
|
| 497 | + $values['base'] = null; |
|
| 498 | + $values['owner'] = $line[3]; |
|
| 499 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 500 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 501 | + $values['cancel'] = ''; |
|
| 502 | 502 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 503 | - $values['registration'] = $line[0]; |
|
| 504 | - $values['base'] = null; |
|
| 505 | - $values['owner'] = $line[3]; |
|
| 506 | - $values['date_first_reg'] = null; |
|
| 507 | - $values['cancel'] = ''; |
|
| 503 | + $values['registration'] = $line[0]; |
|
| 504 | + $values['base'] = null; |
|
| 505 | + $values['owner'] = $line[3]; |
|
| 506 | + $values['date_first_reg'] = null; |
|
| 507 | + $values['cancel'] = ''; |
|
| 508 | 508 | } |
| 509 | 509 | if ($values['cancel'] == '' && $values['registration'] != null) { |
| 510 | 510 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -626,20 +626,20 @@ discard block |
||
| 626 | 626 | try { |
| 627 | 627 | $Connection = new Connection(); |
| 628 | 628 | $sth = $Connection->db->prepare($query); |
| 629 | - $sth->execute(); |
|
| 630 | - } catch(PDOException $e) { |
|
| 631 | - return "error : ".$e->getMessage(); |
|
| 632 | - } |
|
| 629 | + $sth->execute(); |
|
| 630 | + } catch(PDOException $e) { |
|
| 631 | + return "error : ".$e->getMessage(); |
|
| 632 | + } |
|
| 633 | 633 | |
| 634 | 634 | |
| 635 | 635 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
| 636 | 636 | try { |
| 637 | 637 | $Connection = new Connection(); |
| 638 | 638 | $sth = $Connection->db->prepare($query); |
| 639 | - $sth->execute(); |
|
| 640 | - } catch(PDOException $e) { |
|
| 641 | - return "error : ".$e->getMessage(); |
|
| 642 | - } |
|
| 639 | + $sth->execute(); |
|
| 640 | + } catch(PDOException $e) { |
|
| 641 | + return "error : ".$e->getMessage(); |
|
| 642 | + } |
|
| 643 | 643 | |
| 644 | 644 | $query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`) |
| 645 | 645 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
@@ -705,10 +705,10 @@ discard block |
||
| 705 | 705 | try { |
| 706 | 706 | $Connection = new Connection(); |
| 707 | 707 | $sth = $Connection->db->prepare($query); |
| 708 | - $sth->execute(); |
|
| 709 | - } catch(PDOException $e) { |
|
| 710 | - return "error : ".$e->getMessage(); |
|
| 711 | - } |
|
| 708 | + $sth->execute(); |
|
| 709 | + } catch(PDOException $e) { |
|
| 710 | + return "error : ".$e->getMessage(); |
|
| 711 | + } |
|
| 712 | 712 | |
| 713 | 713 | |
| 714 | 714 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
@@ -718,10 +718,10 @@ discard block |
||
| 718 | 718 | try { |
| 719 | 719 | $Connection = new Connection(); |
| 720 | 720 | $sth = $Connection->db->prepare($query); |
| 721 | - $sth->execute($query_values); |
|
| 722 | - } catch(PDOException $e) { |
|
| 723 | - return "error : ".$e->getMessage(); |
|
| 724 | - } |
|
| 721 | + $sth->execute($query_values); |
|
| 722 | + } catch(PDOException $e) { |
|
| 723 | + return "error : ".$e->getMessage(); |
|
| 724 | + } |
|
| 725 | 725 | $i++; |
| 726 | 726 | /* |
| 727 | 727 | $query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)'; |
@@ -835,7 +835,7 @@ discard block |
||
| 835 | 835 | |
| 836 | 836 | |
| 837 | 837 | |
| 838 | - return "success"; |
|
| 838 | + return "success"; |
|
| 839 | 839 | } |
| 840 | 840 | |
| 841 | 841 | public static function translation() { |
@@ -851,10 +851,10 @@ discard block |
||
| 851 | 851 | try { |
| 852 | 852 | $Connection = new Connection(); |
| 853 | 853 | $sth = $Connection->db->prepare($query); |
| 854 | - $sth->execute(array(':source' => 'translation.csv')); |
|
| 855 | - } catch(PDOException $e) { |
|
| 856 | - return "error : ".$e->getMessage(); |
|
| 857 | - } |
|
| 854 | + $sth->execute(array(':source' => 'translation.csv')); |
|
| 855 | + } catch(PDOException $e) { |
|
| 856 | + return "error : ".$e->getMessage(); |
|
| 857 | + } |
|
| 858 | 858 | |
| 859 | 859 | |
| 860 | 860 | //update_db::unzip($out_file); |
@@ -873,21 +873,21 @@ discard block |
||
| 873 | 873 | $data = $row; |
| 874 | 874 | $operator = $data[2]; |
| 875 | 875 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
| 876 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 877 | - //echo substr($operator, 0, 2)."\n";; |
|
| 878 | - if (count($airline_array) > 0) { |
|
| 876 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 877 | + //echo substr($operator, 0, 2)."\n";; |
|
| 878 | + if (count($airline_array) > 0) { |
|
| 879 | 879 | //print_r($airline_array); |
| 880 | 880 | $operator = $airline_array[0]['icao'].substr($operator,2); |
| 881 | - } |
|
| 882 | - } |
|
| 881 | + } |
|
| 882 | + } |
|
| 883 | 883 | |
| 884 | 884 | $operator_correct = $data[3]; |
| 885 | 885 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 886 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 887 | - if (count($airline_array) > 0) { |
|
| 888 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 889 | - } |
|
| 890 | - } |
|
| 886 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 887 | + if (count($airline_array) > 0) { |
|
| 888 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 889 | + } |
|
| 890 | + } |
|
| 891 | 891 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 892 | 892 | try { |
| 893 | 893 | $sth = $Connection->db->prepare($query); |
@@ -901,7 +901,7 @@ discard block |
||
| 901 | 901 | //$Connection->db->commit(); |
| 902 | 902 | } |
| 903 | 903 | return ''; |
| 904 | - } |
|
| 904 | + } |
|
| 905 | 905 | |
| 906 | 906 | public static function translation_fam() { |
| 907 | 907 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -911,10 +911,10 @@ discard block |
||
| 911 | 911 | try { |
| 912 | 912 | $Connection = new Connection(); |
| 913 | 913 | $sth = $Connection->db->prepare($query); |
| 914 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 915 | - } catch(PDOException $e) { |
|
| 916 | - return "error : ".$e->getMessage(); |
|
| 917 | - } |
|
| 914 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 915 | + } catch(PDOException $e) { |
|
| 916 | + return "error : ".$e->getMessage(); |
|
| 917 | + } |
|
| 918 | 918 | |
| 919 | 919 | |
| 920 | 920 | //update_db::unzip($out_file); |
@@ -943,7 +943,7 @@ discard block |
||
| 943 | 943 | //$Connection->db->commit(); |
| 944 | 944 | } |
| 945 | 945 | return ''; |
| 946 | - } |
|
| 946 | + } |
|
| 947 | 947 | |
| 948 | 948 | /* |
| 949 | 949 | * This function use FAA public data. |
@@ -955,19 +955,19 @@ discard block |
||
| 955 | 955 | try { |
| 956 | 956 | $Connection = new Connection(); |
| 957 | 957 | $sth = $Connection->db->prepare($query); |
| 958 | - $sth->execute(array(':source' => 'website_faa')); |
|
| 959 | - } catch(PDOException $e) { |
|
| 960 | - return "error : ".$e->getMessage(); |
|
| 961 | - } |
|
| 958 | + $sth->execute(array(':source' => 'website_faa')); |
|
| 959 | + } catch(PDOException $e) { |
|
| 960 | + return "error : ".$e->getMessage(); |
|
| 961 | + } |
|
| 962 | 962 | |
| 963 | 963 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source = :source"; |
| 964 | 964 | try { |
| 965 | 965 | $Connection = new Connection(); |
| 966 | 966 | $sth = $Connection->db->prepare($query); |
| 967 | - $sth->execute(array(':source' => 'website_faa')); |
|
| 968 | - } catch(PDOException $e) { |
|
| 969 | - return "error : ".$e->getMessage(); |
|
| 970 | - } |
|
| 967 | + $sth->execute(array(':source' => 'website_faa')); |
|
| 968 | + } catch(PDOException $e) { |
|
| 969 | + return "error : ".$e->getMessage(); |
|
| 970 | + } |
|
| 971 | 971 | |
| 972 | 972 | $delimiter = ","; |
| 973 | 973 | $mfr = array(); |
@@ -1043,17 +1043,17 @@ discard block |
||
| 1043 | 1043 | } |
| 1044 | 1044 | print_r($mfr); |
| 1045 | 1045 | return ''; |
| 1046 | - } |
|
| 1046 | + } |
|
| 1047 | 1047 | public static function modes_fam() { |
| 1048 | 1048 | global $tmp_dir, $globalTransaction; |
| 1049 | 1049 | $query = "DELETE FROM aircraft_modes WHERE Source = '' OR Source = :source"; |
| 1050 | 1050 | try { |
| 1051 | 1051 | $Connection = new Connection(); |
| 1052 | 1052 | $sth = $Connection->db->prepare($query); |
| 1053 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 1054 | - } catch(PDOException $e) { |
|
| 1055 | - return "error : ".$e->getMessage(); |
|
| 1056 | - } |
|
| 1053 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 1054 | + } catch(PDOException $e) { |
|
| 1055 | + return "error : ".$e->getMessage(); |
|
| 1056 | + } |
|
| 1057 | 1057 | |
| 1058 | 1058 | |
| 1059 | 1059 | //update_db::unzip($out_file); |
@@ -1082,7 +1082,7 @@ discard block |
||
| 1082 | 1082 | if ($globalTransaction) $Connection->db->commit(); |
| 1083 | 1083 | } |
| 1084 | 1084 | return ''; |
| 1085 | - } |
|
| 1085 | + } |
|
| 1086 | 1086 | |
| 1087 | 1087 | public static function owner_fam() { |
| 1088 | 1088 | global $tmp_dir, $globalTransaction; |
@@ -1090,10 +1090,10 @@ discard block |
||
| 1090 | 1090 | try { |
| 1091 | 1091 | $Connection = new Connection(); |
| 1092 | 1092 | $sth = $Connection->db->prepare($query); |
| 1093 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 1094 | - } catch(PDOException $e) { |
|
| 1095 | - return "error : ".$e->getMessage(); |
|
| 1096 | - } |
|
| 1093 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 1094 | + } catch(PDOException $e) { |
|
| 1095 | + return "error : ".$e->getMessage(); |
|
| 1096 | + } |
|
| 1097 | 1097 | |
| 1098 | 1098 | $delimiter = "\t"; |
| 1099 | 1099 | $Connection = new Connection(); |
@@ -1119,7 +1119,7 @@ discard block |
||
| 1119 | 1119 | if ($globalTransaction) $Connection->db->commit(); |
| 1120 | 1120 | } |
| 1121 | 1121 | return ''; |
| 1122 | - } |
|
| 1122 | + } |
|
| 1123 | 1123 | |
| 1124 | 1124 | public static function routes_fam() { |
| 1125 | 1125 | global $tmp_dir, $globalTransaction; |
@@ -1127,10 +1127,10 @@ discard block |
||
| 1127 | 1127 | try { |
| 1128 | 1128 | $Connection = new Connection(); |
| 1129 | 1129 | $sth = $Connection->db->prepare($query); |
| 1130 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 1131 | - } catch(PDOException $e) { |
|
| 1132 | - return "error : ".$e->getMessage(); |
|
| 1133 | - } |
|
| 1130 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 1131 | + } catch(PDOException $e) { |
|
| 1132 | + return "error : ".$e->getMessage(); |
|
| 1133 | + } |
|
| 1134 | 1134 | |
| 1135 | 1135 | |
| 1136 | 1136 | //update_db::unzip($out_file); |
@@ -1159,7 +1159,7 @@ discard block |
||
| 1159 | 1159 | if ($globalTransaction) $Connection->db->commit(); |
| 1160 | 1160 | } |
| 1161 | 1161 | return ''; |
| 1162 | - } |
|
| 1162 | + } |
|
| 1163 | 1163 | |
| 1164 | 1164 | public static function banned_fam() { |
| 1165 | 1165 | global $tmp_dir, $globalTransaction; |
@@ -1193,7 +1193,7 @@ discard block |
||
| 1193 | 1193 | if ($globalTransaction) $Connection->db->commit(); |
| 1194 | 1194 | } |
| 1195 | 1195 | return ''; |
| 1196 | - } |
|
| 1196 | + } |
|
| 1197 | 1197 | |
| 1198 | 1198 | public static function tle($filename,$tletype) { |
| 1199 | 1199 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1204,10 +1204,10 @@ discard block |
||
| 1204 | 1204 | try { |
| 1205 | 1205 | $Connection = new Connection(); |
| 1206 | 1206 | $sth = $Connection->db->prepare($query); |
| 1207 | - $sth->execute(array(':source' => $filename)); |
|
| 1208 | - } catch(PDOException $e) { |
|
| 1209 | - return "error : ".$e->getMessage(); |
|
| 1210 | - } |
|
| 1207 | + $sth->execute(array(':source' => $filename)); |
|
| 1208 | + } catch(PDOException $e) { |
|
| 1209 | + return "error : ".$e->getMessage(); |
|
| 1210 | + } |
|
| 1211 | 1211 | |
| 1212 | 1212 | $Connection = new Connection(); |
| 1213 | 1213 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -1242,54 +1242,54 @@ discard block |
||
| 1242 | 1242 | //$Connection->db->commit(); |
| 1243 | 1243 | } |
| 1244 | 1244 | return ''; |
| 1245 | - } |
|
| 1245 | + } |
|
| 1246 | 1246 | |
| 1247 | 1247 | /** |
| 1248 | - * Convert a HTML table to an array |
|
| 1249 | - * @param String $data HTML page |
|
| 1250 | - * @return Array array of the tables in HTML page |
|
| 1251 | - */ |
|
| 1252 | - private static function table2array($data) { |
|
| 1253 | - $html = str_get_html($data); |
|
| 1254 | - $tabledata=array(); |
|
| 1255 | - foreach($html->find('tr') as $element) |
|
| 1256 | - { |
|
| 1257 | - $td = array(); |
|
| 1258 | - foreach( $element->find('th') as $row) |
|
| 1259 | - { |
|
| 1260 | - $td [] = trim($row->plaintext); |
|
| 1261 | - } |
|
| 1262 | - $td=array_filter($td); |
|
| 1263 | - $tabledata[] = $td; |
|
| 1264 | - |
|
| 1265 | - $td = array(); |
|
| 1266 | - $tdi = array(); |
|
| 1267 | - foreach( $element->find('td') as $row) |
|
| 1268 | - { |
|
| 1269 | - $td [] = trim($row->plaintext); |
|
| 1270 | - $tdi [] = trim($row->innertext); |
|
| 1271 | - } |
|
| 1272 | - $td=array_filter($td); |
|
| 1273 | - $tdi=array_filter($tdi); |
|
| 1274 | - // $tabledata[]=array_merge($td,$tdi); |
|
| 1275 | - $tabledata[]=$td; |
|
| 1276 | - } |
|
| 1277 | - return(array_filter($tabledata)); |
|
| 1278 | - } |
|
| 1279 | - |
|
| 1280 | - /** |
|
| 1281 | - * Get data from form result |
|
| 1282 | - * @param String $url form URL |
|
| 1283 | - * @return String the result |
|
| 1284 | - */ |
|
| 1285 | - private static function getData($url) { |
|
| 1286 | - $ch = curl_init(); |
|
| 1287 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 1288 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 1289 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 1290 | - 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'); |
|
| 1291 | - return curl_exec($ch); |
|
| 1292 | - } |
|
| 1248 | + * Convert a HTML table to an array |
|
| 1249 | + * @param String $data HTML page |
|
| 1250 | + * @return Array array of the tables in HTML page |
|
| 1251 | + */ |
|
| 1252 | + private static function table2array($data) { |
|
| 1253 | + $html = str_get_html($data); |
|
| 1254 | + $tabledata=array(); |
|
| 1255 | + foreach($html->find('tr') as $element) |
|
| 1256 | + { |
|
| 1257 | + $td = array(); |
|
| 1258 | + foreach( $element->find('th') as $row) |
|
| 1259 | + { |
|
| 1260 | + $td [] = trim($row->plaintext); |
|
| 1261 | + } |
|
| 1262 | + $td=array_filter($td); |
|
| 1263 | + $tabledata[] = $td; |
|
| 1264 | + |
|
| 1265 | + $td = array(); |
|
| 1266 | + $tdi = array(); |
|
| 1267 | + foreach( $element->find('td') as $row) |
|
| 1268 | + { |
|
| 1269 | + $td [] = trim($row->plaintext); |
|
| 1270 | + $tdi [] = trim($row->innertext); |
|
| 1271 | + } |
|
| 1272 | + $td=array_filter($td); |
|
| 1273 | + $tdi=array_filter($tdi); |
|
| 1274 | + // $tabledata[]=array_merge($td,$tdi); |
|
| 1275 | + $tabledata[]=$td; |
|
| 1276 | + } |
|
| 1277 | + return(array_filter($tabledata)); |
|
| 1278 | + } |
|
| 1279 | + |
|
| 1280 | + /** |
|
| 1281 | + * Get data from form result |
|
| 1282 | + * @param String $url form URL |
|
| 1283 | + * @return String the result |
|
| 1284 | + */ |
|
| 1285 | + private static function getData($url) { |
|
| 1286 | + $ch = curl_init(); |
|
| 1287 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 1288 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 1289 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 1290 | + 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'); |
|
| 1291 | + return curl_exec($ch); |
|
| 1292 | + } |
|
| 1293 | 1293 | /* |
| 1294 | 1294 | public static function waypoints() { |
| 1295 | 1295 | $data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html'); |
@@ -1372,7 +1372,7 @@ discard block |
||
| 1372 | 1372 | if ($globalTransaction) $Connection->db->commit(); |
| 1373 | 1373 | } |
| 1374 | 1374 | return ''; |
| 1375 | - } |
|
| 1375 | + } |
|
| 1376 | 1376 | |
| 1377 | 1377 | public static function ivao_airlines($filename) { |
| 1378 | 1378 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1382,10 +1382,10 @@ discard block |
||
| 1382 | 1382 | try { |
| 1383 | 1383 | $Connection = new Connection(); |
| 1384 | 1384 | $sth = $Connection->db->prepare($query); |
| 1385 | - $sth->execute(); |
|
| 1386 | - } catch(PDOException $e) { |
|
| 1387 | - return "error : ".$e->getMessage(); |
|
| 1388 | - } |
|
| 1385 | + $sth->execute(); |
|
| 1386 | + } catch(PDOException $e) { |
|
| 1387 | + return "error : ".$e->getMessage(); |
|
| 1388 | + } |
|
| 1389 | 1389 | |
| 1390 | 1390 | $header = NULL; |
| 1391 | 1391 | $delimiter = ':'; |
@@ -1409,7 +1409,7 @@ discard block |
||
| 1409 | 1409 | if ($globalTransaction) $Connection->db->commit(); |
| 1410 | 1410 | } |
| 1411 | 1411 | return ''; |
| 1412 | - } |
|
| 1412 | + } |
|
| 1413 | 1413 | |
| 1414 | 1414 | public static function update_airspace() { |
| 1415 | 1415 | global $tmp_dir, $globalDBdriver; |
@@ -1419,11 +1419,11 @@ discard block |
||
| 1419 | 1419 | $query = 'DROP TABLE airspace'; |
| 1420 | 1420 | try { |
| 1421 | 1421 | $sth = $Connection->db->prepare($query); |
| 1422 | - $sth->execute(); |
|
| 1423 | - } catch(PDOException $e) { |
|
| 1422 | + $sth->execute(); |
|
| 1423 | + } catch(PDOException $e) { |
|
| 1424 | 1424 | return "error : ".$e->getMessage(); |
| 1425 | - } |
|
| 1426 | - } |
|
| 1425 | + } |
|
| 1426 | + } |
|
| 1427 | 1427 | |
| 1428 | 1428 | |
| 1429 | 1429 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1478,10 +1478,10 @@ discard block |
||
| 1478 | 1478 | $query = 'DROP TABLE countries'; |
| 1479 | 1479 | try { |
| 1480 | 1480 | $sth = $Connection->db->prepare($query); |
| 1481 | - $sth->execute(); |
|
| 1482 | - } catch(PDOException $e) { |
|
| 1483 | - echo "error : ".$e->getMessage(); |
|
| 1484 | - } |
|
| 1481 | + $sth->execute(); |
|
| 1482 | + } catch(PDOException $e) { |
|
| 1483 | + echo "error : ".$e->getMessage(); |
|
| 1484 | + } |
|
| 1485 | 1485 | } |
| 1486 | 1486 | if ($globalDBdriver == 'mysql') { |
| 1487 | 1487 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -1956,11 +1956,11 @@ discard block |
||
| 1956 | 1956 | $query = 'DROP TABLE airspace'; |
| 1957 | 1957 | try { |
| 1958 | 1958 | $sth = $Connection->db->prepare($query); |
| 1959 | - $sth->execute(); |
|
| 1960 | - } catch(PDOException $e) { |
|
| 1959 | + $sth->execute(); |
|
| 1960 | + } catch(PDOException $e) { |
|
| 1961 | 1961 | return "error : ".$e->getMessage(); |
| 1962 | - } |
|
| 1963 | - } |
|
| 1962 | + } |
|
| 1963 | + } |
|
| 1964 | 1964 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 1965 | 1965 | update_db::insert_airspace_version($airspace_md5); |
| 1966 | 1966 | } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
@@ -2080,12 +2080,12 @@ discard block |
||
| 2080 | 2080 | echo $data; |
| 2081 | 2081 | */ |
| 2082 | 2082 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 2083 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 2084 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 2085 | - $result = fread($fh,100000000); |
|
| 2086 | - //echo $result; |
|
| 2087 | - //var_dump(str_get_html($result)); |
|
| 2088 | - //print_r(self::table2array($result)); |
|
| 2083 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 2084 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 2085 | + $result = fread($fh,100000000); |
|
| 2086 | + //echo $result; |
|
| 2087 | + //var_dump(str_get_html($result)); |
|
| 2088 | + //print_r(self::table2array($result)); |
|
| 2089 | 2089 | } |
| 2090 | 2090 | |
| 2091 | 2091 | } |
@@ -2099,10 +2099,10 @@ discard block |
||
| 2099 | 2099 | try { |
| 2100 | 2100 | $Connection = new Connection(); |
| 2101 | 2101 | $sth = $Connection->db->prepare($query); |
| 2102 | - $sth->execute(); |
|
| 2103 | - } catch(PDOException $e) { |
|
| 2104 | - return "error : ".$e->getMessage(); |
|
| 2105 | - } |
|
| 2102 | + $sth->execute(); |
|
| 2103 | + } catch(PDOException $e) { |
|
| 2104 | + return "error : ".$e->getMessage(); |
|
| 2105 | + } |
|
| 2106 | 2106 | |
| 2107 | 2107 | $error = ''; |
| 2108 | 2108 | if ($globalDebug) echo "Notam : Download..."; |
@@ -2158,8 +2158,8 @@ discard block |
||
| 2158 | 2158 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
| 2159 | 2159 | $data['permanent'] = 0; |
| 2160 | 2160 | } else { |
| 2161 | - $data['date_end'] = NULL; |
|
| 2162 | - $data['permanent'] = 1; |
|
| 2161 | + $data['date_end'] = NULL; |
|
| 2162 | + $data['permanent'] = 1; |
|
| 2163 | 2163 | } |
| 2164 | 2164 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 2165 | 2165 | $NOTAM = new NOTAM(); |
@@ -2218,13 +2218,13 @@ discard block |
||
| 2218 | 2218 | try { |
| 2219 | 2219 | $Connection = new Connection(); |
| 2220 | 2220 | $sth = $Connection->db->prepare($query); |
| 2221 | - $sth->execute(); |
|
| 2222 | - } catch(PDOException $e) { |
|
| 2223 | - return "error : ".$e->getMessage(); |
|
| 2224 | - } |
|
| 2225 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2226 | - if ($row['nb'] > 0) return false; |
|
| 2227 | - else return true; |
|
| 2221 | + $sth->execute(); |
|
| 2222 | + } catch(PDOException $e) { |
|
| 2223 | + return "error : ".$e->getMessage(); |
|
| 2224 | + } |
|
| 2225 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2226 | + if ($row['nb'] > 0) return false; |
|
| 2227 | + else return true; |
|
| 2228 | 2228 | } |
| 2229 | 2229 | |
| 2230 | 2230 | public static function insert_last_update() { |
@@ -2233,10 +2233,10 @@ discard block |
||
| 2233 | 2233 | try { |
| 2234 | 2234 | $Connection = new Connection(); |
| 2235 | 2235 | $sth = $Connection->db->prepare($query); |
| 2236 | - $sth->execute(); |
|
| 2237 | - } catch(PDOException $e) { |
|
| 2238 | - return "error : ".$e->getMessage(); |
|
| 2239 | - } |
|
| 2236 | + $sth->execute(); |
|
| 2237 | + } catch(PDOException $e) { |
|
| 2238 | + return "error : ".$e->getMessage(); |
|
| 2239 | + } |
|
| 2240 | 2240 | } |
| 2241 | 2241 | |
| 2242 | 2242 | public static function check_airspace_version($version) { |
@@ -2244,13 +2244,13 @@ discard block |
||
| 2244 | 2244 | try { |
| 2245 | 2245 | $Connection = new Connection(); |
| 2246 | 2246 | $sth = $Connection->db->prepare($query); |
| 2247 | - $sth->execute(array(':version' => $version)); |
|
| 2248 | - } catch(PDOException $e) { |
|
| 2249 | - return "error : ".$e->getMessage(); |
|
| 2250 | - } |
|
| 2251 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2252 | - if ($row['nb'] > 0) return true; |
|
| 2253 | - else return false; |
|
| 2247 | + $sth->execute(array(':version' => $version)); |
|
| 2248 | + } catch(PDOException $e) { |
|
| 2249 | + return "error : ".$e->getMessage(); |
|
| 2250 | + } |
|
| 2251 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2252 | + if ($row['nb'] > 0) return true; |
|
| 2253 | + else return false; |
|
| 2254 | 2254 | } |
| 2255 | 2255 | |
| 2256 | 2256 | |
@@ -2260,10 +2260,10 @@ discard block |
||
| 2260 | 2260 | try { |
| 2261 | 2261 | $Connection = new Connection(); |
| 2262 | 2262 | $sth = $Connection->db->prepare($query); |
| 2263 | - $sth->execute(array(':version' => $version)); |
|
| 2264 | - } catch(PDOException $e) { |
|
| 2265 | - return "error : ".$e->getMessage(); |
|
| 2266 | - } |
|
| 2263 | + $sth->execute(array(':version' => $version)); |
|
| 2264 | + } catch(PDOException $e) { |
|
| 2265 | + return "error : ".$e->getMessage(); |
|
| 2266 | + } |
|
| 2267 | 2267 | } |
| 2268 | 2268 | |
| 2269 | 2269 | public static function check_last_notam_update() { |
@@ -2276,13 +2276,13 @@ discard block |
||
| 2276 | 2276 | try { |
| 2277 | 2277 | $Connection = new Connection(); |
| 2278 | 2278 | $sth = $Connection->db->prepare($query); |
| 2279 | - $sth->execute(); |
|
| 2280 | - } catch(PDOException $e) { |
|
| 2281 | - return "error : ".$e->getMessage(); |
|
| 2282 | - } |
|
| 2283 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2284 | - if ($row['nb'] > 0) return false; |
|
| 2285 | - else return true; |
|
| 2279 | + $sth->execute(); |
|
| 2280 | + } catch(PDOException $e) { |
|
| 2281 | + return "error : ".$e->getMessage(); |
|
| 2282 | + } |
|
| 2283 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2284 | + if ($row['nb'] > 0) return false; |
|
| 2285 | + else return true; |
|
| 2286 | 2286 | } |
| 2287 | 2287 | |
| 2288 | 2288 | public static function insert_last_notam_update() { |
@@ -2291,10 +2291,10 @@ discard block |
||
| 2291 | 2291 | try { |
| 2292 | 2292 | $Connection = new Connection(); |
| 2293 | 2293 | $sth = $Connection->db->prepare($query); |
| 2294 | - $sth->execute(); |
|
| 2295 | - } catch(PDOException $e) { |
|
| 2296 | - return "error : ".$e->getMessage(); |
|
| 2297 | - } |
|
| 2294 | + $sth->execute(); |
|
| 2295 | + } catch(PDOException $e) { |
|
| 2296 | + return "error : ".$e->getMessage(); |
|
| 2297 | + } |
|
| 2298 | 2298 | } |
| 2299 | 2299 | public static function check_last_airspace_update() { |
| 2300 | 2300 | global $globalDBdriver; |
@@ -2306,13 +2306,13 @@ discard block |
||
| 2306 | 2306 | try { |
| 2307 | 2307 | $Connection = new Connection(); |
| 2308 | 2308 | $sth = $Connection->db->prepare($query); |
| 2309 | - $sth->execute(); |
|
| 2310 | - } catch(PDOException $e) { |
|
| 2311 | - return "error : ".$e->getMessage(); |
|
| 2312 | - } |
|
| 2313 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2314 | - if ($row['nb'] > 0) return false; |
|
| 2315 | - else return true; |
|
| 2309 | + $sth->execute(); |
|
| 2310 | + } catch(PDOException $e) { |
|
| 2311 | + return "error : ".$e->getMessage(); |
|
| 2312 | + } |
|
| 2313 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2314 | + if ($row['nb'] > 0) return false; |
|
| 2315 | + else return true; |
|
| 2316 | 2316 | } |
| 2317 | 2317 | |
| 2318 | 2318 | public static function insert_last_airspace_update() { |
@@ -2321,10 +2321,10 @@ discard block |
||
| 2321 | 2321 | try { |
| 2322 | 2322 | $Connection = new Connection(); |
| 2323 | 2323 | $sth = $Connection->db->prepare($query); |
| 2324 | - $sth->execute(); |
|
| 2325 | - } catch(PDOException $e) { |
|
| 2326 | - return "error : ".$e->getMessage(); |
|
| 2327 | - } |
|
| 2324 | + $sth->execute(); |
|
| 2325 | + } catch(PDOException $e) { |
|
| 2326 | + return "error : ".$e->getMessage(); |
|
| 2327 | + } |
|
| 2328 | 2328 | } |
| 2329 | 2329 | |
| 2330 | 2330 | public static function check_last_owner_update() { |
@@ -2337,13 +2337,13 @@ discard block |
||
| 2337 | 2337 | try { |
| 2338 | 2338 | $Connection = new Connection(); |
| 2339 | 2339 | $sth = $Connection->db->prepare($query); |
| 2340 | - $sth->execute(); |
|
| 2341 | - } catch(PDOException $e) { |
|
| 2342 | - return "error : ".$e->getMessage(); |
|
| 2343 | - } |
|
| 2344 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2345 | - if ($row['nb'] > 0) return false; |
|
| 2346 | - else return true; |
|
| 2340 | + $sth->execute(); |
|
| 2341 | + } catch(PDOException $e) { |
|
| 2342 | + return "error : ".$e->getMessage(); |
|
| 2343 | + } |
|
| 2344 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2345 | + if ($row['nb'] > 0) return false; |
|
| 2346 | + else return true; |
|
| 2347 | 2347 | } |
| 2348 | 2348 | |
| 2349 | 2349 | public static function insert_last_owner_update() { |
@@ -2352,10 +2352,10 @@ discard block |
||
| 2352 | 2352 | try { |
| 2353 | 2353 | $Connection = new Connection(); |
| 2354 | 2354 | $sth = $Connection->db->prepare($query); |
| 2355 | - $sth->execute(); |
|
| 2356 | - } catch(PDOException $e) { |
|
| 2357 | - return "error : ".$e->getMessage(); |
|
| 2358 | - } |
|
| 2355 | + $sth->execute(); |
|
| 2356 | + } catch(PDOException $e) { |
|
| 2357 | + return "error : ".$e->getMessage(); |
|
| 2358 | + } |
|
| 2359 | 2359 | } |
| 2360 | 2360 | public static function check_last_schedules_update() { |
| 2361 | 2361 | global $globalDBdriver; |
@@ -2367,13 +2367,13 @@ discard block |
||
| 2367 | 2367 | try { |
| 2368 | 2368 | $Connection = new Connection(); |
| 2369 | 2369 | $sth = $Connection->db->prepare($query); |
| 2370 | - $sth->execute(); |
|
| 2371 | - } catch(PDOException $e) { |
|
| 2372 | - return "error : ".$e->getMessage(); |
|
| 2373 | - } |
|
| 2374 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2375 | - if ($row['nb'] > 0) return false; |
|
| 2376 | - else return true; |
|
| 2370 | + $sth->execute(); |
|
| 2371 | + } catch(PDOException $e) { |
|
| 2372 | + return "error : ".$e->getMessage(); |
|
| 2373 | + } |
|
| 2374 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2375 | + if ($row['nb'] > 0) return false; |
|
| 2376 | + else return true; |
|
| 2377 | 2377 | } |
| 2378 | 2378 | |
| 2379 | 2379 | public static function insert_last_schedules_update() { |
@@ -2382,10 +2382,10 @@ discard block |
||
| 2382 | 2382 | try { |
| 2383 | 2383 | $Connection = new Connection(); |
| 2384 | 2384 | $sth = $Connection->db->prepare($query); |
| 2385 | - $sth->execute(); |
|
| 2386 | - } catch(PDOException $e) { |
|
| 2387 | - return "error : ".$e->getMessage(); |
|
| 2388 | - } |
|
| 2385 | + $sth->execute(); |
|
| 2386 | + } catch(PDOException $e) { |
|
| 2387 | + return "error : ".$e->getMessage(); |
|
| 2388 | + } |
|
| 2389 | 2389 | } |
| 2390 | 2390 | public static function check_last_tle_update() { |
| 2391 | 2391 | global $globalDBdriver; |
@@ -2397,13 +2397,13 @@ discard block |
||
| 2397 | 2397 | try { |
| 2398 | 2398 | $Connection = new Connection(); |
| 2399 | 2399 | $sth = $Connection->db->prepare($query); |
| 2400 | - $sth->execute(); |
|
| 2401 | - } catch(PDOException $e) { |
|
| 2402 | - return "error : ".$e->getMessage(); |
|
| 2403 | - } |
|
| 2404 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2405 | - if ($row['nb'] > 0) return false; |
|
| 2406 | - else return true; |
|
| 2400 | + $sth->execute(); |
|
| 2401 | + } catch(PDOException $e) { |
|
| 2402 | + return "error : ".$e->getMessage(); |
|
| 2403 | + } |
|
| 2404 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2405 | + if ($row['nb'] > 0) return false; |
|
| 2406 | + else return true; |
|
| 2407 | 2407 | } |
| 2408 | 2408 | |
| 2409 | 2409 | public static function insert_last_tle_update() { |
@@ -2412,10 +2412,10 @@ discard block |
||
| 2412 | 2412 | try { |
| 2413 | 2413 | $Connection = new Connection(); |
| 2414 | 2414 | $sth = $Connection->db->prepare($query); |
| 2415 | - $sth->execute(); |
|
| 2416 | - } catch(PDOException $e) { |
|
| 2417 | - return "error : ".$e->getMessage(); |
|
| 2418 | - } |
|
| 2415 | + $sth->execute(); |
|
| 2416 | + } catch(PDOException $e) { |
|
| 2417 | + return "error : ".$e->getMessage(); |
|
| 2418 | + } |
|
| 2419 | 2419 | } |
| 2420 | 2420 | public static function delete_duplicatemodes() { |
| 2421 | 2421 | global $globalDBdriver; |
@@ -2427,10 +2427,10 @@ discard block |
||
| 2427 | 2427 | try { |
| 2428 | 2428 | $Connection = new Connection(); |
| 2429 | 2429 | $sth = $Connection->db->prepare($query); |
| 2430 | - $sth->execute(); |
|
| 2431 | - } catch(PDOException $e) { |
|
| 2432 | - return "error : ".$e->getMessage(); |
|
| 2433 | - } |
|
| 2430 | + $sth->execute(); |
|
| 2431 | + } catch(PDOException $e) { |
|
| 2432 | + return "error : ".$e->getMessage(); |
|
| 2433 | + } |
|
| 2434 | 2434 | } |
| 2435 | 2435 | public static function delete_duplicateowner() { |
| 2436 | 2436 | global $globalDBdriver; |
@@ -2442,10 +2442,10 @@ discard block |
||
| 2442 | 2442 | try { |
| 2443 | 2443 | $Connection = new Connection(); |
| 2444 | 2444 | $sth = $Connection->db->prepare($query); |
| 2445 | - $sth->execute(); |
|
| 2446 | - } catch(PDOException $e) { |
|
| 2447 | - return "error : ".$e->getMessage(); |
|
| 2448 | - } |
|
| 2445 | + $sth->execute(); |
|
| 2446 | + } catch(PDOException $e) { |
|
| 2447 | + return "error : ".$e->getMessage(); |
|
| 2448 | + } |
|
| 2449 | 2449 | } |
| 2450 | 2450 | |
| 2451 | 2451 | public static function update_all() { |