@@ -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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 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'] = null; |
|
| 416 | - $values['cancel'] = ''; |
|
| 412 | + $values['registration'] = $line[0]; |
|
| 413 | + $values['base'] = null; |
|
| 414 | + $values['owner'] = $line[3]; |
|
| 415 | + $values['date_first_reg'] = null; |
|
| 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); |
@@ -993,7 +993,7 @@ discard block |
||
| 993 | 993 | if ($globalTransaction) $Connection->db->commit(); |
| 994 | 994 | } |
| 995 | 995 | return ''; |
| 996 | - } |
|
| 996 | + } |
|
| 997 | 997 | |
| 998 | 998 | public static function ivao_airlines($filename) { |
| 999 | 999 | //require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
@@ -1002,10 +1002,10 @@ discard block |
||
| 1002 | 1002 | try { |
| 1003 | 1003 | $Connection = new Connection(); |
| 1004 | 1004 | $sth = $Connection->db->prepare($query); |
| 1005 | - $sth->execute(); |
|
| 1006 | - } catch(PDOException $e) { |
|
| 1007 | - return "error : ".$e->getMessage(); |
|
| 1008 | - } |
|
| 1005 | + $sth->execute(); |
|
| 1006 | + } catch(PDOException $e) { |
|
| 1007 | + return "error : ".$e->getMessage(); |
|
| 1008 | + } |
|
| 1009 | 1009 | |
| 1010 | 1010 | $header = NULL; |
| 1011 | 1011 | $delimiter = ':'; |
@@ -1029,7 +1029,7 @@ discard block |
||
| 1029 | 1029 | if ($globalTransaction) $Connection->db->commit(); |
| 1030 | 1030 | } |
| 1031 | 1031 | return ''; |
| 1032 | - } |
|
| 1032 | + } |
|
| 1033 | 1033 | |
| 1034 | 1034 | public static function update_airspace() { |
| 1035 | 1035 | global $tmp_dir, $globalDBdriver; |
@@ -1065,10 +1065,10 @@ discard block |
||
| 1065 | 1065 | $query = 'DROP TABLE countries'; |
| 1066 | 1066 | try { |
| 1067 | 1067 | $sth = $Connection->db->prepare($query); |
| 1068 | - $sth->execute(); |
|
| 1069 | - } catch(PDOException $e) { |
|
| 1070 | - echo "error : ".$e->getMessage(); |
|
| 1071 | - } |
|
| 1068 | + $sth->execute(); |
|
| 1069 | + } catch(PDOException $e) { |
|
| 1070 | + echo "error : ".$e->getMessage(); |
|
| 1071 | + } |
|
| 1072 | 1072 | } |
| 1073 | 1073 | if ($globalDBdriver == 'mysql') { |
| 1074 | 1074 | update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
@@ -1413,12 +1413,12 @@ discard block |
||
| 1413 | 1413 | echo $data; |
| 1414 | 1414 | */ |
| 1415 | 1415 | if (file_exists($tmp_dir.'aircrafts.html')) { |
| 1416 | - //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1417 | - $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1418 | - $result = fread($fh,100000000); |
|
| 1419 | - //echo $result; |
|
| 1420 | - //var_dump(str_get_html($result)); |
|
| 1421 | - //print_r(self::table2array($result)); |
|
| 1416 | + //var_dump(file_get_html($tmp_dir.'aircrafts.html')); |
|
| 1417 | + $fh = fopen($tmp_dir.'aircrafts.html',"r"); |
|
| 1418 | + $result = fread($fh,100000000); |
|
| 1419 | + //echo $result; |
|
| 1420 | + //var_dump(str_get_html($result)); |
|
| 1421 | + //print_r(self::table2array($result)); |
|
| 1422 | 1422 | } |
| 1423 | 1423 | |
| 1424 | 1424 | } |
@@ -1432,10 +1432,10 @@ discard block |
||
| 1432 | 1432 | try { |
| 1433 | 1433 | $Connection = new Connection(); |
| 1434 | 1434 | $sth = $Connection->db->prepare($query); |
| 1435 | - $sth->execute(); |
|
| 1436 | - } catch(PDOException $e) { |
|
| 1437 | - return "error : ".$e->getMessage(); |
|
| 1438 | - } |
|
| 1435 | + $sth->execute(); |
|
| 1436 | + } catch(PDOException $e) { |
|
| 1437 | + return "error : ".$e->getMessage(); |
|
| 1438 | + } |
|
| 1439 | 1439 | |
| 1440 | 1440 | $error = ''; |
| 1441 | 1441 | if ($globalDebug) echo "Notam : Download..."; |
@@ -1491,8 +1491,8 @@ discard block |
||
| 1491 | 1491 | $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
| 1492 | 1492 | $data['permanent'] = 0; |
| 1493 | 1493 | } else { |
| 1494 | - $data['date_end'] = NULL; |
|
| 1495 | - $data['permanent'] = 1; |
|
| 1494 | + $data['date_end'] = NULL; |
|
| 1495 | + $data['permanent'] = 1; |
|
| 1496 | 1496 | } |
| 1497 | 1497 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 1498 | 1498 | $NOTAM = new NOTAM(); |
@@ -1516,13 +1516,13 @@ discard block |
||
| 1516 | 1516 | try { |
| 1517 | 1517 | $Connection = new Connection(); |
| 1518 | 1518 | $sth = $Connection->db->prepare($query); |
| 1519 | - $sth->execute(); |
|
| 1520 | - } catch(PDOException $e) { |
|
| 1521 | - return "error : ".$e->getMessage(); |
|
| 1522 | - } |
|
| 1523 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1524 | - if ($row['nb'] > 0) return false; |
|
| 1525 | - else return true; |
|
| 1519 | + $sth->execute(); |
|
| 1520 | + } catch(PDOException $e) { |
|
| 1521 | + return "error : ".$e->getMessage(); |
|
| 1522 | + } |
|
| 1523 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1524 | + if ($row['nb'] > 0) return false; |
|
| 1525 | + else return true; |
|
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | public static function insert_last_update() { |
@@ -1531,10 +1531,10 @@ discard block |
||
| 1531 | 1531 | try { |
| 1532 | 1532 | $Connection = new Connection(); |
| 1533 | 1533 | $sth = $Connection->db->prepare($query); |
| 1534 | - $sth->execute(); |
|
| 1535 | - } catch(PDOException $e) { |
|
| 1536 | - return "error : ".$e->getMessage(); |
|
| 1537 | - } |
|
| 1534 | + $sth->execute(); |
|
| 1535 | + } catch(PDOException $e) { |
|
| 1536 | + return "error : ".$e->getMessage(); |
|
| 1537 | + } |
|
| 1538 | 1538 | } |
| 1539 | 1539 | |
| 1540 | 1540 | public static function check_last_notam_update() { |
@@ -1547,13 +1547,13 @@ discard block |
||
| 1547 | 1547 | try { |
| 1548 | 1548 | $Connection = new Connection(); |
| 1549 | 1549 | $sth = $Connection->db->prepare($query); |
| 1550 | - $sth->execute(); |
|
| 1551 | - } catch(PDOException $e) { |
|
| 1552 | - return "error : ".$e->getMessage(); |
|
| 1553 | - } |
|
| 1554 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1555 | - if ($row['nb'] > 0) return false; |
|
| 1556 | - else return true; |
|
| 1550 | + $sth->execute(); |
|
| 1551 | + } catch(PDOException $e) { |
|
| 1552 | + return "error : ".$e->getMessage(); |
|
| 1553 | + } |
|
| 1554 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1555 | + if ($row['nb'] > 0) return false; |
|
| 1556 | + else return true; |
|
| 1557 | 1557 | } |
| 1558 | 1558 | |
| 1559 | 1559 | public static function insert_last_notam_update() { |
@@ -1562,10 +1562,10 @@ discard block |
||
| 1562 | 1562 | try { |
| 1563 | 1563 | $Connection = new Connection(); |
| 1564 | 1564 | $sth = $Connection->db->prepare($query); |
| 1565 | - $sth->execute(); |
|
| 1566 | - } catch(PDOException $e) { |
|
| 1567 | - return "error : ".$e->getMessage(); |
|
| 1568 | - } |
|
| 1565 | + $sth->execute(); |
|
| 1566 | + } catch(PDOException $e) { |
|
| 1567 | + return "error : ".$e->getMessage(); |
|
| 1568 | + } |
|
| 1569 | 1569 | } |
| 1570 | 1570 | |
| 1571 | 1571 | public static function check_last_owner_update() { |
@@ -1578,13 +1578,13 @@ discard block |
||
| 1578 | 1578 | try { |
| 1579 | 1579 | $Connection = new Connection(); |
| 1580 | 1580 | $sth = $Connection->db->prepare($query); |
| 1581 | - $sth->execute(); |
|
| 1582 | - } catch(PDOException $e) { |
|
| 1583 | - return "error : ".$e->getMessage(); |
|
| 1584 | - } |
|
| 1585 | - $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1586 | - if ($row['nb'] > 0) return false; |
|
| 1587 | - else return true; |
|
| 1581 | + $sth->execute(); |
|
| 1582 | + } catch(PDOException $e) { |
|
| 1583 | + return "error : ".$e->getMessage(); |
|
| 1584 | + } |
|
| 1585 | + $row = $sth->fetch(PDO::FETCH_ASSOC); |
|
| 1586 | + if ($row['nb'] > 0) return false; |
|
| 1587 | + else return true; |
|
| 1588 | 1588 | } |
| 1589 | 1589 | |
| 1590 | 1590 | public static function insert_last_owner_update() { |
@@ -1593,10 +1593,10 @@ discard block |
||
| 1593 | 1593 | try { |
| 1594 | 1594 | $Connection = new Connection(); |
| 1595 | 1595 | $sth = $Connection->db->prepare($query); |
| 1596 | - $sth->execute(); |
|
| 1597 | - } catch(PDOException $e) { |
|
| 1598 | - return "error : ".$e->getMessage(); |
|
| 1599 | - } |
|
| 1596 | + $sth->execute(); |
|
| 1597 | + } catch(PDOException $e) { |
|
| 1598 | + return "error : ".$e->getMessage(); |
|
| 1599 | + } |
|
| 1600 | 1600 | } |
| 1601 | 1601 | |
| 1602 | 1602 | public static function update_all() { |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | curl_setopt($ch, CURLOPT_URL, $url); |
| 17 | 17 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 18 | 18 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 19 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 19 | + if ($referer != '') { |
|
| 20 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 21 | + } |
|
| 20 | 22 | 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'); |
| 21 | 23 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 22 | 24 | $data = curl_exec($ch); |
@@ -26,11 +28,16 @@ discard block |
||
| 26 | 28 | public static function gunzip($in_file,$out_file_name = '') { |
| 27 | 29 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 28 | 30 | $buffer_size = 4096; // read 4kb at a time |
| 29 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 31 | + if ($out_file_name == '') { |
|
| 32 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 33 | + } |
|
| 30 | 34 | if ($in_file != '' && file_exists($in_file)) { |
| 31 | 35 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 32 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 33 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 36 | + if (function_exists('gzopen')) { |
|
| 37 | + $file = gzopen($in_file,'rb'); |
|
| 38 | + } elseif (function_exists('gzopen64')) { |
|
| 39 | + $file = gzopen64($in_file,'rb'); |
|
| 40 | + } |
|
| 34 | 41 | $out_file = fopen($out_file_name, 'wb'); |
| 35 | 42 | while(!gzeof($file)) { |
| 36 | 43 | fwrite($out_file, gzread($file, $buffer_size)); |
@@ -48,8 +55,12 @@ discard block |
||
| 48 | 55 | if ($res === TRUE) { |
| 49 | 56 | $zip->extractTo($path); |
| 50 | 57 | $zip->close(); |
| 51 | - } else return false; |
|
| 52 | - } else return false; |
|
| 58 | + } else { |
|
| 59 | + return false; |
|
| 60 | + } |
|
| 61 | + } else { |
|
| 62 | + return false; |
|
| 63 | + } |
|
| 53 | 64 | } |
| 54 | 65 | |
| 55 | 66 | public static function connect_sqlite($database) { |
@@ -64,7 +75,9 @@ discard block |
||
| 64 | 75 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 65 | 76 | global $globalDebug, $globalTransaction; |
| 66 | 77 | //$query = 'TRUNCATE TABLE routes'; |
| 67 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 78 | + if ($globalDebug) { |
|
| 79 | + echo " - Delete previous routes from DB -"; |
|
| 80 | + } |
|
| 68 | 81 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 69 | 82 | $Connection = new Connection(); |
| 70 | 83 | try { |
@@ -75,7 +88,9 @@ discard block |
||
| 75 | 88 | return "error : ".$e->getMessage(); |
| 76 | 89 | } |
| 77 | 90 | |
| 78 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 91 | + if ($globalDebug) { |
|
| 92 | + echo " - Add routes to DB -"; |
|
| 93 | + } |
|
| 79 | 94 | update_db::connect_sqlite($database_file); |
| 80 | 95 | //$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 | 96 | $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"; |
@@ -90,15 +105,21 @@ discard block |
||
| 90 | 105 | $Connection = new Connection(); |
| 91 | 106 | $sth_dest = $Connection->db->prepare($query_dest); |
| 92 | 107 | try { |
| 93 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 108 | + if ($globalTransaction) { |
|
| 109 | + $Connection->db->beginTransaction(); |
|
| 110 | + } |
|
| 94 | 111 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 95 | 112 | //$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 | 113 | $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 | 114 | $sth_dest->execute($query_dest_values); |
| 98 | 115 | } |
| 99 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 116 | + if ($globalTransaction) { |
|
| 117 | + $Connection->db->commit(); |
|
| 118 | + } |
|
| 100 | 119 | } catch(PDOException $e) { |
| 101 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 120 | + if ($globalTransaction) { |
|
| 121 | + $Connection->db->rollBack(); |
|
| 122 | + } |
|
| 102 | 123 | return "error : ".$e->getMessage(); |
| 103 | 124 | } |
| 104 | 125 | return ''; |
@@ -140,11 +161,16 @@ discard block |
||
| 140 | 161 | $sth_dest = $Connection->db->prepare($query_dest); |
| 141 | 162 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 142 | 163 | try { |
| 143 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 164 | + if ($globalTransaction) { |
|
| 165 | + $Connection->db->beginTransaction(); |
|
| 166 | + } |
|
| 144 | 167 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 145 | 168 | //$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 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
| 147 | - else $type = null; |
|
| 169 | + if ($values['UserString4'] == 'M') { |
|
| 170 | + $type = 'military'; |
|
| 171 | + } else { |
|
| 172 | + $type = null; |
|
| 173 | + } |
|
| 148 | 174 | $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 | 175 | $sth_dest->execute($query_dest_values); |
| 150 | 176 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -152,7 +178,9 @@ discard block |
||
| 152 | 178 | $sth_dest_owner->execute($query_dest_owner_values); |
| 153 | 179 | } |
| 154 | 180 | } |
| 155 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 181 | + if ($globalTransaction) { |
|
| 182 | + $Connection->db->commit(); |
|
| 183 | + } |
|
| 156 | 184 | } catch(PDOException $e) { |
| 157 | 185 | return "error : ".$e->getMessage(); |
| 158 | 186 | } |
@@ -188,7 +216,9 @@ discard block |
||
| 188 | 216 | $Connection = new Connection(); |
| 189 | 217 | $sth_dest = $Connection->db->prepare($query_dest); |
| 190 | 218 | try { |
| 191 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 219 | + if ($globalTransaction) { |
|
| 220 | + $Connection->db->beginTransaction(); |
|
| 221 | + } |
|
| 192 | 222 | while (!feof($fh)) { |
| 193 | 223 | $line = $Common->hex2str(fgets($fh,9999)); |
| 194 | 224 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
@@ -198,7 +228,9 @@ discard block |
||
| 198 | 228 | // Check if we can find ICAO, else set it to GLID |
| 199 | 229 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 200 | 230 | $search_more = ''; |
| 201 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 231 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 232 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 233 | + } |
|
| 202 | 234 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 203 | 235 | $sth_search = $Connection->db->prepare($query_search); |
| 204 | 236 | try { |
@@ -211,7 +243,9 @@ discard block |
||
| 211 | 243 | } catch(PDOException $e) { |
| 212 | 244 | return "error : ".$e->getMessage(); |
| 213 | 245 | } |
| 214 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
| 246 | + if (!isset($values['ICAOTypeCode'])) { |
|
| 247 | + $values['ICAOTypeCode'] = 'GLID'; |
|
| 248 | + } |
|
| 215 | 249 | // Add data to db |
| 216 | 250 | if ($values['ModeS'] != '' && $values['Registration'] != '' && $values['Registration'] != '0000') { |
| 217 | 251 | //$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']); |
@@ -220,7 +254,9 @@ discard block |
||
| 220 | 254 | $sth_dest->execute($query_dest_values); |
| 221 | 255 | } |
| 222 | 256 | } |
| 223 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 257 | + if ($globalTransaction) { |
|
| 258 | + $Connection->db->commit(); |
|
| 259 | + } |
|
| 224 | 260 | } catch(PDOException $e) { |
| 225 | 261 | return "error : ".$e->getMessage(); |
| 226 | 262 | } |
@@ -256,7 +292,9 @@ discard block |
||
| 256 | 292 | $Connection = new Connection(); |
| 257 | 293 | $sth_dest = $Connection->db->prepare($query_dest); |
| 258 | 294 | try { |
| 259 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 295 | + if ($globalTransaction) { |
|
| 296 | + $Connection->db->beginTransaction(); |
|
| 297 | + } |
|
| 260 | 298 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 261 | 299 | while (!feof($fh)) { |
| 262 | 300 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -269,13 +307,17 @@ discard block |
||
| 269 | 307 | // Check if we can find ICAO, else set it to GLID |
| 270 | 308 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 271 | 309 | $search_more = ''; |
| 272 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 310 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 311 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 312 | + } |
|
| 273 | 313 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 274 | 314 | $sth_search = $Connection->db->prepare($query_search); |
| 275 | 315 | try { |
| 276 | 316 | $sth_search->execute(); |
| 277 | 317 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 278 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 318 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 319 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 320 | + } |
|
| 279 | 321 | } catch(PDOException $e) { |
| 280 | 322 | return "error : ".$e->getMessage(); |
| 281 | 323 | } |
@@ -288,7 +330,9 @@ discard block |
||
| 288 | 330 | $sth_dest->execute($query_dest_values); |
| 289 | 331 | } |
| 290 | 332 | } |
| 291 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 333 | + if ($globalTransaction) { |
|
| 334 | + $Connection->db->commit(); |
|
| 335 | + } |
|
| 292 | 336 | } catch(PDOException $e) { |
| 293 | 337 | return "error : ".$e->getMessage(); |
| 294 | 338 | } |
@@ -324,7 +368,9 @@ discard block |
||
| 324 | 368 | $Connection = new Connection(); |
| 325 | 369 | $sth_dest = $Connection->db->prepare($query_dest); |
| 326 | 370 | try { |
| 327 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 371 | + if ($globalTransaction) { |
|
| 372 | + $Connection->db->beginTransaction(); |
|
| 373 | + } |
|
| 328 | 374 | $tmp = fgetcsv($fh,9999,',','"'); |
| 329 | 375 | while (!feof($fh)) { |
| 330 | 376 | $line = fgetcsv($fh,9999,',','"'); |
@@ -333,16 +379,22 @@ discard block |
||
| 333 | 379 | $values['registration'] = $line[0]; |
| 334 | 380 | $values['base'] = $line[4]; |
| 335 | 381 | $values['owner'] = $line[5]; |
| 336 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 337 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 382 | + if ($line[6] == '') { |
|
| 383 | + $values['date_first_reg'] = null; |
|
| 384 | + } else { |
|
| 385 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 386 | + } |
|
| 338 | 387 | $values['cancel'] = $line[7]; |
| 339 | 388 | } elseif ($country == 'EI') { |
| 340 | 389 | // TODO : add modeS & reg to aircraft_modes |
| 341 | 390 | $values['registration'] = $line[0]; |
| 342 | 391 | $values['base'] = $line[3]; |
| 343 | 392 | $values['owner'] = $line[2]; |
| 344 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 345 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 393 | + if ($line[1] == '') { |
|
| 394 | + $values['date_first_reg'] = null; |
|
| 395 | + } else { |
|
| 396 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 397 | + } |
|
| 346 | 398 | $values['cancel'] = ''; |
| 347 | 399 | } elseif ($country == 'HB') { |
| 348 | 400 | // TODO : add modeS & reg to aircraft_modes |
@@ -356,16 +408,22 @@ discard block |
||
| 356 | 408 | $values['registration'] = $line[3]; |
| 357 | 409 | $values['base'] = null; |
| 358 | 410 | $values['owner'] = $line[5]; |
| 359 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 360 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 411 | + if ($line[18] == '') { |
|
| 412 | + $values['date_first_reg'] = null; |
|
| 413 | + } else { |
|
| 414 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 415 | + } |
|
| 361 | 416 | $values['cancel'] = ''; |
| 362 | 417 | } elseif ($country == 'VH') { |
| 363 | 418 | // TODO : add modeS & reg to aircraft_modes |
| 364 | 419 | $values['registration'] = $line[0]; |
| 365 | 420 | $values['base'] = null; |
| 366 | 421 | $values['owner'] = $line[12]; |
| 367 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 368 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 422 | + if ($line[28] == '') { |
|
| 423 | + $values['date_first_reg'] = null; |
|
| 424 | + } else { |
|
| 425 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 426 | + } |
|
| 369 | 427 | |
| 370 | 428 | $values['cancel'] = $line[39]; |
| 371 | 429 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -384,29 +442,41 @@ discard block |
||
| 384 | 442 | $values['registration'] = $line[0]; |
| 385 | 443 | $values['base'] = null; |
| 386 | 444 | $values['owner'] = $line[8]; |
| 387 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 388 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 445 | + if ($line[7] == '') { |
|
| 446 | + $values['date_first_reg'] = null; |
|
| 447 | + } else { |
|
| 448 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 449 | + } |
|
| 389 | 450 | $values['cancel'] = ''; |
| 390 | 451 | } elseif ($country == 'PP') { |
| 391 | 452 | $values['registration'] = $line[0]; |
| 392 | 453 | $values['base'] = null; |
| 393 | 454 | $values['owner'] = $line[4]; |
| 394 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 395 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 455 | + if ($line[6] == '') { |
|
| 456 | + $values['date_first_reg'] = null; |
|
| 457 | + } else { |
|
| 458 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 459 | + } |
|
| 396 | 460 | $values['cancel'] = $line[7]; |
| 397 | 461 | } elseif ($country == 'E7') { |
| 398 | 462 | $values['registration'] = $line[0]; |
| 399 | 463 | $values['base'] = null; |
| 400 | 464 | $values['owner'] = $line[4]; |
| 401 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 402 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 465 | + if ($line[5] == '') { |
|
| 466 | + $values['date_first_reg'] = null; |
|
| 467 | + } else { |
|
| 468 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 469 | + } |
|
| 403 | 470 | $values['cancel'] = ''; |
| 404 | 471 | } elseif ($country == '8Q') { |
| 405 | 472 | $values['registration'] = $line[0]; |
| 406 | 473 | $values['base'] = null; |
| 407 | 474 | $values['owner'] = $line[3]; |
| 408 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 409 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 475 | + if ($line[7] == '') { |
|
| 476 | + $values['date_first_reg'] = null; |
|
| 477 | + } else { |
|
| 478 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 479 | + } |
|
| 410 | 480 | $values['cancel'] = ''; |
| 411 | 481 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 412 | 482 | $values['registration'] = $line[0]; |
@@ -420,7 +490,9 @@ discard block |
||
| 420 | 490 | $sth_dest->execute($query_dest_values); |
| 421 | 491 | } |
| 422 | 492 | } |
| 423 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 493 | + if ($globalTransaction) { |
|
| 494 | + $Connection->db->commit(); |
|
| 495 | + } |
|
| 424 | 496 | } catch(PDOException $e) { |
| 425 | 497 | return "error : ".$e->getMessage(); |
| 426 | 498 | } |
@@ -554,25 +626,45 @@ discard block |
||
| 554 | 626 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
| 555 | 627 | $Connection = new Connection(); |
| 556 | 628 | $sth_dest = $Connection->db->prepare($query_dest); |
| 557 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 629 | + if ($globalTransaction) { |
|
| 630 | + $Connection->db->beginTransaction(); |
|
| 631 | + } |
|
| 558 | 632 | |
| 559 | 633 | $i = 0; |
| 560 | 634 | while($row = sparql_fetch_array($result)) |
| 561 | 635 | { |
| 562 | 636 | if ($i >= 1) { |
| 563 | 637 | //print_r($row); |
| 564 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
| 565 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
| 566 | - if (!isset($row['type'])) $row['type'] = ''; |
|
| 567 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
| 638 | + if (!isset($row['iata'])) { |
|
| 639 | + $row['iata'] = ''; |
|
| 640 | + } |
|
| 641 | + if (!isset($row['icao'])) { |
|
| 642 | + $row['icao'] = ''; |
|
| 643 | + } |
|
| 644 | + if (!isset($row['type'])) { |
|
| 645 | + $row['type'] = ''; |
|
| 646 | + } |
|
| 647 | + if (!isset($row['altitude'])) { |
|
| 648 | + $row['altitude'] = ''; |
|
| 649 | + } |
|
| 568 | 650 | if (isset($row['city_bis'])) { |
| 569 | 651 | $row['city'] = $row['city_bis']; |
| 570 | 652 | } |
| 571 | - if (!isset($row['city'])) $row['city'] = ''; |
|
| 572 | - if (!isset($row['country'])) $row['country'] = ''; |
|
| 573 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
| 574 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
| 575 | - if (!isset($row['name'])) continue; |
|
| 653 | + if (!isset($row['city'])) { |
|
| 654 | + $row['city'] = ''; |
|
| 655 | + } |
|
| 656 | + if (!isset($row['country'])) { |
|
| 657 | + $row['country'] = ''; |
|
| 658 | + } |
|
| 659 | + if (!isset($row['homepage'])) { |
|
| 660 | + $row['homepage'] = ''; |
|
| 661 | + } |
|
| 662 | + if (!isset($row['wikipedia_page'])) { |
|
| 663 | + $row['wikipedia_page'] = ''; |
|
| 664 | + } |
|
| 665 | + if (!isset($row['name'])) { |
|
| 666 | + continue; |
|
| 667 | + } |
|
| 576 | 668 | if (!isset($row['image'])) { |
| 577 | 669 | $row['image'] = ''; |
| 578 | 670 | $row['image_thumb'] = ''; |
@@ -608,7 +700,9 @@ discard block |
||
| 608 | 700 | |
| 609 | 701 | $i++; |
| 610 | 702 | } |
| 611 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 703 | + if ($globalTransaction) { |
|
| 704 | + $Connection->db->commit(); |
|
| 705 | + } |
|
| 612 | 706 | echo "Delete duplicate rows...\n"; |
| 613 | 707 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
| 614 | 708 | try { |
@@ -620,7 +714,9 @@ discard block |
||
| 620 | 714 | } |
| 621 | 715 | |
| 622 | 716 | |
| 623 | - if ($globalDebug) echo "Insert Not available Airport...\n"; |
|
| 717 | + if ($globalDebug) { |
|
| 718 | + echo "Insert Not available Airport...\n"; |
|
| 719 | + } |
|
| 624 | 720 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
| 625 | 721 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
| 626 | 722 | $query_values = array(':airport_id' => $i, ':name' => 'Not available',':iata' => 'NA',':icao' => 'NA',':latitude' => '0',':longitude' => '0',':altitude' => '0',':type' => 'NA',':city' => 'N/A',':country' => 'N/A',':home_link' => '',':wikipedia_link' => '',':image' => '',':image_thumb' => ''); |
@@ -647,7 +743,9 @@ discard block |
||
| 647 | 743 | $delimiter = ','; |
| 648 | 744 | $out_file = $tmp_dir.'airports.csv'; |
| 649 | 745 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
| 650 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 746 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 747 | + return FALSE; |
|
| 748 | + } |
|
| 651 | 749 | echo "Add data from ourairports.com...\n"; |
| 652 | 750 | |
| 653 | 751 | $header = NULL; |
@@ -657,8 +755,9 @@ discard block |
||
| 657 | 755 | //$Connection->db->beginTransaction(); |
| 658 | 756 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 659 | 757 | { |
| 660 | - if(!$header) $header = $row; |
|
| 661 | - else { |
|
| 758 | + if(!$header) { |
|
| 759 | + $header = $row; |
|
| 760 | + } else { |
|
| 662 | 761 | $data = array(); |
| 663 | 762 | $data = array_combine($header, $row); |
| 664 | 763 | try { |
@@ -696,7 +795,9 @@ discard block |
||
| 696 | 795 | echo "Download data from another free database...\n"; |
| 697 | 796 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 698 | 797 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
| 699 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 798 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 799 | + return FALSE; |
|
| 800 | + } |
|
| 700 | 801 | update_db::unzip($out_file); |
| 701 | 802 | $header = NULL; |
| 702 | 803 | echo "Add data from another free database...\n"; |
@@ -707,8 +808,9 @@ discard block |
||
| 707 | 808 | //$Connection->db->beginTransaction(); |
| 708 | 809 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 709 | 810 | { |
| 710 | - if(!$header) $header = $row; |
|
| 711 | - else { |
|
| 811 | + if(!$header) { |
|
| 812 | + $header = $row; |
|
| 813 | + } else { |
|
| 712 | 814 | $data = $row; |
| 713 | 815 | |
| 714 | 816 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
@@ -962,7 +1064,9 @@ discard block |
||
| 962 | 1064 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 963 | 1065 | { |
| 964 | 1066 | $i = 0; |
| 965 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1067 | + if ($globalTransaction) { |
|
| 1068 | + $Connection->db->beginTransaction(); |
|
| 1069 | + } |
|
| 966 | 1070 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 967 | 1071 | { |
| 968 | 1072 | $i++; |
@@ -990,7 +1094,9 @@ discard block |
||
| 990 | 1094 | } |
| 991 | 1095 | } |
| 992 | 1096 | fclose($handle); |
| 993 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1097 | + if ($globalTransaction) { |
|
| 1098 | + $Connection->db->commit(); |
|
| 1099 | + } |
|
| 994 | 1100 | } |
| 995 | 1101 | return ''; |
| 996 | 1102 | } |
@@ -1012,7 +1118,9 @@ discard block |
||
| 1012 | 1118 | $Connection = new Connection(); |
| 1013 | 1119 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1014 | 1120 | { |
| 1015 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1121 | + if ($globalTransaction) { |
|
| 1122 | + $Connection->db->beginTransaction(); |
|
| 1123 | + } |
|
| 1016 | 1124 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1017 | 1125 | { |
| 1018 | 1126 | if(count($row) > 1) { |
@@ -1026,7 +1134,9 @@ discard block |
||
| 1026 | 1134 | } |
| 1027 | 1135 | } |
| 1028 | 1136 | fclose($handle); |
| 1029 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1137 | + if ($globalTransaction) { |
|
| 1138 | + $Connection->db->commit(); |
|
| 1139 | + } |
|
| 1030 | 1140 | } |
| 1031 | 1141 | return ''; |
| 1032 | 1142 | } |
@@ -1034,8 +1144,9 @@ discard block |
||
| 1034 | 1144 | public static function update_airspace() { |
| 1035 | 1145 | global $tmp_dir, $globalDBdriver; |
| 1036 | 1146 | include_once('class.create_db.php'); |
| 1037 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1038 | - else { |
|
| 1147 | + if ($globalDBdriver == 'mysql') { |
|
| 1148 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1149 | + } else { |
|
| 1039 | 1150 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 1040 | 1151 | $query = "CREATE EXTENSION postgis"; |
| 1041 | 1152 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1100,35 +1211,59 @@ discard block |
||
| 1100 | 1211 | //if ($globalDebug) echo "IVAO : Download..."; |
| 1101 | 1212 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 1102 | 1213 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 1103 | - if ($globalDebug) echo "Unzip..."; |
|
| 1214 | + if ($globalDebug) { |
|
| 1215 | + echo "Unzip..."; |
|
| 1216 | + } |
|
| 1104 | 1217 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 1105 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1218 | + if ($globalDebug) { |
|
| 1219 | + echo "Add to DB..."; |
|
| 1220 | + } |
|
| 1106 | 1221 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1107 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 1222 | + if ($globalDebug) { |
|
| 1223 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 1224 | + } |
|
| 1108 | 1225 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1109 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1110 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 1111 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 1226 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 1227 | + $error = "Failed to copy airlines logo."; |
|
| 1228 | + } |
|
| 1229 | + } else { |
|
| 1230 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 1231 | + } |
|
| 1232 | + } else { |
|
| 1233 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 1234 | + } |
|
| 1112 | 1235 | if ($error != '') { |
| 1113 | 1236 | return $error; |
| 1114 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1237 | + } elseif ($globalDebug) { |
|
| 1238 | + echo "Done\n"; |
|
| 1239 | + } |
|
| 1115 | 1240 | return ''; |
| 1116 | 1241 | } |
| 1117 | 1242 | |
| 1118 | 1243 | public static function update_routes() { |
| 1119 | 1244 | global $tmp_dir, $globalDebug; |
| 1120 | 1245 | $error = ''; |
| 1121 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 1246 | + if ($globalDebug) { |
|
| 1247 | + echo "Routes : Download..."; |
|
| 1248 | + } |
|
| 1122 | 1249 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 1123 | 1250 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1124 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1251 | + if ($globalDebug) { |
|
| 1252 | + echo "Gunzip..."; |
|
| 1253 | + } |
|
| 1125 | 1254 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 1126 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1255 | + if ($globalDebug) { |
|
| 1256 | + echo "Add to DB..."; |
|
| 1257 | + } |
|
| 1127 | 1258 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 1128 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 1259 | + } else { |
|
| 1260 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 1261 | + } |
|
| 1129 | 1262 | if ($error != '') { |
| 1130 | 1263 | return $error; |
| 1131 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1264 | + } elseif ($globalDebug) { |
|
| 1265 | + echo "Done\n"; |
|
| 1266 | + } |
|
| 1132 | 1267 | return ''; |
| 1133 | 1268 | } |
| 1134 | 1269 | public static function update_ModeS() { |
@@ -1145,257 +1280,455 @@ discard block |
||
| 1145 | 1280 | exit; |
| 1146 | 1281 | } elseif ($globalDebug) echo "Done\n"; |
| 1147 | 1282 | */ |
| 1148 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 1283 | + if ($globalDebug) { |
|
| 1284 | + echo "Modes : Download..."; |
|
| 1285 | + } |
|
| 1149 | 1286 | update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 1150 | 1287 | if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 1151 | - if ($globalDebug) echo "Unzip..."; |
|
| 1288 | + if ($globalDebug) { |
|
| 1289 | + echo "Unzip..."; |
|
| 1290 | + } |
|
| 1152 | 1291 | update_db::unzip($tmp_dir.'basestation_latest.zip'); |
| 1153 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1292 | + if ($globalDebug) { |
|
| 1293 | + echo "Add to DB..."; |
|
| 1294 | + } |
|
| 1154 | 1295 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 1155 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 1296 | + } else { |
|
| 1297 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 1298 | + } |
|
| 1156 | 1299 | if ($error != '') { |
| 1157 | 1300 | return $error; |
| 1158 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1301 | + } elseif ($globalDebug) { |
|
| 1302 | + echo "Done\n"; |
|
| 1303 | + } |
|
| 1159 | 1304 | return ''; |
| 1160 | 1305 | } |
| 1161 | 1306 | |
| 1162 | 1307 | public static function update_ModeS_flarm() { |
| 1163 | 1308 | global $tmp_dir, $globalDebug; |
| 1164 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 1309 | + if ($globalDebug) { |
|
| 1310 | + echo "Modes Flarmnet: Download..."; |
|
| 1311 | + } |
|
| 1165 | 1312 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 1166 | 1313 | if (file_exists($tmp_dir.'data.fln')) { |
| 1167 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1314 | + if ($globalDebug) { |
|
| 1315 | + echo "Add to DB..."; |
|
| 1316 | + } |
|
| 1168 | 1317 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 1169 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 1318 | + } else { |
|
| 1319 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 1320 | + } |
|
| 1170 | 1321 | if ($error != '') { |
| 1171 | 1322 | return $error; |
| 1172 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1323 | + } elseif ($globalDebug) { |
|
| 1324 | + echo "Done\n"; |
|
| 1325 | + } |
|
| 1173 | 1326 | return ''; |
| 1174 | 1327 | } |
| 1175 | 1328 | |
| 1176 | 1329 | public static function update_ModeS_ogn() { |
| 1177 | 1330 | global $tmp_dir, $globalDebug; |
| 1178 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 1331 | + if ($globalDebug) { |
|
| 1332 | + echo "Modes OGN: Download..."; |
|
| 1333 | + } |
|
| 1179 | 1334 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 1180 | 1335 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 1181 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1336 | + if ($globalDebug) { |
|
| 1337 | + echo "Add to DB..."; |
|
| 1338 | + } |
|
| 1182 | 1339 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 1183 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 1340 | + } else { |
|
| 1341 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 1342 | + } |
|
| 1184 | 1343 | if ($error != '') { |
| 1185 | 1344 | return $error; |
| 1186 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1345 | + } elseif ($globalDebug) { |
|
| 1346 | + echo "Done\n"; |
|
| 1347 | + } |
|
| 1187 | 1348 | return ''; |
| 1188 | 1349 | } |
| 1189 | 1350 | |
| 1190 | 1351 | public static function update_owner() { |
| 1191 | 1352 | global $tmp_dir, $globalDebug; |
| 1192 | 1353 | |
| 1193 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 1354 | + if ($globalDebug) { |
|
| 1355 | + echo "Owner France: Download..."; |
|
| 1356 | + } |
|
| 1194 | 1357 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 1195 | 1358 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 1196 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1359 | + if ($globalDebug) { |
|
| 1360 | + echo "Add to DB..."; |
|
| 1361 | + } |
|
| 1197 | 1362 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 1198 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 1363 | + } else { |
|
| 1364 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 1365 | + } |
|
| 1199 | 1366 | if ($error != '') { |
| 1200 | 1367 | return $error; |
| 1201 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1368 | + } elseif ($globalDebug) { |
|
| 1369 | + echo "Done\n"; |
|
| 1370 | + } |
|
| 1202 | 1371 | |
| 1203 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 1372 | + if ($globalDebug) { |
|
| 1373 | + echo "Owner Ireland: Download..."; |
|
| 1374 | + } |
|
| 1204 | 1375 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 1205 | 1376 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 1206 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1377 | + if ($globalDebug) { |
|
| 1378 | + echo "Add to DB..."; |
|
| 1379 | + } |
|
| 1207 | 1380 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 1208 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 1381 | + } else { |
|
| 1382 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 1383 | + } |
|
| 1209 | 1384 | if ($error != '') { |
| 1210 | 1385 | return $error; |
| 1211 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1212 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 1386 | + } elseif ($globalDebug) { |
|
| 1387 | + echo "Done\n"; |
|
| 1388 | + } |
|
| 1389 | + if ($globalDebug) { |
|
| 1390 | + echo "Owner Switzerland: Download..."; |
|
| 1391 | + } |
|
| 1213 | 1392 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 1214 | 1393 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 1215 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1394 | + if ($globalDebug) { |
|
| 1395 | + echo "Add to DB..."; |
|
| 1396 | + } |
|
| 1216 | 1397 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 1217 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 1398 | + } else { |
|
| 1399 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 1400 | + } |
|
| 1218 | 1401 | if ($error != '') { |
| 1219 | 1402 | return $error; |
| 1220 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1221 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 1403 | + } elseif ($globalDebug) { |
|
| 1404 | + echo "Done\n"; |
|
| 1405 | + } |
|
| 1406 | + if ($globalDebug) { |
|
| 1407 | + echo "Owner Czech Republic: Download..."; |
|
| 1408 | + } |
|
| 1222 | 1409 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 1223 | 1410 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 1224 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1411 | + if ($globalDebug) { |
|
| 1412 | + echo "Add to DB..."; |
|
| 1413 | + } |
|
| 1225 | 1414 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 1226 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 1415 | + } else { |
|
| 1416 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 1417 | + } |
|
| 1227 | 1418 | if ($error != '') { |
| 1228 | 1419 | return $error; |
| 1229 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1230 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 1420 | + } elseif ($globalDebug) { |
|
| 1421 | + echo "Done\n"; |
|
| 1422 | + } |
|
| 1423 | + if ($globalDebug) { |
|
| 1424 | + echo "Owner Australia: Download..."; |
|
| 1425 | + } |
|
| 1231 | 1426 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 1232 | 1427 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 1233 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1428 | + if ($globalDebug) { |
|
| 1429 | + echo "Add to DB..."; |
|
| 1430 | + } |
|
| 1234 | 1431 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 1235 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 1432 | + } else { |
|
| 1433 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 1434 | + } |
|
| 1236 | 1435 | if ($error != '') { |
| 1237 | 1436 | return $error; |
| 1238 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1239 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 1437 | + } elseif ($globalDebug) { |
|
| 1438 | + echo "Done\n"; |
|
| 1439 | + } |
|
| 1440 | + if ($globalDebug) { |
|
| 1441 | + echo "Owner Austria: Download..."; |
|
| 1442 | + } |
|
| 1240 | 1443 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 1241 | 1444 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 1242 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1445 | + if ($globalDebug) { |
|
| 1446 | + echo "Add to DB..."; |
|
| 1447 | + } |
|
| 1243 | 1448 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 1244 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 1449 | + } else { |
|
| 1450 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 1451 | + } |
|
| 1245 | 1452 | if ($error != '') { |
| 1246 | 1453 | return $error; |
| 1247 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1248 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 1454 | + } elseif ($globalDebug) { |
|
| 1455 | + echo "Done\n"; |
|
| 1456 | + } |
|
| 1457 | + if ($globalDebug) { |
|
| 1458 | + echo "Owner Chile: Download..."; |
|
| 1459 | + } |
|
| 1249 | 1460 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 1250 | 1461 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 1251 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1462 | + if ($globalDebug) { |
|
| 1463 | + echo "Add to DB..."; |
|
| 1464 | + } |
|
| 1252 | 1465 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 1253 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 1466 | + } else { |
|
| 1467 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 1468 | + } |
|
| 1254 | 1469 | if ($error != '') { |
| 1255 | 1470 | return $error; |
| 1256 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1257 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 1471 | + } elseif ($globalDebug) { |
|
| 1472 | + echo "Done\n"; |
|
| 1473 | + } |
|
| 1474 | + if ($globalDebug) { |
|
| 1475 | + echo "Owner Colombia: Download..."; |
|
| 1476 | + } |
|
| 1258 | 1477 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 1259 | 1478 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 1260 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1479 | + if ($globalDebug) { |
|
| 1480 | + echo "Add to DB..."; |
|
| 1481 | + } |
|
| 1261 | 1482 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 1262 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 1483 | + } else { |
|
| 1484 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 1485 | + } |
|
| 1263 | 1486 | if ($error != '') { |
| 1264 | 1487 | return $error; |
| 1265 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1266 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 1488 | + } elseif ($globalDebug) { |
|
| 1489 | + echo "Done\n"; |
|
| 1490 | + } |
|
| 1491 | + if ($globalDebug) { |
|
| 1492 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 1493 | + } |
|
| 1267 | 1494 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 1268 | 1495 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 1269 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1496 | + if ($globalDebug) { |
|
| 1497 | + echo "Add to DB..."; |
|
| 1498 | + } |
|
| 1270 | 1499 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 1271 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 1500 | + } else { |
|
| 1501 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 1502 | + } |
|
| 1272 | 1503 | if ($error != '') { |
| 1273 | 1504 | return $error; |
| 1274 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1275 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 1505 | + } elseif ($globalDebug) { |
|
| 1506 | + echo "Done\n"; |
|
| 1507 | + } |
|
| 1508 | + if ($globalDebug) { |
|
| 1509 | + echo "Owner Brazil: Download..."; |
|
| 1510 | + } |
|
| 1276 | 1511 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 1277 | 1512 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 1278 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1513 | + if ($globalDebug) { |
|
| 1514 | + echo "Add to DB..."; |
|
| 1515 | + } |
|
| 1279 | 1516 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 1280 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 1517 | + } else { |
|
| 1518 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 1519 | + } |
|
| 1281 | 1520 | if ($error != '') { |
| 1282 | 1521 | return $error; |
| 1283 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1284 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 1522 | + } elseif ($globalDebug) { |
|
| 1523 | + echo "Done\n"; |
|
| 1524 | + } |
|
| 1525 | + if ($globalDebug) { |
|
| 1526 | + echo "Owner Cayman Islands: Download..."; |
|
| 1527 | + } |
|
| 1285 | 1528 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 1286 | 1529 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 1287 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1530 | + if ($globalDebug) { |
|
| 1531 | + echo "Add to DB..."; |
|
| 1532 | + } |
|
| 1288 | 1533 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 1289 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 1534 | + } else { |
|
| 1535 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 1536 | + } |
|
| 1290 | 1537 | if ($error != '') { |
| 1291 | 1538 | return $error; |
| 1292 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1293 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 1539 | + } elseif ($globalDebug) { |
|
| 1540 | + echo "Done\n"; |
|
| 1541 | + } |
|
| 1542 | + if ($globalDebug) { |
|
| 1543 | + echo "Owner Croatia: Download..."; |
|
| 1544 | + } |
|
| 1294 | 1545 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 1295 | 1546 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 1296 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1547 | + if ($globalDebug) { |
|
| 1548 | + echo "Add to DB..."; |
|
| 1549 | + } |
|
| 1297 | 1550 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 1298 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 1551 | + } else { |
|
| 1552 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 1553 | + } |
|
| 1299 | 1554 | if ($error != '') { |
| 1300 | 1555 | return $error; |
| 1301 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1302 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 1556 | + } elseif ($globalDebug) { |
|
| 1557 | + echo "Done\n"; |
|
| 1558 | + } |
|
| 1559 | + if ($globalDebug) { |
|
| 1560 | + echo "Owner Luxembourg: Download..."; |
|
| 1561 | + } |
|
| 1303 | 1562 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 1304 | 1563 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 1305 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1564 | + if ($globalDebug) { |
|
| 1565 | + echo "Add to DB..."; |
|
| 1566 | + } |
|
| 1306 | 1567 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 1307 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 1568 | + } else { |
|
| 1569 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 1570 | + } |
|
| 1308 | 1571 | if ($error != '') { |
| 1309 | 1572 | return $error; |
| 1310 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1311 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 1573 | + } elseif ($globalDebug) { |
|
| 1574 | + echo "Done\n"; |
|
| 1575 | + } |
|
| 1576 | + if ($globalDebug) { |
|
| 1577 | + echo "Owner Maldives: Download..."; |
|
| 1578 | + } |
|
| 1312 | 1579 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 1313 | 1580 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 1314 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1581 | + if ($globalDebug) { |
|
| 1582 | + echo "Add to DB..."; |
|
| 1583 | + } |
|
| 1315 | 1584 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 1316 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 1585 | + } else { |
|
| 1586 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 1587 | + } |
|
| 1317 | 1588 | if ($error != '') { |
| 1318 | 1589 | return $error; |
| 1319 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1320 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 1590 | + } elseif ($globalDebug) { |
|
| 1591 | + echo "Done\n"; |
|
| 1592 | + } |
|
| 1593 | + if ($globalDebug) { |
|
| 1594 | + echo "Owner New Zealand: Download..."; |
|
| 1595 | + } |
|
| 1321 | 1596 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 1322 | 1597 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 1323 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1598 | + if ($globalDebug) { |
|
| 1599 | + echo "Add to DB..."; |
|
| 1600 | + } |
|
| 1324 | 1601 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 1325 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 1602 | + } else { |
|
| 1603 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 1604 | + } |
|
| 1326 | 1605 | if ($error != '') { |
| 1327 | 1606 | return $error; |
| 1328 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1329 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 1607 | + } elseif ($globalDebug) { |
|
| 1608 | + echo "Done\n"; |
|
| 1609 | + } |
|
| 1610 | + if ($globalDebug) { |
|
| 1611 | + echo "Owner Papua New Guinea: Download..."; |
|
| 1612 | + } |
|
| 1330 | 1613 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 1331 | 1614 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 1332 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1615 | + if ($globalDebug) { |
|
| 1616 | + echo "Add to DB..."; |
|
| 1617 | + } |
|
| 1333 | 1618 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 1334 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 1619 | + } else { |
|
| 1620 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 1621 | + } |
|
| 1335 | 1622 | if ($error != '') { |
| 1336 | 1623 | return $error; |
| 1337 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1338 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 1624 | + } elseif ($globalDebug) { |
|
| 1625 | + echo "Done\n"; |
|
| 1626 | + } |
|
| 1627 | + if ($globalDebug) { |
|
| 1628 | + echo "Owner Slovakia: Download..."; |
|
| 1629 | + } |
|
| 1339 | 1630 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 1340 | 1631 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 1341 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1632 | + if ($globalDebug) { |
|
| 1633 | + echo "Add to DB..."; |
|
| 1634 | + } |
|
| 1342 | 1635 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 1343 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 1636 | + } else { |
|
| 1637 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 1638 | + } |
|
| 1344 | 1639 | if ($error != '') { |
| 1345 | 1640 | return $error; |
| 1346 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1347 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 1641 | + } elseif ($globalDebug) { |
|
| 1642 | + echo "Done\n"; |
|
| 1643 | + } |
|
| 1644 | + if ($globalDebug) { |
|
| 1645 | + echo "Owner Ecuador: Download..."; |
|
| 1646 | + } |
|
| 1348 | 1647 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 1349 | 1648 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 1350 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1649 | + if ($globalDebug) { |
|
| 1650 | + echo "Add to DB..."; |
|
| 1651 | + } |
|
| 1351 | 1652 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 1352 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 1653 | + } else { |
|
| 1654 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 1655 | + } |
|
| 1353 | 1656 | if ($error != '') { |
| 1354 | 1657 | return $error; |
| 1355 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1356 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 1658 | + } elseif ($globalDebug) { |
|
| 1659 | + echo "Done\n"; |
|
| 1660 | + } |
|
| 1661 | + if ($globalDebug) { |
|
| 1662 | + echo "Owner Iceland: Download..."; |
|
| 1663 | + } |
|
| 1357 | 1664 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 1358 | 1665 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 1359 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1666 | + if ($globalDebug) { |
|
| 1667 | + echo "Add to DB..."; |
|
| 1668 | + } |
|
| 1360 | 1669 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 1361 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 1670 | + } else { |
|
| 1671 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 1672 | + } |
|
| 1362 | 1673 | if ($error != '') { |
| 1363 | 1674 | return $error; |
| 1364 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1675 | + } elseif ($globalDebug) { |
|
| 1676 | + echo "Done\n"; |
|
| 1677 | + } |
|
| 1365 | 1678 | return ''; |
| 1366 | 1679 | } |
| 1367 | 1680 | |
| 1368 | 1681 | public static function update_translation() { |
| 1369 | 1682 | global $tmp_dir, $globalDebug; |
| 1370 | 1683 | $error = ''; |
| 1371 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 1684 | + if ($globalDebug) { |
|
| 1685 | + echo "Translation : Download..."; |
|
| 1686 | + } |
|
| 1372 | 1687 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 1373 | 1688 | if (file_exists($tmp_dir.'translation.zip')) { |
| 1374 | - if ($globalDebug) echo "Unzip..."; |
|
| 1689 | + if ($globalDebug) { |
|
| 1690 | + echo "Unzip..."; |
|
| 1691 | + } |
|
| 1375 | 1692 | update_db::unzip($tmp_dir.'translation.zip'); |
| 1376 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1693 | + if ($globalDebug) { |
|
| 1694 | + echo "Add to DB..."; |
|
| 1695 | + } |
|
| 1377 | 1696 | $error = update_db::translation(); |
| 1378 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 1697 | + } else { |
|
| 1698 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 1699 | + } |
|
| 1379 | 1700 | if ($error != '') { |
| 1380 | 1701 | return $error; |
| 1381 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1702 | + } elseif ($globalDebug) { |
|
| 1703 | + echo "Done\n"; |
|
| 1704 | + } |
|
| 1382 | 1705 | return ''; |
| 1383 | 1706 | } |
| 1384 | 1707 | |
| 1385 | 1708 | public static function update_translation_fam() { |
| 1386 | 1709 | global $tmp_dir, $globalDebug; |
| 1387 | 1710 | $error = ''; |
| 1388 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 1711 | + if ($globalDebug) { |
|
| 1712 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 1713 | + } |
|
| 1389 | 1714 | update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 1390 | 1715 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
| 1391 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1716 | + if ($globalDebug) { |
|
| 1717 | + echo "Gunzip..."; |
|
| 1718 | + } |
|
| 1392 | 1719 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 1393 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1720 | + if ($globalDebug) { |
|
| 1721 | + echo "Add to DB..."; |
|
| 1722 | + } |
|
| 1394 | 1723 | $error = update_db::translation_fam(); |
| 1395 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 1724 | + } else { |
|
| 1725 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 1726 | + } |
|
| 1396 | 1727 | if ($error != '') { |
| 1397 | 1728 | return $error; |
| 1398 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1729 | + } elseif ($globalDebug) { |
|
| 1730 | + echo "Done\n"; |
|
| 1731 | + } |
|
| 1399 | 1732 | return ''; |
| 1400 | 1733 | } |
| 1401 | 1734 | |
@@ -1438,7 +1771,9 @@ discard block |
||
| 1438 | 1771 | } |
| 1439 | 1772 | |
| 1440 | 1773 | $error = ''; |
| 1441 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 1774 | + if ($globalDebug) { |
|
| 1775 | + echo "Notam : Download..."; |
|
| 1776 | + } |
|
| 1442 | 1777 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 1443 | 1778 | if (file_exists($tmp_dir.'notam.rss')) { |
| 1444 | 1779 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -1453,14 +1788,30 @@ discard block |
||
| 1453 | 1788 | $data['fir'] = $q[0]; |
| 1454 | 1789 | $data['code'] = $q[1]; |
| 1455 | 1790 | $ifrvfr = $q[2]; |
| 1456 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 1457 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 1458 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 1459 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 1460 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 1461 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 1462 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 1463 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 1791 | + if ($ifrvfr == 'IV') { |
|
| 1792 | + $data['rules'] = 'IFR/VFR'; |
|
| 1793 | + } |
|
| 1794 | + if ($ifrvfr == 'I') { |
|
| 1795 | + $data['rules'] = 'IFR'; |
|
| 1796 | + } |
|
| 1797 | + if ($ifrvfr == 'V') { |
|
| 1798 | + $data['rules'] = 'VFR'; |
|
| 1799 | + } |
|
| 1800 | + if ($q[4] == 'A') { |
|
| 1801 | + $data['scope'] = 'Airport warning'; |
|
| 1802 | + } |
|
| 1803 | + if ($q[4] == 'E') { |
|
| 1804 | + $data['scope'] = 'Enroute warning'; |
|
| 1805 | + } |
|
| 1806 | + if ($q[4] == 'W') { |
|
| 1807 | + $data['scope'] = 'Navigation warning'; |
|
| 1808 | + } |
|
| 1809 | + if ($q[4] == 'AE') { |
|
| 1810 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 1811 | + } |
|
| 1812 | + if ($q[4] == 'AW') { |
|
| 1813 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 1814 | + } |
|
| 1464 | 1815 | //$data['scope'] = $q[4]; |
| 1465 | 1816 | $data['lower_limit'] = $q[5]; |
| 1466 | 1817 | $data['upper_limit'] = $q[6]; |
@@ -1468,8 +1819,12 @@ discard block |
||
| 1468 | 1819 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 1469 | 1820 | $latitude = $Common->convertDec($las,'latitude'); |
| 1470 | 1821 | $longitude = $Common->convertDec($lns,'longitude'); |
| 1471 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 1472 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 1822 | + if ($lac == 'S') { |
|
| 1823 | + $latitude = '-'.$latitude; |
|
| 1824 | + } |
|
| 1825 | + if ($lnc == 'W') { |
|
| 1826 | + $longitude = '-'.$longitude; |
|
| 1827 | + } |
|
| 1473 | 1828 | $data['center_latitude'] = $latitude; |
| 1474 | 1829 | $data['center_longitude'] = $longitude; |
| 1475 | 1830 | $data['radius'] = intval($radius); |
@@ -1499,10 +1854,14 @@ discard block |
||
| 1499 | 1854 | $NOTAM->addNOTAM($data['ref'],$data['title'],'',$data['fir'],$data['code'],'',$data['scope'],$data['lower_limit'],$data['upper_limit'],$data['center_latitude'],$data['center_longitude'],$data['radius'],$data['date_begin'],$data['date_end'],$data['permanent'],$data['text'],$data['full_notam']); |
| 1500 | 1855 | unset($data); |
| 1501 | 1856 | } |
| 1502 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 1857 | + } else { |
|
| 1858 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 1859 | + } |
|
| 1503 | 1860 | if ($error != '') { |
| 1504 | 1861 | return $error; |
| 1505 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1862 | + } elseif ($globalDebug) { |
|
| 1863 | + echo "Done\n"; |
|
| 1864 | + } |
|
| 1506 | 1865 | return ''; |
| 1507 | 1866 | } |
| 1508 | 1867 | |
@@ -1521,8 +1880,11 @@ discard block |
||
| 1521 | 1880 | return "error : ".$e->getMessage(); |
| 1522 | 1881 | } |
| 1523 | 1882 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 1524 | - if ($row['nb'] > 0) return false; |
|
| 1525 | - else return true; |
|
| 1883 | + if ($row['nb'] > 0) { |
|
| 1884 | + return false; |
|
| 1885 | + } else { |
|
| 1886 | + return true; |
|
| 1887 | + } |
|
| 1526 | 1888 | } |
| 1527 | 1889 | |
| 1528 | 1890 | public static function insert_last_update() { |
@@ -1552,8 +1914,11 @@ discard block |
||
| 1552 | 1914 | return "error : ".$e->getMessage(); |
| 1553 | 1915 | } |
| 1554 | 1916 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 1555 | - if ($row['nb'] > 0) return false; |
|
| 1556 | - else return true; |
|
| 1917 | + if ($row['nb'] > 0) { |
|
| 1918 | + return false; |
|
| 1919 | + } else { |
|
| 1920 | + return true; |
|
| 1921 | + } |
|
| 1557 | 1922 | } |
| 1558 | 1923 | |
| 1559 | 1924 | public static function insert_last_notam_update() { |
@@ -1583,8 +1948,11 @@ discard block |
||
| 1583 | 1948 | return "error : ".$e->getMessage(); |
| 1584 | 1949 | } |
| 1585 | 1950 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 1586 | - if ($row['nb'] > 0) return false; |
|
| 1587 | - else return true; |
|
| 1951 | + if ($row['nb'] > 0) { |
|
| 1952 | + return false; |
|
| 1953 | + } else { |
|
| 1954 | + return true; |
|
| 1955 | + } |
|
| 1588 | 1956 | } |
| 1589 | 1957 | |
| 1590 | 1958 | public static function insert_last_owner_update() { |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | print '</ul>You <strong>must</strong> add these modules.</div>'; |
| 87 | 87 | require('../footer.php'); |
| 88 | - exit; |
|
| 88 | + exit; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && (count($error) == 0)) { |
@@ -291,14 +291,14 @@ discard block |
||
| 291 | 291 | <th>Source name</th> |
| 292 | 292 | </tr> |
| 293 | 293 | <?php |
| 294 | - require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
| 295 | - $Connection = new Connection(); |
|
| 296 | - if ($Connection->db != NULL) { |
|
| 294 | + require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
|
| 295 | + $Connection = new Connection(); |
|
| 296 | + if ($Connection->db != NULL) { |
|
| 297 | 297 | if ($Connection->tableExists('source_location')) { |
| 298 | - require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
| 299 | - $Source = new Source(); |
|
| 300 | - $alllocations = $Source->getAllLocationInfo(); |
|
| 301 | - foreach ($alllocations as $location) { |
|
| 298 | + require_once(dirname(__FILE__).'/../require/class.Source.php'); |
|
| 299 | + $Source = new Source(); |
|
| 300 | + $alllocations = $Source->getAllLocationInfo(); |
|
| 301 | + foreach ($alllocations as $location) { |
|
| 302 | 302 | ?> |
| 303 | 303 | <tr> |
| 304 | 304 | <input type="hidden" name="source_id[]" value="<?php print $location['id']; ?>" /> |
@@ -312,9 +312,9 @@ discard block |
||
| 312 | 312 | </tr> |
| 313 | 313 | |
| 314 | 314 | <?php |
| 315 | - } |
|
| 315 | + } |
|
| 316 | + } |
|
| 316 | 317 | } |
| 317 | - } |
|
| 318 | 318 | ?> |
| 319 | 319 | |
| 320 | 320 | <tr> |
@@ -499,12 +499,12 @@ discard block |
||
| 499 | 499 | ?> |
| 500 | 500 | <tr> |
| 501 | 501 | <?php |
| 502 | - if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 502 | + if (filter_var($source['host'],FILTER_VALIDATE_URL)) { |
|
| 503 | 503 | ?> |
| 504 | 504 | <td><input type="text" name="host[]" id="host" value="<?php print $source['host']; ?>" /></td> |
| 505 | 505 | <td><input type="number" name="port[]" id="port" value="<?php print $source['port']; ?>" /></td> |
| 506 | 506 | <?php |
| 507 | - } else { |
|
| 507 | + } else { |
|
| 508 | 508 | $hostport = explode(':',$source['host']); |
| 509 | 509 | if (isset($hostport[1])) { |
| 510 | 510 | $host = $hostport[0]; |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | <td><input type="text" name="host[]" id="host" value="<?php print $host; ?>" /></td> |
| 518 | 518 | <td><input type="number" name="port[]" id="port" value="<?php print $port; ?>" /></td> |
| 519 | 519 | <?php |
| 520 | - } |
|
| 520 | + } |
|
| 521 | 521 | ?> |
| 522 | 522 | <td> |
| 523 | 523 | <select name="format[]" id="format"> |
@@ -792,7 +792,7 @@ discard block |
||
| 792 | 792 | <br /> |
| 793 | 793 | <p> |
| 794 | 794 | <?php |
| 795 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 795 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 796 | 796 | ?> |
| 797 | 797 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 798 | 798 | <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
@@ -802,11 +802,11 @@ discard block |
||
| 802 | 802 | <b>The directory cache is not writable, aircraft icon will not be cached</b> |
| 803 | 803 | <?php |
| 804 | 804 | } |
| 805 | - } else { |
|
| 805 | + } else { |
|
| 806 | 806 | ?> |
| 807 | 807 | <b>PHP GD is not installed, you can t change color of aircraft icon on map</b> |
| 808 | 808 | <?php |
| 809 | - } |
|
| 809 | + } |
|
| 810 | 810 | ?> |
| 811 | 811 | </p> |
| 812 | 812 | <br /> |
@@ -825,7 +825,7 @@ discard block |
||
| 825 | 825 | </p> |
| 826 | 826 | <?php |
| 827 | 827 | require('../footer.php'); |
| 828 | - exit; |
|
| 828 | + exit; |
|
| 829 | 829 | } |
| 830 | 830 | |
| 831 | 831 | $settings = array(); |
@@ -915,8 +915,8 @@ discard block |
||
| 915 | 915 | |
| 916 | 916 | $sources = array(); |
| 917 | 917 | foreach ($source_name as $keys => $name) { |
| 918 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 919 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 918 | + if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 919 | + else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 920 | 920 | } |
| 921 | 921 | if (count($sources) > 0) $_SESSION['sources'] = $sources; |
| 922 | 922 | |
@@ -1168,14 +1168,14 @@ discard block |
||
| 1168 | 1168 | |
| 1169 | 1169 | // Set some defaults values... |
| 1170 | 1170 | if (!isset($globalAircraftImageSources)) { |
| 1171 | - $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1172 | - $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1171 | + $globalAircraftImageSources = array('ivaomtl','wikimedia','airportdata','deviantart','flickr','bing','jetphotos','planepictures','planespotters'); |
|
| 1172 | + $settings = array_merge($settings,array('globalAircraftImageSources' => $globalAircraftImageSources)); |
|
| 1173 | 1173 | } |
| 1174 | 1174 | |
| 1175 | 1175 | if (!isset($globalSchedulesSources)) { |
| 1176 | - $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1177 | - $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1178 | - } |
|
| 1176 | + $globalSchedulesSources = array('flightmapper','costtotravel','flightradar24','flightaware'); |
|
| 1177 | + $settings = array_merge($settings,array('globalSchedulesSources' => $globalSchedulesSources)); |
|
| 1178 | + } |
|
| 1179 | 1179 | |
| 1180 | 1180 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1181 | 1181 | |
@@ -1215,17 +1215,17 @@ discard block |
||
| 1215 | 1215 | print '<ul><div id="step">'; |
| 1216 | 1216 | $pop = false; |
| 1217 | 1217 | foreach ($_SESSION['done'] as $done) { |
| 1218 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
| 1219 | - if ($done == 'Create database') $pop = true; |
|
| 1220 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1221 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1218 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
| 1219 | + if ($done == 'Create database') $pop = true; |
|
| 1220 | + if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1221 | + if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1222 | 1222 | } |
| 1223 | 1223 | if ($pop) { |
| 1224 | - sleep(5); |
|
| 1225 | - print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
| 1224 | + sleep(5); |
|
| 1225 | + print '<li>Create database....<img src="../images/loading.gif" /></li>'; |
|
| 1226 | 1226 | } else if ($popi) { |
| 1227 | - sleep(5); |
|
| 1228 | - print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
| 1227 | + sleep(5); |
|
| 1228 | + print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
|
| 1229 | 1229 | } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
| 1230 | 1230 | print '</div></ul>'; |
| 1231 | 1231 | print '<div id="error"></div>'; |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | unset($_COOKIE['install']); |
| 1289 | 1289 | print '<div class="info column"><ul>'; |
| 1290 | 1290 | foreach ($_SESSION['done'] as $done) { |
| 1291 | - print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
| 1291 | + print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
|
| 1292 | 1292 | } |
| 1293 | 1293 | print '<li>Reloading page to check all is now ok....<strong>SUCCESS</strong></li>'; |
| 1294 | 1294 | print '</ul></div>'; |
@@ -117,44 +117,71 @@ discard block |
||
| 117 | 117 | </div> |
| 118 | 118 | <p> |
| 119 | 119 | <label for="dbhost">Database hostname</label> |
| 120 | - <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) print $globalDBhost; ?>" /> |
|
| 120 | + <input type="text" name="dbhost" id="dbhost" value="<?php if (isset($globalDBhost)) { |
|
| 121 | + print $globalDBhost; |
|
| 122 | +} |
|
| 123 | +?>" /> |
|
| 121 | 124 | </p> |
| 122 | 125 | <p> |
| 123 | 126 | <label for="dbport">Database port</label> |
| 124 | - <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) print $globalDBport; ?>" /> |
|
| 127 | + <input type="text" name="dbport" id="dbport" value="<?php if (isset($globalDBport)) { |
|
| 128 | + print $globalDBport; |
|
| 129 | +} |
|
| 130 | +?>" /> |
|
| 125 | 131 | </p> |
| 126 | 132 | <p> |
| 127 | 133 | <label for="dbname">Database name</label> |
| 128 | - <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) print $globalDBname; ?>" /> |
|
| 134 | + <input type="text" name="dbname" id="dbname" value="<?php if (isset($globalDBname)) { |
|
| 135 | + print $globalDBname; |
|
| 136 | +} |
|
| 137 | +?>" /> |
|
| 129 | 138 | </p> |
| 130 | 139 | <p> |
| 131 | 140 | <label for="dbuser">Database user</label> |
| 132 | - <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) print $globalDBuser; ?>" /> |
|
| 141 | + <input type="text" name="dbuser" id="dbuser" value="<?php if (isset($globalDBuser)) { |
|
| 142 | + print $globalDBuser; |
|
| 143 | +} |
|
| 144 | +?>" /> |
|
| 133 | 145 | </p> |
| 134 | 146 | <p> |
| 135 | 147 | <label for="dbuserpass">Database user password</label> |
| 136 | - <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) print $globalDBpass; ?>" /> |
|
| 148 | + <input type="password" name="dbuserpass" id="dbuserpass" value="<?php if (isset($globalDBpass)) { |
|
| 149 | + print $globalDBpass; |
|
| 150 | +} |
|
| 151 | +?>" /> |
|
| 137 | 152 | </p> |
| 138 | 153 | </fieldset> |
| 139 | 154 | <fieldset> |
| 140 | 155 | <legend>Site configuration</legend> |
| 141 | 156 | <p> |
| 142 | 157 | <label for="sitename">Site name</label> |
| 143 | - <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) print $globalName; ?>" /> |
|
| 158 | + <input type="text" name="sitename" id="sitename" value="<?php if (isset($globalName)) { |
|
| 159 | + print $globalName; |
|
| 160 | +} |
|
| 161 | +?>" /> |
|
| 144 | 162 | </p> |
| 145 | 163 | <p> |
| 146 | 164 | <label for="siteurl">Site directory</label> |
| 147 | - <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) print $globalURL; ?>" /> |
|
| 165 | + <input type="text" name="siteurl" id="siteurl" value="<?php if (isset($globalURL)) { |
|
| 166 | + print $globalURL; |
|
| 167 | +} |
|
| 168 | +?>" /> |
|
| 148 | 169 | <p class="help-block">Can be null. ex : <i>flightairmap</i> if complete URL is <i>http://toto.com/flightairmap</i></p> |
| 149 | 170 | </p> |
| 150 | 171 | <p> |
| 151 | 172 | <label for="timezone">Timezone</label> |
| 152 | - <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) print $globalTimezone; ?>" /> |
|
| 173 | + <input type="text" name="timezone" id="timezone" value="<?php if (isset($globalTimezone)) { |
|
| 174 | + print $globalTimezone; |
|
| 175 | +} |
|
| 176 | +?>" /> |
|
| 153 | 177 | <p class="help-block">ex : UTC, Europe/Paris,...</p> |
| 154 | 178 | </p> |
| 155 | 179 | <p> |
| 156 | 180 | <label for="language">Language</label> |
| 157 | - <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) print $globalLanguage; ?>" /> |
|
| 181 | + <input type="text" name="language" id="language" value="<?php if (isset($globalLanguage)) { |
|
| 182 | + print $globalLanguage; |
|
| 183 | +} |
|
| 184 | +?>" /> |
|
| 158 | 185 | <p class="help-block">Used only when link to wikipedia for now. Can be EN,DE,FR,...</p> |
| 159 | 186 | </p> |
| 160 | 187 | </fieldset> |
@@ -175,18 +202,27 @@ discard block |
||
| 175 | 202 | <div id="mapbox_data"> |
| 176 | 203 | <p> |
| 177 | 204 | <label for="mapboxid">Mapbox id</label> |
| 178 | - <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) print $globalMapboxId; ?>" /> |
|
| 205 | + <input type="text" name="mapboxid" id="mapboxid" value="<?php if (isset($globalMapboxId)) { |
|
| 206 | + print $globalMapboxId; |
|
| 207 | +} |
|
| 208 | +?>" /> |
|
| 179 | 209 | </p> |
| 180 | 210 | <p> |
| 181 | 211 | <label for="mapboxtoken">Mapbox token</label> |
| 182 | - <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) print $globalMapboxToken; ?>" /> |
|
| 212 | + <input type="text" name="mapboxtoken" id="mapboxtoken" value="<?php if (isset($globalMapboxToken)) { |
|
| 213 | + print $globalMapboxToken; |
|
| 214 | +} |
|
| 215 | +?>" /> |
|
| 183 | 216 | </p> |
| 184 | 217 | </div> |
| 185 | 218 | <br /> |
| 186 | 219 | <div id="google_data"> |
| 187 | 220 | <p> |
| 188 | 221 | <label for="googlekey">Google API key</label> |
| 189 | - <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) print $globalGoogleAPIKey; ?>" /> |
|
| 222 | + <input type="text" name="googlekey" id="googlekey" value="<?php if (isset($globalGoogleAPIKey)) { |
|
| 223 | + print $globalGoogleAPIKey; |
|
| 224 | +} |
|
| 225 | +?>" /> |
|
| 190 | 226 | <p class="help-block">Get a key <a href="https://developers.google.com/maps/documentation/javascript/get-api-key#get-an-api-key">here</a></p> |
| 191 | 227 | </p> |
| 192 | 228 | </div> |
@@ -194,7 +230,10 @@ discard block |
||
| 194 | 230 | <div id="bing_data"> |
| 195 | 231 | <p> |
| 196 | 232 | <label for="bingkey">Bing Map key</label> |
| 197 | - <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) print $globalBingMapKey; ?>" /> |
|
| 233 | + <input type="text" name="bingkey" id="bingkey" value="<?php if (isset($globalBingMapKey)) { |
|
| 234 | + print $globalBingMapKey; |
|
| 235 | +} |
|
| 236 | +?>" /> |
|
| 198 | 237 | <p class="help-block">Get a key <a href="https://msdn.microsoft.com/en-us/library/ff428642.aspx">here</a></p> |
| 199 | 238 | </p> |
| 200 | 239 | </div> |
@@ -202,7 +241,10 @@ discard block |
||
| 202 | 241 | <div id="mapquest_data"> |
| 203 | 242 | <p> |
| 204 | 243 | <label for="mapquestkey">MapQuest key</label> |
| 205 | - <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) print $globalMapQuestKey; ?>" /> |
|
| 244 | + <input type="text" name="mapquestkey" id="mapquestkey" value="<?php if (isset($globalMapQuestKey)) { |
|
| 245 | + print $globalMapQuestKey; |
|
| 246 | +} |
|
| 247 | +?>" /> |
|
| 206 | 248 | <p class="help-block">Get a key <a href="https://developer.mapquest.com/user/me/apps">here</a></p> |
| 207 | 249 | </p> |
| 208 | 250 | </div> |
@@ -210,11 +252,17 @@ discard block |
||
| 210 | 252 | <div id="here_data"> |
| 211 | 253 | <p> |
| 212 | 254 | <label for="hereappid">Here App_Id</label> |
| 213 | - <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) print $globalHereappId; ?>" /> |
|
| 255 | + <input type="text" name="hereappid" id="hereappid" value="<?php if (isset($globalHereappId)) { |
|
| 256 | + print $globalHereappId; |
|
| 257 | +} |
|
| 258 | +?>" /> |
|
| 214 | 259 | </p> |
| 215 | 260 | <p> |
| 216 | 261 | <label for="hereappcode">Here App_Code</label> |
| 217 | - <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) print $globalHereappCode; ?>" /> |
|
| 262 | + <input type="text" name="hereappcode" id="hereappcode" value="<?php if (isset($globalHereappCode)) { |
|
| 263 | + print $globalHereappCode; |
|
| 264 | +} |
|
| 265 | +?>" /> |
|
| 218 | 266 | </p> |
| 219 | 267 | <p class="help-block">Get a key <a href="https://developer.here.com/rest-apis/documentation/enterprise-map-tile/topics/quick-start.html">here</a></p> |
| 220 | 268 | </div> |
@@ -223,42 +271,86 @@ discard block |
||
| 223 | 271 | <legend>Coverage area</legend> |
| 224 | 272 | <p> |
| 225 | 273 | <label for="latitudemax">The maximum latitude (north)</label> |
| 226 | - <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) print $globalLatitudeMax; ?>" /> |
|
| 274 | + <input type="text" name="latitudemax" id="latitudemax" value="<?php if (isset($globalLatitudeMax)) { |
|
| 275 | + print $globalLatitudeMax; |
|
| 276 | +} |
|
| 277 | +?>" /> |
|
| 227 | 278 | </p> |
| 228 | 279 | <p> |
| 229 | 280 | <label for="latitudemin">The minimum latitude (south)</label> |
| 230 | - <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) print $globalLatitudeMin; ?>" /> |
|
| 281 | + <input type="text" name="latitudemin" id="latitudemin" value="<?php if (isset($globalLatitudeMin)) { |
|
| 282 | + print $globalLatitudeMin; |
|
| 283 | +} |
|
| 284 | +?>" /> |
|
| 231 | 285 | </p> |
| 232 | 286 | <p> |
| 233 | 287 | <label for="longitudemax">The maximum longitude (west)</label> |
| 234 | - <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) print $globalLongitudeMax; ?>" /> |
|
| 288 | + <input type="text" name="longitudemax" id="longitudemax" value="<?php if (isset($globalLongitudeMax)) { |
|
| 289 | + print $globalLongitudeMax; |
|
| 290 | +} |
|
| 291 | +?>" /> |
|
| 235 | 292 | </p> |
| 236 | 293 | <p> |
| 237 | 294 | <label for="longitudemin">The minimum longitude (east)</label> |
| 238 | - <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) print $globalLongitudeMin; ?>" /> |
|
| 295 | + <input type="text" name="longitudemin" id="longitudemin" value="<?php if (isset($globalLongitudeMin)) { |
|
| 296 | + print $globalLongitudeMin; |
|
| 297 | +} |
|
| 298 | +?>" /> |
|
| 239 | 299 | </p> |
| 240 | 300 | <p> |
| 241 | 301 | <label for="latitudecenter">The latitude center</label> |
| 242 | - <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) print $globalCenterLatitude; ?>" /> |
|
| 302 | + <input type="text" name="latitudecenter" id="latitudecenter" value="<?php if (isset($globalCenterLatitude)) { |
|
| 303 | + print $globalCenterLatitude; |
|
| 304 | +} |
|
| 305 | +?>" /> |
|
| 243 | 306 | </p> |
| 244 | 307 | <p> |
| 245 | 308 | <label for="longitudecenter">The longitude center</label> |
| 246 | - <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) print $globalCenterLongitude; ?>" /> |
|
| 309 | + <input type="text" name="longitudecenter" id="longitudecenter" value="<?php if (isset($globalCenterLongitude)) { |
|
| 310 | + print $globalCenterLongitude; |
|
| 311 | +} |
|
| 312 | +?>" /> |
|
| 247 | 313 | </p> |
| 248 | 314 | <p> |
| 249 | 315 | <label for="livezoom">Default Zoom on live map</label> |
| 250 | - <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) print $globalLiveZoom; else print '9'; ?>" /> |
|
| 316 | + <input type="number" name="livezoom" id="livezoom" value="<?php if (isset($globalLiveZoom)) { |
|
| 317 | + print $globalLiveZoom; |
|
| 318 | +} else { |
|
| 319 | + print '9'; |
|
| 320 | +} |
|
| 321 | +?>" /> |
|
| 251 | 322 | </p> |
| 252 | 323 | <p> |
| 253 | 324 | <label for="squawk_country">Country for squawk usage</label> |
| 254 | 325 | <select name="squawk_country" id="squawk_country"> |
| 255 | - <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') print ' selected '; ?>>UK</option> |
|
| 256 | - <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') print ' selected '; ?>>NZ</option> |
|
| 257 | - <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') print ' selected '; ?>>US</option> |
|
| 258 | - <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') print ' selected '; ?>>AU</option> |
|
| 259 | - <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') print ' selected '; ?>>NL</option> |
|
| 260 | - <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') print ' selected '; ?>>FR</option> |
|
| 261 | - <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') print ' selected '; ?>>TR</option> |
|
| 326 | + <option value="UK"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'UK') { |
|
| 327 | + print ' selected '; |
|
| 328 | +} |
|
| 329 | +?>>UK</option> |
|
| 330 | + <option value="NZ"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NZ') { |
|
| 331 | + print ' selected '; |
|
| 332 | +} |
|
| 333 | +?>>NZ</option> |
|
| 334 | + <option value="US"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'US') { |
|
| 335 | + print ' selected '; |
|
| 336 | +} |
|
| 337 | +?>>US</option> |
|
| 338 | + <option value="AU"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'AU') { |
|
| 339 | + print ' selected '; |
|
| 340 | +} |
|
| 341 | +?>>AU</option> |
|
| 342 | + <option value="NL"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'NL') { |
|
| 343 | + print ' selected '; |
|
| 344 | +} |
|
| 345 | +?>>NL</option> |
|
| 346 | + <option value="FR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'FR') { |
|
| 347 | + print ' selected '; |
|
| 348 | +} |
|
| 349 | +?>>FR</option> |
|
| 350 | + <option value="TR"<?php if (isset($globalSquawkCountry) && $globalSquawkCountry == 'TR') { |
|
| 351 | + print ' selected '; |
|
| 352 | +} |
|
| 353 | +?>>TR</option> |
|
| 262 | 354 | </select> |
| 263 | 355 | </p> |
| 264 | 356 | </fieldset> |
@@ -267,15 +359,24 @@ discard block |
||
| 267 | 359 | <p><i>Only put in DB flights that are inside a circle</i></p> |
| 268 | 360 | <p> |
| 269 | 361 | <label for="latitude">Center latitude</label> |
| 270 | - <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) echo $globalDistanceIgnore['latitude']; ?>" /> |
|
| 362 | + <input type="text" name="zoilatitude" id="latitude" value="<?php if (isset($globalDistanceIgnore['latitude'])) { |
|
| 363 | + echo $globalDistanceIgnore['latitude']; |
|
| 364 | +} |
|
| 365 | +?>" /> |
|
| 271 | 366 | </p> |
| 272 | 367 | <p> |
| 273 | 368 | <label for="longitude">Center longitude</label> |
| 274 | - <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) echo $globalDistanceIgnore['longitude']; ?>" /> |
|
| 369 | + <input type="text" name="zoilongitude" id="longitude" value="<?php if (isset($globalDistanceIgnore['longitude'])) { |
|
| 370 | + echo $globalDistanceIgnore['longitude']; |
|
| 371 | +} |
|
| 372 | +?>" /> |
|
| 275 | 373 | </p> |
| 276 | 374 | <p> |
| 277 | 375 | <label for="Distance">Distance (in km)</label> |
| 278 | - <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) echo $globalDistanceIgnore['distance']; ?>" /> |
|
| 376 | + <input type="text" name="zoidistance" id="distance" value="<?php if (isset($globalDistanceIgnore['distance'])) { |
|
| 377 | + echo $globalDistanceIgnore['distance']; |
|
| 378 | +} |
|
| 379 | +?>" /> |
|
| 279 | 380 | </p> |
| 280 | 381 | </fieldset> |
| 281 | 382 | <fieldset> |
@@ -364,11 +465,17 @@ discard block |
||
| 364 | 465 | <div id="flightaware_data"> |
| 365 | 466 | <p> |
| 366 | 467 | <label for="flightawareusername">FlightAware username</label> |
| 367 | - <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) print $globalFlightAwareUsername; ?>" /> |
|
| 468 | + <input type="text" name="flightawareusername" id="flightawareusername" value="<?php if (isset($globalFlightAwareUsername)) { |
|
| 469 | + print $globalFlightAwareUsername; |
|
| 470 | +} |
|
| 471 | +?>" /> |
|
| 368 | 472 | </p> |
| 369 | 473 | <p> |
| 370 | 474 | <label for="flightawarepassword">FlightAware password/API key</label> |
| 371 | - <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) print $globalFlightAwarePassword; ?>" /> |
|
| 475 | + <input type="text" name="flightawarepassword" id="flightawarepassword" value="<?php if (isset($globalFlightAwarePassword)) { |
|
| 476 | + print $globalFlightAwarePassword; |
|
| 477 | +} |
|
| 478 | +?>" /> |
|
| 372 | 479 | </p> |
| 373 | 480 | </div> |
| 374 | 481 | --> |
@@ -521,20 +628,56 @@ discard block |
||
| 521 | 628 | ?> |
| 522 | 629 | <td> |
| 523 | 630 | <select name="format[]" id="format"> |
| 524 | - <option value="auto" <?php if (!isset($source['format'])) print 'selected'; ?>>Auto</option> |
|
| 525 | - <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') print 'selected'; ?>>SBS</option> |
|
| 526 | - <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') print 'selected'; ?>>TSV</option> |
|
| 527 | - <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') print 'selected'; ?>>Raw</option> |
|
| 528 | - <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') print 'selected'; ?>>APRS</option> |
|
| 529 | - <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') print 'selected'; ?>>Radarcape deltadb.txt</option> |
|
| 530 | - <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') print 'selected'; ?>>Vatsim</option> |
|
| 531 | - <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') print 'selected'; ?>>Virtual Radar Server</option> |
|
| 532 | - <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') print 'selected'; ?>>phpVMS</option> |
|
| 533 | - <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') print 'selected'; ?>>IVAO</option> |
|
| 631 | + <option value="auto" <?php if (!isset($source['format'])) { |
|
| 632 | + print 'selected'; |
|
| 633 | +} |
|
| 634 | +?>>Auto</option> |
|
| 635 | + <option value="sbs" <?php if (isset($source['format']) && $source['format'] == 'sbs') { |
|
| 636 | + print 'selected'; |
|
| 637 | +} |
|
| 638 | +?>>SBS</option> |
|
| 639 | + <option value="tsv" <?php if (isset($source['format']) && $source['format'] == 'tsv') { |
|
| 640 | + print 'selected'; |
|
| 641 | +} |
|
| 642 | +?>>TSV</option> |
|
| 643 | + <option value="raw" <?php if (isset($source['format']) && $source['format'] == 'raw') { |
|
| 644 | + print 'selected'; |
|
| 645 | +} |
|
| 646 | +?>>Raw</option> |
|
| 647 | + <option value="aprs" <?php if (isset($source['format']) && $source['format'] == 'aprs') { |
|
| 648 | + print 'selected'; |
|
| 649 | +} |
|
| 650 | +?>>APRS</option> |
|
| 651 | + <option value="deltadbtxt" <?php if (isset($source['format']) && $source['format'] == 'deltadbtxt') { |
|
| 652 | + print 'selected'; |
|
| 653 | +} |
|
| 654 | +?>>Radarcape deltadb.txt</option> |
|
| 655 | + <option value="vatsimtxt" <?php if (isset($source['format']) && $source['format'] == 'vatsimtxt') { |
|
| 656 | + print 'selected'; |
|
| 657 | +} |
|
| 658 | +?>>Vatsim</option> |
|
| 659 | + <option value="aircraftlistjson" <?php if (isset($source['format']) && $source['format'] == 'aircraftlistjson') { |
|
| 660 | + print 'selected'; |
|
| 661 | +} |
|
| 662 | +?>>Virtual Radar Server</option> |
|
| 663 | + <option value="phpvmacars" <?php if (isset($source['format']) && $source['format'] == 'phpvmacars') { |
|
| 664 | + print 'selected'; |
|
| 665 | +} |
|
| 666 | +?>>phpVMS</option> |
|
| 667 | + <option value="whazzup" <?php if (isset($source['format']) && $source['format'] == 'whazzup') { |
|
| 668 | + print 'selected'; |
|
| 669 | +} |
|
| 670 | +?>>IVAO</option> |
|
| 534 | 671 | </select> |
| 535 | 672 | </td> |
| 536 | - <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) print $source['name']; ?>" /></td> |
|
| 537 | - <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) print 'checked'; ?> /></td> |
|
| 673 | + <td><input type="text" name="name[]" id="name" value="<?php if (isset($source['name'])) { |
|
| 674 | + print $source['name']; |
|
| 675 | +} |
|
| 676 | +?>" /></td> |
|
| 677 | + <td><input type="checkbox" name="sourcestats[]" id="sourcestats" title="Create statistics for the source like number of messages, distance,..." value="1" <?php if (isset($source['sourcestats']) && $source['sourcestats']) { |
|
| 678 | + print 'checked'; |
|
| 679 | +} |
|
| 680 | +?> /></td> |
|
| 538 | 681 | <td><input type="button" id="delhost" value="Delete" onclick="deleteRow(this)" /> <input type="button" id="addhost" value="Add" onclick="insRow()" /></td> |
| 539 | 682 | </tr> |
| 540 | 683 | <?php |
@@ -573,11 +716,17 @@ discard block |
||
| 573 | 716 | <p>Listen UDP server for acarsdec/acarsdeco2/...</p> |
| 574 | 717 | <p> |
| 575 | 718 | <label for="acarshost">ACARS UDP host</label> |
| 576 | - <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) print $globalACARSHost; ?>" /> |
|
| 719 | + <input type="text" name="acarshost" id="acarshost" value="<?php if (isset($globalACARSHost)) { |
|
| 720 | + print $globalACARSHost; |
|
| 721 | +} |
|
| 722 | +?>" /> |
|
| 577 | 723 | </p> |
| 578 | 724 | <p> |
| 579 | 725 | <label for="acarsport">ACARS UDP port</label> |
| 580 | - <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) print $globalACARSPort; ?>" /> |
|
| 726 | + <input type="number" name="acarsport" id="acarsport" value="<?php if (isset($globalACARSPort)) { |
|
| 727 | + print $globalACARSPort; |
|
| 728 | +} |
|
| 729 | +?>" /> |
|
| 581 | 730 | </p> |
| 582 | 731 | </fieldset> |
| 583 | 732 | </div> |
@@ -631,12 +780,18 @@ discard block |
||
| 631 | 780 | <div id="schedules_options"> |
| 632 | 781 | <p> |
| 633 | 782 | <label for="britishairways">British Airways API Key</label> |
| 634 | - <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) print $globalBritishAirwaysKey; ?>" /> |
|
| 783 | + <input type="text" name="britishairways" id="britishairways" value="<?php if (isset($globalBritishAirwaysKey)) { |
|
| 784 | + print $globalBritishAirwaysKey; |
|
| 785 | +} |
|
| 786 | +?>" /> |
|
| 635 | 787 | <p class="help-block">Register an account on <a href="https://developer.ba.com/">https://developer.ba.com/</a></p> |
| 636 | 788 | </p> |
| 637 | 789 | <p> |
| 638 | 790 | <label for="transavia">Transavia Test API Consumer Key</label> |
| 639 | - <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) print $globalTransaviaKey; ?>" /> |
|
| 791 | + <input type="text" name="transavia" id="transavia" value="<?php if (isset($globalTransaviaKey)) { |
|
| 792 | + print $globalTransaviaKey; |
|
| 793 | +} |
|
| 794 | +?>" /> |
|
| 640 | 795 | <p class="help-block">Register an account on <a href="https://developer.transavia.com">https://developer.transavia.com</a></p> |
| 641 | 796 | </p> |
| 642 | 797 | <p> |
@@ -644,10 +799,16 @@ discard block |
||
| 644 | 799 | <b>Lufthansa API Key</b> |
| 645 | 800 | <p> |
| 646 | 801 | <label for="lufthansakey">Key</label> |
| 647 | - <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) print $globalLufthansaKey['key']; ?>" /> |
|
| 802 | + <input type="text" name="lufthansakey" id="lufthansakey" value="<?php if (isset($globalLufthansaKey['key'])) { |
|
| 803 | + print $globalLufthansaKey['key']; |
|
| 804 | +} |
|
| 805 | +?>" /> |
|
| 648 | 806 | </p><p> |
| 649 | 807 | <label for="lufthansasecret">Secret</label> |
| 650 | - <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) print $globalLufthansaKey['secret']; ?>" /> |
|
| 808 | + <input type="text" name="lufthansasecret" id="lufthansasecret" value="<?php if (isset($globalLufthansaKey['secret'])) { |
|
| 809 | + print $globalLufthansaKey['secret']; |
|
| 810 | +} |
|
| 811 | +?>" /> |
|
| 651 | 812 | </p> |
| 652 | 813 | </div> |
| 653 | 814 | <p class="help-block">Register an account on <a href="https://developer.lufthansa.com/page">https://developer.lufthansa.com/page</a></p> |
@@ -667,7 +828,10 @@ discard block |
||
| 667 | 828 | </p> |
| 668 | 829 | <p> |
| 669 | 830 | <label for="notamsource">URL of your feed from notaminfo.com</label> |
| 670 | - <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) print $globalNOTAMSource; ?>" /> |
|
| 831 | + <input type="text" name="notamsource" id="notamsource" value="<?php if (isset($globalNOTAMSource)) { |
|
| 832 | + print $globalNOTAMSource; |
|
| 833 | +} |
|
| 834 | +?>" /> |
|
| 671 | 835 | </p> |
| 672 | 836 | <br /> |
| 673 | 837 | <p> |
@@ -682,14 +846,20 @@ discard block |
||
| 682 | 846 | <div id="metarsrc"> |
| 683 | 847 | <p> |
| 684 | 848 | <label for="metarsource">URL of your METAR source</label> |
| 685 | - <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) print $globalMETARurl; ?>" /> |
|
| 849 | + <input type="text" name="metarsource" id="metarsource" value="<?php if (isset($globalMETARurl)) { |
|
| 850 | + print $globalMETARurl; |
|
| 851 | +} |
|
| 852 | +?>" /> |
|
| 686 | 853 | <p class="help-block">Use {icao} to specify where we replace by airport icao. ex : http://metar.vatsim.net/metar.php?id={icao}</p> |
| 687 | 854 | </p> |
| 688 | 855 | </div> |
| 689 | 856 | <br /> |
| 690 | 857 | <p> |
| 691 | 858 | <label for="bitly">Bit.ly access token api (used in search page)</label> |
| 692 | - <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) print $globalBitlyAccessToken; ?>" /> |
|
| 859 | + <input type="text" name="bitly" id="bitly" value="<?php if (isset($globalBitlyAccessToken)) { |
|
| 860 | + print $globalBitlyAccessToken; |
|
| 861 | +} |
|
| 862 | +?>" /> |
|
| 693 | 863 | </p> |
| 694 | 864 | <br /> |
| 695 | 865 | <p> |
@@ -703,7 +873,12 @@ discard block |
||
| 703 | 873 | </p> |
| 704 | 874 | <p> |
| 705 | 875 | <label for="archivemonths">Generate statistics, delete or put in archive flights older than xx months</label> |
| 706 | - <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) print $globalArchiveMonths; else echo '0'; ?>" /> |
|
| 876 | + <input type="number" name="archivemonths" id="archivemonths" value="<?php if (isset($globalArchiveMonths)) { |
|
| 877 | + print $globalArchiveMonths; |
|
| 878 | +} else { |
|
| 879 | + echo '0'; |
|
| 880 | +} |
|
| 881 | +?>" /> |
|
| 707 | 882 | <p class="help-block">0 to disable, delete old flight if <i>Archive all flights data</i> is disabled</p> |
| 708 | 883 | </p> |
| 709 | 884 | <p> |
@@ -713,12 +888,22 @@ discard block |
||
| 713 | 888 | </p> |
| 714 | 889 | <p> |
| 715 | 890 | <label for="archivekeepmonths">Keep flights data for xx months in archive</label> |
| 716 | - <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) print $globalArchiveKeepMonths; else echo '0'; ?>" /> |
|
| 891 | + <input type="number" name="archivekeepmonths" id="archivekeepmonths" value="<?php if (isset($globalArchiveKeepMonths)) { |
|
| 892 | + print $globalArchiveKeepMonths; |
|
| 893 | +} else { |
|
| 894 | + echo '0'; |
|
| 895 | +} |
|
| 896 | +?>" /> |
|
| 717 | 897 | <p class="help-block">0 to disable</p> |
| 718 | 898 | </p> |
| 719 | 899 | <p> |
| 720 | 900 | <label for="archivekeeptrackmonths">Keep flights track data for xx months in archive</label> |
| 721 | - <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) print $globalArchiveKeepTrackMonths; else echo '0'; ?>" /> |
|
| 901 | + <input type="number" name="archivekeeptrackmonths" id="archivekeeptrackmonths" value="<?php if (isset($globalArchiveKeepTrackMonths)) { |
|
| 902 | + print $globalArchiveKeepTrackMonths; |
|
| 903 | +} else { |
|
| 904 | + echo '0'; |
|
| 905 | +} |
|
| 906 | +?>" /> |
|
| 722 | 907 | <p class="help-block">0 to disable, should be less or egal to <i>Keep flights data</i> value</p> |
| 723 | 908 | </p> |
| 724 | 909 | <br /> |
@@ -727,7 +912,12 @@ discard block |
||
| 727 | 912 | <input type="checkbox" name="daemon" id="daemon" value="daemon"<?php if ((isset($globalDaemon) && $globalDaemon) || !isset($globalDaemon)) { ?> checked="checked"<?php } ?> onClick="daemon_js()" /> |
| 728 | 913 | <div id="cronends"> |
| 729 | 914 | <label for="cronend">Run script for xx seconds</label> |
| 730 | - <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) print $globalCronEnd; else print '0'; ?>" /> |
|
| 915 | + <input type="number" name="cronend" id="cronend" value="<?php if (isset($globalCronEnd)) { |
|
| 916 | + print $globalCronEnd; |
|
| 917 | +} else { |
|
| 918 | + print '0'; |
|
| 919 | +} |
|
| 920 | +?>" /> |
|
| 731 | 921 | <p class="help-block">Set to 0 to disable. Should be disabled if source is URL.</p> |
| 732 | 922 | </div> |
| 733 | 923 | <p class="help-block">Uncheck if the script is running as cron job</p> |
@@ -768,26 +958,49 @@ discard block |
||
| 768 | 958 | <br /> |
| 769 | 959 | <p> |
| 770 | 960 | <label for="refresh">Show flights detected since xxx seconds</label> |
| 771 | - <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) echo $globalLiveInterval; else echo '200'; ?>" /> |
|
| 961 | + <input type="number" name="refresh" id="refresh" value="<?php if (isset($globalLiveInterval)) { |
|
| 962 | + echo $globalLiveInterval; |
|
| 963 | +} else { |
|
| 964 | + echo '200'; |
|
| 965 | +} |
|
| 966 | +?>" /> |
|
| 772 | 967 | </p> |
| 773 | 968 | <p> |
| 774 | 969 | <label for="maprefresh">Live map refresh (in seconds)</label> |
| 775 | - <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) echo $globalMapRefresh; else echo '30'; ?>" /> |
|
| 970 | + <input type="number" name="maprefresh" id="maprefresh" value="<?php if (isset($globalMapRefresh)) { |
|
| 971 | + echo $globalMapRefresh; |
|
| 972 | +} else { |
|
| 973 | + echo '30'; |
|
| 974 | +} |
|
| 975 | +?>" /> |
|
| 776 | 976 | </p> |
| 777 | 977 | <p> |
| 778 | 978 | <label for="mapidle">Map idle timeout (in minutes)</label> |
| 779 | - <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) echo $globalMapIdleTimeout; else echo '30'; ?>" /> |
|
| 979 | + <input type="number" name="mapidle" id="mapidle" value="<?php if (isset($globalMapIdleTimeout)) { |
|
| 980 | + echo $globalMapIdleTimeout; |
|
| 981 | +} else { |
|
| 982 | + echo '30'; |
|
| 983 | +} |
|
| 984 | +?>" /> |
|
| 780 | 985 | <p class="help-block">0 to disable</p> |
| 781 | 986 | </p> |
| 782 | 987 | <br /> |
| 783 | 988 | <p> |
| 784 | 989 | <label for="closestmindist">Distance to airport set as arrival (in km)</label> |
| 785 | - <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) echo $globalClosestMinDist; else echo '50'; ?>" /> |
|
| 990 | + <input type="number" name="closestmindist" id="closestmindist" value="<?php if (isset($globalClosestMinDist)) { |
|
| 991 | + echo $globalClosestMinDist; |
|
| 992 | +} else { |
|
| 993 | + echo '50'; |
|
| 994 | +} |
|
| 995 | +?>" /> |
|
| 786 | 996 | </p> |
| 787 | 997 | <br /> |
| 788 | 998 | <p> |
| 789 | 999 | <label for="aircraftsize">Size of aircraft icon on map (default to 30px if zoom > 7 else 15px), empty to default</label> |
| 790 | - <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) echo $globalAircraftSize;?>" /> |
|
| 1000 | + <input type="number" name="aircraftsize" id="aircraftsize" value="<?php if (isset($globalAircraftSize)) { |
|
| 1001 | + echo $globalAircraftSize; |
|
| 1002 | +} |
|
| 1003 | +?>" /> |
|
| 791 | 1004 | </p> |
| 792 | 1005 | <br /> |
| 793 | 1006 | <p> |
@@ -795,7 +1008,12 @@ discard block |
||
| 795 | 1008 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 796 | 1009 | ?> |
| 797 | 1010 | <label for="aircrafticoncolor">Color of aircraft icon on map</label> |
| 798 | - <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) echo $globalAircraftIconColor; else echo '1a3151'; ?>" /> |
|
| 1011 | + <input type="color" name="aircrafticoncolor" id="aircrafticoncolor" value="#<?php if (isset($globalAircraftIconColor)) { |
|
| 1012 | + echo $globalAircraftIconColor; |
|
| 1013 | +} else { |
|
| 1014 | + echo '1a3151'; |
|
| 1015 | +} |
|
| 1016 | +?>" /> |
|
| 799 | 1017 | <?php |
| 800 | 1018 | if (!is_writable('../cache')) { |
| 801 | 1019 | ?> |
@@ -813,8 +1031,18 @@ discard block |
||
| 813 | 1031 | <p> |
| 814 | 1032 | <label for="airportzoom">Zoom level minimum to see airports icons</label> |
| 815 | 1033 | <div class="range"> |
| 816 | - <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?>" /> |
|
| 817 | - <output id="range"><?php if (isset($globalAirportZoom)) echo $globalAirportZoom; else echo '7'; ?></output> |
|
| 1034 | + <input type="range" name="airportzoom" id="airportzoom" value="<?php if (isset($globalAirportZoom)) { |
|
| 1035 | + echo $globalAirportZoom; |
|
| 1036 | +} else { |
|
| 1037 | + echo '7'; |
|
| 1038 | +} |
|
| 1039 | +?>" /> |
|
| 1040 | + <output id="range"><?php if (isset($globalAirportZoom)) { |
|
| 1041 | + echo $globalAirportZoom; |
|
| 1042 | +} else { |
|
| 1043 | + echo '7'; |
|
| 1044 | +} |
|
| 1045 | +?></output> |
|
| 818 | 1046 | </div> |
| 819 | 1047 | </p> |
| 820 | 1048 | </fieldset> |
@@ -842,8 +1070,12 @@ discard block |
||
| 842 | 1070 | $dbhost = filter_input(INPUT_POST,'dbhost',FILTER_SANITIZE_STRING); |
| 843 | 1071 | $dbport = filter_input(INPUT_POST,'dbport',FILTER_SANITIZE_STRING); |
| 844 | 1072 | |
| 845 | - if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) $error .= 'Mysql driver for PDO must be loaded'; |
|
| 846 | - if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1073 | + if ($dbtype == 'mysql' && !extension_loaded('pdo_mysql')) { |
|
| 1074 | + $error .= 'Mysql driver for PDO must be loaded'; |
|
| 1075 | + } |
|
| 1076 | + if ($dbtype == 'pgsql' && !extension_loaded('pdo_pgsql')) { |
|
| 1077 | + $error .= 'PosgreSQL driver for PDO must be loaded'; |
|
| 1078 | + } |
|
| 847 | 1079 | |
| 848 | 1080 | $_SESSION['database_root'] = $dbroot; |
| 849 | 1081 | $_SESSION['database_rootpass'] = $dbrootpass; |
@@ -910,15 +1142,23 @@ discard block |
||
| 910 | 1142 | $source_city = $_POST['source_city']; |
| 911 | 1143 | $source_country = $_POST['source_country']; |
| 912 | 1144 | $source_ref = $_POST['source_ref']; |
| 913 | - if (isset($source_id)) $source_id = $_POST['source_id']; |
|
| 914 | - else $source_id = array(); |
|
| 1145 | + if (isset($source_id)) { |
|
| 1146 | + $source_id = $_POST['source_id']; |
|
| 1147 | + } else { |
|
| 1148 | + $source_id = array(); |
|
| 1149 | + } |
|
| 915 | 1150 | |
| 916 | 1151 | $sources = array(); |
| 917 | 1152 | foreach ($source_name as $keys => $name) { |
| 918 | - if (isset($source_id[$keys])) $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 919 | - else $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1153 | + if (isset($source_id[$keys])) { |
|
| 1154 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'id' => $source_id[$keys],'source' => $source_ref[$keys]); |
|
| 1155 | + } else { |
|
| 1156 | + $sources[] = array('name' => $name,'latitude' => $source_latitude[$keys],'longitude' => $source_longitude[$keys],'altitude' => $source_altitude[$keys],'city' => $source_city[$keys],'country' => $source_country[$keys],'source' => $source_ref[$keys]); |
|
| 1157 | + } |
|
| 1158 | + } |
|
| 1159 | + if (count($sources) > 0) { |
|
| 1160 | + $_SESSION['sources'] = $sources; |
|
| 920 | 1161 | } |
| 921 | - if (count($sources) > 0) $_SESSION['sources'] = $sources; |
|
| 922 | 1162 | |
| 923 | 1163 | //$sbshost = filter_input(INPUT_POST,'sbshost',FILTER_SANITIZE_STRING); |
| 924 | 1164 | //$sbsport = filter_input(INPUT_POST,'sbsport',FILTER_SANITIZE_NUMBER_INT); |
@@ -958,9 +1198,14 @@ discard block |
||
| 958 | 1198 | $sourcestats = $_POST['sourcestats']; |
| 959 | 1199 | $gSources = array(); |
| 960 | 1200 | foreach ($host as $key => $h) { |
| 961 | - if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) $cov = 'TRUE'; |
|
| 962 | - else $cov = 'FALSE'; |
|
| 963 | - if ($h != '') $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
| 1201 | + if (isset($sourcestats[$key]) && $sourcestats[$key] == 1) { |
|
| 1202 | + $cov = 'TRUE'; |
|
| 1203 | + } else { |
|
| 1204 | + $cov = 'FALSE'; |
|
| 1205 | + } |
|
| 1206 | + if ($h != '') { |
|
| 1207 | + $gSources[] = array('host' => $h, 'port' => $port[$key],'name' => $name[$key],'format' => $format[$key],'sourcestats' => $cov); |
|
| 1208 | + } |
|
| 964 | 1209 | } |
| 965 | 1210 | $settings = array_merge($settings,array('globalSources' => $gSources)); |
| 966 | 1211 | |
@@ -984,7 +1229,9 @@ discard block |
||
| 984 | 1229 | $zoidistance = filter_input(INPUT_POST,'zoidistance',FILTER_SANITIZE_NUMBER_INT); |
| 985 | 1230 | if ($zoilatitude != '' && $zoilongitude != '' && $zoidistance != '') { |
| 986 | 1231 | $settings = array_merge($settings,array('globalDistanceIgnore' => array('latitude' => $zoilatitude,'longitude' => $zoilongitude,'distance' => $zoidistance))); |
| 987 | - } else $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1232 | + } else { |
|
| 1233 | + $settings = array_merge($settings,array('globalDistanceIgnore' => array())); |
|
| 1234 | + } |
|
| 988 | 1235 | |
| 989 | 1236 | $refresh = filter_input(INPUT_POST,'refresh',FILTER_SANITIZE_NUMBER_INT); |
| 990 | 1237 | $settings = array_merge($settings,array('globalLiveInterval' => $refresh)); |
@@ -1023,7 +1270,9 @@ discard block |
||
| 1023 | 1270 | |
| 1024 | 1271 | // Create in settings.php keys not yet configurable if not already here |
| 1025 | 1272 | //if (!isset($globalImageBingKey)) $settings = array_merge($settings,array('globalImageBingKey' => '')); |
| 1026 | - if (!isset($globalDebug)) $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1273 | + if (!isset($globalDebug)) { |
|
| 1274 | + $settings = array_merge($settings,array('globalDebug' => 'TRUE')); |
|
| 1275 | + } |
|
| 1027 | 1276 | |
| 1028 | 1277 | $archive = filter_input(INPUT_POST,'archive',FILTER_SANITIZE_STRING); |
| 1029 | 1278 | if ($archive == 'archive') { |
@@ -1053,24 +1302,38 @@ discard block |
||
| 1053 | 1302 | } |
| 1054 | 1303 | */ |
| 1055 | 1304 | $settings = array_merge($settings,array('globalFlightAware' => 'FALSE')); |
| 1056 | - if ($globalsbs == 'sbs') $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1057 | - else $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1058 | - if ($globalaprs == 'aprs') $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1059 | - else $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1305 | + if ($globalsbs == 'sbs') { |
|
| 1306 | + $settings = array_merge($settings,array('globalSBS1' => 'TRUE')); |
|
| 1307 | + } else { |
|
| 1308 | + $settings = array_merge($settings,array('globalSBS1' => 'FALSE')); |
|
| 1309 | + } |
|
| 1310 | + if ($globalaprs == 'aprs') { |
|
| 1311 | + $settings = array_merge($settings,array('globalAPRS' => 'TRUE')); |
|
| 1312 | + } else { |
|
| 1313 | + $settings = array_merge($settings,array('globalAPRS' => 'FALSE')); |
|
| 1314 | + } |
|
| 1060 | 1315 | if ($globalivao == 'ivao') { |
| 1061 | 1316 | //$settings = array_merge($settings,array('globalIVAO' => 'TRUE','globalVATSIM' => 'FALSE')); |
| 1062 | 1317 | $settings = array_merge($settings,array('globalIVAO' => 'TRUE')); |
| 1063 | - } else $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1318 | + } else { |
|
| 1319 | + $settings = array_merge($settings,array('globalIVAO' => 'FALSE')); |
|
| 1320 | + } |
|
| 1064 | 1321 | if ($globalvatsim == 'vatsim') { |
| 1065 | 1322 | //$settings = array_merge($settings,array('globalVATSIM' => 'TRUE','globalIVAO' => 'FALSE')); |
| 1066 | 1323 | $settings = array_merge($settings,array('globalVATSIM' => 'TRUE')); |
| 1067 | - } else $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1324 | + } else { |
|
| 1325 | + $settings = array_merge($settings,array('globalVATSIM' => 'FALSE')); |
|
| 1326 | + } |
|
| 1068 | 1327 | if ($globalphpvms == 'phpvms') { |
| 1069 | 1328 | $settings = array_merge($settings,array('globalphpVMS' => 'TRUE')); |
| 1070 | - } else $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1329 | + } else { |
|
| 1330 | + $settings = array_merge($settings,array('globalphpVMS' => 'FALSE')); |
|
| 1331 | + } |
|
| 1071 | 1332 | if ($globalvatsim == 'vatsim' || $globalivao == 'ivao' || $globalphpvms == 'phpvms') { |
| 1072 | 1333 | $settings = array_merge($settings,array('globalSchedulesFetch' => 'FALSE','globalTranslationFetch' => 'FALSE')); |
| 1073 | - } else $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1334 | + } else { |
|
| 1335 | + $settings = array_merge($settings,array('globalSchedulesFetch' => 'TRUE','globalTranslationFetch' => 'TRUE')); |
|
| 1336 | + } |
|
| 1074 | 1337 | |
| 1075 | 1338 | |
| 1076 | 1339 | |
@@ -1164,7 +1427,9 @@ discard block |
||
| 1164 | 1427 | $settings = array_merge($settings,array('globalMapRoute' => 'FALSE')); |
| 1165 | 1428 | } |
| 1166 | 1429 | |
| 1167 | - if (!isset($globalTransaction)) $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1430 | + if (!isset($globalTransaction)) { |
|
| 1431 | + $settings = array_merge($settings,array('globalTransaction' => 'TRUE')); |
|
| 1432 | + } |
|
| 1168 | 1433 | |
| 1169 | 1434 | // Set some defaults values... |
| 1170 | 1435 | if (!isset($globalAircraftImageSources)) { |
@@ -1179,15 +1444,23 @@ discard block |
||
| 1179 | 1444 | |
| 1180 | 1445 | $settings = array_merge($settings,array('globalInstalled' => 'TRUE')); |
| 1181 | 1446 | |
| 1182 | - if ($error == '') settings::modify_settings($settings); |
|
| 1183 | - if ($error == '') settings::comment_settings($settings_comment); |
|
| 1447 | + if ($error == '') { |
|
| 1448 | + settings::modify_settings($settings); |
|
| 1449 | + } |
|
| 1450 | + if ($error == '') { |
|
| 1451 | + settings::comment_settings($settings_comment); |
|
| 1452 | + } |
|
| 1184 | 1453 | if ($error != '') { |
| 1185 | 1454 | print '<div class="info column">'.$error.'</div>'; |
| 1186 | 1455 | require('../footer.php'); |
| 1187 | 1456 | exit; |
| 1188 | 1457 | } else { |
| 1189 | - if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') $_SESSION['waypoints'] = 1; |
|
| 1190 | - if (isset($_POST['owner']) && $_POST['owner'] == 'owner') $_SESSION['owner'] = 1; |
|
| 1458 | + if (isset($_POST['waypoints']) && $_POST['waypoints'] == 'waypoints') { |
|
| 1459 | + $_SESSION['waypoints'] = 1; |
|
| 1460 | + } |
|
| 1461 | + if (isset($_POST['owner']) && $_POST['owner'] == 'owner') { |
|
| 1462 | + $_SESSION['owner'] = 1; |
|
| 1463 | + } |
|
| 1191 | 1464 | if (isset($_POST['createdb'])) { |
| 1192 | 1465 | $_SESSION['install'] = 'database_create'; |
| 1193 | 1466 | } else { |
@@ -1216,9 +1489,15 @@ discard block |
||
| 1216 | 1489 | $pop = false; |
| 1217 | 1490 | foreach ($_SESSION['done'] as $done) { |
| 1218 | 1491 | print '<li>'.$done.'....<strong>SUCCESS</strong></li>'; |
| 1219 | - if ($done == 'Create database') $pop = true; |
|
| 1220 | - if ($_SESSION['install'] == 'database_create') $pop = true; |
|
| 1221 | - if ($_SESSION['install'] == 'database_import') $popi = true; |
|
| 1492 | + if ($done == 'Create database') { |
|
| 1493 | + $pop = true; |
|
| 1494 | + } |
|
| 1495 | + if ($_SESSION['install'] == 'database_create') { |
|
| 1496 | + $pop = true; |
|
| 1497 | + } |
|
| 1498 | + if ($_SESSION['install'] == 'database_import') { |
|
| 1499 | + $popi = true; |
|
| 1500 | + } |
|
| 1222 | 1501 | } |
| 1223 | 1502 | if ($pop) { |
| 1224 | 1503 | sleep(5); |
@@ -1226,7 +1505,9 @@ discard block |
||
| 1226 | 1505 | } else if ($popi) { |
| 1227 | 1506 | sleep(5); |
| 1228 | 1507 | print '<li>Create and import tables....<img src="../images/loading.gif" /></li>'; |
| 1229 | - } else print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1508 | + } else { |
|
| 1509 | + print '<li>Update schema if needed....<img src="../images/loading.gif" /></li>'; |
|
| 1510 | + } |
|
| 1230 | 1511 | print '</div></ul>'; |
| 1231 | 1512 | print '<div id="error"></div>'; |
| 1232 | 1513 | /* foreach ($_SESSION['done'] as $done) { |