@@ -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 | curl_exec($ch); |
@@ -27,12 +29,16 @@ discard block |
||
| 27 | 29 | public static function gunzip($in_file,$out_file_name = '') { |
| 28 | 30 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 29 | 31 | $buffer_size = 4096; // read 4kb at a time |
| 30 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 32 | + if ($out_file_name == '') { |
|
| 33 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 34 | + } |
|
| 31 | 35 | if ($in_file != '' && file_exists($in_file)) { |
| 32 | 36 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 33 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 34 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 35 | - else { |
|
| 37 | + if (function_exists('gzopen')) { |
|
| 38 | + $file = gzopen($in_file,'rb'); |
|
| 39 | + } elseif (function_exists('gzopen64')) { |
|
| 40 | + $file = gzopen64($in_file,'rb'); |
|
| 41 | + } else { |
|
| 36 | 42 | echo 'gzopen not available'; |
| 37 | 43 | die; |
| 38 | 44 | } |
@@ -53,8 +59,12 @@ discard block |
||
| 53 | 59 | if ($res === TRUE) { |
| 54 | 60 | $zip->extractTo($path); |
| 55 | 61 | $zip->close(); |
| 56 | - } else return false; |
|
| 57 | - } else return false; |
|
| 62 | + } else { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | + } else { |
|
| 66 | + return false; |
|
| 67 | + } |
|
| 58 | 68 | } |
| 59 | 69 | |
| 60 | 70 | public static function connect_sqlite($database) { |
@@ -69,7 +79,9 @@ discard block |
||
| 69 | 79 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 70 | 80 | global $globalDebug, $globalTransaction; |
| 71 | 81 | //$query = 'TRUNCATE TABLE routes'; |
| 72 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 82 | + if ($globalDebug) { |
|
| 83 | + echo " - Delete previous routes from DB -"; |
|
| 84 | + } |
|
| 73 | 85 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 74 | 86 | $Connection = new Connection(); |
| 75 | 87 | try { |
@@ -80,7 +92,9 @@ discard block |
||
| 80 | 92 | return "error : ".$e->getMessage(); |
| 81 | 93 | } |
| 82 | 94 | |
| 83 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 95 | + if ($globalDebug) { |
|
| 96 | + echo " - Add routes to DB -"; |
|
| 97 | + } |
|
| 84 | 98 | update_db::connect_sqlite($database_file); |
| 85 | 99 | //$query = 'select Route.RouteID, Route.callsign, operator.Icao AS operator_icao, FromAir.Icao AS FromAirportIcao, ToAir.Icao AS ToAirportIcao from Route inner join operator ON Route.operatorId = operator.operatorId LEFT JOIN Airport AS FromAir ON route.FromAirportId = FromAir.AirportId LEFT JOIN Airport AS ToAir ON ToAir.AirportID = route.ToAirportID'; |
| 86 | 100 | $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"; |
@@ -95,15 +109,21 @@ discard block |
||
| 95 | 109 | $Connection = new Connection(); |
| 96 | 110 | $sth_dest = $Connection->db->prepare($query_dest); |
| 97 | 111 | try { |
| 98 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 112 | + if ($globalTransaction) { |
|
| 113 | + $Connection->db->beginTransaction(); |
|
| 114 | + } |
|
| 99 | 115 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 100 | 116 | //$query_dest_values = array(':RouteID' => $values['RouteId'],':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 101 | 117 | $query_dest_values = array(':CallSign' => $values['Callsign'],':Operator_ICAO' => $values['operator_icao'],':FromAirport_ICAO' => $values['FromAirportIcao'],':ToAirport_ICAO' => $values['ToAirportIcao'],':routestop' => $values['AllStop'],':source' => $database_file); |
| 102 | 118 | $sth_dest->execute($query_dest_values); |
| 103 | 119 | } |
| 104 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 120 | + if ($globalTransaction) { |
|
| 121 | + $Connection->db->commit(); |
|
| 122 | + } |
|
| 105 | 123 | } catch(PDOException $e) { |
| 106 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 124 | + if ($globalTransaction) { |
|
| 125 | + $Connection->db->rollBack(); |
|
| 126 | + } |
|
| 107 | 127 | return "error : ".$e->getMessage(); |
| 108 | 128 | } |
| 109 | 129 | return ''; |
@@ -111,7 +131,9 @@ discard block |
||
| 111 | 131 | public static function retrieve_route_oneworld($database_file) { |
| 112 | 132 | global $globalDebug, $globalTransaction; |
| 113 | 133 | //$query = 'TRUNCATE TABLE routes'; |
| 114 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 134 | + if ($globalDebug) { |
|
| 135 | + echo " - Delete previous routes from DB -"; |
|
| 136 | + } |
|
| 115 | 137 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 116 | 138 | $Connection = new Connection(); |
| 117 | 139 | try { |
@@ -122,14 +144,18 @@ discard block |
||
| 122 | 144 | return "error : ".$e->getMessage(); |
| 123 | 145 | } |
| 124 | 146 | |
| 125 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 147 | + if ($globalDebug) { |
|
| 148 | + echo " - Add routes to DB -"; |
|
| 149 | + } |
|
| 126 | 150 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 127 | 151 | $Spotter = new Spotter(); |
| 128 | 152 | if ($fh = fopen($database_file,"r")) { |
| 129 | 153 | $query_dest = 'INSERT INTO routes (CallSign,Operator_ICAO,FromAirport_ICAO,FromAirport_Time,ToAirport_ICAO,ToAirport_Time,RouteStop,Source) VALUES (:CallSign, :Operator_ICAO, :FromAirport_ICAO,:FromAirport_Time, :ToAirport_ICAO, :ToAirport_Time,:routestop, :source)'; |
| 130 | 154 | $Connection = new Connection(); |
| 131 | 155 | $sth_dest = $Connection->db->prepare($query_dest); |
| 132 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 156 | + if ($globalTransaction) { |
|
| 157 | + $Connection->db->beginTransaction(); |
|
| 158 | + } |
|
| 133 | 159 | while (!feof($fh)) { |
| 134 | 160 | $line = fgetcsv($fh,9999,','); |
| 135 | 161 | if ($line[0] != '') { |
@@ -138,13 +164,17 @@ discard block |
||
| 138 | 164 | $query_dest_values = array(':CallSign' => str_replace('*','',$line[7]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[5],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[6],':routestop' => '',':source' => 'oneworld'); |
| 139 | 165 | $sth_dest->execute($query_dest_values); |
| 140 | 166 | } catch(PDOException $e) { |
| 141 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 167 | + if ($globalTransaction) { |
|
| 168 | + $Connection->db->rollBack(); |
|
| 169 | + } |
|
| 142 | 170 | return "error : ".$e->getMessage(); |
| 143 | 171 | } |
| 144 | 172 | } |
| 145 | 173 | } |
| 146 | 174 | } |
| 147 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 175 | + if ($globalTransaction) { |
|
| 176 | + $Connection->db->commit(); |
|
| 177 | + } |
|
| 148 | 178 | } |
| 149 | 179 | return ''; |
| 150 | 180 | } |
@@ -152,7 +182,9 @@ discard block |
||
| 152 | 182 | public static function retrieve_route_skyteam($database_file) { |
| 153 | 183 | global $globalDebug, $globalTransaction; |
| 154 | 184 | //$query = 'TRUNCATE TABLE routes'; |
| 155 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 185 | + if ($globalDebug) { |
|
| 186 | + echo " - Delete previous routes from DB -"; |
|
| 187 | + } |
|
| 156 | 188 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 157 | 189 | $Connection = new Connection(); |
| 158 | 190 | try { |
@@ -163,7 +195,9 @@ discard block |
||
| 163 | 195 | return "error : ".$e->getMessage(); |
| 164 | 196 | } |
| 165 | 197 | |
| 166 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 198 | + if ($globalDebug) { |
|
| 199 | + echo " - Add routes to DB -"; |
|
| 200 | + } |
|
| 167 | 201 | |
| 168 | 202 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 169 | 203 | $Spotter = new Spotter(); |
@@ -172,7 +206,9 @@ discard block |
||
| 172 | 206 | $Connection = new Connection(); |
| 173 | 207 | $sth_dest = $Connection->db->prepare($query_dest); |
| 174 | 208 | try { |
| 175 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 209 | + if ($globalTransaction) { |
|
| 210 | + $Connection->db->beginTransaction(); |
|
| 211 | + } |
|
| 176 | 212 | while (!feof($fh)) { |
| 177 | 213 | $line = fgetcsv($fh,9999,','); |
| 178 | 214 | if ($line[0] != '') { |
@@ -183,9 +219,13 @@ discard block |
||
| 183 | 219 | } |
| 184 | 220 | } |
| 185 | 221 | } |
| 186 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 222 | + if ($globalTransaction) { |
|
| 223 | + $Connection->db->commit(); |
|
| 224 | + } |
|
| 187 | 225 | } catch(PDOException $e) { |
| 188 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 226 | + if ($globalTransaction) { |
|
| 227 | + $Connection->db->rollBack(); |
|
| 228 | + } |
|
| 189 | 229 | return "error : ".$e->getMessage(); |
| 190 | 230 | } |
| 191 | 231 | } |
@@ -228,11 +268,16 @@ discard block |
||
| 228 | 268 | $sth_dest = $Connection->db->prepare($query_dest); |
| 229 | 269 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 230 | 270 | try { |
| 231 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 271 | + if ($globalTransaction) { |
|
| 272 | + $Connection->db->beginTransaction(); |
|
| 273 | + } |
|
| 232 | 274 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 233 | 275 | //$query_dest_values = array(':AircraftID' => $values['AircraftID'],':FirstCreated' => $values['FirstCreated'],':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':SerialNo' => $values['SerialNo'], ':OperatorFlagCode' => $values['OperatorFlagCode'], ':Manufacturer' => $values['Manufacturer'], ':Type' => $values['Type'], ':FirstRegDate' => $values['FirstRegDate'], ':CurrentRegDate' => $values['CurrentRegDate'], ':Country' => $values['Country'], ':PreviousID' => $values['PreviousID'], ':DeRegDate' => $values['DeRegDate'], ':Status' => $values['Status'], ':PopularName' => $values['PopularName'],':GenericName' => $values['GenericName'],':AircraftClass' => $values['AircraftClass'], ':Engines' => $values['Engines'], ':OwnershipStatus' => $values['OwnershipStatus'],':RegisteredOwners' => $values['RegisteredOwners'],':MTOW' => $values['MTOW'], ':TotalHours' => $values['TotalHours'],':YearBuilt' => $values['YearBuilt'], ':CofACategory' => $values['CofACategory'], ':CofAExpiry' => $values['CofAExpiry'], ':UserNotes' => $values['UserNotes'], ':Interested' => $values['Interested'], ':UserTag' => $values['UserTag'], ':InfoUrl' => $values['InfoURL'], ':PictureUrl1' => $values['PictureURL1'], ':PictureUrl2' => $values['PictureURL2'], ':PictureUrl3' => $values['PictureURL3'], ':UserBool1' => $values['UserBool1'], ':UserBool2' => $values['UserBool2'], ':UserBool3' => $values['UserBool3'], ':UserBool4' => $values['UserBool4'], ':UserBool5' => $values['UserBool5'], ':UserString1' => $values['UserString1'], ':UserString2' => $values['UserString2'], ':UserString3' => $values['UserString3'], ':UserString4' => $values['UserString4'], ':UserString5' => $values['UserString5'], ':UserInt1' => $values['UserInt1'], ':UserInt2' => $values['UserInt2'], ':UserInt3' => $values['UserInt3'], ':UserInt4' => $values['UserInt4'], ':UserInt5' => $values['UserInt5']); |
| 234 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
| 235 | - else $type = null; |
|
| 276 | + if ($values['UserString4'] == 'M') { |
|
| 277 | + $type = 'military'; |
|
| 278 | + } else { |
|
| 279 | + $type = null; |
|
| 280 | + } |
|
| 236 | 281 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 237 | 282 | $sth_dest->execute($query_dest_values); |
| 238 | 283 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -240,7 +285,9 @@ discard block |
||
| 240 | 285 | $sth_dest_owner->execute($query_dest_owner_values); |
| 241 | 286 | } |
| 242 | 287 | } |
| 243 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 288 | + if ($globalTransaction) { |
|
| 289 | + $Connection->db->commit(); |
|
| 290 | + } |
|
| 244 | 291 | } catch(PDOException $e) { |
| 245 | 292 | return "error : ".$e->getMessage(); |
| 246 | 293 | } |
@@ -277,7 +324,9 @@ discard block |
||
| 277 | 324 | $Connection = new Connection(); |
| 278 | 325 | $sth_dest = $Connection->db->prepare($query_dest); |
| 279 | 326 | try { |
| 280 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 327 | + if ($globalTransaction) { |
|
| 328 | + $Connection->db->beginTransaction(); |
|
| 329 | + } |
|
| 281 | 330 | while (!feof($fh)) { |
| 282 | 331 | $values = array(); |
| 283 | 332 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -288,7 +337,9 @@ discard block |
||
| 288 | 337 | // Check if we can find ICAO, else set it to GLID |
| 289 | 338 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 290 | 339 | $search_more = ''; |
| 291 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 340 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 341 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 342 | + } |
|
| 292 | 343 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 293 | 344 | $sth_search = $Connection->db->prepare($query_search); |
| 294 | 345 | try { |
@@ -301,7 +352,9 @@ discard block |
||
| 301 | 352 | } catch(PDOException $e) { |
| 302 | 353 | return "error : ".$e->getMessage(); |
| 303 | 354 | } |
| 304 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
| 355 | + if (!isset($values['ICAOTypeCode'])) { |
|
| 356 | + $values['ICAOTypeCode'] = 'GLID'; |
|
| 357 | + } |
|
| 305 | 358 | // Add data to db |
| 306 | 359 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 307 | 360 | //$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']); |
@@ -310,7 +363,9 @@ discard block |
||
| 310 | 363 | $sth_dest->execute($query_dest_values); |
| 311 | 364 | } |
| 312 | 365 | } |
| 313 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 366 | + if ($globalTransaction) { |
|
| 367 | + $Connection->db->commit(); |
|
| 368 | + } |
|
| 314 | 369 | } catch(PDOException $e) { |
| 315 | 370 | return "error : ".$e->getMessage(); |
| 316 | 371 | } |
@@ -346,7 +401,9 @@ discard block |
||
| 346 | 401 | $Connection = new Connection(); |
| 347 | 402 | $sth_dest = $Connection->db->prepare($query_dest); |
| 348 | 403 | try { |
| 349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 404 | + if ($globalTransaction) { |
|
| 405 | + $Connection->db->beginTransaction(); |
|
| 406 | + } |
|
| 350 | 407 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 351 | 408 | while (!feof($fh)) { |
| 352 | 409 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -359,13 +416,17 @@ discard block |
||
| 359 | 416 | // Check if we can find ICAO, else set it to GLID |
| 360 | 417 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 361 | 418 | $search_more = ''; |
| 362 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 419 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 420 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 421 | + } |
|
| 363 | 422 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 364 | 423 | $sth_search = $Connection->db->prepare($query_search); |
| 365 | 424 | try { |
| 366 | 425 | $sth_search->execute(); |
| 367 | 426 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 368 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 427 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 428 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 429 | + } |
|
| 369 | 430 | } catch(PDOException $e) { |
| 370 | 431 | return "error : ".$e->getMessage(); |
| 371 | 432 | } |
@@ -378,7 +439,9 @@ discard block |
||
| 378 | 439 | $sth_dest->execute($query_dest_values); |
| 379 | 440 | } |
| 380 | 441 | } |
| 381 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 442 | + if ($globalTransaction) { |
|
| 443 | + $Connection->db->commit(); |
|
| 444 | + } |
|
| 382 | 445 | } catch(PDOException $e) { |
| 383 | 446 | return "error : ".$e->getMessage(); |
| 384 | 447 | } |
@@ -414,7 +477,9 @@ discard block |
||
| 414 | 477 | $Connection = new Connection(); |
| 415 | 478 | $sth_dest = $Connection->db->prepare($query_dest); |
| 416 | 479 | try { |
| 417 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 480 | + if ($globalTransaction) { |
|
| 481 | + $Connection->db->beginTransaction(); |
|
| 482 | + } |
|
| 418 | 483 | $tmp = fgetcsv($fh,9999,',','"'); |
| 419 | 484 | while (!feof($fh)) { |
| 420 | 485 | $line = fgetcsv($fh,9999,',','"'); |
@@ -424,16 +489,22 @@ discard block |
||
| 424 | 489 | $values['registration'] = $line[0]; |
| 425 | 490 | $values['base'] = $line[4]; |
| 426 | 491 | $values['owner'] = $line[5]; |
| 427 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 428 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 492 | + if ($line[6] == '') { |
|
| 493 | + $values['date_first_reg'] = null; |
|
| 494 | + } else { |
|
| 495 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 496 | + } |
|
| 429 | 497 | $values['cancel'] = $line[7]; |
| 430 | 498 | } elseif ($country == 'EI') { |
| 431 | 499 | // TODO : add modeS & reg to aircraft_modes |
| 432 | 500 | $values['registration'] = $line[0]; |
| 433 | 501 | $values['base'] = $line[3]; |
| 434 | 502 | $values['owner'] = $line[2]; |
| 435 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 436 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 503 | + if ($line[1] == '') { |
|
| 504 | + $values['date_first_reg'] = null; |
|
| 505 | + } else { |
|
| 506 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 507 | + } |
|
| 437 | 508 | $values['cancel'] = ''; |
| 438 | 509 | } elseif ($country == 'HB') { |
| 439 | 510 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,16 +518,22 @@ discard block |
||
| 447 | 518 | $values['registration'] = $line[3]; |
| 448 | 519 | $values['base'] = null; |
| 449 | 520 | $values['owner'] = $line[5]; |
| 450 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 451 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 521 | + if ($line[18] == '') { |
|
| 522 | + $values['date_first_reg'] = null; |
|
| 523 | + } else { |
|
| 524 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 525 | + } |
|
| 452 | 526 | $values['cancel'] = ''; |
| 453 | 527 | } elseif ($country == 'VH') { |
| 454 | 528 | // TODO : add modeS & reg to aircraft_modes |
| 455 | 529 | $values['registration'] = $line[0]; |
| 456 | 530 | $values['base'] = null; |
| 457 | 531 | $values['owner'] = $line[12]; |
| 458 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 459 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 532 | + if ($line[28] == '') { |
|
| 533 | + $values['date_first_reg'] = null; |
|
| 534 | + } else { |
|
| 535 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 536 | + } |
|
| 460 | 537 | |
| 461 | 538 | $values['cancel'] = $line[39]; |
| 462 | 539 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -475,29 +552,41 @@ discard block |
||
| 475 | 552 | $values['registration'] = $line[0]; |
| 476 | 553 | $values['base'] = null; |
| 477 | 554 | $values['owner'] = $line[8]; |
| 478 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 479 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 555 | + if ($line[7] == '') { |
|
| 556 | + $values['date_first_reg'] = null; |
|
| 557 | + } else { |
|
| 558 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 559 | + } |
|
| 480 | 560 | $values['cancel'] = ''; |
| 481 | 561 | } elseif ($country == 'PP') { |
| 482 | 562 | $values['registration'] = $line[0]; |
| 483 | 563 | $values['base'] = null; |
| 484 | 564 | $values['owner'] = $line[4]; |
| 485 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 486 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 565 | + if ($line[6] == '') { |
|
| 566 | + $values['date_first_reg'] = null; |
|
| 567 | + } else { |
|
| 568 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 569 | + } |
|
| 487 | 570 | $values['cancel'] = $line[7]; |
| 488 | 571 | } elseif ($country == 'E7') { |
| 489 | 572 | $values['registration'] = $line[0]; |
| 490 | 573 | $values['base'] = null; |
| 491 | 574 | $values['owner'] = $line[4]; |
| 492 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 493 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 575 | + if ($line[5] == '') { |
|
| 576 | + $values['date_first_reg'] = null; |
|
| 577 | + } else { |
|
| 578 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 579 | + } |
|
| 494 | 580 | $values['cancel'] = ''; |
| 495 | 581 | } elseif ($country == '8Q') { |
| 496 | 582 | $values['registration'] = $line[0]; |
| 497 | 583 | $values['base'] = null; |
| 498 | 584 | $values['owner'] = $line[3]; |
| 499 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 500 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 585 | + if ($line[7] == '') { |
|
| 586 | + $values['date_first_reg'] = null; |
|
| 587 | + } else { |
|
| 588 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 589 | + } |
|
| 501 | 590 | $values['cancel'] = ''; |
| 502 | 591 | } elseif ($country == 'ZK' || $country == 'OM' || $country == 'TF') { |
| 503 | 592 | $values['registration'] = $line[0]; |
@@ -511,7 +600,9 @@ discard block |
||
| 511 | 600 | $sth_dest->execute($query_dest_values); |
| 512 | 601 | } |
| 513 | 602 | } |
| 514 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 603 | + if ($globalTransaction) { |
|
| 604 | + $Connection->db->commit(); |
|
| 605 | + } |
|
| 515 | 606 | } catch(PDOException $e) { |
| 516 | 607 | return "error : ".$e->getMessage(); |
| 517 | 608 | } |
@@ -645,25 +736,45 @@ discard block |
||
| 645 | 736 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
| 646 | 737 | $Connection = new Connection(); |
| 647 | 738 | $sth_dest = $Connection->db->prepare($query_dest); |
| 648 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 739 | + if ($globalTransaction) { |
|
| 740 | + $Connection->db->beginTransaction(); |
|
| 741 | + } |
|
| 649 | 742 | |
| 650 | 743 | $i = 0; |
| 651 | 744 | while($row = sparql_fetch_array($result)) |
| 652 | 745 | { |
| 653 | 746 | if ($i >= 1) { |
| 654 | 747 | //print_r($row); |
| 655 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
| 656 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
| 657 | - if (!isset($row['type'])) $row['type'] = ''; |
|
| 658 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
| 748 | + if (!isset($row['iata'])) { |
|
| 749 | + $row['iata'] = ''; |
|
| 750 | + } |
|
| 751 | + if (!isset($row['icao'])) { |
|
| 752 | + $row['icao'] = ''; |
|
| 753 | + } |
|
| 754 | + if (!isset($row['type'])) { |
|
| 755 | + $row['type'] = ''; |
|
| 756 | + } |
|
| 757 | + if (!isset($row['altitude'])) { |
|
| 758 | + $row['altitude'] = ''; |
|
| 759 | + } |
|
| 659 | 760 | if (isset($row['city_bis'])) { |
| 660 | 761 | $row['city'] = $row['city_bis']; |
| 661 | 762 | } |
| 662 | - if (!isset($row['city'])) $row['city'] = ''; |
|
| 663 | - if (!isset($row['country'])) $row['country'] = ''; |
|
| 664 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
| 665 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
| 666 | - if (!isset($row['name'])) continue; |
|
| 763 | + if (!isset($row['city'])) { |
|
| 764 | + $row['city'] = ''; |
|
| 765 | + } |
|
| 766 | + if (!isset($row['country'])) { |
|
| 767 | + $row['country'] = ''; |
|
| 768 | + } |
|
| 769 | + if (!isset($row['homepage'])) { |
|
| 770 | + $row['homepage'] = ''; |
|
| 771 | + } |
|
| 772 | + if (!isset($row['wikipedia_page'])) { |
|
| 773 | + $row['wikipedia_page'] = ''; |
|
| 774 | + } |
|
| 775 | + if (!isset($row['name'])) { |
|
| 776 | + continue; |
|
| 777 | + } |
|
| 667 | 778 | if (!isset($row['image'])) { |
| 668 | 779 | $row['image'] = ''; |
| 669 | 780 | $row['image_thumb'] = ''; |
@@ -699,7 +810,9 @@ discard block |
||
| 699 | 810 | |
| 700 | 811 | $i++; |
| 701 | 812 | } |
| 702 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 813 | + if ($globalTransaction) { |
|
| 814 | + $Connection->db->commit(); |
|
| 815 | + } |
|
| 703 | 816 | echo "Delete duplicate rows...\n"; |
| 704 | 817 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
| 705 | 818 | try { |
@@ -711,7 +824,9 @@ discard block |
||
| 711 | 824 | } |
| 712 | 825 | |
| 713 | 826 | |
| 714 | - if ($globalDebug) echo "Insert Not available Airport...\n"; |
|
| 827 | + if ($globalDebug) { |
|
| 828 | + echo "Insert Not available Airport...\n"; |
|
| 829 | + } |
|
| 715 | 830 | $query = "INSERT INTO airport (`airport_id`,`name`,`city`,`country`,`iata`,`icao`,`latitude`,`longitude`,`altitude`,`type`,`home_link`,`wikipedia_link`,`image`,`image_thumb`) |
| 716 | 831 | VALUES (:airport_id, :name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image, :image_thumb)"; |
| 717 | 832 | $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' => ''); |
@@ -738,7 +853,9 @@ discard block |
||
| 738 | 853 | $delimiter = ','; |
| 739 | 854 | $out_file = $tmp_dir.'airports.csv'; |
| 740 | 855 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
| 741 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 856 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 857 | + return FALSE; |
|
| 858 | + } |
|
| 742 | 859 | echo "Add data from ourairports.com...\n"; |
| 743 | 860 | |
| 744 | 861 | $header = NULL; |
@@ -748,8 +865,9 @@ discard block |
||
| 748 | 865 | //$Connection->db->beginTransaction(); |
| 749 | 866 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 750 | 867 | { |
| 751 | - if(!$header) $header = $row; |
|
| 752 | - else { |
|
| 868 | + if(!$header) { |
|
| 869 | + $header = $row; |
|
| 870 | + } else { |
|
| 753 | 871 | $data = array(); |
| 754 | 872 | $data = array_combine($header, $row); |
| 755 | 873 | try { |
@@ -787,7 +905,9 @@ discard block |
||
| 787 | 905 | echo "Download data from another free database...\n"; |
| 788 | 906 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 789 | 907 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
| 790 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 908 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 909 | + return FALSE; |
|
| 910 | + } |
|
| 791 | 911 | update_db::unzip($out_file); |
| 792 | 912 | $header = NULL; |
| 793 | 913 | echo "Add data from another free database...\n"; |
@@ -798,8 +918,9 @@ discard block |
||
| 798 | 918 | //$Connection->db->beginTransaction(); |
| 799 | 919 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 800 | 920 | { |
| 801 | - if(!$header) $header = $row; |
|
| 802 | - else { |
|
| 921 | + if(!$header) { |
|
| 922 | + $header = $row; |
|
| 923 | + } else { |
|
| 803 | 924 | $data = $row; |
| 804 | 925 | |
| 805 | 926 | $query = 'UPDATE airport SET `city` = :city, `country` = :country WHERE icao = :icao'; |
@@ -972,7 +1093,9 @@ discard block |
||
| 972 | 1093 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
| 973 | 1094 | { |
| 974 | 1095 | $i = 0; |
| 975 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1096 | + if ($globalTransaction) { |
|
| 1097 | + $Connection->db->beginTransaction(); |
|
| 1098 | + } |
|
| 976 | 1099 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 977 | 1100 | { |
| 978 | 1101 | if ($i > 0) { |
@@ -998,7 +1121,9 @@ discard block |
||
| 998 | 1121 | $i++; |
| 999 | 1122 | } |
| 1000 | 1123 | fclose($handle); |
| 1001 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1124 | + if ($globalTransaction) { |
|
| 1125 | + $Connection->db->commit(); |
|
| 1126 | + } |
|
| 1002 | 1127 | } |
| 1003 | 1128 | return ''; |
| 1004 | 1129 | } |
@@ -1022,7 +1147,9 @@ discard block |
||
| 1022 | 1147 | $i = 0; |
| 1023 | 1148 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1024 | 1149 | //$Connection->db->beginTransaction(); |
| 1025 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1150 | + if ($globalTransaction) { |
|
| 1151 | + $Connection->db->beginTransaction(); |
|
| 1152 | + } |
|
| 1026 | 1153 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1027 | 1154 | { |
| 1028 | 1155 | if ($i > 0) { |
@@ -1037,7 +1164,9 @@ discard block |
||
| 1037 | 1164 | $i++; |
| 1038 | 1165 | } |
| 1039 | 1166 | fclose($handle); |
| 1040 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1167 | + if ($globalTransaction) { |
|
| 1168 | + $Connection->db->commit(); |
|
| 1169 | + } |
|
| 1041 | 1170 | } |
| 1042 | 1171 | return ''; |
| 1043 | 1172 | } |
@@ -1058,7 +1187,9 @@ discard block |
||
| 1058 | 1187 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
| 1059 | 1188 | { |
| 1060 | 1189 | $i = 0; |
| 1061 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1190 | + if ($globalTransaction) { |
|
| 1191 | + $Connection->db->beginTransaction(); |
|
| 1192 | + } |
|
| 1062 | 1193 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1063 | 1194 | { |
| 1064 | 1195 | if ($i > 0) { |
@@ -1074,7 +1205,9 @@ discard block |
||
| 1074 | 1205 | $i++; |
| 1075 | 1206 | } |
| 1076 | 1207 | fclose($handle); |
| 1077 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1208 | + if ($globalTransaction) { |
|
| 1209 | + $Connection->db->commit(); |
|
| 1210 | + } |
|
| 1078 | 1211 | } |
| 1079 | 1212 | return ''; |
| 1080 | 1213 | } |
@@ -1099,7 +1232,9 @@ discard block |
||
| 1099 | 1232 | $i = 0; |
| 1100 | 1233 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1101 | 1234 | //$Connection->db->beginTransaction(); |
| 1102 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1235 | + if ($globalTransaction) { |
|
| 1236 | + $Connection->db->beginTransaction(); |
|
| 1237 | + } |
|
| 1103 | 1238 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1104 | 1239 | { |
| 1105 | 1240 | if ($i > 0) { |
@@ -1114,7 +1249,9 @@ discard block |
||
| 1114 | 1249 | $i++; |
| 1115 | 1250 | } |
| 1116 | 1251 | fclose($handle); |
| 1117 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1252 | + if ($globalTransaction) { |
|
| 1253 | + $Connection->db->commit(); |
|
| 1254 | + } |
|
| 1118 | 1255 | } |
| 1119 | 1256 | return ''; |
| 1120 | 1257 | } |
@@ -1265,7 +1402,9 @@ discard block |
||
| 1265 | 1402 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1266 | 1403 | { |
| 1267 | 1404 | $i = 0; |
| 1268 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1405 | + if ($globalTransaction) { |
|
| 1406 | + $Connection->db->beginTransaction(); |
|
| 1407 | + } |
|
| 1269 | 1408 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1270 | 1409 | { |
| 1271 | 1410 | $i++; |
@@ -1293,7 +1432,9 @@ discard block |
||
| 1293 | 1432 | } |
| 1294 | 1433 | } |
| 1295 | 1434 | fclose($handle); |
| 1296 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1435 | + if ($globalTransaction) { |
|
| 1436 | + $Connection->db->commit(); |
|
| 1437 | + } |
|
| 1297 | 1438 | } |
| 1298 | 1439 | return ''; |
| 1299 | 1440 | } |
@@ -1316,7 +1457,9 @@ discard block |
||
| 1316 | 1457 | $Connection = new Connection(); |
| 1317 | 1458 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1318 | 1459 | { |
| 1319 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1460 | + if ($globalTransaction) { |
|
| 1461 | + $Connection->db->beginTransaction(); |
|
| 1462 | + } |
|
| 1320 | 1463 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1321 | 1464 | { |
| 1322 | 1465 | if(count($row) > 1) { |
@@ -1330,7 +1473,9 @@ discard block |
||
| 1330 | 1473 | } |
| 1331 | 1474 | } |
| 1332 | 1475 | fclose($handle); |
| 1333 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1476 | + if ($globalTransaction) { |
|
| 1477 | + $Connection->db->commit(); |
|
| 1478 | + } |
|
| 1334 | 1479 | } |
| 1335 | 1480 | return ''; |
| 1336 | 1481 | } |
@@ -1350,8 +1495,9 @@ discard block |
||
| 1350 | 1495 | } |
| 1351 | 1496 | |
| 1352 | 1497 | |
| 1353 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1354 | - else { |
|
| 1498 | + if ($globalDBdriver == 'mysql') { |
|
| 1499 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1500 | + } else { |
|
| 1355 | 1501 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 1356 | 1502 | $query = "CREATE EXTENSION postgis"; |
| 1357 | 1503 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1370,20 +1516,30 @@ discard block |
||
| 1370 | 1516 | global $tmp_dir, $globalDebug; |
| 1371 | 1517 | include_once('class.create_db.php'); |
| 1372 | 1518 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 1373 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
| 1519 | + if ($globalDebug) { |
|
| 1520 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
| 1521 | + } |
|
| 1374 | 1522 | update_db::download('http://data.flightairmap.fr/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
| 1375 | 1523 | $error = ''; |
| 1376 | 1524 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 1377 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1525 | + if ($globalDebug) { |
|
| 1526 | + echo "Gunzip..."; |
|
| 1527 | + } |
|
| 1378 | 1528 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
| 1379 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1529 | + if ($globalDebug) { |
|
| 1530 | + echo "Add to DB..."; |
|
| 1531 | + } |
|
| 1380 | 1532 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
| 1381 | 1533 | $NOTAM = new NOTAM(); |
| 1382 | 1534 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
| 1383 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 1535 | + } else { |
|
| 1536 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 1537 | + } |
|
| 1384 | 1538 | if ($error != '') { |
| 1385 | 1539 | return $error; |
| 1386 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1540 | + } elseif ($globalDebug) { |
|
| 1541 | + echo "Done\n"; |
|
| 1542 | + } |
|
| 1387 | 1543 | return ''; |
| 1388 | 1544 | } |
| 1389 | 1545 | |
@@ -1437,67 +1593,111 @@ discard block |
||
| 1437 | 1593 | //if ($globalDebug) echo "IVAO : Download..."; |
| 1438 | 1594 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 1439 | 1595 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 1440 | - if ($globalDebug) echo "Unzip..."; |
|
| 1596 | + if ($globalDebug) { |
|
| 1597 | + echo "Unzip..."; |
|
| 1598 | + } |
|
| 1441 | 1599 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 1442 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1600 | + if ($globalDebug) { |
|
| 1601 | + echo "Add to DB..."; |
|
| 1602 | + } |
|
| 1443 | 1603 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 1444 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 1604 | + if ($globalDebug) { |
|
| 1605 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 1606 | + } |
|
| 1445 | 1607 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 1446 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 1447 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 1448 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 1608 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 1609 | + $error = "Failed to copy airlines logo."; |
|
| 1610 | + } |
|
| 1611 | + } else { |
|
| 1612 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 1613 | + } |
|
| 1614 | + } else { |
|
| 1615 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 1616 | + } |
|
| 1449 | 1617 | if ($error != '') { |
| 1450 | 1618 | return $error; |
| 1451 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1619 | + } elseif ($globalDebug) { |
|
| 1620 | + echo "Done\n"; |
|
| 1621 | + } |
|
| 1452 | 1622 | return ''; |
| 1453 | 1623 | } |
| 1454 | 1624 | |
| 1455 | 1625 | public static function update_routes() { |
| 1456 | 1626 | global $tmp_dir, $globalDebug; |
| 1457 | 1627 | $error = ''; |
| 1458 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 1628 | + if ($globalDebug) { |
|
| 1629 | + echo "Routes : Download..."; |
|
| 1630 | + } |
|
| 1459 | 1631 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 1460 | 1632 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 1461 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1633 | + if ($globalDebug) { |
|
| 1634 | + echo "Gunzip..."; |
|
| 1635 | + } |
|
| 1462 | 1636 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 1463 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1637 | + if ($globalDebug) { |
|
| 1638 | + echo "Add to DB..."; |
|
| 1639 | + } |
|
| 1464 | 1640 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 1465 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 1641 | + } else { |
|
| 1642 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 1643 | + } |
|
| 1466 | 1644 | if ($error != '') { |
| 1467 | 1645 | return $error; |
| 1468 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1646 | + } elseif ($globalDebug) { |
|
| 1647 | + echo "Done\n"; |
|
| 1648 | + } |
|
| 1469 | 1649 | return ''; |
| 1470 | 1650 | } |
| 1471 | 1651 | public static function update_oneworld() { |
| 1472 | 1652 | global $tmp_dir, $globalDebug; |
| 1473 | 1653 | $error = ''; |
| 1474 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
| 1654 | + if ($globalDebug) { |
|
| 1655 | + echo "Schedules Oneworld : Download..."; |
|
| 1656 | + } |
|
| 1475 | 1657 | update_db::download('http://data.flightairmap.fr/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
| 1476 | 1658 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 1477 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1659 | + if ($globalDebug) { |
|
| 1660 | + echo "Gunzip..."; |
|
| 1661 | + } |
|
| 1478 | 1662 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
| 1479 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1663 | + if ($globalDebug) { |
|
| 1664 | + echo "Add to DB..."; |
|
| 1665 | + } |
|
| 1480 | 1666 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
| 1481 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 1667 | + } else { |
|
| 1668 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 1669 | + } |
|
| 1482 | 1670 | if ($error != '') { |
| 1483 | 1671 | return $error; |
| 1484 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1672 | + } elseif ($globalDebug) { |
|
| 1673 | + echo "Done\n"; |
|
| 1674 | + } |
|
| 1485 | 1675 | return ''; |
| 1486 | 1676 | } |
| 1487 | 1677 | public static function update_skyteam() { |
| 1488 | 1678 | global $tmp_dir, $globalDebug; |
| 1489 | 1679 | $error = ''; |
| 1490 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
| 1680 | + if ($globalDebug) { |
|
| 1681 | + echo "Schedules Skyteam : Download..."; |
|
| 1682 | + } |
|
| 1491 | 1683 | update_db::download('http://data.flightairmap.fr/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
| 1492 | 1684 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 1493 | - if ($globalDebug) echo "Gunzip..."; |
|
| 1685 | + if ($globalDebug) { |
|
| 1686 | + echo "Gunzip..."; |
|
| 1687 | + } |
|
| 1494 | 1688 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
| 1495 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1689 | + if ($globalDebug) { |
|
| 1690 | + echo "Add to DB..."; |
|
| 1691 | + } |
|
| 1496 | 1692 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
| 1497 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 1693 | + } else { |
|
| 1694 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 1695 | + } |
|
| 1498 | 1696 | if ($error != '') { |
| 1499 | 1697 | return $error; |
| 1500 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1698 | + } elseif ($globalDebug) { |
|
| 1699 | + echo "Done\n"; |
|
| 1700 | + } |
|
| 1501 | 1701 | return ''; |
| 1502 | 1702 | } |
| 1503 | 1703 | public static function update_ModeS() { |
@@ -1514,326 +1714,564 @@ discard block |
||
| 1514 | 1714 | exit; |
| 1515 | 1715 | } elseif ($globalDebug) echo "Done\n"; |
| 1516 | 1716 | */ |
| 1517 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 1518 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 1717 | + if ($globalDebug) { |
|
| 1718 | + echo "Modes : Download..."; |
|
| 1719 | + } |
|
| 1720 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 1519 | 1721 | update_db::download('http://data.flightairmap.fr/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
| 1520 | 1722 | |
| 1521 | 1723 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 1522 | 1724 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
| 1523 | - if ($globalDebug) echo "Unzip..."; |
|
| 1524 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 1725 | + if ($globalDebug) { |
|
| 1726 | + echo "Unzip..."; |
|
| 1727 | + } |
|
| 1728 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 1525 | 1729 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
| 1526 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1730 | + if ($globalDebug) { |
|
| 1731 | + echo "Add to DB..."; |
|
| 1732 | + } |
|
| 1527 | 1733 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 1528 | 1734 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
| 1529 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 1735 | + } else { |
|
| 1736 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 1737 | + } |
|
| 1530 | 1738 | if ($error != '') { |
| 1531 | 1739 | return $error; |
| 1532 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1740 | + } elseif ($globalDebug) { |
|
| 1741 | + echo "Done\n"; |
|
| 1742 | + } |
|
| 1533 | 1743 | return ''; |
| 1534 | 1744 | } |
| 1535 | 1745 | |
| 1536 | 1746 | public static function update_ModeS_faa() { |
| 1537 | 1747 | global $tmp_dir, $globalDebug; |
| 1538 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
| 1748 | + if ($globalDebug) { |
|
| 1749 | + echo "Modes FAA: Download..."; |
|
| 1750 | + } |
|
| 1539 | 1751 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
| 1540 | 1752 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 1541 | - if ($globalDebug) echo "Unzip..."; |
|
| 1753 | + if ($globalDebug) { |
|
| 1754 | + echo "Unzip..."; |
|
| 1755 | + } |
|
| 1542 | 1756 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
| 1543 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1757 | + if ($globalDebug) { |
|
| 1758 | + echo "Add to DB..."; |
|
| 1759 | + } |
|
| 1544 | 1760 | $error = update_db::modes_faa($tmp_dir.'ReleasableAircraft.zip'); |
| 1545 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 1761 | + } else { |
|
| 1762 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 1763 | + } |
|
| 1546 | 1764 | if ($error != '') { |
| 1547 | 1765 | return $error; |
| 1548 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1766 | + } elseif ($globalDebug) { |
|
| 1767 | + echo "Done\n"; |
|
| 1768 | + } |
|
| 1549 | 1769 | return ''; |
| 1550 | 1770 | } |
| 1551 | 1771 | |
| 1552 | 1772 | public static function update_ModeS_flarm() { |
| 1553 | 1773 | global $tmp_dir, $globalDebug; |
| 1554 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 1774 | + if ($globalDebug) { |
|
| 1775 | + echo "Modes Flarmnet: Download..."; |
|
| 1776 | + } |
|
| 1555 | 1777 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 1556 | 1778 | if (file_exists($tmp_dir.'data.fln')) { |
| 1557 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1779 | + if ($globalDebug) { |
|
| 1780 | + echo "Add to DB..."; |
|
| 1781 | + } |
|
| 1558 | 1782 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 1559 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 1783 | + } else { |
|
| 1784 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 1785 | + } |
|
| 1560 | 1786 | if ($error != '') { |
| 1561 | 1787 | return $error; |
| 1562 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1788 | + } elseif ($globalDebug) { |
|
| 1789 | + echo "Done\n"; |
|
| 1790 | + } |
|
| 1563 | 1791 | return ''; |
| 1564 | 1792 | } |
| 1565 | 1793 | |
| 1566 | 1794 | public static function update_ModeS_ogn() { |
| 1567 | 1795 | global $tmp_dir, $globalDebug; |
| 1568 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 1796 | + if ($globalDebug) { |
|
| 1797 | + echo "Modes OGN: Download..."; |
|
| 1798 | + } |
|
| 1569 | 1799 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 1570 | 1800 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 1571 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1801 | + if ($globalDebug) { |
|
| 1802 | + echo "Add to DB..."; |
|
| 1803 | + } |
|
| 1572 | 1804 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 1573 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 1805 | + } else { |
|
| 1806 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 1807 | + } |
|
| 1574 | 1808 | if ($error != '') { |
| 1575 | 1809 | return $error; |
| 1576 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1810 | + } elseif ($globalDebug) { |
|
| 1811 | + echo "Done\n"; |
|
| 1812 | + } |
|
| 1577 | 1813 | return ''; |
| 1578 | 1814 | } |
| 1579 | 1815 | |
| 1580 | 1816 | public static function update_owner() { |
| 1581 | 1817 | global $tmp_dir, $globalDebug; |
| 1582 | 1818 | |
| 1583 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 1819 | + if ($globalDebug) { |
|
| 1820 | + echo "Owner France: Download..."; |
|
| 1821 | + } |
|
| 1584 | 1822 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 1585 | 1823 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 1586 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1824 | + if ($globalDebug) { |
|
| 1825 | + echo "Add to DB..."; |
|
| 1826 | + } |
|
| 1587 | 1827 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 1588 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 1828 | + } else { |
|
| 1829 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 1830 | + } |
|
| 1589 | 1831 | if ($error != '') { |
| 1590 | 1832 | return $error; |
| 1591 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1833 | + } elseif ($globalDebug) { |
|
| 1834 | + echo "Done\n"; |
|
| 1835 | + } |
|
| 1592 | 1836 | |
| 1593 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 1837 | + if ($globalDebug) { |
|
| 1838 | + echo "Owner Ireland: Download..."; |
|
| 1839 | + } |
|
| 1594 | 1840 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 1595 | 1841 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 1596 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1842 | + if ($globalDebug) { |
|
| 1843 | + echo "Add to DB..."; |
|
| 1844 | + } |
|
| 1597 | 1845 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 1598 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 1846 | + } else { |
|
| 1847 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 1848 | + } |
|
| 1599 | 1849 | if ($error != '') { |
| 1600 | 1850 | return $error; |
| 1601 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1602 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 1851 | + } elseif ($globalDebug) { |
|
| 1852 | + echo "Done\n"; |
|
| 1853 | + } |
|
| 1854 | + if ($globalDebug) { |
|
| 1855 | + echo "Owner Switzerland: Download..."; |
|
| 1856 | + } |
|
| 1603 | 1857 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 1604 | 1858 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 1605 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1859 | + if ($globalDebug) { |
|
| 1860 | + echo "Add to DB..."; |
|
| 1861 | + } |
|
| 1606 | 1862 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 1607 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 1863 | + } else { |
|
| 1864 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 1865 | + } |
|
| 1608 | 1866 | if ($error != '') { |
| 1609 | 1867 | return $error; |
| 1610 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1611 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 1868 | + } elseif ($globalDebug) { |
|
| 1869 | + echo "Done\n"; |
|
| 1870 | + } |
|
| 1871 | + if ($globalDebug) { |
|
| 1872 | + echo "Owner Czech Republic: Download..."; |
|
| 1873 | + } |
|
| 1612 | 1874 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 1613 | 1875 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 1614 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1876 | + if ($globalDebug) { |
|
| 1877 | + echo "Add to DB..."; |
|
| 1878 | + } |
|
| 1615 | 1879 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 1616 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 1880 | + } else { |
|
| 1881 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 1882 | + } |
|
| 1617 | 1883 | if ($error != '') { |
| 1618 | 1884 | return $error; |
| 1619 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1620 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 1885 | + } elseif ($globalDebug) { |
|
| 1886 | + echo "Done\n"; |
|
| 1887 | + } |
|
| 1888 | + if ($globalDebug) { |
|
| 1889 | + echo "Owner Australia: Download..."; |
|
| 1890 | + } |
|
| 1621 | 1891 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 1622 | 1892 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 1623 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1893 | + if ($globalDebug) { |
|
| 1894 | + echo "Add to DB..."; |
|
| 1895 | + } |
|
| 1624 | 1896 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 1625 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 1897 | + } else { |
|
| 1898 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 1899 | + } |
|
| 1626 | 1900 | if ($error != '') { |
| 1627 | 1901 | return $error; |
| 1628 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1629 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 1902 | + } elseif ($globalDebug) { |
|
| 1903 | + echo "Done\n"; |
|
| 1904 | + } |
|
| 1905 | + if ($globalDebug) { |
|
| 1906 | + echo "Owner Austria: Download..."; |
|
| 1907 | + } |
|
| 1630 | 1908 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 1631 | 1909 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 1632 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1910 | + if ($globalDebug) { |
|
| 1911 | + echo "Add to DB..."; |
|
| 1912 | + } |
|
| 1633 | 1913 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 1634 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 1914 | + } else { |
|
| 1915 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 1916 | + } |
|
| 1635 | 1917 | if ($error != '') { |
| 1636 | 1918 | return $error; |
| 1637 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1638 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 1919 | + } elseif ($globalDebug) { |
|
| 1920 | + echo "Done\n"; |
|
| 1921 | + } |
|
| 1922 | + if ($globalDebug) { |
|
| 1923 | + echo "Owner Chile: Download..."; |
|
| 1924 | + } |
|
| 1639 | 1925 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 1640 | 1926 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 1641 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1927 | + if ($globalDebug) { |
|
| 1928 | + echo "Add to DB..."; |
|
| 1929 | + } |
|
| 1642 | 1930 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 1643 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 1931 | + } else { |
|
| 1932 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 1933 | + } |
|
| 1644 | 1934 | if ($error != '') { |
| 1645 | 1935 | return $error; |
| 1646 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1647 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 1936 | + } elseif ($globalDebug) { |
|
| 1937 | + echo "Done\n"; |
|
| 1938 | + } |
|
| 1939 | + if ($globalDebug) { |
|
| 1940 | + echo "Owner Colombia: Download..."; |
|
| 1941 | + } |
|
| 1648 | 1942 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 1649 | 1943 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 1650 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1944 | + if ($globalDebug) { |
|
| 1945 | + echo "Add to DB..."; |
|
| 1946 | + } |
|
| 1651 | 1947 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 1652 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 1948 | + } else { |
|
| 1949 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 1950 | + } |
|
| 1653 | 1951 | if ($error != '') { |
| 1654 | 1952 | return $error; |
| 1655 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1656 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 1953 | + } elseif ($globalDebug) { |
|
| 1954 | + echo "Done\n"; |
|
| 1955 | + } |
|
| 1956 | + if ($globalDebug) { |
|
| 1957 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 1958 | + } |
|
| 1657 | 1959 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 1658 | 1960 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 1659 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1961 | + if ($globalDebug) { |
|
| 1962 | + echo "Add to DB..."; |
|
| 1963 | + } |
|
| 1660 | 1964 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 1661 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 1965 | + } else { |
|
| 1966 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 1967 | + } |
|
| 1662 | 1968 | if ($error != '') { |
| 1663 | 1969 | return $error; |
| 1664 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1665 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 1970 | + } elseif ($globalDebug) { |
|
| 1971 | + echo "Done\n"; |
|
| 1972 | + } |
|
| 1973 | + if ($globalDebug) { |
|
| 1974 | + echo "Owner Brazil: Download..."; |
|
| 1975 | + } |
|
| 1666 | 1976 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 1667 | 1977 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 1668 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1978 | + if ($globalDebug) { |
|
| 1979 | + echo "Add to DB..."; |
|
| 1980 | + } |
|
| 1669 | 1981 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 1670 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 1982 | + } else { |
|
| 1983 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 1984 | + } |
|
| 1671 | 1985 | if ($error != '') { |
| 1672 | 1986 | return $error; |
| 1673 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1674 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 1987 | + } elseif ($globalDebug) { |
|
| 1988 | + echo "Done\n"; |
|
| 1989 | + } |
|
| 1990 | + if ($globalDebug) { |
|
| 1991 | + echo "Owner Cayman Islands: Download..."; |
|
| 1992 | + } |
|
| 1675 | 1993 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 1676 | 1994 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 1677 | - if ($globalDebug) echo "Add to DB..."; |
|
| 1995 | + if ($globalDebug) { |
|
| 1996 | + echo "Add to DB..."; |
|
| 1997 | + } |
|
| 1678 | 1998 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 1679 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 1999 | + } else { |
|
| 2000 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2001 | + } |
|
| 1680 | 2002 | if ($error != '') { |
| 1681 | 2003 | return $error; |
| 1682 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1683 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 2004 | + } elseif ($globalDebug) { |
|
| 2005 | + echo "Done\n"; |
|
| 2006 | + } |
|
| 2007 | + if ($globalDebug) { |
|
| 2008 | + echo "Owner Croatia: Download..."; |
|
| 2009 | + } |
|
| 1684 | 2010 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 1685 | 2011 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 1686 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2012 | + if ($globalDebug) { |
|
| 2013 | + echo "Add to DB..."; |
|
| 2014 | + } |
|
| 1687 | 2015 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 1688 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2016 | + } else { |
|
| 2017 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2018 | + } |
|
| 1689 | 2019 | if ($error != '') { |
| 1690 | 2020 | return $error; |
| 1691 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1692 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 2021 | + } elseif ($globalDebug) { |
|
| 2022 | + echo "Done\n"; |
|
| 2023 | + } |
|
| 2024 | + if ($globalDebug) { |
|
| 2025 | + echo "Owner Luxembourg: Download..."; |
|
| 2026 | + } |
|
| 1693 | 2027 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 1694 | 2028 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 1695 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2029 | + if ($globalDebug) { |
|
| 2030 | + echo "Add to DB..."; |
|
| 2031 | + } |
|
| 1696 | 2032 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 1697 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2033 | + } else { |
|
| 2034 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2035 | + } |
|
| 1698 | 2036 | if ($error != '') { |
| 1699 | 2037 | return $error; |
| 1700 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1701 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 2038 | + } elseif ($globalDebug) { |
|
| 2039 | + echo "Done\n"; |
|
| 2040 | + } |
|
| 2041 | + if ($globalDebug) { |
|
| 2042 | + echo "Owner Maldives: Download..."; |
|
| 2043 | + } |
|
| 1702 | 2044 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 1703 | 2045 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 1704 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2046 | + if ($globalDebug) { |
|
| 2047 | + echo "Add to DB..."; |
|
| 2048 | + } |
|
| 1705 | 2049 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 1706 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2050 | + } else { |
|
| 2051 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2052 | + } |
|
| 1707 | 2053 | if ($error != '') { |
| 1708 | 2054 | return $error; |
| 1709 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1710 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 2055 | + } elseif ($globalDebug) { |
|
| 2056 | + echo "Done\n"; |
|
| 2057 | + } |
|
| 2058 | + if ($globalDebug) { |
|
| 2059 | + echo "Owner New Zealand: Download..."; |
|
| 2060 | + } |
|
| 1711 | 2061 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 1712 | 2062 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 1713 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2063 | + if ($globalDebug) { |
|
| 2064 | + echo "Add to DB..."; |
|
| 2065 | + } |
|
| 1714 | 2066 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 1715 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2067 | + } else { |
|
| 2068 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2069 | + } |
|
| 1716 | 2070 | if ($error != '') { |
| 1717 | 2071 | return $error; |
| 1718 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1719 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 2072 | + } elseif ($globalDebug) { |
|
| 2073 | + echo "Done\n"; |
|
| 2074 | + } |
|
| 2075 | + if ($globalDebug) { |
|
| 2076 | + echo "Owner Papua New Guinea: Download..."; |
|
| 2077 | + } |
|
| 1720 | 2078 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 1721 | 2079 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 1722 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2080 | + if ($globalDebug) { |
|
| 2081 | + echo "Add to DB..."; |
|
| 2082 | + } |
|
| 1723 | 2083 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 1724 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2084 | + } else { |
|
| 2085 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2086 | + } |
|
| 1725 | 2087 | if ($error != '') { |
| 1726 | 2088 | return $error; |
| 1727 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1728 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 2089 | + } elseif ($globalDebug) { |
|
| 2090 | + echo "Done\n"; |
|
| 2091 | + } |
|
| 2092 | + if ($globalDebug) { |
|
| 2093 | + echo "Owner Slovakia: Download..."; |
|
| 2094 | + } |
|
| 1729 | 2095 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 1730 | 2096 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 1731 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2097 | + if ($globalDebug) { |
|
| 2098 | + echo "Add to DB..."; |
|
| 2099 | + } |
|
| 1732 | 2100 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 1733 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2101 | + } else { |
|
| 2102 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2103 | + } |
|
| 1734 | 2104 | if ($error != '') { |
| 1735 | 2105 | return $error; |
| 1736 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1737 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 2106 | + } elseif ($globalDebug) { |
|
| 2107 | + echo "Done\n"; |
|
| 2108 | + } |
|
| 2109 | + if ($globalDebug) { |
|
| 2110 | + echo "Owner Ecuador: Download..."; |
|
| 2111 | + } |
|
| 1738 | 2112 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 1739 | 2113 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 1740 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2114 | + if ($globalDebug) { |
|
| 2115 | + echo "Add to DB..."; |
|
| 2116 | + } |
|
| 1741 | 2117 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 1742 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2118 | + } else { |
|
| 2119 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2120 | + } |
|
| 1743 | 2121 | if ($error != '') { |
| 1744 | 2122 | return $error; |
| 1745 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 1746 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 2123 | + } elseif ($globalDebug) { |
|
| 2124 | + echo "Done\n"; |
|
| 2125 | + } |
|
| 2126 | + if ($globalDebug) { |
|
| 2127 | + echo "Owner Iceland: Download..."; |
|
| 2128 | + } |
|
| 1747 | 2129 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 1748 | 2130 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 1749 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2131 | + if ($globalDebug) { |
|
| 2132 | + echo "Add to DB..."; |
|
| 2133 | + } |
|
| 1750 | 2134 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 1751 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2135 | + } else { |
|
| 2136 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2137 | + } |
|
| 1752 | 2138 | if ($error != '') { |
| 1753 | 2139 | return $error; |
| 1754 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2140 | + } elseif ($globalDebug) { |
|
| 2141 | + echo "Done\n"; |
|
| 2142 | + } |
|
| 1755 | 2143 | return ''; |
| 1756 | 2144 | } |
| 1757 | 2145 | |
| 1758 | 2146 | public static function update_translation() { |
| 1759 | 2147 | global $tmp_dir, $globalDebug; |
| 1760 | 2148 | $error = ''; |
| 1761 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 2149 | + if ($globalDebug) { |
|
| 2150 | + echo "Translation : Download..."; |
|
| 2151 | + } |
|
| 1762 | 2152 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 1763 | 2153 | if (file_exists($tmp_dir.'translation.zip')) { |
| 1764 | - if ($globalDebug) echo "Unzip..."; |
|
| 2154 | + if ($globalDebug) { |
|
| 2155 | + echo "Unzip..."; |
|
| 2156 | + } |
|
| 1765 | 2157 | update_db::unzip($tmp_dir.'translation.zip'); |
| 1766 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2158 | + if ($globalDebug) { |
|
| 2159 | + echo "Add to DB..."; |
|
| 2160 | + } |
|
| 1767 | 2161 | $error = update_db::translation(); |
| 1768 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2162 | + } else { |
|
| 2163 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2164 | + } |
|
| 1769 | 2165 | if ($error != '') { |
| 1770 | 2166 | return $error; |
| 1771 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2167 | + } elseif ($globalDebug) { |
|
| 2168 | + echo "Done\n"; |
|
| 2169 | + } |
|
| 1772 | 2170 | return ''; |
| 1773 | 2171 | } |
| 1774 | 2172 | |
| 1775 | 2173 | public static function update_translation_fam() { |
| 1776 | 2174 | global $tmp_dir, $globalDebug; |
| 1777 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 2175 | + if ($globalDebug) { |
|
| 2176 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 2177 | + } |
|
| 1778 | 2178 | update_db::download('http://data.flightairmap.fr/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 1779 | 2179 | if (file_exists($tmp_dir.'translation.tsv.gz')) { |
| 1780 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2180 | + if ($globalDebug) { |
|
| 2181 | + echo "Gunzip..."; |
|
| 2182 | + } |
|
| 1781 | 2183 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 1782 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2184 | + if ($globalDebug) { |
|
| 2185 | + echo "Add to DB..."; |
|
| 2186 | + } |
|
| 1783 | 2187 | $error = update_db::translation_fam(); |
| 1784 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2188 | + } else { |
|
| 2189 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2190 | + } |
|
| 1785 | 2191 | if ($error != '') { |
| 1786 | 2192 | return $error; |
| 1787 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2193 | + } elseif ($globalDebug) { |
|
| 2194 | + echo "Done\n"; |
|
| 2195 | + } |
|
| 1788 | 2196 | return ''; |
| 1789 | 2197 | } |
| 1790 | 2198 | public static function update_ModeS_fam() { |
| 1791 | 2199 | global $tmp_dir, $globalDebug; |
| 1792 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
| 2200 | + if ($globalDebug) { |
|
| 2201 | + echo "ModeS from FlightAirMap website : Download..."; |
|
| 2202 | + } |
|
| 1793 | 2203 | update_db::download('http://data.flightairmap.fr/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
| 1794 | 2204 | if (file_exists($tmp_dir.'modes.tsv.gz')) { |
| 1795 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2205 | + if ($globalDebug) { |
|
| 2206 | + echo "Gunzip..."; |
|
| 2207 | + } |
|
| 1796 | 2208 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
| 1797 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2209 | + if ($globalDebug) { |
|
| 2210 | + echo "Add to DB..."; |
|
| 2211 | + } |
|
| 1798 | 2212 | $error = update_db::modes_fam(); |
| 1799 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2213 | + } else { |
|
| 2214 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2215 | + } |
|
| 1800 | 2216 | if ($error != '') { |
| 1801 | 2217 | return $error; |
| 1802 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2218 | + } elseif ($globalDebug) { |
|
| 2219 | + echo "Done\n"; |
|
| 2220 | + } |
|
| 1803 | 2221 | return ''; |
| 1804 | 2222 | } |
| 1805 | 2223 | public static function update_owner_fam() { |
| 1806 | 2224 | global $tmp_dir, $globalDebug, $globalOwner; |
| 1807 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
| 2225 | + if ($globalDebug) { |
|
| 2226 | + echo "owner from FlightAirMap website : Download..."; |
|
| 2227 | + } |
|
| 1808 | 2228 | if ($globalOwner === TRUE) { |
| 1809 | 2229 | update_db::download('http://data.flightairmap.fr/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
| 1810 | 2230 | } else { |
| 1811 | 2231 | update_db::download('http://data.flightairmap.fr/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
| 1812 | 2232 | } |
| 1813 | 2233 | if (file_exists($tmp_dir.'owners.tsv.gz')) { |
| 1814 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2234 | + if ($globalDebug) { |
|
| 2235 | + echo "Gunzip..."; |
|
| 2236 | + } |
|
| 1815 | 2237 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
| 1816 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2238 | + if ($globalDebug) { |
|
| 2239 | + echo "Add to DB..."; |
|
| 2240 | + } |
|
| 1817 | 2241 | $error = update_db::owner_fam(); |
| 1818 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 2242 | + } else { |
|
| 2243 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 2244 | + } |
|
| 1819 | 2245 | if ($error != '') { |
| 1820 | 2246 | return $error; |
| 1821 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2247 | + } elseif ($globalDebug) { |
|
| 2248 | + echo "Done\n"; |
|
| 2249 | + } |
|
| 1822 | 2250 | return ''; |
| 1823 | 2251 | } |
| 1824 | 2252 | public static function update_routes_fam() { |
| 1825 | 2253 | global $tmp_dir, $globalDebug; |
| 1826 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
| 2254 | + if ($globalDebug) { |
|
| 2255 | + echo "Routes from FlightAirMap website : Download..."; |
|
| 2256 | + } |
|
| 1827 | 2257 | update_db::download('http://data.flightairmap.fr/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
| 1828 | 2258 | if (file_exists($tmp_dir.'routes.tsv.gz')) { |
| 1829 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2259 | + if ($globalDebug) { |
|
| 2260 | + echo "Gunzip..."; |
|
| 2261 | + } |
|
| 1830 | 2262 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
| 1831 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2263 | + if ($globalDebug) { |
|
| 2264 | + echo "Add to DB..."; |
|
| 2265 | + } |
|
| 1832 | 2266 | $error = update_db::routes_fam(); |
| 1833 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2267 | + } else { |
|
| 2268 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2269 | + } |
|
| 1834 | 2270 | if ($error != '') { |
| 1835 | 2271 | return $error; |
| 1836 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2272 | + } elseif ($globalDebug) { |
|
| 2273 | + echo "Done\n"; |
|
| 2274 | + } |
|
| 1837 | 2275 | return ''; |
| 1838 | 2276 | } |
| 1839 | 2277 | |
@@ -1841,7 +2279,9 @@ discard block |
||
| 1841 | 2279 | global $tmp_dir, $globalDebug, $globalDBdriver; |
| 1842 | 2280 | include_once('class.create_db.php'); |
| 1843 | 2281 | $error = ''; |
| 1844 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
| 2282 | + if ($globalDebug) { |
|
| 2283 | + echo "Airspace from FlightAirMap website : Download..."; |
|
| 2284 | + } |
|
| 1845 | 2285 | if ($globalDBdriver == 'mysql') { |
| 1846 | 2286 | update_db::download('http://data.flightairmap.fr/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
| 1847 | 2287 | } else { |
@@ -1857,9 +2297,13 @@ discard block |
||
| 1857 | 2297 | update_db::download('http://data.flightairmap.fr/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
| 1858 | 2298 | } |
| 1859 | 2299 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 1860 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2300 | + if ($globalDebug) { |
|
| 2301 | + echo "Gunzip..."; |
|
| 2302 | + } |
|
| 1861 | 2303 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
| 1862 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2304 | + if ($globalDebug) { |
|
| 2305 | + echo "Add to DB..."; |
|
| 2306 | + } |
|
| 1863 | 2307 | $Connection = new Connection(); |
| 1864 | 2308 | if ($Connection->tableExists('airspace')) { |
| 1865 | 2309 | $query = 'DROP TABLE airspace'; |
@@ -1872,31 +2316,47 @@ discard block |
||
| 1872 | 2316 | } |
| 1873 | 2317 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 1874 | 2318 | update_db::insert_airspace_version($airspace_md5); |
| 1875 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
| 2319 | + } else { |
|
| 2320 | + $error = "File ".$tmp_dir.'airpsace.sql.gz'." doesn't exist. Download failed."; |
|
| 2321 | + } |
|
| 1876 | 2322 | } |
| 1877 | - } else $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 2323 | + } else { |
|
| 2324 | + $error = "File ".$tmp_dir.'airpsace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 2325 | + } |
|
| 1878 | 2326 | if ($error != '') { |
| 1879 | 2327 | return $error; |
| 1880 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2328 | + } elseif ($globalDebug) { |
|
| 2329 | + echo "Done\n"; |
|
| 2330 | + } |
|
| 1881 | 2331 | return ''; |
| 1882 | 2332 | } |
| 1883 | 2333 | |
| 1884 | 2334 | public static function update_tle() { |
| 1885 | 2335 | global $tmp_dir, $globalDebug; |
| 1886 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
| 2336 | + if ($globalDebug) { |
|
| 2337 | + echo "Download TLE : Download..."; |
|
| 2338 | + } |
|
| 1887 | 2339 | $alltle = array('stations.txt','gps-ops.txt','glo-ops.txt','galileo.txt','weather.txt','noaa.txt','goes.txt','resource.txt','dmc.txt','tdrss.txt','geo.txt','intelsat.txt','gorizont.txt', |
| 1888 | 2340 | 'raduga.txt','molniya.txt','iridium.txt','orbcomm.txt','globalstar.txt','amateur.txt','x-comm.txt','other-comm.txt','sbas.txt','nnss.txt','musson.txt','science.txt','geodetic.txt', |
| 1889 | 2341 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt'); |
| 1890 | 2342 | foreach ($alltle as $filename) { |
| 1891 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
| 2343 | + if ($globalDebug) { |
|
| 2344 | + echo "downloading ".$filename.'...'; |
|
| 2345 | + } |
|
| 1892 | 2346 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
| 1893 | 2347 | if (file_exists($tmp_dir.$filename)) { |
| 1894 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
| 2348 | + if ($globalDebug) { |
|
| 2349 | + echo "Add to DB ".$filename."..."; |
|
| 2350 | + } |
|
| 1895 | 2351 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
| 1896 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 2352 | + } else { |
|
| 2353 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 2354 | + } |
|
| 1897 | 2355 | if ($error != '') { |
| 1898 | 2356 | echo $error."\n"; |
| 1899 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2357 | + } elseif ($globalDebug) { |
|
| 2358 | + echo "Done\n"; |
|
| 2359 | + } |
|
| 1900 | 2360 | } |
| 1901 | 2361 | return ''; |
| 1902 | 2362 | } |
@@ -1904,10 +2364,14 @@ discard block |
||
| 1904 | 2364 | public static function update_models() { |
| 1905 | 2365 | global $tmp_dir, $globalDebug; |
| 1906 | 2366 | $error = ''; |
| 1907 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 2367 | + if ($globalDebug) { |
|
| 2368 | + echo "Models from FlightAirMap website : Download..."; |
|
| 2369 | + } |
|
| 1908 | 2370 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
| 1909 | 2371 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 1910 | - if ($globalDebug) echo "Check files...\n"; |
|
| 2372 | + if ($globalDebug) { |
|
| 2373 | + echo "Check files...\n"; |
|
| 2374 | + } |
|
| 1911 | 2375 | $newmodelsdb = array(); |
| 1912 | 2376 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
| 1913 | 2377 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -1926,25 +2390,35 @@ discard block |
||
| 1926 | 2390 | } |
| 1927 | 2391 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 1928 | 2392 | foreach ($diff as $key => $value) { |
| 1929 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 2393 | + if ($globalDebug) { |
|
| 2394 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 2395 | + } |
|
| 1930 | 2396 | update_db::download('http://data.flightairmap.fr/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
| 1931 | 2397 | |
| 1932 | 2398 | } |
| 1933 | 2399 | update_db::download('http://data.flightairmap.fr/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
| 1934 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 2400 | + } else { |
|
| 2401 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 2402 | + } |
|
| 1935 | 2403 | if ($error != '') { |
| 1936 | 2404 | return $error; |
| 1937 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2405 | + } elseif ($globalDebug) { |
|
| 2406 | + echo "Done\n"; |
|
| 2407 | + } |
|
| 1938 | 2408 | return ''; |
| 1939 | 2409 | } |
| 1940 | 2410 | |
| 1941 | 2411 | public static function update_space_models() { |
| 1942 | 2412 | global $tmp_dir, $globalDebug; |
| 1943 | 2413 | $error = ''; |
| 1944 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
| 2414 | + if ($globalDebug) { |
|
| 2415 | + echo "Space models from FlightAirMap website : Download..."; |
|
| 2416 | + } |
|
| 1945 | 2417 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
| 1946 | 2418 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 1947 | - if ($globalDebug) echo "Check files...\n"; |
|
| 2419 | + if ($globalDebug) { |
|
| 2420 | + echo "Check files...\n"; |
|
| 2421 | + } |
|
| 1948 | 2422 | $newmodelsdb = array(); |
| 1949 | 2423 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
| 1950 | 2424 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -1963,15 +2437,21 @@ discard block |
||
| 1963 | 2437 | } |
| 1964 | 2438 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 1965 | 2439 | foreach ($diff as $key => $value) { |
| 1966 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 2440 | + if ($globalDebug) { |
|
| 2441 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 2442 | + } |
|
| 1967 | 2443 | update_db::download('http://data.flightairmap.fr/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
| 1968 | 2444 | |
| 1969 | 2445 | } |
| 1970 | 2446 | update_db::download('http://data.flightairmap.fr/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
| 1971 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 2447 | + } else { |
|
| 2448 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 2449 | + } |
|
| 1972 | 2450 | if ($error != '') { |
| 1973 | 2451 | return $error; |
| 1974 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2452 | + } elseif ($globalDebug) { |
|
| 2453 | + echo "Done\n"; |
|
| 2454 | + } |
|
| 1975 | 2455 | return ''; |
| 1976 | 2456 | } |
| 1977 | 2457 | |
@@ -2014,7 +2494,9 @@ discard block |
||
| 2014 | 2494 | } |
| 2015 | 2495 | |
| 2016 | 2496 | $error = ''; |
| 2017 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 2497 | + if ($globalDebug) { |
|
| 2498 | + echo "Notam : Download..."; |
|
| 2499 | + } |
|
| 2018 | 2500 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 2019 | 2501 | if (file_exists($tmp_dir.'notam.rss')) { |
| 2020 | 2502 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -2029,14 +2511,30 @@ discard block |
||
| 2029 | 2511 | $data['fir'] = $q[0]; |
| 2030 | 2512 | $data['code'] = $q[1]; |
| 2031 | 2513 | $ifrvfr = $q[2]; |
| 2032 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 2033 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 2034 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 2035 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 2036 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 2037 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 2038 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 2039 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 2514 | + if ($ifrvfr == 'IV') { |
|
| 2515 | + $data['rules'] = 'IFR/VFR'; |
|
| 2516 | + } |
|
| 2517 | + if ($ifrvfr == 'I') { |
|
| 2518 | + $data['rules'] = 'IFR'; |
|
| 2519 | + } |
|
| 2520 | + if ($ifrvfr == 'V') { |
|
| 2521 | + $data['rules'] = 'VFR'; |
|
| 2522 | + } |
|
| 2523 | + if ($q[4] == 'A') { |
|
| 2524 | + $data['scope'] = 'Airport warning'; |
|
| 2525 | + } |
|
| 2526 | + if ($q[4] == 'E') { |
|
| 2527 | + $data['scope'] = 'Enroute warning'; |
|
| 2528 | + } |
|
| 2529 | + if ($q[4] == 'W') { |
|
| 2530 | + $data['scope'] = 'Navigation warning'; |
|
| 2531 | + } |
|
| 2532 | + if ($q[4] == 'AE') { |
|
| 2533 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 2534 | + } |
|
| 2535 | + if ($q[4] == 'AW') { |
|
| 2536 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 2537 | + } |
|
| 2040 | 2538 | //$data['scope'] = $q[4]; |
| 2041 | 2539 | $data['lower_limit'] = $q[5]; |
| 2042 | 2540 | $data['upper_limit'] = $q[6]; |
@@ -2044,8 +2542,12 @@ discard block |
||
| 2044 | 2542 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 2045 | 2543 | $latitude = $Common->convertDec($las,'latitude'); |
| 2046 | 2544 | $longitude = $Common->convertDec($lns,'longitude'); |
| 2047 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 2048 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 2545 | + if ($lac == 'S') { |
|
| 2546 | + $latitude = '-'.$latitude; |
|
| 2547 | + } |
|
| 2548 | + if ($lnc == 'W') { |
|
| 2549 | + $longitude = '-'.$longitude; |
|
| 2550 | + } |
|
| 2049 | 2551 | $data['center_latitude'] = $latitude; |
| 2050 | 2552 | $data['center_longitude'] = $longitude; |
| 2051 | 2553 | $data['radius'] = intval($radius); |
@@ -2075,10 +2577,14 @@ discard block |
||
| 2075 | 2577 | $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']); |
| 2076 | 2578 | unset($data); |
| 2077 | 2579 | } |
| 2078 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 2580 | + } else { |
|
| 2581 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 2582 | + } |
|
| 2079 | 2583 | if ($error != '') { |
| 2080 | 2584 | return $error; |
| 2081 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2585 | + } elseif ($globalDebug) { |
|
| 2586 | + echo "Done\n"; |
|
| 2587 | + } |
|
| 2082 | 2588 | return ''; |
| 2083 | 2589 | } |
| 2084 | 2590 | |
@@ -2103,7 +2609,9 @@ discard block |
||
| 2103 | 2609 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 2104 | 2610 | $airspace_json = json_decode($airspace_lst,true); |
| 2105 | 2611 | foreach ($airspace_json['records'] as $airspace) { |
| 2106 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
| 2612 | + if ($globalDebug) { |
|
| 2613 | + echo $airspace['name']."...\n"; |
|
| 2614 | + } |
|
| 2107 | 2615 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
| 2108 | 2616 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 2109 | 2617 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -2132,8 +2640,11 @@ discard block |
||
| 2132 | 2640 | return "error : ".$e->getMessage(); |
| 2133 | 2641 | } |
| 2134 | 2642 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2135 | - if ($row['nb'] > 0) return false; |
|
| 2136 | - else return true; |
|
| 2643 | + if ($row['nb'] > 0) { |
|
| 2644 | + return false; |
|
| 2645 | + } else { |
|
| 2646 | + return true; |
|
| 2647 | + } |
|
| 2137 | 2648 | } |
| 2138 | 2649 | |
| 2139 | 2650 | public static function insert_last_update() { |
@@ -2158,8 +2669,11 @@ discard block |
||
| 2158 | 2669 | return "error : ".$e->getMessage(); |
| 2159 | 2670 | } |
| 2160 | 2671 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2161 | - if ($row['nb'] > 0) return true; |
|
| 2162 | - else return false; |
|
| 2672 | + if ($row['nb'] > 0) { |
|
| 2673 | + return true; |
|
| 2674 | + } else { |
|
| 2675 | + return false; |
|
| 2676 | + } |
|
| 2163 | 2677 | } |
| 2164 | 2678 | |
| 2165 | 2679 | |
@@ -2190,8 +2704,11 @@ discard block |
||
| 2190 | 2704 | return "error : ".$e->getMessage(); |
| 2191 | 2705 | } |
| 2192 | 2706 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2193 | - if ($row['nb'] > 0) return false; |
|
| 2194 | - else return true; |
|
| 2707 | + if ($row['nb'] > 0) { |
|
| 2708 | + return false; |
|
| 2709 | + } else { |
|
| 2710 | + return true; |
|
| 2711 | + } |
|
| 2195 | 2712 | } |
| 2196 | 2713 | |
| 2197 | 2714 | public static function insert_last_notam_update() { |
@@ -2220,8 +2737,11 @@ discard block |
||
| 2220 | 2737 | return "error : ".$e->getMessage(); |
| 2221 | 2738 | } |
| 2222 | 2739 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2223 | - if ($row['nb'] > 0) return false; |
|
| 2224 | - else return true; |
|
| 2740 | + if ($row['nb'] > 0) { |
|
| 2741 | + return false; |
|
| 2742 | + } else { |
|
| 2743 | + return true; |
|
| 2744 | + } |
|
| 2225 | 2745 | } |
| 2226 | 2746 | |
| 2227 | 2747 | public static function insert_last_airspace_update() { |
@@ -2251,8 +2771,11 @@ discard block |
||
| 2251 | 2771 | return "error : ".$e->getMessage(); |
| 2252 | 2772 | } |
| 2253 | 2773 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2254 | - if ($row['nb'] > 0) return false; |
|
| 2255 | - else return true; |
|
| 2774 | + if ($row['nb'] > 0) { |
|
| 2775 | + return false; |
|
| 2776 | + } else { |
|
| 2777 | + return true; |
|
| 2778 | + } |
|
| 2256 | 2779 | } |
| 2257 | 2780 | |
| 2258 | 2781 | public static function insert_last_owner_update() { |
@@ -2281,8 +2804,11 @@ discard block |
||
| 2281 | 2804 | return "error : ".$e->getMessage(); |
| 2282 | 2805 | } |
| 2283 | 2806 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2284 | - if ($row['nb'] > 0) return false; |
|
| 2285 | - else return true; |
|
| 2807 | + if ($row['nb'] > 0) { |
|
| 2808 | + return false; |
|
| 2809 | + } else { |
|
| 2810 | + return true; |
|
| 2811 | + } |
|
| 2286 | 2812 | } |
| 2287 | 2813 | |
| 2288 | 2814 | public static function insert_last_schedules_update() { |
@@ -2311,8 +2837,11 @@ discard block |
||
| 2311 | 2837 | return "error : ".$e->getMessage(); |
| 2312 | 2838 | } |
| 2313 | 2839 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 2314 | - if ($row['nb'] > 0) return false; |
|
| 2315 | - else return true; |
|
| 2840 | + if ($row['nb'] > 0) { |
|
| 2841 | + return false; |
|
| 2842 | + } else { |
|
| 2843 | + return true; |
|
| 2844 | + } |
|
| 2316 | 2845 | } |
| 2317 | 2846 | |
| 2318 | 2847 | public static function insert_last_tle_update() { |