@@ -824,11 +824,11 @@ |
||
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** |
| 827 | - * Returns true if $string is valid UTF-8 and false otherwise. |
|
| 828 | - * |
|
| 829 | - * @param mixed $str String to be tested |
|
| 830 | - * @return boolean |
|
| 831 | - */ |
|
| 827 | + * Returns true if $string is valid UTF-8 and false otherwise. |
|
| 828 | + * |
|
| 829 | + * @param mixed $str String to be tested |
|
| 830 | + * @return boolean |
|
| 831 | + */ |
|
| 832 | 832 | static function is_utf8($str) |
| 833 | 833 | { |
| 834 | 834 | $c=0; $b=0; |
@@ -68,27 +68,27 @@ discard block |
||
| 68 | 68 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'database_import') { |
| 69 | 69 | if (update_schema::check_version(false) == '0') { |
| 70 | 70 | if ($globalDBdriver == 'mysql') { |
| 71 | - $error .= create_db::import_all_db('../db/'); |
|
| 71 | + $error .= create_db::import_all_db('../db/'); |
|
| 72 | 72 | } elseif ($globalDBdriver == 'pgsql') { |
| 73 | - $error .= create_db::import_all_db('../db/pgsql/'); |
|
| 73 | + $error .= create_db::import_all_db('../db/pgsql/'); |
|
| 74 | 74 | } |
| 75 | 75 | if ($error != '') { |
| 76 | - $_SESSION['error'] = $error; |
|
| 76 | + $_SESSION['error'] = $error; |
|
| 77 | 77 | } |
| 78 | 78 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Create and import tables')); |
| 79 | 79 | if ($globalSBS1 && !$globalIVAO && !$globalVATSIM && !$globalphpVMS) { |
| 80 | 80 | $_SESSION['install'] = 'populate'; |
| 81 | 81 | $_SESSION['next'] = 'Populate aircraft_modes table with externals data for ADS-B'; |
| 82 | 82 | } else { |
| 83 | - $_SESSION['install'] = 'sources'; |
|
| 84 | - $_SESSION['next'] = 'Insert data in source table'; |
|
| 83 | + $_SESSION['install'] = 'sources'; |
|
| 84 | + $_SESSION['next'] = 'Insert data in source table'; |
|
| 85 | 85 | } |
| 86 | 86 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 87 | 87 | print json_encode($result); |
| 88 | 88 | } else { |
| 89 | 89 | $error .= update_schema::check_version(true); |
| 90 | 90 | if ($error != '') { |
| 91 | - $_SESSION['error'] = $error; |
|
| 91 | + $_SESSION['error'] = $error; |
|
| 92 | 92 | } |
| 93 | 93 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Update schema if needed')); |
| 94 | 94 | $_SESSION['install'] = 'sources'; |
@@ -118,25 +118,25 @@ discard block |
||
| 118 | 118 | $error .= update_db::update_countries(); |
| 119 | 119 | $_SESSION['done'] = array_merge($_SESSION['done'],array('Populate countries database')); |
| 120 | 120 | if (isset($globalNOTAM) && $globalNOTAM && isset($globalNOTAMSource) && $globalNOTAMSource != '') { |
| 121 | - $_SESSION['install'] = 'notam'; |
|
| 122 | - $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
| 123 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 124 | - print json_encode($result); |
|
| 121 | + $_SESSION['install'] = 'notam'; |
|
| 122 | + $_SESSION['next'] = 'Populate NOTAM table with externals data'; |
|
| 123 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 124 | + print json_encode($result); |
|
| 125 | 125 | } elseif (isset($_SESSION['owner']) && $_SESSION['owner'] == 1) { |
| 126 | - $_SESSION['install'] = 'owner'; |
|
| 127 | - $_SESSION['next'] = 'Populate owner table with externals data'; |
|
| 128 | - unset($_SESSION['owner']); |
|
| 129 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 130 | - print json_encode($result); |
|
| 126 | + $_SESSION['install'] = 'owner'; |
|
| 127 | + $_SESSION['next'] = 'Populate owner table with externals data'; |
|
| 128 | + unset($_SESSION['owner']); |
|
| 129 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 130 | + print json_encode($result); |
|
| 131 | 131 | } else { |
| 132 | - $_SESSION['install'] = 'sources'; |
|
| 133 | - $_SESSION['next'] = 'Insert data in source table'; |
|
| 134 | - $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 135 | - print json_encode($result); |
|
| 132 | + $_SESSION['install'] = 'sources'; |
|
| 133 | + $_SESSION['next'] = 'Insert data in source table'; |
|
| 134 | + $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
|
| 135 | + print json_encode($result); |
|
| 136 | 136 | } |
| 137 | 137 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate') { |
| 138 | 138 | if (!is_writable('tmp')) { |
| 139 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 139 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 140 | 140 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 141 | 141 | print json_encode($result); |
| 142 | 142 | } else { |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | } |
| 153 | 153 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'populate_flarm') { |
| 154 | 154 | if (!is_writable('tmp')) { |
| 155 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 155 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 156 | 156 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 157 | 157 | print json_encode($result); |
| 158 | 158 | } else { |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'routes') { |
| 187 | 187 | if (!is_writable('tmp')) { |
| 188 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 188 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 189 | 189 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 190 | 190 | print json_encode($result); |
| 191 | 191 | } else { |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'translation') { |
| 202 | 202 | if (!is_writable('tmp')) { |
| 203 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 203 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 204 | 204 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 205 | 205 | print json_encode($result); |
| 206 | 206 | } else { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'owner') { |
| 231 | 231 | if (!is_writable('tmp')) { |
| 232 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 232 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 233 | 233 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 234 | 234 | print json_encode($result); |
| 235 | 235 | } else { |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'notam') { |
| 246 | 246 | if (!is_writable('tmp')) { |
| 247 | - $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 247 | + $error = 'The directory <i>install/tmp</i> must be writable.'; |
|
| 248 | 248 | $result = array('error' => $error,'done' => $_SESSION['done'],'next' => $_SESSION['next'],'install' => $_SESSION['install']); |
| 249 | 249 | print json_encode($result); |
| 250 | 250 | } else { |
@@ -296,17 +296,17 @@ discard block |
||
| 296 | 296 | */ |
| 297 | 297 | } else if (isset($_SESSION['install']) && $_SESSION['install'] == 'sources') { |
| 298 | 298 | if (isset($_SESSION['sources']) && count($_SESSION['sources']) > 0) { |
| 299 | - $sources = $_SESSION['sources']; |
|
| 299 | + $sources = $_SESSION['sources']; |
|
| 300 | 300 | |
| 301 | - include_once('../require/class.Source.php'); |
|
| 302 | - $globalDebug = FALSE; |
|
| 303 | - $Source = new Source(); |
|
| 304 | - $Source->deleteAllLocation(); |
|
| 305 | - foreach ($sources as $src) { |
|
| 301 | + include_once('../require/class.Source.php'); |
|
| 302 | + $globalDebug = FALSE; |
|
| 303 | + $Source = new Source(); |
|
| 304 | + $Source->deleteAllLocation(); |
|
| 305 | + foreach ($sources as $src) { |
|
| 306 | 306 | if (isset($src['latitude']) && $src['latitude'] != '') $Source->addLocation($src['name'],$src['latitude'],$src['longitude'],$src['altitude'],$src['city'],$src['country'],$src['source'],'antenna.png'); |
| 307 | - } |
|
| 308 | - $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
| 309 | - unset($_SESSION['sources']); |
|
| 307 | + } |
|
| 308 | + $_SESSION['done'] = array_merge($_SESSION['done'],array('Insert data in source table')); |
|
| 309 | + unset($_SESSION['sources']); |
|
| 310 | 310 | } |
| 311 | 311 | /* |
| 312 | 312 | if (isset($globalIVAO) && $globalIVAO) $_SESSION['install'] = 'ivao'; |
@@ -4,13 +4,13 @@ |
||
| 4 | 4 | * This Script will try to find all real arrival airports for all flights in DB |
| 5 | 5 | * |
| 6 | 6 | */ |
| 7 | - require_once('../require/settings.php'); |
|
| 8 | - if ($globalInstalled) { |
|
| 9 | - echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
| 10 | - exit; |
|
| 11 | - } |
|
| 12 | - require('../require/class.Spotter.php'); |
|
| 13 | - $Spotter = new Spotter(); |
|
| 14 | - $Spotter->updateArrivalAirports(); |
|
| 7 | + require_once('../require/settings.php'); |
|
| 8 | + if ($globalInstalled) { |
|
| 9 | + echo '$globalInstalled must be set to FALSE in require/settings.php'; |
|
| 10 | + exit; |
|
| 11 | + } |
|
| 12 | + require('../require/class.Spotter.php'); |
|
| 13 | + $Spotter = new Spotter(); |
|
| 14 | + $Spotter->updateArrivalAirports(); |
|
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | \ No newline at end of file |
@@ -70,38 +70,38 @@ discard block |
||
| 70 | 70 | try { |
| 71 | 71 | //$Connection = new Connection(); |
| 72 | 72 | $sth = $Connection->db->prepare($query); |
| 73 | - $sth->execute(array(':source' => $database_file)); |
|
| 74 | - } catch(PDOException $e) { |
|
| 75 | - return "error : ".$e->getMessage(); |
|
| 76 | - } |
|
| 73 | + $sth->execute(array(':source' => $database_file)); |
|
| 74 | + } catch(PDOException $e) { |
|
| 75 | + return "error : ".$e->getMessage(); |
|
| 76 | + } |
|
| 77 | 77 | |
| 78 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 79 | - update_db::connect_sqlite($database_file); |
|
| 78 | + if ($globalDebug) echo " - Add routes to DB -"; |
|
| 79 | + update_db::connect_sqlite($database_file); |
|
| 80 | 80 | //$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'; |
| 81 | 81 | $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"; |
| 82 | 82 | try { |
| 83 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 84 | - $sth->execute(); |
|
| 85 | - } catch(PDOException $e) { |
|
| 86 | - return "error : ".$e->getMessage(); |
|
| 87 | - } |
|
| 83 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 84 | + $sth->execute(); |
|
| 85 | + } catch(PDOException $e) { |
|
| 86 | + return "error : ".$e->getMessage(); |
|
| 87 | + } |
|
| 88 | 88 | //$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)'; |
| 89 | 89 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,ToAirport_ICAO,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
| 90 | 90 | $Connection = new Connection(); |
| 91 | 91 | $sth_dest = $Connection->db->prepare($query_dest); |
| 92 | 92 | try { |
| 93 | 93 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 94 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 94 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 95 | 95 | //$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); |
| 96 | 96 | $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); |
| 97 | 97 | $sth_dest->execute($query_dest_values); |
| 98 | - } |
|
| 98 | + } |
|
| 99 | 99 | if ($globalTransaction) $Connection->db->commit(); |
| 100 | 100 | } catch(PDOException $e) { |
| 101 | 101 | if ($globalTransaction) $Connection->db->rollBack(); |
| 102 | 102 | return "error : ".$e->getMessage(); |
| 103 | 103 | } |
| 104 | - return ''; |
|
| 104 | + return ''; |
|
| 105 | 105 | } |
| 106 | 106 | public static function retrieve_modes_sqlite_to_dest($database_file) { |
| 107 | 107 | global $globalTransaction; |
@@ -110,27 +110,27 @@ discard block |
||
| 110 | 110 | try { |
| 111 | 111 | $Connection = new Connection(); |
| 112 | 112 | $sth = $Connection->db->prepare($query); |
| 113 | - $sth->execute(array(':source' => $database_file)); |
|
| 114 | - } catch(PDOException $e) { |
|
| 115 | - return "error : ".$e->getMessage(); |
|
| 116 | - } |
|
| 113 | + $sth->execute(array(':source' => $database_file)); |
|
| 114 | + } catch(PDOException $e) { |
|
| 115 | + return "error : ".$e->getMessage(); |
|
| 116 | + } |
|
| 117 | 117 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
| 118 | 118 | try { |
| 119 | 119 | $Connection = new Connection(); |
| 120 | 120 | $sth = $Connection->db->prepare($query); |
| 121 | - $sth->execute(array(':source' => $database_file)); |
|
| 122 | - } catch(PDOException $e) { |
|
| 123 | - return "error : ".$e->getMessage(); |
|
| 124 | - } |
|
| 121 | + $sth->execute(array(':source' => $database_file)); |
|
| 122 | + } catch(PDOException $e) { |
|
| 123 | + return "error : ".$e->getMessage(); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - update_db::connect_sqlite($database_file); |
|
| 126 | + update_db::connect_sqlite($database_file); |
|
| 127 | 127 | $query = 'select * from Aircraft'; |
| 128 | 128 | try { |
| 129 | - $sth = update_db::$db_sqlite->prepare($query); |
|
| 130 | - $sth->execute(); |
|
| 131 | - } catch(PDOException $e) { |
|
| 132 | - return "error : ".$e->getMessage(); |
|
| 133 | - } |
|
| 129 | + $sth = update_db::$db_sqlite->prepare($query); |
|
| 130 | + $sth->execute(); |
|
| 131 | + } catch(PDOException $e) { |
|
| 132 | + return "error : ".$e->getMessage(); |
|
| 133 | + } |
|
| 134 | 134 | //$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)'; |
| 135 | 135 | $query_dest = 'INSERT INTO aircraft_modes (LastModified, ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type,:source)'; |
| 136 | 136 | |
@@ -141,17 +141,17 @@ discard block |
||
| 141 | 141 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 142 | 142 | try { |
| 143 | 143 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 144 | - while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 144 | + while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
|
| 145 | 145 | //$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']); |
| 146 | 146 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 147 | 147 | else $type = null; |
| 148 | 148 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 149 | 149 | $sth_dest->execute($query_dest_values); |
| 150 | 150 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 151 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 152 | - $sth_dest_owner->execute($query_dest_owner_values); |
|
| 151 | + $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 152 | + $sth_dest_owner->execute($query_dest_owner_values); |
|
| 153 | 153 | } |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | if ($globalTransaction) $Connection->db->commit(); |
| 156 | 156 | } catch(PDOException $e) { |
| 157 | 157 | return "error : ".$e->getMessage(); |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | try { |
| 162 | 162 | $Connection = new Connection(); |
| 163 | 163 | $sth = $Connection->db->prepare($query); |
| 164 | - $sth->execute(array(':source' => $database_file)); |
|
| 165 | - } catch(PDOException $e) { |
|
| 166 | - return "error : ".$e->getMessage(); |
|
| 167 | - } |
|
| 164 | + $sth->execute(array(':source' => $database_file)); |
|
| 165 | + } catch(PDOException $e) { |
|
| 166 | + return "error : ".$e->getMessage(); |
|
| 167 | + } |
|
| 168 | 168 | return ''; |
| 169 | 169 | } |
| 170 | 170 | |
@@ -176,10 +176,10 @@ discard block |
||
| 176 | 176 | try { |
| 177 | 177 | $Connection = new Connection(); |
| 178 | 178 | $sth = $Connection->db->prepare($query); |
| 179 | - $sth->execute(array(':source' => $database_file)); |
|
| 180 | - } catch(PDOException $e) { |
|
| 181 | - return "error : ".$e->getMessage(); |
|
| 182 | - } |
|
| 179 | + $sth->execute(array(':source' => $database_file)); |
|
| 180 | + } catch(PDOException $e) { |
|
| 181 | + return "error : ".$e->getMessage(); |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | 184 | if ($fh = fopen($database_file,"r")) { |
| 185 | 185 | //$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)'; |
@@ -189,25 +189,25 @@ discard block |
||
| 189 | 189 | $sth_dest = $Connection->db->prepare($query_dest); |
| 190 | 190 | try { |
| 191 | 191 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 192 | - while (!feof($fh)) { |
|
| 193 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 192 | + while (!feof($fh)) { |
|
| 193 | + $line = $Common->hex2str(fgets($fh,9999)); |
|
| 194 | 194 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 195 | - $values['ModeS'] = substr($line,0,6); |
|
| 196 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 197 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 198 | - // Check if we can find ICAO, else set it to GLID |
|
| 199 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 200 | - $search_more = ''; |
|
| 201 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 202 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 203 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 195 | + $values['ModeS'] = substr($line,0,6); |
|
| 196 | + $values['Registration'] = trim(substr($line,69,6)); |
|
| 197 | + $aircraft_name = trim(substr($line,48,6)); |
|
| 198 | + // Check if we can find ICAO, else set it to GLID |
|
| 199 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 200 | + $search_more = ''; |
|
| 201 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 202 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 203 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 204 | 204 | try { |
| 205 | - $sth_search->execute(); |
|
| 206 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 207 | - //if (count($result) > 0) { |
|
| 208 | - if (isset($result['icao']) && $result['icao'] != '') { |
|
| 209 | - $values['ICAOTypeCode'] = $result['icao']; |
|
| 210 | - } |
|
| 205 | + $sth_search->execute(); |
|
| 206 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 207 | + //if (count($result) > 0) { |
|
| 208 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 209 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 210 | + } |
|
| 211 | 211 | } catch(PDOException $e) { |
| 212 | 212 | return "error : ".$e->getMessage(); |
| 213 | 213 | } |
@@ -230,10 +230,10 @@ discard block |
||
| 230 | 230 | try { |
| 231 | 231 | $Connection = new Connection(); |
| 232 | 232 | $sth = $Connection->db->prepare($query); |
| 233 | - $sth->execute(array(':source' => $database_file)); |
|
| 234 | - } catch(PDOException $e) { |
|
| 235 | - return "error : ".$e->getMessage(); |
|
| 236 | - } |
|
| 233 | + $sth->execute(array(':source' => $database_file)); |
|
| 234 | + } catch(PDOException $e) { |
|
| 235 | + return "error : ".$e->getMessage(); |
|
| 236 | + } |
|
| 237 | 237 | return ''; |
| 238 | 238 | } |
| 239 | 239 | |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | try { |
| 245 | 245 | $Connection = new Connection(); |
| 246 | 246 | $sth = $Connection->db->prepare($query); |
| 247 | - $sth->execute(array(':source' => $database_file)); |
|
| 248 | - } catch(PDOException $e) { |
|
| 249 | - return "error : ".$e->getMessage(); |
|
| 250 | - } |
|
| 247 | + $sth->execute(array(':source' => $database_file)); |
|
| 248 | + } catch(PDOException $e) { |
|
| 249 | + return "error : ".$e->getMessage(); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | 252 | if ($fh = fopen($database_file,"r")) { |
| 253 | 253 | //$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)'; |
@@ -258,24 +258,24 @@ discard block |
||
| 258 | 258 | try { |
| 259 | 259 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 260 | 260 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 261 | - while (!feof($fh)) { |
|
| 262 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 261 | + while (!feof($fh)) { |
|
| 262 | + $line = fgetcsv($fh,9999,',',"'"); |
|
| 263 | 263 | |
| 264 | 264 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 265 | 265 | //print_r($line); |
| 266 | - $values['ModeS'] = $line[1]; |
|
| 267 | - $values['Registration'] = $line[3]; |
|
| 268 | - $aircraft_name = $line[2]; |
|
| 269 | - // Check if we can find ICAO, else set it to GLID |
|
| 270 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 271 | - $search_more = ''; |
|
| 272 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 273 | - $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 274 | - $sth_search = $Connection->db->prepare($query_search); |
|
| 266 | + $values['ModeS'] = $line[1]; |
|
| 267 | + $values['Registration'] = $line[3]; |
|
| 268 | + $aircraft_name = $line[2]; |
|
| 269 | + // Check if we can find ICAO, else set it to GLID |
|
| 270 | + $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 271 | + $search_more = ''; |
|
| 272 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 273 | + $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
|
| 274 | + $sth_search = $Connection->db->prepare($query_search); |
|
| 275 | 275 | try { |
| 276 | - $sth_search->execute(); |
|
| 277 | - $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 278 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 276 | + $sth_search->execute(); |
|
| 277 | + $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
|
| 278 | + if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 279 | 279 | } catch(PDOException $e) { |
| 280 | 280 | return "error : ".$e->getMessage(); |
| 281 | 281 | } |
@@ -298,10 +298,10 @@ discard block |
||
| 298 | 298 | try { |
| 299 | 299 | $Connection = new Connection(); |
| 300 | 300 | $sth = $Connection->db->prepare($query); |
| 301 | - $sth->execute(array(':source' => $database_file)); |
|
| 302 | - } catch(PDOException $e) { |
|
| 303 | - return "error : ".$e->getMessage(); |
|
| 304 | - } |
|
| 301 | + $sth->execute(array(':source' => $database_file)); |
|
| 302 | + } catch(PDOException $e) { |
|
| 303 | + return "error : ".$e->getMessage(); |
|
| 304 | + } |
|
| 305 | 305 | return ''; |
| 306 | 306 | } |
| 307 | 307 | |
@@ -312,10 +312,10 @@ discard block |
||
| 312 | 312 | try { |
| 313 | 313 | $Connection = new Connection(); |
| 314 | 314 | $sth = $Connection->db->prepare($query); |
| 315 | - $sth->execute(array(':source' => $database_file)); |
|
| 316 | - } catch(PDOException $e) { |
|
| 317 | - return "error : ".$e->getMessage(); |
|
| 318 | - } |
|
| 315 | + $sth->execute(array(':source' => $database_file)); |
|
| 316 | + } catch(PDOException $e) { |
|
| 317 | + return "error : ".$e->getMessage(); |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | 320 | if ($fh = fopen($database_file,"r")) { |
| 321 | 321 | //$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)'; |
@@ -326,94 +326,94 @@ discard block |
||
| 326 | 326 | try { |
| 327 | 327 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 328 | 328 | $tmp = fgetcsv($fh,9999,',','"'); |
| 329 | - while (!feof($fh)) { |
|
| 330 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 331 | - //print_r($line); |
|
| 332 | - if ($country == 'F') { |
|
| 333 | - $values['registration'] = $line[0]; |
|
| 334 | - $values['base'] = $line[4]; |
|
| 335 | - $values['owner'] = $line[5]; |
|
| 336 | - if ($line[6] == '') $values['date_first_reg'] = ''; |
|
| 337 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 338 | - $values['cancel'] = $line[7]; |
|
| 329 | + while (!feof($fh)) { |
|
| 330 | + $line = fgetcsv($fh,9999,',','"'); |
|
| 331 | + //print_r($line); |
|
| 332 | + if ($country == 'F') { |
|
| 333 | + $values['registration'] = $line[0]; |
|
| 334 | + $values['base'] = $line[4]; |
|
| 335 | + $values['owner'] = $line[5]; |
|
| 336 | + if ($line[6] == '') $values['date_first_reg'] = ''; |
|
| 337 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 338 | + $values['cancel'] = $line[7]; |
|
| 339 | 339 | } elseif ($country == 'EI') { |
| 340 | - // TODO : add modeS & reg to aircraft_modes |
|
| 341 | - $values['registration'] = $line[0]; |
|
| 342 | - $values['base'] = $line[3]; |
|
| 343 | - $values['owner'] = $line[2]; |
|
| 344 | - if ($line[1] == '') $values['date_first_reg'] = ''; |
|
| 345 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 346 | - $values['cancel'] = ''; |
|
| 340 | + // TODO : add modeS & reg to aircraft_modes |
|
| 341 | + $values['registration'] = $line[0]; |
|
| 342 | + $values['base'] = $line[3]; |
|
| 343 | + $values['owner'] = $line[2]; |
|
| 344 | + if ($line[1] == '') $values['date_first_reg'] = ''; |
|
| 345 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 346 | + $values['cancel'] = ''; |
|
| 347 | 347 | } elseif ($country == 'HB') { |
| 348 | - // TODO : add modeS & reg to aircraft_modes |
|
| 349 | - $values['registration'] = $line[0]; |
|
| 350 | - $values['base'] = null; |
|
| 351 | - $values['owner'] = $line[5]; |
|
| 352 | - $values['date_first_reg'] = ''; |
|
| 353 | - $values['cancel'] = ''; |
|
| 348 | + // TODO : add modeS & reg to aircraft_modes |
|
| 349 | + $values['registration'] = $line[0]; |
|
| 350 | + $values['base'] = null; |
|
| 351 | + $values['owner'] = $line[5]; |
|
| 352 | + $values['date_first_reg'] = ''; |
|
| 353 | + $values['cancel'] = ''; |
|
| 354 | 354 | } elseif ($country == 'OK') { |
| 355 | - // TODO : add modeS & reg to aircraft_modes |
|
| 356 | - $values['registration'] = $line[3]; |
|
| 357 | - $values['base'] = null; |
|
| 358 | - $values['owner'] = $line[5]; |
|
| 359 | - if ($line[18] == '') $values['date_first_reg'] = ''; |
|
| 360 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 361 | - $values['cancel'] = ''; |
|
| 355 | + // TODO : add modeS & reg to aircraft_modes |
|
| 356 | + $values['registration'] = $line[3]; |
|
| 357 | + $values['base'] = null; |
|
| 358 | + $values['owner'] = $line[5]; |
|
| 359 | + if ($line[18] == '') $values['date_first_reg'] = ''; |
|
| 360 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 361 | + $values['cancel'] = ''; |
|
| 362 | 362 | } elseif ($country == 'VH') { |
| 363 | - // TODO : add modeS & reg to aircraft_modes |
|
| 364 | - $values['registration'] = $line[0]; |
|
| 365 | - $values['base'] = null; |
|
| 366 | - $values['owner'] = $line[12]; |
|
| 367 | - if ($line[28] == '') $values['date_first_reg'] = ''; |
|
| 368 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 369 | - |
|
| 370 | - $values['cancel'] = $line[39]; |
|
| 363 | + // TODO : add modeS & reg to aircraft_modes |
|
| 364 | + $values['registration'] = $line[0]; |
|
| 365 | + $values['base'] = null; |
|
| 366 | + $values['owner'] = $line[12]; |
|
| 367 | + if ($line[28] == '') $values['date_first_reg'] = ''; |
|
| 368 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 369 | + |
|
| 370 | + $values['cancel'] = $line[39]; |
|
| 371 | 371 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
| 372 | - $values['registration'] = $line[0]; |
|
| 373 | - $values['base'] = null; |
|
| 374 | - $values['owner'] = $line[4]; |
|
| 375 | - $values['date_first_reg'] = null; |
|
| 376 | - $values['cancel'] = ''; |
|
| 372 | + $values['registration'] = $line[0]; |
|
| 373 | + $values['base'] = null; |
|
| 374 | + $values['owner'] = $line[4]; |
|
| 375 | + $values['date_first_reg'] = null; |
|
| 376 | + $values['cancel'] = ''; |
|
| 377 | 377 | } elseif ($country == 'CC') { |
| 378 | - $values['registration'] = $line[0]; |
|
| 379 | - $values['base'] = null; |
|
| 380 | - $values['owner'] = $line[6]; |
|
| 381 | - $values['date_first_reg'] = null; |
|
| 382 | - $values['cancel'] = ''; |
|
| 378 | + $values['registration'] = $line[0]; |
|
| 379 | + $values['base'] = null; |
|
| 380 | + $values['owner'] = $line[6]; |
|
| 381 | + $values['date_first_reg'] = null; |
|
| 382 | + $values['cancel'] = ''; |
|
| 383 | 383 | } elseif ($country == 'HJ') { |
| 384 | - $values['registration'] = $line[0]; |
|
| 385 | - $values['base'] = null; |
|
| 386 | - $values['owner'] = $line[8]; |
|
| 387 | - if ($line[7] == '') $values['date_first_reg'] = ''; |
|
| 388 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 389 | - $values['cancel'] = ''; |
|
| 384 | + $values['registration'] = $line[0]; |
|
| 385 | + $values['base'] = null; |
|
| 386 | + $values['owner'] = $line[8]; |
|
| 387 | + if ($line[7] == '') $values['date_first_reg'] = ''; |
|
| 388 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 389 | + $values['cancel'] = ''; |
|
| 390 | 390 | } elseif ($country == 'PP') { |
| 391 | - $values['registration'] = $line[0]; |
|
| 392 | - $values['base'] = null; |
|
| 393 | - $values['owner'] = $line[4]; |
|
| 394 | - if ($line[6] == '') $values['date_first_reg'] = ''; |
|
| 395 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 396 | - $values['cancel'] = $line[7]; |
|
| 391 | + $values['registration'] = $line[0]; |
|
| 392 | + $values['base'] = null; |
|
| 393 | + $values['owner'] = $line[4]; |
|
| 394 | + if ($line[6] == '') $values['date_first_reg'] = ''; |
|
| 395 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 396 | + $values['cancel'] = $line[7]; |
|
| 397 | 397 | } elseif ($country == 'E7') { |
| 398 | - $values['registration'] = $line[0]; |
|
| 399 | - $values['base'] = null; |
|
| 400 | - $values['owner'] = $line[4]; |
|
| 401 | - if ($line[5] == '') $values['date_first_reg'] = ''; |
|
| 402 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 403 | - $values['cancel'] = ''; |
|
| 398 | + $values['registration'] = $line[0]; |
|
| 399 | + $values['base'] = null; |
|
| 400 | + $values['owner'] = $line[4]; |
|
| 401 | + if ($line[5] == '') $values['date_first_reg'] = ''; |
|
| 402 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 403 | + $values['cancel'] = ''; |
|
| 404 | 404 | } elseif ($country == '8Q') { |
| 405 | - $values['registration'] = $line[0]; |
|
| 406 | - $values['base'] = null; |
|
| 407 | - $values['owner'] = $line[3]; |
|
| 408 | - if ($line[7] == '') $values['date_first_reg'] = ''; |
|
| 409 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 410 | - $values['cancel'] = ''; |
|
| 405 | + $values['registration'] = $line[0]; |
|
| 406 | + $values['base'] = null; |
|
| 407 | + $values['owner'] = $line[3]; |
|
| 408 | + if ($line[7] == '') $values['date_first_reg'] = ''; |
|
| 409 | + else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 410 | + $values['cancel'] = ''; |
|
| 411 | 411 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 412 | - $values['registration'] = $line[0]; |
|
| 413 | - $values['base'] = null; |
|
| 414 | - $values['owner'] = $line[3]; |
|
| 415 | - $values['date_first_reg'] = ''; |
|
| 416 | - $values['cancel'] = ''; |
|
| 412 | + $values['registration'] = $line[0]; |
|
| 413 | + $values['base'] = null; |
|
| 414 | + $values['owner'] = $line[3]; |
|
| 415 | + $values['date_first_reg'] = ''; |
|
| 416 | + $values['cancel'] = ''; |
|
| 417 | 417 | } |
| 418 | 418 | if ($values['cancel'] == '' && $values['registration'] != null) { |
| 419 | 419 | $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
@@ -535,20 +535,20 @@ discard block |
||
| 535 | 535 | try { |
| 536 | 536 | $Connection = new Connection(); |
| 537 | 537 | $sth = $Connection->db->prepare($query); |
| 538 | - $sth->execute(); |
|
| 539 | - } catch(PDOException $e) { |
|
| 540 | - return "error : ".$e->getMessage(); |
|
| 541 | - } |
|
| 538 | + $sth->execute(); |
|
| 539 | + } catch(PDOException $e) { |
|
| 540 | + return "error : ".$e->getMessage(); |
|
| 541 | + } |
|
| 542 | 542 | |
| 543 | 543 | |
| 544 | 544 | $query = 'ALTER TABLE airport DROP INDEX icaoidx'; |
| 545 | 545 | try { |
| 546 | 546 | $Connection = new Connection(); |
| 547 | 547 | $sth = $Connection->db->prepare($query); |
| 548 | - $sth->execute(); |
|
| 549 | - } catch(PDOException $e) { |
|
| 550 | - return "error : ".$e->getMessage(); |
|
| 551 | - } |
|
| 548 | + $sth->execute(); |
|
| 549 | + } catch(PDOException $e) { |
|
| 550 | + return "error : ".$e->getMessage(); |
|
| 551 | + } |
|
| 552 | 552 | |
| 553 | 553 | $query_dest = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image_thumb`,`image`) |
| 554 | 554 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
@@ -614,10 +614,10 @@ discard block |
||
| 614 | 614 | try { |
| 615 | 615 | $Connection = new Connection(); |
| 616 | 616 | $sth = $Connection->db->prepare($query); |
| 617 | - $sth->execute(); |
|
| 618 | - } catch(PDOException $e) { |
|
| 619 | - return "error : ".$e->getMessage(); |
|
| 620 | - } |
|
| 617 | + $sth->execute(); |
|
| 618 | + } catch(PDOException $e) { |
|
| 619 | + return "error : ".$e->getMessage(); |
|
| 620 | + } |
|
| 621 | 621 | |
| 622 | 622 | |
| 623 | 623 | if ($globalDebug) echo "Insert Not available Airport...\n"; |
@@ -627,10 +627,10 @@ discard block |
||
| 627 | 627 | try { |
| 628 | 628 | $Connection = new Connection(); |
| 629 | 629 | $sth = $Connection->db->prepare($query); |
| 630 | - $sth->execute($query_values); |
|
| 631 | - } catch(PDOException $e) { |
|
| 632 | - return "error : ".$e->getMessage(); |
|
| 633 | - } |
|
| 630 | + $sth->execute($query_values); |
|
| 631 | + } catch(PDOException $e) { |
|
| 632 | + return "error : ".$e->getMessage(); |
|
| 633 | + } |
|
| 634 | 634 | $i++; |
| 635 | 635 | /* |
| 636 | 636 | $query = 'DELETE FROM airport WHERE airport_id IN (SELECT * FROM (SELECT min(a.airport_id) FROM airport a GROUP BY a.icao) x)'; |
@@ -744,7 +744,7 @@ discard block |
||
| 744 | 744 | |
| 745 | 745 | |
| 746 | 746 | |
| 747 | - return "success"; |
|
| 747 | + return "success"; |
|
| 748 | 748 | } |
| 749 | 749 | |
| 750 | 750 | public static function translation() { |
@@ -760,10 +760,10 @@ discard block |
||
| 760 | 760 | try { |
| 761 | 761 | $Connection = new Connection(); |
| 762 | 762 | $sth = $Connection->db->prepare($query); |
| 763 | - $sth->execute(array(':source' => 'translation.csv')); |
|
| 764 | - } catch(PDOException $e) { |
|
| 765 | - return "error : ".$e->getMessage(); |
|
| 766 | - } |
|
| 763 | + $sth->execute(array(':source' => 'translation.csv')); |
|
| 764 | + } catch(PDOException $e) { |
|
| 765 | + return "error : ".$e->getMessage(); |
|
| 766 | + } |
|
| 767 | 767 | |
| 768 | 768 | |
| 769 | 769 | //update_db::unzip($out_file); |
@@ -782,21 +782,21 @@ discard block |
||
| 782 | 782 | $data = $row; |
| 783 | 783 | $operator = $data[2]; |
| 784 | 784 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
| 785 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 786 | - //echo substr($operator, 0, 2)."\n";; |
|
| 787 | - if (count($airline_array) > 0) { |
|
| 785 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator, 0, 2)); |
|
| 786 | + //echo substr($operator, 0, 2)."\n";; |
|
| 787 | + if (count($airline_array) > 0) { |
|
| 788 | 788 | //print_r($airline_array); |
| 789 | 789 | $operator = $airline_array[0]['icao'].substr($operator,2); |
| 790 | - } |
|
| 791 | - } |
|
| 790 | + } |
|
| 791 | + } |
|
| 792 | 792 | |
| 793 | 793 | $operator_correct = $data[3]; |
| 794 | 794 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 795 | - $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 796 | - if (count($airline_array) > 0) { |
|
| 797 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 798 | - } |
|
| 799 | - } |
|
| 795 | + $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
|
| 796 | + if (count($airline_array) > 0) { |
|
| 797 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 798 | + } |
|
| 799 | + } |
|
| 800 | 800 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 801 | 801 | try { |
| 802 | 802 | $sth = $Connection->db->prepare($query); |
@@ -810,7 +810,7 @@ discard block |
||
| 810 | 810 | //$Connection->db->commit(); |
| 811 | 811 | } |
| 812 | 812 | return ''; |
| 813 | - } |
|
| 813 | + } |
|
| 814 | 814 | |
| 815 | 815 | public static function translation_fam() { |
| 816 | 816 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -820,10 +820,10 @@ discard block |
||
| 820 | 820 | try { |
| 821 | 821 | $Connection = new Connection(); |
| 822 | 822 | $sth = $Connection->db->prepare($query); |
| 823 | - $sth->execute(array(':source' => 'website_fam')); |
|
| 824 | - } catch(PDOException $e) { |
|
| 825 | - return "error : ".$e->getMessage(); |
|
| 826 | - } |
|
| 823 | + $sth->execute(array(':source' => 'website_fam')); |
|
| 824 | + } catch(PDOException $e) { |
|
| 825 | + return "error : ".$e->getMessage(); |
|
| 826 | + } |
|
| 827 | 827 | |
| 828 | 828 | |
| 829 | 829 | //update_db::unzip($out_file); |
@@ -852,54 +852,54 @@ discard block |
||
| 852 | 852 | //$Connection->db->commit(); |
| 853 | 853 | } |
| 854 | 854 | return ''; |
| 855 | - } |
|
| 855 | + } |
|
| 856 | 856 | |
| 857 | 857 | /** |
| 858 | - * Convert a HTML table to an array |
|
| 859 | - * @param String $data HTML page |
|
| 860 | - * @return Array array of the tables in HTML page |
|
| 861 | - */ |
|
| 862 | - private static function table2array($data) { |
|
| 863 | - $html = str_get_html($data); |
|
| 864 | - $tabledata=array(); |
|
| 865 | - foreach($html->find('tr') as $element) |
|
| 866 | - { |
|
| 867 | - $td = array(); |
|
| 868 | - foreach( $element->find('th') as $row) |
|
| 869 | - { |
|
| 870 | - $td [] = trim($row->plaintext); |
|
| 871 | - } |
|
| 872 | - $td=array_filter($td); |
|
| 873 | - $tabledata[] = $td; |
|
| 874 | - |
|
| 875 | - $td = array(); |
|
| 876 | - $tdi = array(); |
|
| 877 | - foreach( $element->find('td') as $row) |
|
| 878 | - { |
|
| 879 | - $td [] = trim($row->plaintext); |
|
| 880 | - $tdi [] = trim($row->innertext); |
|
| 881 | - } |
|
| 882 | - $td=array_filter($td); |
|
| 883 | - $tdi=array_filter($tdi); |
|
| 884 | - // $tabledata[]=array_merge($td,$tdi); |
|
| 885 | - $tabledata[]=$td; |
|
| 886 | - } |
|
| 887 | - return(array_filter($tabledata)); |
|
| 888 | - } |
|
| 889 | - |
|
| 890 | - /** |
|
| 891 | - * Get data from form result |
|
| 892 | - * @param String $url form URL |
|
| 893 | - * @return String the result |
|
| 894 | - */ |
|
| 895 | - private static function getData($url) { |
|
| 896 | - $ch = curl_init(); |
|
| 897 | - curl_setopt($ch, CURLOPT_URL, $url); |
|
| 898 | - curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 899 | - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 900 | - 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'); |
|
| 901 | - return curl_exec($ch); |
|
| 902 | - } |
|
| 858 | + * Convert a HTML table to an array |
|
| 859 | + * @param String $data HTML page |
|
| 860 | + * @return Array array of the tables in HTML page |
|
| 861 | + */ |
|
| 862 | + private static function table2array($data) { |
|
| 863 | + $html = str_get_html($data); |
|
| 864 | + $tabledata=array(); |
|
| 865 | + foreach($html->find('tr') as $element) |
|
| 866 | + { |
|
| 867 | + $td = array(); |
|
| 868 | + foreach( $element->find('th') as $row) |
|
| 869 | + { |
|
| 870 | + $td [] = trim($row->plaintext); |
|
| 871 | + } |
|
| 872 | + $td=array_filter($td); |
|
| 873 | + $tabledata[] = $td; |
|
| 874 | + |
|
| 875 | + $td = array(); |
|
| 876 | + $tdi = array(); |
|
| 877 | + foreach( $element->find('td') as $row) |
|
| 878 | + { |
|
| 879 | + $td [] = trim($row->plaintext); |
|
| 880 | + $tdi [] = trim($row->innertext); |
|
| 881 | + } |
|
| 882 | + $td=array_filter($td); |
|
| 883 | + $tdi=array_filter($tdi); |
|
| 884 | + // $tabledata[]=array_merge($td,$tdi); |
|
| 885 | + $tabledata[]=$td; |
|
| 886 | + } |
|
| 887 | + return(array_filter($tabledata)); |
|
| 888 | + } |
|
| 889 | + |
|
| 890 | + /** |
|
| 891 | + * Get data from form result |
|
| 892 | + * @param String $url form URL |
|
| 893 | + * @return String the result |
|
| 894 | + */ |
|
| 895 | + private static function getData($url) { |
|
| 896 | + $ch = curl_init(); |
|
| 897 | + curl_setopt($ch, CURLOPT_URL, $url); |
|
| 898 | + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
|
| 899 | + curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
|
| 900 | + 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'); |
|
| 901 | + return curl_exec($ch); |
|
| 902 | + } |
|
| 903 | 903 | /* |
| 904 | 904 | public static function waypoints() { |
| 905 | 905 | $data = update_db::getData('http://www.fallingrain.com/world/FR/waypoints.html'); |
@@ -949,10 +949,10 @@ discard block |
||
| 949 | 949 | try { |
| 950 | 950 | $Connection = new Connection(); |
| 951 | 951 | $sth = $Connection->db->prepare($query); |
| 952 | - $sth->execute(); |
|
| 953 | - } catch(PDOException $e) { |
|
| 954 | - return "error : ".$e->getMessage(); |
|
| 955 | - } |
|
| 952 | + $sth->execute(); |
|
| 953 | + } catch(PDOException $e) { |
|
| 954 | + return "error : ".$e->getMessage(); |
|
| 955 | + } |
|
| 956 | 956 | |
| 957 | 957 | |
| 958 | 958 | //update_db::unzip($out_file); |
@@ -991,7 +991,7 @@ discard block |
||
| 991 | 991 | if ($globalTransaction) $Connection->db->commit(); |
| 992 | 992 | } |
| 993 | 993 | return ''; |
| 994 | - } |
|
| 994 | + } |
|
| 995 | 995 | |
| 996 | 996 | public static function ivao_airlines($filename) { |
| 997 | 997 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1000,10 +1000,10 @@ discard block |
||
| 1000 | 1000 | try { |
| 1001 | 1001 | $Connection = new Connection(); |
| 1002 | 1002 | $sth = $Connection->db->prepare($query); |
| 1003 | - $sth->execute(); |
|
| 1004 | - } catch(PDOException $e) { |
|
| 1005 | - return "error : ".$e->getMessage(); |
|
| 1006 | - } |
|
| 1003 | + $sth->execute(); |
|
| 1004 | + } catch(PDOException $e) { |
|
| 1005 | + return "error : ".$e->getMessage(); |
|
| 1006 | + } |
|
| 1007 | 1007 | |
| 1008 | 1008 | $header = NULL; |
| 1009 | 1009 | $delimiter = ':'; |
@@ -1027,7 +1027,7 @@ discard block |
||
| 1027 | 1027 | if ($globalTransaction) $Connection->db->commit(); |
| 1028 | 1028 | } |
| 1029 | 1029 | return ''; |
| 1030 | - } |
|
| 1030 | + } |
|
| 1031 | 1031 | |
| 1032 | 1032 | public static function update_airspace() { |
| 1033 | 1033 | global $tmp_dir, $globalDBdriver; |
@@ -1053,10 +1053,10 @@ discard block |
||
| 1053 | 1053 | $query = 'DROP TABLE countries'; |
| 1054 | 1054 | try { |
| 1055 | 1055 | $sth = $Connection->db->prepare($query); |
| 1056 | - $sth->execute(); |
|
| 1057 | - } catch(PDOException $e) { |
|
| 1058 | - echo "error : ".$e->getMessage(); |
|
| 1059 | - } |
|
| 1056 | + $sth->execute(); |
|
| 1057 | + } catch(PDOException $e) { |
|
| 1058 | + echo "error : ".$e->getMessage(); |
|
| 1059 | + } |
|
| 1060 | 1060 | } |
| 1061 | 1061 | if ($globalDBdriver == 'mysql') { |
| 1062 | 1062 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -1401,12 +1401,12 @@ discard block |
||
| 1401 | 1401 | echo $data; |
| 1402 | 1402 | */ |
| 1403 | 1403 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 1404 | - var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1405 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1406 | - $result = fread($fh,100000000); |
|
| 1407 | - //echo $result; |
|
| 1408 | - var_dump(str_get_html($result)); |
|
| 1409 | - //print_r(self::table2array($result)); |
|
| 1404 | + var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1405 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1406 | + $result = fread($fh,100000000); |
|
| 1407 | + //echo $result; |
|
| 1408 | + var_dump(str_get_html($result)); |
|
| 1409 | + //print_r(self::table2array($result)); |
|
| 1410 | 1410 | } |
| 1411 | 1411 | |
| 1412 | 1412 | } |
@@ -1420,10 +1420,10 @@ discard block |
||
| 1420 | 1420 | try { |
| 1421 | 1421 | $Connection = new Connection(); |
| 1422 | 1422 | $sth = $Connection->db->prepare($query); |
| 1423 | - $sth->execute(); |
|
| 1424 | - } catch(PDOException $e) { |
|
| 1425 | - return "error : ".$e->getMessage(); |
|
| 1426 | - } |
|
| 1423 | + $sth->execute(); |
|
| 1424 | + } catch(PDOException $e) { |
|
| 1425 | + return "error : ".$e->getMessage(); |
|
| 1426 | + } |
|
| 1427 | 1427 | |
| 1428 | 1428 | $error = ''; |
| 1429 | 1429 | if ($globalDebug) echo "Notam : Download..."; |
@@ -1479,8 +1479,8 @@ discard block |
||
| 1479 | 1479 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
| 1480 | 1480 | $data['permanent'] = 0; |
| 1481 | 1481 | } else { |
| 1482 | - $data['date_end'] = NULL; |
|
| 1483 | - $data['permanent'] = 1; |
|
| 1482 | + $data['date_end'] = NULL; |
|
| 1483 | + $data['permanent'] = 1; |
|
| 1484 | 1484 | } |
| 1485 | 1485 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 1486 | 1486 | $NOTAM = new NOTAM(); |
@@ -1504,13 +1504,13 @@ discard block |
||
| 1504 | 1504 | try { |
| 1505 | 1505 | $Connection = new Connection(); |
| 1506 | 1506 | $sth = $Connection->db->prepare($query); |
| 1507 | - $sth->execute(); |
|
| 1508 | - } catch(PDOException $e) { |
|
| 1509 | - return "error : ".$e->getMessage(); |
|
| 1510 | - } |
|
| 1511 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1512 | - if ($row['nb'] > 0) return false; |
|
| 1513 | - else return true; |
|
| 1507 | + $sth->execute(); |
|
| 1508 | + } catch(PDOException $e) { |
|
| 1509 | + return "error : ".$e->getMessage(); |
|
| 1510 | + } |
|
| 1511 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1512 | + if ($row['nb'] > 0) return false; |
|
| 1513 | + else return true; |
|
| 1514 | 1514 | } |
| 1515 | 1515 | |
| 1516 | 1516 | public static function insert_last_update() { |
@@ -1519,10 +1519,10 @@ discard block |
||
| 1519 | 1519 | try { |
| 1520 | 1520 | $Connection = new Connection(); |
| 1521 | 1521 | $sth = $Connection->db->prepare($query); |
| 1522 | - $sth->execute(); |
|
| 1523 | - } catch(PDOException $e) { |
|
| 1524 | - return "error : ".$e->getMessage(); |
|
| 1525 | - } |
|
| 1522 | + $sth->execute(); |
|
| 1523 | + } catch(PDOException $e) { |
|
| 1524 | + return "error : ".$e->getMessage(); |
|
| 1525 | + } |
|
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | public static function check_last_notam_update() { |
@@ -1535,13 +1535,13 @@ discard block |
||
| 1535 | 1535 | try { |
| 1536 | 1536 | $Connection = new Connection(); |
| 1537 | 1537 | $sth = $Connection->db->prepare($query); |
| 1538 | - $sth->execute(); |
|
| 1539 | - } catch(PDOException $e) { |
|
| 1540 | - return "error : ".$e->getMessage(); |
|
| 1541 | - } |
|
| 1542 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1543 | - if ($row['nb'] > 0) return false; |
|
| 1544 | - else return true; |
|
| 1538 | + $sth->execute(); |
|
| 1539 | + } catch(PDOException $e) { |
|
| 1540 | + return "error : ".$e->getMessage(); |
|
| 1541 | + } |
|
| 1542 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1543 | + if ($row['nb'] > 0) return false; |
|
| 1544 | + else return true; |
|
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | 1547 | public static function insert_last_notam_update() { |
@@ -1550,10 +1550,10 @@ discard block |
||
| 1550 | 1550 | try { |
| 1551 | 1551 | $Connection = new Connection(); |
| 1552 | 1552 | $sth = $Connection->db->prepare($query); |
| 1553 | - $sth->execute(); |
|
| 1554 | - } catch(PDOException $e) { |
|
| 1555 | - return "error : ".$e->getMessage(); |
|
| 1556 | - } |
|
| 1553 | + $sth->execute(); |
|
| 1554 | + } catch(PDOException $e) { |
|
| 1555 | + return "error : ".$e->getMessage(); |
|
| 1556 | + } |
|
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | public static function check_last_owner_update() { |
@@ -1566,13 +1566,13 @@ discard block |
||
| 1566 | 1566 | try { |
| 1567 | 1567 | $Connection = new Connection(); |
| 1568 | 1568 | $sth = $Connection->db->prepare($query); |
| 1569 | - $sth->execute(); |
|
| 1570 | - } catch(PDOException $e) { |
|
| 1571 | - return "error : ".$e->getMessage(); |
|
| 1572 | - } |
|
| 1573 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1574 | - if ($row['nb'] > 0) return false; |
|
| 1575 | - else return true; |
|
| 1569 | + $sth->execute(); |
|
| 1570 | + } catch(PDOException $e) { |
|
| 1571 | + return "error : ".$e->getMessage(); |
|
| 1572 | + } |
|
| 1573 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1574 | + if ($row['nb'] > 0) return false; |
|
| 1575 | + else return true; |
|
| 1576 | 1576 | } |
| 1577 | 1577 | |
| 1578 | 1578 | public static function insert_last_owner_update() { |
@@ -1581,10 +1581,10 @@ discard block |
||
| 1581 | 1581 | try { |
| 1582 | 1582 | $Connection = new Connection(); |
| 1583 | 1583 | $sth = $Connection->db->prepare($query); |
| 1584 | - $sth->execute(); |
|
| 1585 | - } catch(PDOException $e) { |
|
| 1586 | - return "error : ".$e->getMessage(); |
|
| 1587 | - } |
|
| 1584 | + $sth->execute(); |
|
| 1585 | + } catch(PDOException $e) { |
|
| 1586 | + return "error : ".$e->getMessage(); |
|
| 1587 | + } |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | public static function update_all() { |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | $metar_info = $METAR->getMETAR($airport_icao); |
| 47 | 47 | //print_r($metar_info); |
| 48 | 48 | if (isset($metar_info[0]['metar'])) $metar_parse = $METAR->parse($metar_info[0]['metar']); |
| 49 | - //print_r($metar_parse); |
|
| 49 | + //print_r($metar_parse); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | $title = sprintf(_("Detailed View for %s, %s (%s)"),$airport_array[0]['city'],$airport_array[0]['name'],$airport_array[0]['icao']); |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | function drawChart6() { |
| 100 | 100 | var data = google.visualization.arrayToDataTable([ |
| 101 | 101 | ["'._("Date").'","'._("Departure").'","'._("Arrival").'"], '; |
| 102 | - $airport_data = ''; |
|
| 103 | - foreach($all_data as $data) |
|
| 104 | - { |
|
| 105 | - $airport_data .= '[ "'.$data['date'].'",'.$data['departure'].','.$data['arrival'].'],'; |
|
| 106 | - } |
|
| 107 | - $airport_data = substr($airport_data, 0, -1); |
|
| 108 | - print $airport_data.']); |
|
| 102 | + $airport_data = ''; |
|
| 103 | + foreach($all_data as $data) |
|
| 104 | + { |
|
| 105 | + $airport_data .= '[ "'.$data['date'].'",'.$data['departure'].','.$data['arrival'].'],'; |
|
| 106 | + } |
|
| 107 | + $airport_data = substr($airport_data, 0, -1); |
|
| 108 | + print $airport_data.']); |
|
| 109 | 109 | |
| 110 | 110 | var options = { |
| 111 | 111 | legend: {position: "none"}, |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | function drawChart() { |
| 39 | 39 | var data = google.visualization.arrayToDataTable([ |
| 40 | 40 | ["'._("Hour").'", "'._("# of Flights").'"], '; |
| 41 | - $hour_data = ''; |
|
| 41 | + $hour_data = ''; |
|
| 42 | 42 | foreach($hour_array as $hour_item) |
| 43 | 43 | { |
| 44 | 44 | $hour_data .= '[ "'.date("ga", strtotime($hour_item['hour_name'].":00")).'",'.$hour_item['hour_count'].'],'; |
@@ -3,8 +3,8 @@ |
||
| 3 | 3 | require_once('require/class.Spotter.php'); |
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | if (!isset($_GET['ident'])) { |
| 6 | - header('Location: '.$globalURL.'/ident'); |
|
| 7 | - die(); |
|
| 6 | + header('Location: '.$globalURL.'/ident'); |
|
| 7 | + die(); |
|
| 8 | 8 | } |
| 9 | 9 | $Spotter = new Spotter(); |
| 10 | 10 | $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
@@ -20,16 +20,16 @@ discard block |
||
| 20 | 20 | print '<div class="select-item">'; |
| 21 | 21 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
| 22 | 22 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
| 23 | - print '<option></option>'; |
|
| 24 | - $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 25 | - foreach($aircraft_types as $aircrafttype) |
|
| 26 | - { |
|
| 27 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 28 | - { |
|
| 29 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 30 | - } else { |
|
| 31 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 32 | - } |
|
| 23 | + print '<option></option>'; |
|
| 24 | + $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 25 | + foreach($aircraft_types as $aircrafttype) |
|
| 26 | + { |
|
| 27 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 28 | + { |
|
| 29 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 30 | + } else { |
|
| 31 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 32 | + } |
|
| 33 | 33 | } |
| 34 | 34 | print '</select>'; |
| 35 | 35 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | function drawChart() { |
| 62 | 62 | var data = google.visualization.arrayToDataTable([ |
| 63 | 63 | ["Country", "# of times"], '; |
| 64 | - $country_data = ''; |
|
| 64 | + $country_data = ''; |
|
| 65 | 65 | foreach($airline_array as $airline_item) |
| 66 | 66 | { |
| 67 | 67 | $country_data .= '[ "'.$airline_item['airline_country'].'",'.$airline_item['airline_country_count'].'],'; |
@@ -4,66 +4,66 @@ |
||
| 4 | 4 | $hex = str_replace("#", "", $hex); |
| 5 | 5 | $color = array(); |
| 6 | 6 | if (strlen($hex) == 3) { |
| 7 | - $color['r'] = hexdec(substr($hex, 0, 1) . $r); |
|
| 8 | - $color['g'] = hexdec(substr($hex, 1, 1) . $g); |
|
| 9 | - $color['b'] = hexdec(substr($hex, 2, 1) . $b); |
|
| 7 | + $color['r'] = hexdec(substr($hex, 0, 1) . $r); |
|
| 8 | + $color['g'] = hexdec(substr($hex, 1, 1) . $g); |
|
| 9 | + $color['b'] = hexdec(substr($hex, 2, 1) . $b); |
|
| 10 | 10 | } else if (strlen($hex) == 6) { |
| 11 | - $color['r'] = hexdec(substr($hex, 0, 2)); |
|
| 12 | - $color['g'] = hexdec(substr($hex, 2, 2)); |
|
| 13 | - $color['b'] = hexdec(substr($hex, 4, 2)); |
|
| 11 | + $color['r'] = hexdec(substr($hex, 0, 2)); |
|
| 12 | + $color['g'] = hexdec(substr($hex, 2, 2)); |
|
| 13 | + $color['b'] = hexdec(substr($hex, 4, 2)); |
|
| 14 | 14 | } |
| 15 | 15 | return $color; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
| 19 | 19 | if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { |
| 20 | - exit(0); |
|
| 20 | + exit(0); |
|
| 21 | 21 | } |
| 22 | 22 | $color = $_GET['color']; |
| 23 | 23 | if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) { |
| 24 | - echo "Incorrect filename"; |
|
| 25 | - exit(0); |
|
| 24 | + echo "Incorrect filename"; |
|
| 25 | + exit(0); |
|
| 26 | 26 | } |
| 27 | 27 | $filename = $_GET['filename']; |
| 28 | 28 | if (file_exists(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename)) { |
| 29 | - header('Content-type: image/png'); |
|
| 30 | - readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
| 31 | - exit(0); |
|
| 29 | + header('Content-type: image/png'); |
|
| 30 | + readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR.$color.'-'.$filename); |
|
| 31 | + exit(0); |
|
| 32 | 32 | } |
| 33 | 33 | $original = dirname(__FILE__).DIRECTORY_SEPARATOR.'images'.DIRECTORY_SEPARATOR.'aircrafts'.DIRECTORY_SEPARATOR.'new'.DIRECTORY_SEPARATOR.$filename; |
| 34 | 34 | if (!file_exists($original)) { |
| 35 | - echo "File not found"; |
|
| 35 | + echo "File not found"; |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 39 | - $image = imagecreatefrompng($original); |
|
| 40 | - $index = imagecolorexact($image,26,49,81); |
|
| 41 | - if ($index < 0) { |
|
| 39 | + $image = imagecreatefrompng($original); |
|
| 40 | + $index = imagecolorexact($image,26,49,81); |
|
| 41 | + if ($index < 0) { |
|
| 42 | 42 | $index = imagecolorexact($image,25,49,79); |
| 43 | - } |
|
| 44 | - if ($index < 0) { |
|
| 43 | + } |
|
| 44 | + if ($index < 0) { |
|
| 45 | 45 | $index = imagecolorexact($image,0,0,0); |
| 46 | - } |
|
| 47 | - $c = hexToRGB($color); |
|
| 48 | - imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
| 46 | + } |
|
| 47 | + $c = hexToRGB($color); |
|
| 48 | + imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
| 49 | 49 | /* |
| 50 | 50 | $ig = imagecolorat($image, 0, 0); |
| 51 | 51 | imagecolortransparent($image, $ig); |
| 52 | 52 | */ |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - header('Content-type: image/png'); |
|
| 56 | - imagealphablending($image, false); |
|
| 57 | - imagesavealpha($image, true); |
|
| 58 | - imagepng($image); |
|
| 59 | - if (is_writable('cache')) { |
|
| 60 | - imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
| 61 | - } |
|
| 55 | + header('Content-type: image/png'); |
|
| 56 | + imagealphablending($image, false); |
|
| 57 | + imagesavealpha($image, true); |
|
| 58 | + imagepng($image); |
|
| 59 | + if (is_writable('cache')) { |
|
| 60 | + imagepng($image,dirname(__FILE__).DIRECTORY_SEPARATOR.'cache/'.$color.'-'.$filename); |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - imagedestroy($image); |
|
| 63 | + imagedestroy($image); |
|
| 64 | 64 | } else { |
| 65 | - header('Content-type: image/png'); |
|
| 66 | - if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
| 67 | - else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
| 65 | + header('Content-type: image/png'); |
|
| 66 | + if ($color == 'FF0000') readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/selected/'.$filename); |
|
| 67 | + else readfile(dirname(__FILE__).DIRECTORY_SEPARATOR.'images/aircrafts/'.$filename); |
|
| 68 | 68 | } |
| 69 | 69 | ?> |
| 70 | 70 | \ No newline at end of file |