@@ -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(); |
@@ -249,10 +249,10 @@ discard block |
||
| 249 | 249 | try { |
| 250 | 250 | $Connection = new Connection(); |
| 251 | 251 | $sth = $Connection->db->prepare($query); |
| 252 | - $sth->execute(array(':source' => $database_file)); |
|
| 253 | - } catch(PDOException $e) { |
|
| 254 | - return "error : ".$e->getMessage(); |
|
| 255 | - } |
|
| 252 | + $sth->execute(array(':source' => $database_file)); |
|
| 253 | + } catch(PDOException $e) { |
|
| 254 | + return "error : ".$e->getMessage(); |
|
| 255 | + } |
|
| 256 | 256 | return ''; |
| 257 | 257 | } |
| 258 | 258 | |
@@ -264,10 +264,10 @@ discard block |
||
| 264 | 264 | try { |
| 265 | 265 | $Connection = new Connection(); |
| 266 | 266 | $sth = $Connection->db->prepare($query); |
| 267 | - $sth->execute(array(':source' => $database_file)); |
|
| 268 | - } catch(PDOException $e) { |
|
| 269 | - return "error : ".$e->getMessage(); |
|
| 270 | - } |
|
| 267 | + $sth->execute(array(':source' => $database_file)); |
|
| 268 | + } catch(PDOException $e) { |
|
| 269 | + return "error : ".$e->getMessage(); |
|
| 270 | + } |
|
| 271 | 271 | |
| 272 | 272 | if ($fh = fopen($database_file,"r")) { |
| 273 | 273 | //$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)'; |
@@ -277,26 +277,26 @@ discard block |
||
| 277 | 277 | $sth_dest = $Connection->db->prepare($query_dest); |
| 278 | 278 | try { |
| 279 | 279 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 280 | - while (!feof($fh)) { |
|
| 281 | - $values = array(); |
|
| 282 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 280 | + while (!feof($fh)) { |
|
| 281 | + $values = array(); |
|
| 282 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
| 283 | 283 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 284 | - $values['ModeS'] = substr($line,0,6); |
|
| 285 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 286 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 287 | - // Check if we can find ICAO, else set it to GLID |
|
| 288 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 289 | - $search_more = ''; |
|
| 290 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 291 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 292 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 284 | + $values['ModeS'] = substr($line,0,6); |
|
| 285 | + $values['Registration'] = trim(substr($line,69,6)); |
|
| 286 | + $aircraft_name = trim(substr($line,48,6)); |
|
| 287 | + // Check if we can find ICAO, else set it to GLID |
|
| 288 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 289 | + $search_more = ''; |
|
| 290 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 291 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 292 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 293 | 293 | try { |
| 294 | - $sth_search->execute(); |
|
| 295 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 296 | - //if (count($result) > 0) { |
|
| 297 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
| 298 | - $values['ICAOTypeCode'] = $result['icao']; |
|
| 299 | - } |
|
| 294 | + $sth_search->execute(); |
|
| 295 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 296 | + //if (count($result) > 0) { |
|
| 297 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 298 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 299 | + } |
|
| 300 | 300 | } catch(PDOException $e) { |
| 301 | 301 | return "error : ".$e->getMessage(); |
| 302 | 302 | } |
@@ -319,10 +319,10 @@ discard block |
||
| 319 | 319 | try { |
| 320 | 320 | $Connection = new Connection(); |
| 321 | 321 | $sth = $Connection->db->prepare($query); |
| 322 | - $sth->execute(array(':source' => $database_file)); |
|
| 323 | - } catch(PDOException $e) { |
|
| 324 | - return "error : ".$e->getMessage(); |
|
| 325 | - } |
|
| 322 | + $sth->execute(array(':source' => $database_file)); |
|
| 323 | + } catch(PDOException $e) { |
|
| 324 | + return "error : ".$e->getMessage(); |
|
| 325 | + } |
|
| 326 | 326 | return ''; |
| 327 | 327 | } |
| 328 | 328 | |
@@ -333,10 +333,10 @@ discard block |
||
| 333 | 333 | try { |
| 334 | 334 | $Connection = new Connection(); |
| 335 | 335 | $sth = $Connection->db->prepare($query); |
| 336 | - $sth->execute(array(':source' => $database_file)); |
|
| 337 | - } catch(PDOException $e) { |
|
| 338 | - return "error : ".$e->getMessage(); |
|
| 339 | - } |
|
| 336 | + $sth->execute(array(':source' => $database_file)); |
|
| 337 | + } catch(PDOException $e) { |
|
| 338 | + return "error : ".$e->getMessage(); |
|
| 339 | + } |
|
| 340 | 340 | |
| 341 | 341 | if ($fh = fopen($database_file,"r")) { |
| 342 | 342 | //$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)'; |
@@ -347,24 +347,24 @@ discard block |
||
| 347 | 347 | try { |
| 348 | 348 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 349 | 349 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 350 | - while (!feof($fh)) { |
|
| 351 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 350 | + while (!feof($fh)) { |
|
| 351 | + $line = fgetcsv($fh,9999,',',"'"); |
|
| 352 | 352 | |
| 353 | 353 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 354 | 354 | //print_r($line); |
| 355 | - $values['ModeS'] = $line[1]; |
|
| 356 | - $values['Registration'] = $line[3]; |
|
| 357 | - $aircraft_name = $line[2]; |
|
| 358 | - // Check if we can find ICAO, else set it to GLID |
|
| 359 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 360 | - $search_more = ''; |
|
| 361 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 362 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 363 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 355 | + $values['ModeS'] = $line[1]; |
|
| 356 | + $values['Registration'] = $line[3]; |
|
| 357 | + $aircraft_name = $line[2]; |
|
| 358 | + // Check if we can find ICAO, else set it to GLID |
|
| 359 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 360 | + $search_more = ''; |
|
| 361 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 362 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 363 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 364 | 364 | try { |
| 365 | - $sth_search->execute(); |
|
| 366 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 367 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 365 | + $sth_search->execute(); |
|
| 366 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 367 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 368 | 368 | } catch(PDOException $e) { |
| 369 | 369 | return "error : ".$e->getMessage(); |
| 370 | 370 | } |
@@ -387,10 +387,10 @@ discard block |
||
| 387 | 387 | try { |
| 388 | 388 | $Connection = new Connection(); |
| 389 | 389 | $sth = $Connection->db->prepare($query); |
| 390 | - $sth->execute(array(':source' => $database_file)); |
|
| 391 | - } catch(PDOException $e) { |
|
| 392 | - return "error : ".$e->getMessage(); |
|
| 393 | - } |
|
| 390 | + $sth->execute(array(':source' => $database_file)); |
|
| 391 | + } catch(PDOException $e) { |
|
| 392 | + return "error : ".$e->getMessage(); |
|
| 393 | + } |
|
| 394 | 394 | return ''; |
| 395 | 395 | } |
| 396 | 396 | |
@@ -401,10 +401,10 @@ discard block |
||
| 401 | 401 | try { |
| 402 | 402 | $Connection = new Connection(); |
| 403 | 403 | $sth = $Connection->db->prepare($query); |
| 404 | - $sth->execute(array(':source' => $database_file)); |
|
| 405 | - } catch(PDOException $e) { |
|
| 406 | - return "error : ".$e->getMessage(); |
|
| 407 | - } |
|
| 404 | + $sth->execute(array(':source' => $database_file)); |
|
| 405 | + } catch(PDOException $e) { |
|
| 406 | + return "error : ".$e->getMessage(); |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | if ($fh = fopen($database_file,"r")) { |
| 410 | 410 | //$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)'; |
@@ -415,95 +415,95 @@ discard block |
||
| 415 | 415 | try { |
| 416 | 416 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 417 | 417 | $tmp = fgetcsv($fh,9999,',','"'); |
| 418 | - while (!feof($fh)) { |
|
| 419 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 420 | - $values = array(); |
|
| 421 | - //print_r($line); |
|
| 422 | - if ($country == 'F') { |
|
| 423 | - $values['registration'] = $line[0]; |
|
| 424 | - $values['base'] = $line[4]; |
|
| 425 | - $values['owner'] = $line[5]; |
|
| 426 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 427 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 428 | - $values['cancel'] = $line[7]; |
|
| 418 | + while (!feof($fh)) { |
|
| 419 | + $line = fgetcsv($fh,9999,',','"'); |
|
| 420 | + $values = array(); |
|
| 421 | + //print_r($line); |
|
| 422 | + if ($country == 'F') { |
|
| 423 | + $values['registration'] = $line[0]; |
|
| 424 | + $values['base'] = $line[4]; |
|
| 425 | + $values['owner'] = $line[5]; |
|
| 426 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 427 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 428 | + $values['cancel'] = $line[7]; |
|
| 429 | 429 | } elseif ($country == 'EI') { |
| 430 | - // TODO : add modeS & reg to aircraft_modes |
|
| 431 | - $values['registration'] = $line[0]; |
|
| 432 | - $values['base'] = $line[3]; |
|
| 433 | - $values['owner'] = $line[2]; |
|
| 434 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 435 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 436 | - $values['cancel'] = ''; |
|
| 430 | + // TODO : add modeS & reg to aircraft_modes |
|
| 431 | + $values['registration'] = $line[0]; |
|
| 432 | + $values['base'] = $line[3]; |
|
| 433 | + $values['owner'] = $line[2]; |
|
| 434 | + if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 435 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 436 | + $values['cancel'] = ''; |
|
| 437 | 437 | } elseif ($country == 'HB') { |
| 438 | - // TODO : add modeS & reg to aircraft_modes |
|
| 439 | - $values['registration'] = $line[0]; |
|
| 440 | - $values['base'] = null; |
|
| 441 | - $values['owner'] = $line[5]; |
|
| 442 | - $values['date_first_reg'] = null; |
|
| 443 | - $values['cancel'] = ''; |
|
| 438 | + // TODO : add modeS & reg to aircraft_modes |
|
| 439 | + $values['registration'] = $line[0]; |
|
| 440 | + $values['base'] = null; |
|
| 441 | + $values['owner'] = $line[5]; |
|
| 442 | + $values['date_first_reg'] = null; |
|
| 443 | + $values['cancel'] = ''; |
|
| 444 | 444 | } elseif ($country == 'OK') { |
| 445 | - // TODO : add modeS & reg to aircraft_modes |
|
| 446 | - $values['registration'] = $line[3]; |
|
| 447 | - $values['base'] = null; |
|
| 448 | - $values['owner'] = $line[5]; |
|
| 449 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 451 | - $values['cancel'] = ''; |
|
| 445 | + // TODO : add modeS & reg to aircraft_modes |
|
| 446 | + $values['registration'] = $line[3]; |
|
| 447 | + $values['base'] = null; |
|
| 448 | + $values['owner'] = $line[5]; |
|
| 449 | + if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 450 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 451 | + $values['cancel'] = ''; |
|
| 452 | 452 | } elseif ($country == 'VH') { |
| 453 | - // TODO : add modeS & reg to aircraft_modes |
|
| 454 | - $values['registration'] = $line[0]; |
|
| 455 | - $values['base'] = null; |
|
| 456 | - $values['owner'] = $line[12]; |
|
| 457 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 458 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 459 | - |
|
| 460 | - $values['cancel'] = $line[39]; |
|
| 453 | + // TODO : add modeS & reg to aircraft_modes |
|
| 454 | + $values['registration'] = $line[0]; |
|
| 455 | + $values['base'] = null; |
|
| 456 | + $values['owner'] = $line[12]; |
|
| 457 | + if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 458 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 459 | + |
|
| 460 | + $values['cancel'] = $line[39]; |
|
| 461 | 461 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
| 462 | - $values['registration'] = $line[0]; |
|
| 463 | - $values['base'] = null; |
|
| 464 | - $values['owner'] = $line[4]; |
|
| 465 | - $values['date_first_reg'] = null; |
|
| 466 | - $values['cancel'] = ''; |
|
| 462 | + $values['registration'] = $line[0]; |
|
| 463 | + $values['base'] = null; |
|
| 464 | + $values['owner'] = $line[4]; |
|
| 465 | + $values['date_first_reg'] = null; |
|
| 466 | + $values['cancel'] = ''; |
|
| 467 | 467 | } elseif ($country == 'CC') { |
| 468 | - $values['registration'] = $line[0]; |
|
| 469 | - $values['base'] = null; |
|
| 470 | - $values['owner'] = $line[6]; |
|
| 471 | - $values['date_first_reg'] = null; |
|
| 472 | - $values['cancel'] = ''; |
|
| 468 | + $values['registration'] = $line[0]; |
|
| 469 | + $values['base'] = null; |
|
| 470 | + $values['owner'] = $line[6]; |
|
| 471 | + $values['date_first_reg'] = null; |
|
| 472 | + $values['cancel'] = ''; |
|
| 473 | 473 | } elseif ($country == 'HJ') { |
| 474 | - $values['registration'] = $line[0]; |
|
| 475 | - $values['base'] = null; |
|
| 476 | - $values['owner'] = $line[8]; |
|
| 477 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 479 | - $values['cancel'] = ''; |
|
| 474 | + $values['registration'] = $line[0]; |
|
| 475 | + $values['base'] = null; |
|
| 476 | + $values['owner'] = $line[8]; |
|
| 477 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 478 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 479 | + $values['cancel'] = ''; |
|
| 480 | 480 | } elseif ($country == 'PP') { |
| 481 | - $values['registration'] = $line[0]; |
|
| 482 | - $values['base'] = null; |
|
| 483 | - $values['owner'] = $line[4]; |
|
| 484 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 485 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 486 | - $values['cancel'] = $line[7]; |
|
| 481 | + $values['registration'] = $line[0]; |
|
| 482 | + $values['base'] = null; |
|
| 483 | + $values['owner'] = $line[4]; |
|
| 484 | + if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 485 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 486 | + $values['cancel'] = $line[7]; |
|
| 487 | 487 | } elseif ($country == 'E7') { |
| 488 | - $values['registration'] = $line[0]; |
|
| 489 | - $values['base'] = null; |
|
| 490 | - $values['owner'] = $line[4]; |
|
| 491 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 492 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 493 | - $values['cancel'] = ''; |
|
| 488 | + $values['registration'] = $line[0]; |
|
| 489 | + $values['base'] = null; |
|
| 490 | + $values['owner'] = $line[4]; |
|
| 491 | + if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 492 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 493 | + $values['cancel'] = ''; |
|
| 494 | 494 | } elseif ($country == '8Q') { |
| 495 | - $values['registration'] = $line[0]; |
|
| 496 | - $values['base'] = null; |
|
| 497 | - $values['owner'] = $line[3]; |
|
| 498 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 499 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 500 | - $values['cancel'] = ''; |
|
| 495 | + $values['registration'] = $line[0]; |
|
| 496 | + $values['base'] = null; |
|
| 497 | + $values['owner'] = $line[3]; |
|
| 498 | + if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 499 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 500 | + $values['cancel'] = ''; |
|
| 501 | 501 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 502 | - $values['registration'] = $line[0]; |
|
| 503 | - $values['base'] = null; |
|
| 504 | - $values['owner'] = $line[3]; |
|
| 505 | - $values['date_first_reg'] = null; |
|
| 506 | - $values['cancel'] = ''; |
|
| 502 | + $values['registration'] = $line[0]; |
|
| 503 | + $values['base'] = null; |
|
| 504 | + $values['owner'] = $line[3]; |
|
| 505 | + $values['date_first_reg'] = null; |
|
| 506 | + $values['cancel'] = ''; |
|
| 507 | 507 | } |
| 508 | 508 | if ($values['cancel'] == '' && $values['registration'] != null) { |
| 509 | 509 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -625,20 +625,20 @@ discard block |
||
| 625 | 625 | try { |
| 626 | 626 | $Connection = new Connection(); |
| 627 | 627 | $sth = $Connection->db->prepare($query); |
| 628 | - $sth->execute(); |
|
| 629 | - } catch(PDOException $e) { |
|
| 630 | - return "error : ".$e->getMessage(); |
|
| 631 | - } |
|
| 628 | + $sth->execute(); |
|
| 629 | + } catch(PDOException $e) { |
|
| 630 | + return "error : ".$e->getMessage(); |
|
| 631 | + } |
|
| 632 | 632 | |
| 633 | 633 | |
| 634 | 634 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
| 635 | 635 | try { |
| 636 | 636 | $Connection = new Connection(); |
| 637 | 637 | $sth = $Connection->db->prepare($query); |
| 638 | - $sth->execute(); |
|
| 639 | - } catch(PDOException $e) { |
|
| 640 | - return "error : ".$e->getMessage(); |
|
| 641 | - } |
|
| 638 | + $sth->execute(); |
|
| 639 | + } catch(PDOException $e) { |
|
| 640 | + return "error : ".$e->getMessage(); |
|
| 641 | + } |
|
| 642 | 642 | |
| 643 | 643 | $query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`) |
| 644 | 644 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
@@ -704,10 +704,10 @@ discard block |
||
| 704 | 704 | try { |
| 705 | 705 | $Connection = new Connection(); |
| 706 | 706 | $sth = $Connection->db->prepare($query); |
| 707 | - $sth->execute(); |
|
| 708 | - } catch(PDOException $e) { |
|
| 709 | - return "error : ".$e->getMessage(); |
|
| 710 | - } |
|
| 707 | + $sth->execute(); |
|
| 708 | + } catch(PDOException $e) { |
|
| 709 | + return "error : ".$e->getMessage(); |
|
| 710 | + } |
|
| 711 | 711 | |
| 712 | 712 | |
| 713 | 713 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
@@ -717,10 +717,10 @@ discard block |
||
| 717 | 717 | try { |
| 718 | 718 | $Connection = new Connection(); |
| 719 | 719 | $sth = $Connection->db->prepare($query); |
| 720 | - $sth->execute($query_values); |
|
| 721 | - } catch(PDOException $e) { |
|
| 722 | - return "error : ".$e->getMessage(); |
|
| 723 | - } |
|
| 720 | + $sth->execute($query_values); |
|
| 721 | + } catch(PDOException $e) { |
|
| 722 | + return "error : ".$e->getMessage(); |
|
| 723 | + } |
|
| 724 | 724 | $i++; |
| 725 | 725 | /* |
| 726 | 726 | $query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)'; |
@@ -834,7 +834,7 @@ discard block |
||
| 834 | 834 | |
| 835 | 835 | |
| 836 | 836 | |
| 837 | - return "success"; |
|
| 837 | + return "success"; |
|
| 838 | 838 | } |
| 839 | 839 | |
| 840 | 840 | public static function translation() { |
@@ -850,10 +850,10 @@ discard block |
||
| 850 | 850 | try { |
| 851 | 851 | $Connection = new Connection(); |
| 852 | 852 | $sth = $Connection->db->prepare($query); |
| 853 | - $sth->execute(array(':source' => 'translation.csv')); |
|
| 854 | - } catch(PDOException $e) { |
|
| 855 | - return "error : ".$e->getMessage(); |
|
| 856 | - } |
|
| 853 | + $sth->execute(array(':source' => 'translation.csv')); |
|
| 854 | + } catch(PDOException $e) { |
|
| 855 | + return "error : ".$e->getMessage(); |
|
| 856 | + } |
|
| 857 | 857 | |
| 858 | 858 | |
| 859 | 859 | //update_db::unzip($out_file); |
@@ -872,21 +872,21 @@ discard block |
||
| 872 | 872 | $data = $row; |
| 873 | 873 | $operator = $data[2]; |
| 874 | 874 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
| 875 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 876 | - //echo substr($operator, 0, 2)."\n";; |
|
| 877 | - if (count($airline_array) > 0) { |
|
| 875 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 876 | + //echo substr($operator, 0, 2)."\n";; |
|
| 877 | + if (count($airline_array) > 0) { |
|
| 878 | 878 | //print_r($airline_array); |
| 879 | 879 | $operator = $airline_array[0]['icao'].substr($operator,2); |
| 880 | - } |
|
| 881 | - } |
|
| 880 | + } |
|
| 881 | + } |
|
| 882 | 882 | |
| 883 | 883 | $operator_correct = $data[3]; |
| 884 | 884 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 885 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 886 | - if (count($airline_array) > 0) { |
|
| 887 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 888 | - } |
|
| 889 | - } |
|
| 885 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 886 | + if (count($airline_array) > 0) { |
|
| 887 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 888 | + } |
|
| 889 | + } |
|
| 890 | 890 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 891 | 891 | try { |
| 892 | 892 | $sth = $Connection->db->prepare($query); |
@@ -900,7 +900,7 @@ discard block |
||
| 900 | 900 | //$Connection->db->commit(); |
| 901 | 901 | } |
| 902 | 902 | return ''; |
| 903 | - } |
|
| 903 | + } |
|
| 904 | 904 | |
| 905 | 905 | public static function translation_fam() { |
| 906 | 906 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -910,10 +910,10 @@ discard block |
||
| 910 | 910 | try { |
| 911 | 911 | $Connection = new Connection(); |
| 912 | 912 | $sth = $Connection->db->prepare($query); |
| 913 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 914 | - } catch(PDOException $e) { |
|
| 915 | - return "error : ".$e->getMessage(); |
|
| 916 | - } |
|
| 913 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 914 | + } catch(PDOException $e) { |
|
| 915 | + return "error : ".$e->getMessage(); |
|
| 916 | + } |
|
| 917 | 917 | |
| 918 | 918 | |
| 919 | 919 | //update_db::unzip($out_file); |
@@ -942,7 +942,7 @@ discard block |
||
| 942 | 942 | //$Connection->db->commit(); |
| 943 | 943 | } |
| 944 | 944 | return ''; |
| 945 | - } |
|
| 945 | + } |
|
| 946 | 946 | |
| 947 | 947 | public static function tle($filename,$tletype) { |
| 948 | 948 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -953,10 +953,10 @@ discard block |
||
| 953 | 953 | try { |
| 954 | 954 | $Connection = new Connection(); |
| 955 | 955 | $sth = $Connection->db->prepare($query); |
| 956 | - $sth->execute(array(':source' => $filename)); |
|
| 957 | - } catch(PDOException $e) { |
|
| 958 | - return "error : ".$e->getMessage(); |
|
| 959 | - } |
|
| 956 | + $sth->execute(array(':source' => $filename)); |
|
| 957 | + } catch(PDOException $e) { |
|
| 958 | + return "error : ".$e->getMessage(); |
|
| 959 | + } |
|
| 960 | 960 | |
| 961 | 961 | $Connection = new Connection(); |
| 962 | 962 | if (($handle = fopen($filename, 'r')) !== FALSE) |
@@ -991,54 +991,54 @@ discard block |
||
| 991 | 991 | //$Connection->db->commit(); |
| 992 | 992 | } |
| 993 | 993 | return ''; |
| 994 | - } |
|
| 994 | + } |
|
| 995 | 995 | |
| 996 | 996 | /** |
| 997 | - * Convert a HTML table to an array |
|
| 998 | - * @param String $data HTML page |
|
| 999 | - * @return Array array of the tables in HTML page |
|
| 1000 | - */ |
|
| 1001 | - private static function table2array($data) { |
|
| 1002 | - $html = str_get_html($data); |
|
| 1003 | - $tabledata=array(); |
|
| 1004 | - foreach($html->find('tr') as $element) |
|
| 1005 | - { |
|
| 1006 | - $td = array(); |
|
| 1007 | - foreach( $element->find('th') as $row) |
|
| 1008 | - { |
|
| 1009 | - $td [] = trim($row->plaintext); |
|
| 1010 | - } |
|
| 1011 | - $td=array_filter($td); |
|
| 1012 | - $tabledata[] = $td; |
|
| 1013 | - |
|
| 1014 | - $td = array(); |
|
| 1015 | - $tdi = array(); |
|
| 1016 | - foreach( $element->find('td') as $row) |
|
| 1017 | - { |
|
| 1018 | - $td [] = trim($row->plaintext); |
|
| 1019 | - $tdi [] = trim($row->innertext); |
|
| 1020 | - } |
|
| 1021 | - $td=array_filter($td); |
|
| 1022 | - $tdi=array_filter($tdi); |
|
| 1023 | - // $tabledata[]=array_merge($td,$tdi); |
|
| 1024 | - $tabledata[]=$td; |
|
| 1025 | - } |
|
| 1026 | - return(array_filter($tabledata)); |
|
| 1027 | - } |
|
| 1028 | - |
|
| 1029 | - /** |
|
| 1030 | - * Get data from form result |
|
| 1031 | - * @param String $url form URL |
|
| 1032 | - * @return String the result |
|
| 1033 | - */ |
|
| 1034 | - private static function getData($url) { |
|
| 1035 | - $ch = curl_init(); |
|
| 1036 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 1037 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 1038 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 1039 | - 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'); |
|
| 1040 | - return curl_exec($ch); |
|
| 1041 | - } |
|
| 997 | + * Convert a HTML table to an array |
|
| 998 | + * @param String $data HTML page |
|
| 999 | + * @return Array array of the tables in HTML page |
|
| 1000 | + */ |
|
| 1001 | + private static function table2array($data) { |
|
| 1002 | + $html = str_get_html($data); |
|
| 1003 | + $tabledata=array(); |
|
| 1004 | + foreach($html->find('tr') as $element) |
|
| 1005 | + { |
|
| 1006 | + $td = array(); |
|
| 1007 | + foreach( $element->find('th') as $row) |
|
| 1008 | + { |
|
| 1009 | + $td [] = trim($row->plaintext); |
|
| 1010 | + } |
|
| 1011 | + $td=array_filter($td); |
|
| 1012 | + $tabledata[] = $td; |
|
| 1013 | + |
|
| 1014 | + $td = array(); |
|
| 1015 | + $tdi = array(); |
|
| 1016 | + foreach( $element->find('td') as $row) |
|
| 1017 | + { |
|
| 1018 | + $td [] = trim($row->plaintext); |
|
| 1019 | + $tdi [] = trim($row->innertext); |
|
| 1020 | + } |
|
| 1021 | + $td=array_filter($td); |
|
| 1022 | + $tdi=array_filter($tdi); |
|
| 1023 | + // $tabledata[]=array_merge($td,$tdi); |
|
| 1024 | + $tabledata[]=$td; |
|
| 1025 | + } |
|
| 1026 | + return(array_filter($tabledata)); |
|
| 1027 | + } |
|
| 1028 | + |
|
| 1029 | + /** |
|
| 1030 | + * Get data from form result |
|
| 1031 | + * @param String $url form URL |
|
| 1032 | + * @return String the result |
|
| 1033 | + */ |
|
| 1034 | + private static function getData($url) { |
|
| 1035 | + $ch = curl_init(); |
|
| 1036 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 1037 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 1038 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 1039 | + 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'); |
|
| 1040 | + return curl_exec($ch); |
|
| 1041 | + } |
|
| 1042 | 1042 | /* |
| 1043 | 1043 | public static function waypoints() { |
| 1044 | 1044 | $data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html'); |
@@ -1121,7 +1121,7 @@ discard block |
||
| 1121 | 1121 | if ($globalTransaction) $Connection->db->commit(); |
| 1122 | 1122 | } |
| 1123 | 1123 | return ''; |
| 1124 | - } |
|
| 1124 | + } |
|
| 1125 | 1125 | |
| 1126 | 1126 | public static function ivao_airlines($filename) { |
| 1127 | 1127 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1131,10 +1131,10 @@ discard block |
||
| 1131 | 1131 | try { |
| 1132 | 1132 | $Connection = new Connection(); |
| 1133 | 1133 | $sth = $Connection->db->prepare($query); |
| 1134 | - $sth->execute(); |
|
| 1135 | - } catch(PDOException $e) { |
|
| 1136 | - return "error : ".$e->getMessage(); |
|
| 1137 | - } |
|
| 1134 | + $sth->execute(); |
|
| 1135 | + } catch(PDOException $e) { |
|
| 1136 | + return "error : ".$e->getMessage(); |
|
| 1137 | + } |
|
| 1138 | 1138 | |
| 1139 | 1139 | $header = NULL; |
| 1140 | 1140 | $delimiter = ':'; |
@@ -1158,7 +1158,7 @@ discard block |
||
| 1158 | 1158 | if ($globalTransaction) $Connection->db->commit(); |
| 1159 | 1159 | } |
| 1160 | 1160 | return ''; |
| 1161 | - } |
|
| 1161 | + } |
|
| 1162 | 1162 | |
| 1163 | 1163 | public static function update_airspace() { |
| 1164 | 1164 | global $tmp_dir, $globalDBdriver; |
@@ -1168,11 +1168,11 @@ discard block |
||
| 1168 | 1168 | $query = 'DROP TABLE airspace'; |
| 1169 | 1169 | try { |
| 1170 | 1170 | $sth = $Connection->db->prepare($query); |
| 1171 | - $sth->execute(); |
|
| 1172 | - } catch(PDOException $e) { |
|
| 1171 | + $sth->execute(); |
|
| 1172 | + } catch(PDOException $e) { |
|
| 1173 | 1173 | return "error : ".$e->getMessage(); |
| 1174 | - } |
|
| 1175 | - } |
|
| 1174 | + } |
|
| 1175 | + } |
|
| 1176 | 1176 | |
| 1177 | 1177 | |
| 1178 | 1178 | if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
@@ -1227,10 +1227,10 @@ discard block |
||
| 1227 | 1227 | $query = 'DROP TABLE countries'; |
| 1228 | 1228 | try { |
| 1229 | 1229 | $sth = $Connection->db->prepare($query); |
| 1230 | - $sth->execute(); |
|
| 1231 | - } catch(PDOException $e) { |
|
| 1232 | - echo "error : ".$e->getMessage(); |
|
| 1233 | - } |
|
| 1230 | + $sth->execute(); |
|
| 1231 | + } catch(PDOException $e) { |
|
| 1232 | + echo "error : ".$e->getMessage(); |
|
| 1233 | + } |
|
| 1234 | 1234 | } |
| 1235 | 1235 | if ($globalDBdriver == 'mysql') { |
| 1236 | 1236 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -1619,11 +1619,11 @@ discard block |
||
| 1619 | 1619 | $query = 'DROP TABLE airspace'; |
| 1620 | 1620 | try { |
| 1621 | 1621 | $sth = $Connection->db->prepare($query); |
| 1622 | - $sth->execute(); |
|
| 1623 | - } catch(PDOException $e) { |
|
| 1622 | + $sth->execute(); |
|
| 1623 | + } catch(PDOException $e) { |
|
| 1624 | 1624 | return "error : ".$e->getMessage(); |
| 1625 | - } |
|
| 1626 | - } |
|
| 1625 | + } |
|
| 1626 | + } |
|
| 1627 | 1627 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 1628 | 1628 | update_db::insert_airspace_version($airspace_md5); |
| 1629 | 1629 | } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
@@ -1743,12 +1743,12 @@ discard block |
||
| 1743 | 1743 | echo $data; |
| 1744 | 1744 | */ |
| 1745 | 1745 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 1746 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1747 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1748 | - $result = fread($fh,100000000); |
|
| 1749 | - //echo $result; |
|
| 1750 | - //var_dump(str_get_html($result)); |
|
| 1751 | - //print_r(self::table2array($result)); |
|
| 1746 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1747 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1748 | + $result = fread($fh,100000000); |
|
| 1749 | + //echo $result; |
|
| 1750 | + //var_dump(str_get_html($result)); |
|
| 1751 | + //print_r(self::table2array($result)); |
|
| 1752 | 1752 | } |
| 1753 | 1753 | |
| 1754 | 1754 | } |
@@ -1762,10 +1762,10 @@ discard block |
||
| 1762 | 1762 | try { |
| 1763 | 1763 | $Connection = new Connection(); |
| 1764 | 1764 | $sth = $Connection->db->prepare($query); |
| 1765 | - $sth->execute(); |
|
| 1766 | - } catch(PDOException $e) { |
|
| 1767 | - return "error : ".$e->getMessage(); |
|
| 1768 | - } |
|
| 1765 | + $sth->execute(); |
|
| 1766 | + } catch(PDOException $e) { |
|
| 1767 | + return "error : ".$e->getMessage(); |
|
| 1768 | + } |
|
| 1769 | 1769 | |
| 1770 | 1770 | $error = ''; |
| 1771 | 1771 | if ($globalDebug) echo "Notam : Download..."; |
@@ -1821,8 +1821,8 @@ discard block |
||
| 1821 | 1821 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
| 1822 | 1822 | $data['permanent'] = 0; |
| 1823 | 1823 | } else { |
| 1824 | - $data['date_end'] = NULL; |
|
| 1825 | - $data['permanent'] = 1; |
|
| 1824 | + $data['date_end'] = NULL; |
|
| 1825 | + $data['permanent'] = 1; |
|
| 1826 | 1826 | } |
| 1827 | 1827 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 1828 | 1828 | $NOTAM = new NOTAM(); |
@@ -1881,13 +1881,13 @@ discard block |
||
| 1881 | 1881 | try { |
| 1882 | 1882 | $Connection = new Connection(); |
| 1883 | 1883 | $sth = $Connection->db->prepare($query); |
| 1884 | - $sth->execute(); |
|
| 1885 | - } catch(PDOException $e) { |
|
| 1886 | - return "error : ".$e->getMessage(); |
|
| 1887 | - } |
|
| 1888 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1889 | - if ($row['nb'] > 0) return false; |
|
| 1890 | - else return true; |
|
| 1884 | + $sth->execute(); |
|
| 1885 | + } catch(PDOException $e) { |
|
| 1886 | + return "error : ".$e->getMessage(); |
|
| 1887 | + } |
|
| 1888 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1889 | + if ($row['nb'] > 0) return false; |
|
| 1890 | + else return true; |
|
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | public static function insert_last_update() { |
@@ -1896,10 +1896,10 @@ discard block |
||
| 1896 | 1896 | try { |
| 1897 | 1897 | $Connection = new Connection(); |
| 1898 | 1898 | $sth = $Connection->db->prepare($query); |
| 1899 | - $sth->execute(); |
|
| 1900 | - } catch(PDOException $e) { |
|
| 1901 | - return "error : ".$e->getMessage(); |
|
| 1902 | - } |
|
| 1899 | + $sth->execute(); |
|
| 1900 | + } catch(PDOException $e) { |
|
| 1901 | + return "error : ".$e->getMessage(); |
|
| 1902 | + } |
|
| 1903 | 1903 | } |
| 1904 | 1904 | |
| 1905 | 1905 | public static function check_airspace_version($version) { |
@@ -1907,13 +1907,13 @@ discard block |
||
| 1907 | 1907 | try { |
| 1908 | 1908 | $Connection = new Connection(); |
| 1909 | 1909 | $sth = $Connection->db->prepare($query); |
| 1910 | - $sth->execute(array(':version' => $version)); |
|
| 1911 | - } catch(PDOException $e) { |
|
| 1912 | - return "error : ".$e->getMessage(); |
|
| 1913 | - } |
|
| 1914 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1915 | - if ($row['nb'] > 0) return true; |
|
| 1916 | - else return false; |
|
| 1910 | + $sth->execute(array(':version' => $version)); |
|
| 1911 | + } catch(PDOException $e) { |
|
| 1912 | + return "error : ".$e->getMessage(); |
|
| 1913 | + } |
|
| 1914 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1915 | + if ($row['nb'] > 0) return true; |
|
| 1916 | + else return false; |
|
| 1917 | 1917 | } |
| 1918 | 1918 | |
| 1919 | 1919 | |
@@ -1923,10 +1923,10 @@ discard block |
||
| 1923 | 1923 | try { |
| 1924 | 1924 | $Connection = new Connection(); |
| 1925 | 1925 | $sth = $Connection->db->prepare($query); |
| 1926 | - $sth->execute(array(':version' => $version)); |
|
| 1927 | - } catch(PDOException $e) { |
|
| 1928 | - return "error : ".$e->getMessage(); |
|
| 1929 | - } |
|
| 1926 | + $sth->execute(array(':version' => $version)); |
|
| 1927 | + } catch(PDOException $e) { |
|
| 1928 | + return "error : ".$e->getMessage(); |
|
| 1929 | + } |
|
| 1930 | 1930 | } |
| 1931 | 1931 | |
| 1932 | 1932 | public static function check_last_notam_update() { |
@@ -1939,13 +1939,13 @@ discard block |
||
| 1939 | 1939 | try { |
| 1940 | 1940 | $Connection = new Connection(); |
| 1941 | 1941 | $sth = $Connection->db->prepare($query); |
| 1942 | - $sth->execute(); |
|
| 1943 | - } catch(PDOException $e) { |
|
| 1944 | - return "error : ".$e->getMessage(); |
|
| 1945 | - } |
|
| 1946 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1947 | - if ($row['nb'] > 0) return false; |
|
| 1948 | - else return true; |
|
| 1942 | + $sth->execute(); |
|
| 1943 | + } catch(PDOException $e) { |
|
| 1944 | + return "error : ".$e->getMessage(); |
|
| 1945 | + } |
|
| 1946 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1947 | + if ($row['nb'] > 0) return false; |
|
| 1948 | + else return true; |
|
| 1949 | 1949 | } |
| 1950 | 1950 | |
| 1951 | 1951 | public static function insert_last_notam_update() { |
@@ -1954,10 +1954,10 @@ discard block |
||
| 1954 | 1954 | try { |
| 1955 | 1955 | $Connection = new Connection(); |
| 1956 | 1956 | $sth = $Connection->db->prepare($query); |
| 1957 | - $sth->execute(); |
|
| 1958 | - } catch(PDOException $e) { |
|
| 1959 | - return "error : ".$e->getMessage(); |
|
| 1960 | - } |
|
| 1957 | + $sth->execute(); |
|
| 1958 | + } catch(PDOException $e) { |
|
| 1959 | + return "error : ".$e->getMessage(); |
|
| 1960 | + } |
|
| 1961 | 1961 | } |
| 1962 | 1962 | public static function check_last_airspace_update() { |
| 1963 | 1963 | global $globalDBdriver; |
@@ -1969,13 +1969,13 @@ discard block |
||
| 1969 | 1969 | try { |
| 1970 | 1970 | $Connection = new Connection(); |
| 1971 | 1971 | $sth = $Connection->db->prepare($query); |
| 1972 | - $sth->execute(); |
|
| 1973 | - } catch(PDOException $e) { |
|
| 1974 | - return "error : ".$e->getMessage(); |
|
| 1975 | - } |
|
| 1976 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1977 | - if ($row['nb'] > 0) return false; |
|
| 1978 | - else return true; |
|
| 1972 | + $sth->execute(); |
|
| 1973 | + } catch(PDOException $e) { |
|
| 1974 | + return "error : ".$e->getMessage(); |
|
| 1975 | + } |
|
| 1976 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1977 | + if ($row['nb'] > 0) return false; |
|
| 1978 | + else return true; |
|
| 1979 | 1979 | } |
| 1980 | 1980 | |
| 1981 | 1981 | public static function insert_last_airspace_update() { |
@@ -1984,10 +1984,10 @@ discard block |
||
| 1984 | 1984 | try { |
| 1985 | 1985 | $Connection = new Connection(); |
| 1986 | 1986 | $sth = $Connection->db->prepare($query); |
| 1987 | - $sth->execute(); |
|
| 1988 | - } catch(PDOException $e) { |
|
| 1989 | - return "error : ".$e->getMessage(); |
|
| 1990 | - } |
|
| 1987 | + $sth->execute(); |
|
| 1988 | + } catch(PDOException $e) { |
|
| 1989 | + return "error : ".$e->getMessage(); |
|
| 1990 | + } |
|
| 1991 | 1991 | } |
| 1992 | 1992 | |
| 1993 | 1993 | public static function check_last_owner_update() { |
@@ -2000,13 +2000,13 @@ discard block |
||
| 2000 | 2000 | try { |
| 2001 | 2001 | $Connection = new Connection(); |
| 2002 | 2002 | $sth = $Connection->db->prepare($query); |
| 2003 | - $sth->execute(); |
|
| 2004 | - } catch(PDOException $e) { |
|
| 2005 | - return "error : ".$e->getMessage(); |
|
| 2006 | - } |
|
| 2007 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2008 | - if ($row['nb'] > 0) return false; |
|
| 2009 | - else return true; |
|
| 2003 | + $sth->execute(); |
|
| 2004 | + } catch(PDOException $e) { |
|
| 2005 | + return "error : ".$e->getMessage(); |
|
| 2006 | + } |
|
| 2007 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2008 | + if ($row['nb'] > 0) return false; |
|
| 2009 | + else return true; |
|
| 2010 | 2010 | } |
| 2011 | 2011 | |
| 2012 | 2012 | public static function insert_last_owner_update() { |
@@ -2015,10 +2015,10 @@ discard block |
||
| 2015 | 2015 | try { |
| 2016 | 2016 | $Connection = new Connection(); |
| 2017 | 2017 | $sth = $Connection->db->prepare($query); |
| 2018 | - $sth->execute(); |
|
| 2019 | - } catch(PDOException $e) { |
|
| 2020 | - return "error : ".$e->getMessage(); |
|
| 2021 | - } |
|
| 2018 | + $sth->execute(); |
|
| 2019 | + } catch(PDOException $e) { |
|
| 2020 | + return "error : ".$e->getMessage(); |
|
| 2021 | + } |
|
| 2022 | 2022 | } |
| 2023 | 2023 | public static function check_last_schedules_update() { |
| 2024 | 2024 | global $globalDBdriver; |
@@ -2030,13 +2030,13 @@ discard block |
||
| 2030 | 2030 | try { |
| 2031 | 2031 | $Connection = new Connection(); |
| 2032 | 2032 | $sth = $Connection->db->prepare($query); |
| 2033 | - $sth->execute(); |
|
| 2034 | - } catch(PDOException $e) { |
|
| 2035 | - return "error : ".$e->getMessage(); |
|
| 2036 | - } |
|
| 2037 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2038 | - if ($row['nb'] > 0) return false; |
|
| 2039 | - else return true; |
|
| 2033 | + $sth->execute(); |
|
| 2034 | + } catch(PDOException $e) { |
|
| 2035 | + return "error : ".$e->getMessage(); |
|
| 2036 | + } |
|
| 2037 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2038 | + if ($row['nb'] > 0) return false; |
|
| 2039 | + else return true; |
|
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | public static function insert_last_schedules_update() { |
@@ -2045,10 +2045,10 @@ discard block |
||
| 2045 | 2045 | try { |
| 2046 | 2046 | $Connection = new Connection(); |
| 2047 | 2047 | $sth = $Connection->db->prepare($query); |
| 2048 | - $sth->execute(); |
|
| 2049 | - } catch(PDOException $e) { |
|
| 2050 | - return "error : ".$e->getMessage(); |
|
| 2051 | - } |
|
| 2048 | + $sth->execute(); |
|
| 2049 | + } catch(PDOException $e) { |
|
| 2050 | + return "error : ".$e->getMessage(); |
|
| 2051 | + } |
|
| 2052 | 2052 | } |
| 2053 | 2053 | public static function check_last_tle_update() { |
| 2054 | 2054 | global $globalDBdriver; |
@@ -2060,13 +2060,13 @@ discard block |
||
| 2060 | 2060 | try { |
| 2061 | 2061 | $Connection = new Connection(); |
| 2062 | 2062 | $sth = $Connection->db->prepare($query); |
| 2063 | - $sth->execute(); |
|
| 2064 | - } catch(PDOException $e) { |
|
| 2065 | - return "error : ".$e->getMessage(); |
|
| 2066 | - } |
|
| 2067 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2068 | - if ($row['nb'] > 0) return false; |
|
| 2069 | - else return true; |
|
| 2063 | + $sth->execute(); |
|
| 2064 | + } catch(PDOException $e) { |
|
| 2065 | + return "error : ".$e->getMessage(); |
|
| 2066 | + } |
|
| 2067 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 2068 | + if ($row['nb'] > 0) return false; |
|
| 2069 | + else return true; |
|
| 2070 | 2070 | } |
| 2071 | 2071 | |
| 2072 | 2072 | public static function insert_last_tle_update() { |
@@ -2075,10 +2075,10 @@ discard block |
||
| 2075 | 2075 | try { |
| 2076 | 2076 | $Connection = new Connection(); |
| 2077 | 2077 | $sth = $Connection->db->prepare($query); |
| 2078 | - $sth->execute(); |
|
| 2079 | - } catch(PDOException $e) { |
|
| 2080 | - return "error : ".$e->getMessage(); |
|
| 2081 | - } |
|
| 2078 | + $sth->execute(); |
|
| 2079 | + } catch(PDOException $e) { |
|
| 2080 | + return "error : ".$e->getMessage(); |
|
| 2081 | + } |
|
| 2082 | 2082 | } |
| 2083 | 2083 | |
| 2084 | 2084 | public static function update_all() { |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -34,14 +34,14 @@ discard block |
||
| 34 | 34 | function drawChart() { |
| 35 | 35 | var data = google.visualization.arrayToDataTable([ |
| 36 | 36 | ["'._("Pilot").'", "'._("# of times").'"], '; |
| 37 | - $pilot_data = ''; |
|
| 37 | + $pilot_data = ''; |
|
| 38 | 38 | foreach($pilot_array as $pilot_item) |
| 39 | 39 | { |
| 40 | 40 | $pilot_data .= '[ "'.$pilot_item['pilot_name'].' ('.$pilot_item['pilot_id'].')",'.$pilot_item['pilot_count'].'],'; |
| 41 | 41 | } |
| 42 | 42 | $pilot_data = substr($pilot_data, 0, -1); |
| 43 | 43 | print $pilot_data; |
| 44 | - print ']); |
|
| 44 | + print ']); |
|
| 45 | 45 | |
| 46 | 46 | var options = { |
| 47 | 47 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -33,14 +33,14 @@ discard block |
||
| 33 | 33 | function drawChart() { |
| 34 | 34 | var data = google.visualization.arrayToDataTable([ |
| 35 | 35 | ["'._("Owner").'", "'._("# of times").'"], '; |
| 36 | - $owner_data = ''; |
|
| 36 | + $owner_data = ''; |
|
| 37 | 37 | foreach($owner_array as $owner_item) |
| 38 | 38 | { |
| 39 | 39 | $owner_data .= '[ "'.$owner_item['owner_name'].'",'.$owner_item['owner_count'].'],'; |
| 40 | 40 | } |
| 41 | 41 | $owner_data = substr($owner_data, 0, -1); |
| 42 | 42 | print $owner_data; |
| 43 | - print ']); |
|
| 43 | + print ']); |
|
| 44 | 44 | |
| 45 | 45 | var options = { |
| 46 | 46 | chartArea: {"width": "80%", "height": "60%"}, |
@@ -7,13 +7,13 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | function drawChart() { |
| 35 | 35 | var data = google.visualization.arrayToDataTable([ |
| 36 | 36 | ["'._("Aircraft Manufacturer").'", "'._("# of times").'"], '; |
| 37 | - $registration_data = ''; |
|
| 37 | + $registration_data = ''; |
|
| 38 | 38 | foreach($registration_array as $registration_item) |
| 39 | 39 | { |
| 40 | 40 | $registration_data .= '[ "'.$registration_item['registration'].' - '.$registration_item['aircraft_name'].' ('.$registration_item['aircraft_icao'].')",'.$registration_item['aircraft_registration_count'].'],'; |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |
@@ -7,13 +7,13 @@ |
||
| 7 | 7 | |
| 8 | 8 | $airline_icao = (string)filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
| 9 | 9 | if ($airline_icao == 'all') { |
| 10 | - unset($_COOKIE['stats_airline_icao']); |
|
| 11 | - setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | - $airline_icao = ''; |
|
| 10 | + unset($_COOKIE['stats_airline_icao']); |
|
| 11 | + setcookie('stats_airline_icao', '', time()-3600); |
|
| 12 | + $airline_icao = ''; |
|
| 13 | 13 | } elseif ($airline_icao == '' && isset($_COOKIE['stats_airline_icao'])) { |
| 14 | - $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 14 | + $airline_icao = $_COOKIE['stats_airline_icao']; |
|
| 15 | 15 | } elseif ($airline_icao == '' && isset($globalFilter)) { |
| 16 | - if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 16 | + if (isset($globalFilter['airline'])) $airline_icao = $globalFilter['airline'][0]; |
|
| 17 | 17 | } |
| 18 | 18 | setcookie('stats_airline_icao',$airline_icao); |
| 19 | 19 | |