@@ -26,7 +26,9 @@ discard block |
||
| 26 | 26 | curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); |
| 27 | 27 | curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true); |
| 28 | 28 | curl_setopt($ch, CURLOPT_TIMEOUT, 200); |
| 29 | - if ($referer != '') curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 29 | + if ($referer != '') { |
|
| 30 | + curl_setopt($ch, CURLOPT_REFERER, $referer); |
|
| 31 | + } |
|
| 30 | 32 | 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'); |
| 31 | 33 | curl_setopt($ch, CURLOPT_FILE, $fp); |
| 32 | 34 | curl_exec($ch); |
@@ -37,12 +39,16 @@ discard block |
||
| 37 | 39 | public static function gunzip($in_file,$out_file_name = '') { |
| 38 | 40 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 39 | 41 | $buffer_size = 4096; // read 4kb at a time |
| 40 | - if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
|
| 42 | + if ($out_file_name == '') { |
|
| 43 | + $out_file_name = str_replace('.gz', '', $in_file); |
|
| 44 | + } |
|
| 41 | 45 | if ($in_file != '' && file_exists($in_file)) { |
| 42 | 46 | // PHP version of Ubuntu use gzopen64 instead of gzopen |
| 43 | - if (function_exists('gzopen')) $file = gzopen($in_file,'rb'); |
|
| 44 | - elseif (function_exists('gzopen64')) $file = gzopen64($in_file,'rb'); |
|
| 45 | - else { |
|
| 47 | + if (function_exists('gzopen')) { |
|
| 48 | + $file = gzopen($in_file,'rb'); |
|
| 49 | + } elseif (function_exists('gzopen64')) { |
|
| 50 | + $file = gzopen64($in_file,'rb'); |
|
| 51 | + } else { |
|
| 46 | 52 | echo 'gzopen not available'; |
| 47 | 53 | die; |
| 48 | 54 | } |
@@ -63,8 +69,12 @@ discard block |
||
| 63 | 69 | if ($res === TRUE) { |
| 64 | 70 | $zip->extractTo($path); |
| 65 | 71 | $zip->close(); |
| 66 | - } else return false; |
|
| 67 | - } else return false; |
|
| 72 | + } else { |
|
| 73 | + return false; |
|
| 74 | + } |
|
| 75 | + } else { |
|
| 76 | + return false; |
|
| 77 | + } |
|
| 68 | 78 | } |
| 69 | 79 | |
| 70 | 80 | public static function connect_sqlite($database) { |
@@ -79,7 +89,9 @@ discard block |
||
| 79 | 89 | public static function retrieve_route_sqlite_to_dest($database_file) { |
| 80 | 90 | global $globalDebug, $globalTransaction; |
| 81 | 91 | //$query = 'TRUNCATE TABLE routes'; |
| 82 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 92 | + if ($globalDebug) { |
|
| 93 | + echo " - Delete previous routes from DB -"; |
|
| 94 | + } |
|
| 83 | 95 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 84 | 96 | $Connection = new Connection(); |
| 85 | 97 | try { |
@@ -90,7 +102,9 @@ discard block |
||
| 90 | 102 | return "error : ".$e->getMessage(); |
| 91 | 103 | } |
| 92 | 104 | |
| 93 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 105 | + if ($globalDebug) { |
|
| 106 | + echo " - Add routes to DB -"; |
|
| 107 | + } |
|
| 94 | 108 | update_db::connect_sqlite($database_file); |
| 95 | 109 | //$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'; |
| 96 | 110 | $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"; |
@@ -105,15 +119,21 @@ discard block |
||
| 105 | 119 | $Connection = new Connection(); |
| 106 | 120 | $sth_dest = $Connection->db->prepare($query_dest); |
| 107 | 121 | try { |
| 108 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 122 | + if ($globalTransaction) { |
|
| 123 | + $Connection->db->beginTransaction(); |
|
| 124 | + } |
|
| 109 | 125 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 110 | 126 | //$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); |
| 111 | 127 | $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); |
| 112 | 128 | $sth_dest->execute($query_dest_values); |
| 113 | 129 | } |
| 114 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 130 | + if ($globalTransaction) { |
|
| 131 | + $Connection->db->commit(); |
|
| 132 | + } |
|
| 115 | 133 | } catch(PDOException $e) { |
| 116 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 134 | + if ($globalTransaction) { |
|
| 135 | + $Connection->db->rollBack(); |
|
| 136 | + } |
|
| 117 | 137 | return "error : ".$e->getMessage(); |
| 118 | 138 | } |
| 119 | 139 | return ''; |
@@ -121,7 +141,9 @@ discard block |
||
| 121 | 141 | public static function retrieve_route_oneworld($database_file) { |
| 122 | 142 | global $globalDebug, $globalTransaction; |
| 123 | 143 | //$query = 'TRUNCATE TABLE routes'; |
| 124 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 144 | + if ($globalDebug) { |
|
| 145 | + echo " - Delete previous routes from DB -"; |
|
| 146 | + } |
|
| 125 | 147 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 126 | 148 | $Connection = new Connection(); |
| 127 | 149 | try { |
@@ -132,14 +154,18 @@ discard block |
||
| 132 | 154 | return "error : ".$e->getMessage(); |
| 133 | 155 | } |
| 134 | 156 | |
| 135 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 157 | + if ($globalDebug) { |
|
| 158 | + echo " - Add routes to DB -"; |
|
| 159 | + } |
|
| 136 | 160 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 137 | 161 | $Spotter = new Spotter(); |
| 138 | 162 | if ($fh = fopen($database_file,"r")) { |
| 139 | 163 | $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)'; |
| 140 | 164 | $Connection = new Connection(); |
| 141 | 165 | $sth_dest = $Connection->db->prepare($query_dest); |
| 142 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 166 | + if ($globalTransaction) { |
|
| 167 | + $Connection->db->beginTransaction(); |
|
| 168 | + } |
|
| 143 | 169 | while (!feof($fh)) { |
| 144 | 170 | $line = fgetcsv($fh,9999,','); |
| 145 | 171 | if ($line[0] != '') { |
@@ -148,13 +174,17 @@ discard block |
||
| 148 | 174 | $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'); |
| 149 | 175 | $sth_dest->execute($query_dest_values); |
| 150 | 176 | } catch(PDOException $e) { |
| 151 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 177 | + if ($globalTransaction) { |
|
| 178 | + $Connection->db->rollBack(); |
|
| 179 | + } |
|
| 152 | 180 | return "error : ".$e->getMessage(); |
| 153 | 181 | } |
| 154 | 182 | } |
| 155 | 183 | } |
| 156 | 184 | } |
| 157 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 185 | + if ($globalTransaction) { |
|
| 186 | + $Connection->db->commit(); |
|
| 187 | + } |
|
| 158 | 188 | } |
| 159 | 189 | return ''; |
| 160 | 190 | } |
@@ -162,7 +192,9 @@ discard block |
||
| 162 | 192 | public static function retrieve_route_skyteam($database_file) { |
| 163 | 193 | global $globalDebug, $globalTransaction; |
| 164 | 194 | //$query = 'TRUNCATE TABLE routes'; |
| 165 | - if ($globalDebug) echo " - Delete previous routes from DB -"; |
|
| 195 | + if ($globalDebug) { |
|
| 196 | + echo " - Delete previous routes from DB -"; |
|
| 197 | + } |
|
| 166 | 198 | $query = "DELETE FROM routes WHERE Source = '' OR Source = :source"; |
| 167 | 199 | $Connection = new Connection(); |
| 168 | 200 | try { |
@@ -173,7 +205,9 @@ discard block |
||
| 173 | 205 | return "error : ".$e->getMessage(); |
| 174 | 206 | } |
| 175 | 207 | |
| 176 | - if ($globalDebug) echo " - Add routes to DB -"; |
|
| 208 | + if ($globalDebug) { |
|
| 209 | + echo " - Add routes to DB -"; |
|
| 210 | + } |
|
| 177 | 211 | |
| 178 | 212 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 179 | 213 | $Spotter = new Spotter(); |
@@ -182,7 +216,9 @@ discard block |
||
| 182 | 216 | $Connection = new Connection(); |
| 183 | 217 | $sth_dest = $Connection->db->prepare($query_dest); |
| 184 | 218 | try { |
| 185 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 219 | + if ($globalTransaction) { |
|
| 220 | + $Connection->db->beginTransaction(); |
|
| 221 | + } |
|
| 186 | 222 | while (!feof($fh)) { |
| 187 | 223 | $line = fgetcsv($fh,9999,','); |
| 188 | 224 | if ($line[0] != '') { |
@@ -193,9 +229,13 @@ discard block |
||
| 193 | 229 | } |
| 194 | 230 | } |
| 195 | 231 | } |
| 196 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 232 | + if ($globalTransaction) { |
|
| 233 | + $Connection->db->commit(); |
|
| 234 | + } |
|
| 197 | 235 | } catch(PDOException $e) { |
| 198 | - if ($globalTransaction) $Connection->db->rollBack(); |
|
| 236 | + if ($globalTransaction) { |
|
| 237 | + $Connection->db->rollBack(); |
|
| 238 | + } |
|
| 199 | 239 | return "error : ".$e->getMessage(); |
| 200 | 240 | } |
| 201 | 241 | } |
@@ -238,11 +278,16 @@ discard block |
||
| 238 | 278 | $sth_dest = $Connection->db->prepare($query_dest); |
| 239 | 279 | $sth_dest_owner = $Connection->db->prepare($query_dest_owner); |
| 240 | 280 | try { |
| 241 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 281 | + if ($globalTransaction) { |
|
| 282 | + $Connection->db->beginTransaction(); |
|
| 283 | + } |
|
| 242 | 284 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 243 | 285 | //$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']); |
| 244 | - if ($values['UserString4'] == 'M') $type = 'military'; |
|
| 245 | - else $type = null; |
|
| 286 | + if ($values['UserString4'] == 'M') { |
|
| 287 | + $type = 'military'; |
|
| 288 | + } else { |
|
| 289 | + $type = null; |
|
| 290 | + } |
|
| 246 | 291 | $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
| 247 | 292 | $sth_dest->execute($query_dest_values); |
| 248 | 293 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
@@ -250,7 +295,9 @@ discard block |
||
| 250 | 295 | $sth_dest_owner->execute($query_dest_owner_values); |
| 251 | 296 | } |
| 252 | 297 | } |
| 253 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 298 | + if ($globalTransaction) { |
|
| 299 | + $Connection->db->commit(); |
|
| 300 | + } |
|
| 254 | 301 | } catch(PDOException $e) { |
| 255 | 302 | return "error : ".$e->getMessage(); |
| 256 | 303 | } |
@@ -287,7 +334,9 @@ discard block |
||
| 287 | 334 | $Connection = new Connection(); |
| 288 | 335 | $sth_dest = $Connection->db->prepare($query_dest); |
| 289 | 336 | try { |
| 290 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 337 | + if ($globalTransaction) { |
|
| 338 | + $Connection->db->beginTransaction(); |
|
| 339 | + } |
|
| 291 | 340 | while (!feof($fh)) { |
| 292 | 341 | $values = array(); |
| 293 | 342 | $line = $Common->hex2str(fgets($fh,9999)); |
@@ -298,7 +347,9 @@ discard block |
||
| 298 | 347 | // Check if we can find ICAO, else set it to GLID |
| 299 | 348 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 300 | 349 | $search_more = ''; |
| 301 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 350 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 351 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 352 | + } |
|
| 302 | 353 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 303 | 354 | $sth_search = $Connection->db->prepare($query_search); |
| 304 | 355 | try { |
@@ -311,7 +362,9 @@ discard block |
||
| 311 | 362 | } catch(PDOException $e) { |
| 312 | 363 | return "error : ".$e->getMessage(); |
| 313 | 364 | } |
| 314 | - if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
|
| 365 | + if (!isset($values['ICAOTypeCode'])) { |
|
| 366 | + $values['ICAOTypeCode'] = 'GLID'; |
|
| 367 | + } |
|
| 315 | 368 | // Add data to db |
| 316 | 369 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 317 | 370 | //$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']); |
@@ -320,7 +373,9 @@ discard block |
||
| 320 | 373 | $sth_dest->execute($query_dest_values); |
| 321 | 374 | } |
| 322 | 375 | } |
| 323 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 376 | + if ($globalTransaction) { |
|
| 377 | + $Connection->db->commit(); |
|
| 378 | + } |
|
| 324 | 379 | } catch(PDOException $e) { |
| 325 | 380 | return "error : ".$e->getMessage(); |
| 326 | 381 | } |
@@ -356,7 +411,9 @@ discard block |
||
| 356 | 411 | $Connection = new Connection(); |
| 357 | 412 | $sth_dest = $Connection->db->prepare($query_dest); |
| 358 | 413 | try { |
| 359 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 414 | + if ($globalTransaction) { |
|
| 415 | + $Connection->db->beginTransaction(); |
|
| 416 | + } |
|
| 360 | 417 | $tmp = fgetcsv($fh,9999,',',"'"); |
| 361 | 418 | while (!feof($fh)) { |
| 362 | 419 | $line = fgetcsv($fh,9999,',',"'"); |
@@ -370,13 +427,17 @@ discard block |
||
| 370 | 427 | // Check if we can find ICAO, else set it to GLID |
| 371 | 428 | $aircraft_name_split = explode(' ',$aircraft_name); |
| 372 | 429 | $search_more = ''; |
| 373 | - if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 430 | + if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) { |
|
| 431 | + $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
|
| 432 | + } |
|
| 374 | 433 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
| 375 | 434 | $sth_search = $Connection->db->prepare($query_search); |
| 376 | 435 | try { |
| 377 | 436 | $sth_search->execute(); |
| 378 | 437 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 379 | - if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
|
| 438 | + if (isset($result['icao']) && $result['icao'] != '') { |
|
| 439 | + $values['ICAOTypeCode'] = $result['icao']; |
|
| 440 | + } |
|
| 380 | 441 | } catch(PDOException $e) { |
| 381 | 442 | return "error : ".$e->getMessage(); |
| 382 | 443 | } |
@@ -389,7 +450,9 @@ discard block |
||
| 389 | 450 | $sth_dest->execute($query_dest_values); |
| 390 | 451 | } |
| 391 | 452 | } |
| 392 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 453 | + if ($globalTransaction) { |
|
| 454 | + $Connection->db->commit(); |
|
| 455 | + } |
|
| 393 | 456 | } catch(PDOException $e) { |
| 394 | 457 | return "error : ".$e->getMessage(); |
| 395 | 458 | } |
@@ -428,7 +491,9 @@ discard block |
||
| 428 | 491 | $sth_dest = $Connection->db->prepare($query_dest); |
| 429 | 492 | $sth_modes = $Connection->db->prepare($query_modes); |
| 430 | 493 | try { |
| 431 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 494 | + if ($globalTransaction) { |
|
| 495 | + $Connection->db->beginTransaction(); |
|
| 496 | + } |
|
| 432 | 497 | $tmp = fgetcsv($fh,9999,',','"'); |
| 433 | 498 | while (!feof($fh)) { |
| 434 | 499 | $line = fgetcsv($fh,9999,',','"'); |
@@ -438,16 +503,22 @@ discard block |
||
| 438 | 503 | $values['registration'] = $line[0]; |
| 439 | 504 | $values['base'] = $line[4]; |
| 440 | 505 | $values['owner'] = $line[5]; |
| 441 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 506 | + if ($line[6] == '') { |
|
| 507 | + $values['date_first_reg'] = null; |
|
| 508 | + } else { |
|
| 509 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 510 | + } |
|
| 443 | 511 | $values['cancel'] = $line[7]; |
| 444 | 512 | } elseif ($country == 'EI') { |
| 445 | 513 | // TODO : add modeS & reg to aircraft_modes |
| 446 | 514 | $values['registration'] = $line[0]; |
| 447 | 515 | $values['base'] = $line[3]; |
| 448 | 516 | $values['owner'] = $line[2]; |
| 449 | - if ($line[1] == '') $values['date_first_reg'] = null; |
|
| 450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 517 | + if ($line[1] == '') { |
|
| 518 | + $values['date_first_reg'] = null; |
|
| 519 | + } else { |
|
| 520 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 521 | + } |
|
| 451 | 522 | $values['cancel'] = ''; |
| 452 | 523 | $values['modes'] = $line[7]; |
| 453 | 524 | $values['icao'] = $line[8]; |
@@ -466,16 +537,22 @@ discard block |
||
| 466 | 537 | $values['registration'] = $line[3]; |
| 467 | 538 | $values['base'] = null; |
| 468 | 539 | $values['owner'] = $line[5]; |
| 469 | - if ($line[18] == '') $values['date_first_reg'] = null; |
|
| 470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 540 | + if ($line[18] == '') { |
|
| 541 | + $values['date_first_reg'] = null; |
|
| 542 | + } else { |
|
| 543 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 544 | + } |
|
| 471 | 545 | $values['cancel'] = ''; |
| 472 | 546 | } elseif ($country == 'VH') { |
| 473 | 547 | // TODO : add modeS & reg to aircraft_modes |
| 474 | 548 | $values['registration'] = $line[0]; |
| 475 | 549 | $values['base'] = null; |
| 476 | 550 | $values['owner'] = $line[12]; |
| 477 | - if ($line[28] == '') $values['date_first_reg'] = null; |
|
| 478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 551 | + if ($line[28] == '') { |
|
| 552 | + $values['date_first_reg'] = null; |
|
| 553 | + } else { |
|
| 554 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 555 | + } |
|
| 479 | 556 | |
| 480 | 557 | $values['cancel'] = $line[39]; |
| 481 | 558 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -494,29 +571,41 @@ discard block |
||
| 494 | 571 | $values['registration'] = $line[0]; |
| 495 | 572 | $values['base'] = null; |
| 496 | 573 | $values['owner'] = $line[8]; |
| 497 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 574 | + if ($line[7] == '') { |
|
| 575 | + $values['date_first_reg'] = null; |
|
| 576 | + } else { |
|
| 577 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 578 | + } |
|
| 499 | 579 | $values['cancel'] = ''; |
| 500 | 580 | } elseif ($country == 'PP') { |
| 501 | 581 | $values['registration'] = $line[0]; |
| 502 | 582 | $values['base'] = null; |
| 503 | 583 | $values['owner'] = $line[4]; |
| 504 | - if ($line[6] == '') $values['date_first_reg'] = null; |
|
| 505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 584 | + if ($line[6] == '') { |
|
| 585 | + $values['date_first_reg'] = null; |
|
| 586 | + } else { |
|
| 587 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 588 | + } |
|
| 506 | 589 | $values['cancel'] = $line[7]; |
| 507 | 590 | } elseif ($country == 'E7') { |
| 508 | 591 | $values['registration'] = $line[0]; |
| 509 | 592 | $values['base'] = null; |
| 510 | 593 | $values['owner'] = $line[4]; |
| 511 | - if ($line[5] == '') $values['date_first_reg'] = null; |
|
| 512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 594 | + if ($line[5] == '') { |
|
| 595 | + $values['date_first_reg'] = null; |
|
| 596 | + } else { |
|
| 597 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 598 | + } |
|
| 513 | 599 | $values['cancel'] = ''; |
| 514 | 600 | } elseif ($country == '8Q') { |
| 515 | 601 | $values['registration'] = $line[0]; |
| 516 | 602 | $values['base'] = null; |
| 517 | 603 | $values['owner'] = $line[3]; |
| 518 | - if ($line[7] == '') $values['date_first_reg'] = null; |
|
| 519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 604 | + if ($line[7] == '') { |
|
| 605 | + $values['date_first_reg'] = null; |
|
| 606 | + } else { |
|
| 607 | + $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 608 | + } |
|
| 520 | 609 | $values['cancel'] = ''; |
| 521 | 610 | } elseif ($country == 'ZK') { |
| 522 | 611 | $values['registration'] = $line[0]; |
@@ -561,7 +650,9 @@ discard block |
||
| 561 | 650 | $sth_modes->execute($query_modes_values); |
| 562 | 651 | } |
| 563 | 652 | } |
| 564 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 653 | + if ($globalTransaction) { |
|
| 654 | + $Connection->db->commit(); |
|
| 655 | + } |
|
| 565 | 656 | } catch(PDOException $e) { |
| 566 | 657 | return "error : ".$e->getMessage(); |
| 567 | 658 | } |
@@ -697,25 +788,45 @@ discard block |
||
| 697 | 788 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link, :image_thumb, :image)"; |
| 698 | 789 | $Connection = new Connection(); |
| 699 | 790 | $sth_dest = $Connection->db->prepare($query_dest); |
| 700 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 791 | + if ($globalTransaction) { |
|
| 792 | + $Connection->db->beginTransaction(); |
|
| 793 | + } |
|
| 701 | 794 | |
| 702 | 795 | $i = 0; |
| 703 | 796 | while($row = sparql_fetch_array($result)) |
| 704 | 797 | { |
| 705 | 798 | if ($i >= 1) { |
| 706 | 799 | //print_r($row); |
| 707 | - if (!isset($row['iata'])) $row['iata'] = ''; |
|
| 708 | - if (!isset($row['icao'])) $row['icao'] = ''; |
|
| 709 | - if (!isset($row['type'])) $row['type'] = ''; |
|
| 710 | - if (!isset($row['altitude'])) $row['altitude'] = ''; |
|
| 800 | + if (!isset($row['iata'])) { |
|
| 801 | + $row['iata'] = ''; |
|
| 802 | + } |
|
| 803 | + if (!isset($row['icao'])) { |
|
| 804 | + $row['icao'] = ''; |
|
| 805 | + } |
|
| 806 | + if (!isset($row['type'])) { |
|
| 807 | + $row['type'] = ''; |
|
| 808 | + } |
|
| 809 | + if (!isset($row['altitude'])) { |
|
| 810 | + $row['altitude'] = ''; |
|
| 811 | + } |
|
| 711 | 812 | if (isset($row['city_bis'])) { |
| 712 | 813 | $row['city'] = $row['city_bis']; |
| 713 | 814 | } |
| 714 | - if (!isset($row['city'])) $row['city'] = ''; |
|
| 715 | - if (!isset($row['country'])) $row['country'] = ''; |
|
| 716 | - if (!isset($row['homepage'])) $row['homepage'] = ''; |
|
| 717 | - if (!isset($row['wikipedia_page'])) $row['wikipedia_page'] = ''; |
|
| 718 | - if (!isset($row['name'])) continue; |
|
| 815 | + if (!isset($row['city'])) { |
|
| 816 | + $row['city'] = ''; |
|
| 817 | + } |
|
| 818 | + if (!isset($row['country'])) { |
|
| 819 | + $row['country'] = ''; |
|
| 820 | + } |
|
| 821 | + if (!isset($row['homepage'])) { |
|
| 822 | + $row['homepage'] = ''; |
|
| 823 | + } |
|
| 824 | + if (!isset($row['wikipedia_page'])) { |
|
| 825 | + $row['wikipedia_page'] = ''; |
|
| 826 | + } |
|
| 827 | + if (!isset($row['name'])) { |
|
| 828 | + continue; |
|
| 829 | + } |
|
| 719 | 830 | if (!isset($row['image'])) { |
| 720 | 831 | $row['image'] = ''; |
| 721 | 832 | $row['image_thumb'] = ''; |
@@ -771,7 +882,9 @@ discard block |
||
| 771 | 882 | |
| 772 | 883 | $i++; |
| 773 | 884 | } |
| 774 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 885 | + if ($globalTransaction) { |
|
| 886 | + $Connection->db->commit(); |
|
| 887 | + } |
|
| 775 | 888 | /* |
| 776 | 889 | echo "Delete duplicate rows...\n"; |
| 777 | 890 | $query = 'ALTER IGNORE TABLE airport ADD UNIQUE INDEX icaoidx (icao)'; |
@@ -814,7 +927,9 @@ discard block |
||
| 814 | 927 | $delimiter = ','; |
| 815 | 928 | $out_file = $tmp_dir.'airports.csv'; |
| 816 | 929 | update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
| 817 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 930 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 931 | + return FALSE; |
|
| 932 | + } |
|
| 818 | 933 | echo "Add data from ourairports.com...\n"; |
| 819 | 934 | |
| 820 | 935 | $header = NULL; |
@@ -824,8 +939,9 @@ discard block |
||
| 824 | 939 | //$Connection->db->beginTransaction(); |
| 825 | 940 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 826 | 941 | { |
| 827 | - if(!$header) $header = $row; |
|
| 828 | - else { |
|
| 942 | + if(!$header) { |
|
| 943 | + $header = $row; |
|
| 944 | + } else { |
|
| 829 | 945 | $data = array(); |
| 830 | 946 | $data = array_combine($header, $row); |
| 831 | 947 | try { |
@@ -866,7 +982,9 @@ discard block |
||
| 866 | 982 | echo "Download data from another free database...\n"; |
| 867 | 983 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 868 | 984 | update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
| 869 | - if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
|
| 985 | + if (!file_exists($out_file) || !is_readable($out_file)) { |
|
| 986 | + return FALSE; |
|
| 987 | + } |
|
| 870 | 988 | update_db::unzip($out_file); |
| 871 | 989 | $header = NULL; |
| 872 | 990 | echo "Add data from another free database...\n"; |
@@ -877,8 +995,9 @@ discard block |
||
| 877 | 995 | //$Connection->db->beginTransaction(); |
| 878 | 996 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 879 | 997 | { |
| 880 | - if(!$header) $header = $row; |
|
| 881 | - else { |
|
| 998 | + if(!$header) { |
|
| 999 | + $header = $row; |
|
| 1000 | + } else { |
|
| 882 | 1001 | $data = $row; |
| 883 | 1002 | |
| 884 | 1003 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
@@ -1047,7 +1166,9 @@ discard block |
||
| 1047 | 1166 | if (($handle = fopen($tmp_dir.'MASTER.txt', 'r')) !== FALSE) |
| 1048 | 1167 | { |
| 1049 | 1168 | $i = 0; |
| 1050 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1169 | + if ($globalTransaction) { |
|
| 1170 | + $Connection->db->beginTransaction(); |
|
| 1171 | + } |
|
| 1051 | 1172 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1052 | 1173 | { |
| 1053 | 1174 | if ($i > 0) { |
@@ -1060,7 +1181,9 @@ discard block |
||
| 1060 | 1181 | } |
| 1061 | 1182 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
| 1062 | 1183 | if (!empty($result_search)) { |
| 1063 | - if ($globalDebug) echo '.'; |
|
| 1184 | + if ($globalDebug) { |
|
| 1185 | + echo '.'; |
|
| 1186 | + } |
|
| 1064 | 1187 | //if ($globalDBdriver == 'mysql') { |
| 1065 | 1188 | // $queryi = 'INSERT INTO faamfr (mfr,icao) VALUES (:mfr,:icao) ON DUPLICATE KEY UPDATE icao = :icao'; |
| 1066 | 1189 | //} else { |
@@ -1082,8 +1205,12 @@ discard block |
||
| 1082 | 1205 | } |
| 1083 | 1206 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
| 1084 | 1207 | if (!empty($result_search_mfr)) { |
| 1085 | - if (trim($data[16]) == '' && trim($data[23]) != '') $data[16] = $data[23]; |
|
| 1086 | - if (trim($data[16]) == '' && trim($data[15]) != '') $data[16] = $data[15]; |
|
| 1208 | + if (trim($data[16]) == '' && trim($data[23]) != '') { |
|
| 1209 | + $data[16] = $data[23]; |
|
| 1210 | + } |
|
| 1211 | + if (trim($data[16]) == '' && trim($data[15]) != '') { |
|
| 1212 | + $data[16] = $data[15]; |
|
| 1213 | + } |
|
| 1087 | 1214 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1088 | 1215 | try { |
| 1089 | 1216 | $sthf = $Connection->db->prepare($queryf); |
@@ -1094,7 +1221,9 @@ discard block |
||
| 1094 | 1221 | } |
| 1095 | 1222 | } |
| 1096 | 1223 | if (strtotime($data[29]) > time()) { |
| 1097 | - if ($globalDebug) echo 'i'; |
|
| 1224 | + if ($globalDebug) { |
|
| 1225 | + echo 'i'; |
|
| 1226 | + } |
|
| 1098 | 1227 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1099 | 1228 | try { |
| 1100 | 1229 | $sth = $Connection->db->prepare($query); |
@@ -1105,13 +1234,19 @@ discard block |
||
| 1105 | 1234 | } |
| 1106 | 1235 | } |
| 1107 | 1236 | if ($i % 90 == 0) { |
| 1108 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1109 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1237 | + if ($globalTransaction) { |
|
| 1238 | + $Connection->db->commit(); |
|
| 1239 | + } |
|
| 1240 | + if ($globalTransaction) { |
|
| 1241 | + $Connection->db->beginTransaction(); |
|
| 1242 | + } |
|
| 1110 | 1243 | } |
| 1111 | 1244 | $i++; |
| 1112 | 1245 | } |
| 1113 | 1246 | fclose($handle); |
| 1114 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1247 | + if ($globalTransaction) { |
|
| 1248 | + $Connection->db->commit(); |
|
| 1249 | + } |
|
| 1115 | 1250 | } |
| 1116 | 1251 | return ''; |
| 1117 | 1252 | } |
@@ -1131,11 +1266,15 @@ discard block |
||
| 1131 | 1266 | if (($handle = fopen($tmp_dir.'modes.tsv', 'r')) !== FALSE) |
| 1132 | 1267 | { |
| 1133 | 1268 | $i = 0; |
| 1134 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1269 | + if ($globalTransaction) { |
|
| 1270 | + $Connection->db->beginTransaction(); |
|
| 1271 | + } |
|
| 1135 | 1272 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1136 | 1273 | { |
| 1137 | 1274 | if ($i > 0) { |
| 1138 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1275 | + if ($data[1] == 'NULL') { |
|
| 1276 | + $data[1] = $data[0]; |
|
| 1277 | + } |
|
| 1139 | 1278 | $query = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,type_flight,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:type_flight,:source)'; |
| 1140 | 1279 | try { |
| 1141 | 1280 | $sth = $Connection->db->prepare($query); |
@@ -1147,7 +1286,9 @@ discard block |
||
| 1147 | 1286 | $i++; |
| 1148 | 1287 | } |
| 1149 | 1288 | fclose($handle); |
| 1150 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1289 | + if ($globalTransaction) { |
|
| 1290 | + $Connection->db->commit(); |
|
| 1291 | + } |
|
| 1151 | 1292 | } |
| 1152 | 1293 | return ''; |
| 1153 | 1294 | } |
@@ -1179,11 +1320,15 @@ discard block |
||
| 1179 | 1320 | if (($handle = fopen($tmp_dir.'airlines.tsv', 'r')) !== FALSE) |
| 1180 | 1321 | { |
| 1181 | 1322 | $i = 0; |
| 1182 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1323 | + if ($globalTransaction) { |
|
| 1324 | + $Connection->db->beginTransaction(); |
|
| 1325 | + } |
|
| 1183 | 1326 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1184 | 1327 | { |
| 1185 | 1328 | if ($i > 0) { |
| 1186 | - if ($data[1] == 'NULL') $data[1] = $data[0]; |
|
| 1329 | + if ($data[1] == 'NULL') { |
|
| 1330 | + $data[1] = $data[0]; |
|
| 1331 | + } |
|
| 1187 | 1332 | $query = 'INSERT INTO airlines (airline_id,name,alias,iata,icao,callsign,country,active,type,home_link,wikipedia_link,alliance,ban_eu) VALUES (0,:name,:alias,:iata,:icao,:callsign,:country,:active,:type,:home,:wikipedia_link,:alliance,:ban_eu)'; |
| 1188 | 1333 | try { |
| 1189 | 1334 | $sth = $Connection->db->prepare($query); |
@@ -1195,7 +1340,9 @@ discard block |
||
| 1195 | 1340 | $i++; |
| 1196 | 1341 | } |
| 1197 | 1342 | fclose($handle); |
| 1198 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1343 | + if ($globalTransaction) { |
|
| 1344 | + $Connection->db->commit(); |
|
| 1345 | + } |
|
| 1199 | 1346 | } |
| 1200 | 1347 | /* |
| 1201 | 1348 | $query = "UNLOCK TABLES"; |
@@ -1225,7 +1372,9 @@ discard block |
||
| 1225 | 1372 | if (($handle = fopen($tmp_dir.'owners.tsv', 'r')) !== FALSE) |
| 1226 | 1373 | { |
| 1227 | 1374 | $i = 0; |
| 1228 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1375 | + if ($globalTransaction) { |
|
| 1376 | + $Connection->db->beginTransaction(); |
|
| 1377 | + } |
|
| 1229 | 1378 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1230 | 1379 | { |
| 1231 | 1380 | if ($i > 0) { |
@@ -1241,7 +1390,9 @@ discard block |
||
| 1241 | 1390 | $i++; |
| 1242 | 1391 | } |
| 1243 | 1392 | fclose($handle); |
| 1244 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1393 | + if ($globalTransaction) { |
|
| 1394 | + $Connection->db->commit(); |
|
| 1395 | + } |
|
| 1245 | 1396 | } |
| 1246 | 1397 | return ''; |
| 1247 | 1398 | } |
@@ -1261,7 +1412,9 @@ discard block |
||
| 1261 | 1412 | if (($handle = fopen($tmp_dir.'routes.tsv', 'r')) !== FALSE) |
| 1262 | 1413 | { |
| 1263 | 1414 | $i = 0; |
| 1264 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1415 | + if ($globalTransaction) { |
|
| 1416 | + $Connection->db->beginTransaction(); |
|
| 1417 | + } |
|
| 1265 | 1418 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1266 | 1419 | { |
| 1267 | 1420 | if ($i > 0) { |
@@ -1271,19 +1424,25 @@ discard block |
||
| 1271 | 1424 | $sth = $Connection->db->prepare($query); |
| 1272 | 1425 | $sth->execute(array(':CallSign' => $data[0],':Operator_ICAO' => $data[1],':FromAirport_ICAO' => $data[2],':FromAirport_Time' => $data[3], ':ToAirport_ICAO' => $data[4],':ToAirport_Time' => $data[5],':RouteStop' => $data[6],':source' => 'website_fam')); |
| 1273 | 1426 | } catch(PDOException $e) { |
| 1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1427 | + if ($globalDebug) { |
|
| 1428 | + echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1429 | + } |
|
| 1275 | 1430 | die(); |
| 1276 | 1431 | } |
| 1277 | 1432 | } |
| 1278 | 1433 | if ($globalTransaction && $i % 2000 == 0) { |
| 1279 | 1434 | $Connection->db->commit(); |
| 1280 | - if ($globalDebug) echo '.'; |
|
| 1435 | + if ($globalDebug) { |
|
| 1436 | + echo '.'; |
|
| 1437 | + } |
|
| 1281 | 1438 | $Connection->db->beginTransaction(); |
| 1282 | 1439 | } |
| 1283 | 1440 | $i++; |
| 1284 | 1441 | } |
| 1285 | 1442 | fclose($handle); |
| 1286 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1443 | + if ($globalTransaction) { |
|
| 1444 | + $Connection->db->commit(); |
|
| 1445 | + } |
|
| 1287 | 1446 | } |
| 1288 | 1447 | return ''; |
| 1289 | 1448 | } |
@@ -1303,7 +1462,9 @@ discard block |
||
| 1303 | 1462 | if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE) |
| 1304 | 1463 | { |
| 1305 | 1464 | $i = 0; |
| 1306 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1465 | + if ($globalTransaction) { |
|
| 1466 | + $Connection->db->beginTransaction(); |
|
| 1467 | + } |
|
| 1307 | 1468 | while (($data = fgets($handle, 1000)) !== FALSE) |
| 1308 | 1469 | { |
| 1309 | 1470 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
@@ -1311,18 +1472,24 @@ discard block |
||
| 1311 | 1472 | $sth = $Connection->db->prepare($query); |
| 1312 | 1473 | $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
| 1313 | 1474 | } catch(PDOException $e) { |
| 1314 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1475 | + if ($globalDebug) { |
|
| 1476 | + echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1477 | + } |
|
| 1315 | 1478 | die(); |
| 1316 | 1479 | } |
| 1317 | 1480 | if ($globalTransaction && $i % 2000 == 0) { |
| 1318 | 1481 | $Connection->db->commit(); |
| 1319 | - if ($globalDebug) echo '.'; |
|
| 1482 | + if ($globalDebug) { |
|
| 1483 | + echo '.'; |
|
| 1484 | + } |
|
| 1320 | 1485 | $Connection->db->beginTransaction(); |
| 1321 | 1486 | } |
| 1322 | 1487 | $i++; |
| 1323 | 1488 | } |
| 1324 | 1489 | fclose($handle); |
| 1325 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1490 | + if ($globalTransaction) { |
|
| 1491 | + $Connection->db->commit(); |
|
| 1492 | + } |
|
| 1326 | 1493 | } |
| 1327 | 1494 | return ''; |
| 1328 | 1495 | } |
@@ -1347,7 +1514,9 @@ discard block |
||
| 1347 | 1514 | $i = 0; |
| 1348 | 1515 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1349 | 1516 | //$Connection->db->beginTransaction(); |
| 1350 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1517 | + if ($globalTransaction) { |
|
| 1518 | + $Connection->db->beginTransaction(); |
|
| 1519 | + } |
|
| 1351 | 1520 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1352 | 1521 | { |
| 1353 | 1522 | if ($i > 0) { |
@@ -1363,7 +1532,9 @@ discard block |
||
| 1363 | 1532 | $i++; |
| 1364 | 1533 | } |
| 1365 | 1534 | fclose($handle); |
| 1366 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1535 | + if ($globalTransaction) { |
|
| 1536 | + $Connection->db->commit(); |
|
| 1537 | + } |
|
| 1367 | 1538 | } |
| 1368 | 1539 | return ''; |
| 1369 | 1540 | } |
@@ -1383,7 +1554,9 @@ discard block |
||
| 1383 | 1554 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
| 1384 | 1555 | { |
| 1385 | 1556 | $i = 0; |
| 1386 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1557 | + if ($globalTransaction) { |
|
| 1558 | + $Connection->db->beginTransaction(); |
|
| 1559 | + } |
|
| 1387 | 1560 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1388 | 1561 | { |
| 1389 | 1562 | if ($i > 0) { |
@@ -1400,7 +1573,9 @@ discard block |
||
| 1400 | 1573 | $i++; |
| 1401 | 1574 | } |
| 1402 | 1575 | fclose($handle); |
| 1403 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1576 | + if ($globalTransaction) { |
|
| 1577 | + $Connection->db->commit(); |
|
| 1578 | + } |
|
| 1404 | 1579 | } |
| 1405 | 1580 | return ''; |
| 1406 | 1581 | } |
@@ -1419,7 +1594,9 @@ discard block |
||
| 1419 | 1594 | $Connection = new Connection(); |
| 1420 | 1595 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
| 1421 | 1596 | { |
| 1422 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1597 | + if ($globalTransaction) { |
|
| 1598 | + $Connection->db->beginTransaction(); |
|
| 1599 | + } |
|
| 1423 | 1600 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
| 1424 | 1601 | { |
| 1425 | 1602 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1434,7 +1611,9 @@ discard block |
||
| 1434 | 1611 | } |
| 1435 | 1612 | } |
| 1436 | 1613 | fclose($handle); |
| 1437 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1614 | + if ($globalTransaction) { |
|
| 1615 | + $Connection->db->commit(); |
|
| 1616 | + } |
|
| 1438 | 1617 | } |
| 1439 | 1618 | return ''; |
| 1440 | 1619 | } |
@@ -1510,9 +1689,14 @@ discard block |
||
| 1510 | 1689 | if ($i > 0 && $data[0] != '') { |
| 1511 | 1690 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1512 | 1691 | $period = str_replace(',','',$data[14]); |
| 1513 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1514 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1515 | - else $launch_date = NULL; |
|
| 1692 | + if (!empty($period) && strpos($period,'days')) { |
|
| 1693 | + $period = str_replace(' days','',$period)*24*60; |
|
| 1694 | + } |
|
| 1695 | + if ($data[18] != '') { |
|
| 1696 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1697 | + } else { |
|
| 1698 | + $launch_date = NULL; |
|
| 1699 | + } |
|
| 1516 | 1700 | $data = array_map(function($value) { |
| 1517 | 1701 | return trim($value) === '' ? null : $value; |
| 1518 | 1702 | }, $data); |
@@ -1875,7 +2059,9 @@ discard block |
||
| 1875 | 2059 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1876 | 2060 | { |
| 1877 | 2061 | $i = 0; |
| 1878 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2062 | + if ($globalTransaction) { |
|
| 2063 | + $Connection->db->beginTransaction(); |
|
| 2064 | + } |
|
| 1879 | 2065 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1880 | 2066 | { |
| 1881 | 2067 | $i++; |
@@ -1903,7 +2089,9 @@ discard block |
||
| 1903 | 2089 | } |
| 1904 | 2090 | } |
| 1905 | 2091 | fclose($handle); |
| 1906 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2092 | + if ($globalTransaction) { |
|
| 2093 | + $Connection->db->commit(); |
|
| 2094 | + } |
|
| 1907 | 2095 | } |
| 1908 | 2096 | return ''; |
| 1909 | 2097 | } |
@@ -1946,7 +2134,9 @@ discard block |
||
| 1946 | 2134 | $Connection = new Connection(); |
| 1947 | 2135 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1948 | 2136 | { |
| 1949 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2137 | + if ($globalTransaction) { |
|
| 2138 | + $Connection->db->beginTransaction(); |
|
| 2139 | + } |
|
| 1950 | 2140 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1951 | 2141 | { |
| 1952 | 2142 | if(count($row) > 1) { |
@@ -1960,7 +2150,9 @@ discard block |
||
| 1960 | 2150 | } |
| 1961 | 2151 | } |
| 1962 | 2152 | fclose($handle); |
| 1963 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2153 | + if ($globalTransaction) { |
|
| 2154 | + $Connection->db->commit(); |
|
| 2155 | + } |
|
| 1964 | 2156 | } |
| 1965 | 2157 | return ''; |
| 1966 | 2158 | } |
@@ -1980,8 +2172,9 @@ discard block |
||
| 1980 | 2172 | } |
| 1981 | 2173 | |
| 1982 | 2174 | |
| 1983 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1984 | - else { |
|
| 2175 | + if ($globalDBdriver == 'mysql') { |
|
| 2176 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2177 | + } else { |
|
| 1985 | 2178 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 1986 | 2179 | $query = "CREATE EXTENSION postgis"; |
| 1987 | 2180 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -2000,7 +2193,9 @@ discard block |
||
| 2000 | 2193 | global $tmp_dir, $globalDebug; |
| 2001 | 2194 | include_once('class.create_db.php'); |
| 2002 | 2195 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2003 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2196 | + if ($globalDebug) { |
|
| 2197 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2198 | + } |
|
| 2004 | 2199 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
| 2005 | 2200 | $error = ''; |
| 2006 | 2201 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2010,20 +2205,34 @@ discard block |
||
| 2010 | 2205 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
| 2011 | 2206 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2012 | 2207 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2013 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2208 | + if ($globalDebug) { |
|
| 2209 | + echo "Gunzip..."; |
|
| 2210 | + } |
|
| 2014 | 2211 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
| 2015 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2212 | + if ($globalDebug) { |
|
| 2213 | + echo "Add to DB..."; |
|
| 2214 | + } |
|
| 2016 | 2215 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
| 2017 | 2216 | $NOTAM = new NOTAM(); |
| 2018 | 2217 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
| 2019 | 2218 | update_db::insert_notam_version($notam_md5); |
| 2020 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2021 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2022 | - } elseif ($globalDebug) echo "No new version."; |
|
| 2023 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2219 | + } else { |
|
| 2220 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2221 | + } |
|
| 2222 | + } else { |
|
| 2223 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2224 | + } |
|
| 2225 | + } elseif ($globalDebug) { |
|
| 2226 | + echo "No new version."; |
|
| 2227 | + } |
|
| 2228 | + } else { |
|
| 2229 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2230 | + } |
|
| 2024 | 2231 | if ($error != '') { |
| 2025 | 2232 | return $error; |
| 2026 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2233 | + } elseif ($globalDebug) { |
|
| 2234 | + echo "Done\n"; |
|
| 2235 | + } |
|
| 2027 | 2236 | return ''; |
| 2028 | 2237 | } |
| 2029 | 2238 | |
@@ -2078,68 +2287,114 @@ discard block |
||
| 2078 | 2287 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 2079 | 2288 | if (extension_loaded('zip')) { |
| 2080 | 2289 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 2081 | - if ($globalDebug) echo "Unzip..."; |
|
| 2290 | + if ($globalDebug) { |
|
| 2291 | + echo "Unzip..."; |
|
| 2292 | + } |
|
| 2082 | 2293 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 2083 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2294 | + if ($globalDebug) { |
|
| 2295 | + echo "Add to DB..."; |
|
| 2296 | + } |
|
| 2084 | 2297 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2085 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 2298 | + if ($globalDebug) { |
|
| 2299 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 2300 | + } |
|
| 2086 | 2301 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2087 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2088 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2089 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2090 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
| 2302 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 2303 | + $error = "Failed to copy airlines logo."; |
|
| 2304 | + } |
|
| 2305 | + } else { |
|
| 2306 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2307 | + } |
|
| 2308 | + } else { |
|
| 2309 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2310 | + } |
|
| 2311 | + } else { |
|
| 2312 | + $error = "ZIP module not loaded but required for IVAO."; |
|
| 2313 | + } |
|
| 2091 | 2314 | if ($error != '') { |
| 2092 | 2315 | return $error; |
| 2093 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2316 | + } elseif ($globalDebug) { |
|
| 2317 | + echo "Done\n"; |
|
| 2318 | + } |
|
| 2094 | 2319 | return ''; |
| 2095 | 2320 | } |
| 2096 | 2321 | |
| 2097 | 2322 | public static function update_routes() { |
| 2098 | 2323 | global $tmp_dir, $globalDebug; |
| 2099 | 2324 | $error = ''; |
| 2100 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 2325 | + if ($globalDebug) { |
|
| 2326 | + echo "Routes : Download..."; |
|
| 2327 | + } |
|
| 2101 | 2328 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 2102 | 2329 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2103 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2330 | + if ($globalDebug) { |
|
| 2331 | + echo "Gunzip..."; |
|
| 2332 | + } |
|
| 2104 | 2333 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 2105 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2334 | + if ($globalDebug) { |
|
| 2335 | + echo "Add to DB..."; |
|
| 2336 | + } |
|
| 2106 | 2337 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 2107 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2338 | + } else { |
|
| 2339 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2340 | + } |
|
| 2108 | 2341 | if ($error != '') { |
| 2109 | 2342 | return $error; |
| 2110 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2343 | + } elseif ($globalDebug) { |
|
| 2344 | + echo "Done\n"; |
|
| 2345 | + } |
|
| 2111 | 2346 | return ''; |
| 2112 | 2347 | } |
| 2113 | 2348 | public static function update_oneworld() { |
| 2114 | 2349 | global $tmp_dir, $globalDebug; |
| 2115 | 2350 | $error = ''; |
| 2116 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
| 2351 | + if ($globalDebug) { |
|
| 2352 | + echo "Schedules Oneworld : Download..."; |
|
| 2353 | + } |
|
| 2117 | 2354 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
| 2118 | 2355 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2119 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2356 | + if ($globalDebug) { |
|
| 2357 | + echo "Gunzip..."; |
|
| 2358 | + } |
|
| 2120 | 2359 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
| 2121 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2360 | + if ($globalDebug) { |
|
| 2361 | + echo "Add to DB..."; |
|
| 2362 | + } |
|
| 2122 | 2363 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
| 2123 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2364 | + } else { |
|
| 2365 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2366 | + } |
|
| 2124 | 2367 | if ($error != '') { |
| 2125 | 2368 | return $error; |
| 2126 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2369 | + } elseif ($globalDebug) { |
|
| 2370 | + echo "Done\n"; |
|
| 2371 | + } |
|
| 2127 | 2372 | return ''; |
| 2128 | 2373 | } |
| 2129 | 2374 | public static function update_skyteam() { |
| 2130 | 2375 | global $tmp_dir, $globalDebug; |
| 2131 | 2376 | $error = ''; |
| 2132 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
| 2377 | + if ($globalDebug) { |
|
| 2378 | + echo "Schedules Skyteam : Download..."; |
|
| 2379 | + } |
|
| 2133 | 2380 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
| 2134 | 2381 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2135 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2382 | + if ($globalDebug) { |
|
| 2383 | + echo "Gunzip..."; |
|
| 2384 | + } |
|
| 2136 | 2385 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
| 2137 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2386 | + if ($globalDebug) { |
|
| 2387 | + echo "Add to DB..."; |
|
| 2388 | + } |
|
| 2138 | 2389 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
| 2139 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2390 | + } else { |
|
| 2391 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2392 | + } |
|
| 2140 | 2393 | if ($error != '') { |
| 2141 | 2394 | return $error; |
| 2142 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2395 | + } elseif ($globalDebug) { |
|
| 2396 | + echo "Done\n"; |
|
| 2397 | + } |
|
| 2143 | 2398 | return ''; |
| 2144 | 2399 | } |
| 2145 | 2400 | public static function update_ModeS() { |
@@ -2156,340 +2411,590 @@ discard block |
||
| 2156 | 2411 | exit; |
| 2157 | 2412 | } elseif ($globalDebug) echo "Done\n"; |
| 2158 | 2413 | */ |
| 2159 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 2160 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2414 | + if ($globalDebug) { |
|
| 2415 | + echo "Modes : Download..."; |
|
| 2416 | + } |
|
| 2417 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2161 | 2418 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
| 2162 | 2419 | |
| 2163 | 2420 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2164 | 2421 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
| 2165 | - if ($globalDebug) echo "Unzip..."; |
|
| 2166 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2422 | + if ($globalDebug) { |
|
| 2423 | + echo "Unzip..."; |
|
| 2424 | + } |
|
| 2425 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2167 | 2426 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
| 2168 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2427 | + if ($globalDebug) { |
|
| 2428 | + echo "Add to DB..."; |
|
| 2429 | + } |
|
| 2169 | 2430 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 2170 | 2431 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
| 2171 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2432 | + } else { |
|
| 2433 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2434 | + } |
|
| 2172 | 2435 | if ($error != '') { |
| 2173 | 2436 | return $error; |
| 2174 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2437 | + } elseif ($globalDebug) { |
|
| 2438 | + echo "Done\n"; |
|
| 2439 | + } |
|
| 2175 | 2440 | return ''; |
| 2176 | 2441 | } |
| 2177 | 2442 | |
| 2178 | 2443 | public static function update_ModeS_faa() { |
| 2179 | 2444 | global $tmp_dir, $globalDebug; |
| 2180 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
| 2445 | + if ($globalDebug) { |
|
| 2446 | + echo "Modes FAA: Download..."; |
|
| 2447 | + } |
|
| 2181 | 2448 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
| 2182 | 2449 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2183 | - if ($globalDebug) echo "Unzip..."; |
|
| 2450 | + if ($globalDebug) { |
|
| 2451 | + echo "Unzip..."; |
|
| 2452 | + } |
|
| 2184 | 2453 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
| 2185 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2454 | + if ($globalDebug) { |
|
| 2455 | + echo "Add to DB..."; |
|
| 2456 | + } |
|
| 2186 | 2457 | $error = update_db::modes_faa(); |
| 2187 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2458 | + } else { |
|
| 2459 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2460 | + } |
|
| 2188 | 2461 | if ($error != '') { |
| 2189 | 2462 | return $error; |
| 2190 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2463 | + } elseif ($globalDebug) { |
|
| 2464 | + echo "Done\n"; |
|
| 2465 | + } |
|
| 2191 | 2466 | return ''; |
| 2192 | 2467 | } |
| 2193 | 2468 | |
| 2194 | 2469 | public static function update_ModeS_flarm() { |
| 2195 | 2470 | global $tmp_dir, $globalDebug; |
| 2196 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 2471 | + if ($globalDebug) { |
|
| 2472 | + echo "Modes Flarmnet: Download..."; |
|
| 2473 | + } |
|
| 2197 | 2474 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 2198 | 2475 | if (file_exists($tmp_dir.'data.fln')) { |
| 2199 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2476 | + if ($globalDebug) { |
|
| 2477 | + echo "Add to DB..."; |
|
| 2478 | + } |
|
| 2200 | 2479 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 2201 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2480 | + } else { |
|
| 2481 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2482 | + } |
|
| 2202 | 2483 | if ($error != '') { |
| 2203 | 2484 | return $error; |
| 2204 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2485 | + } elseif ($globalDebug) { |
|
| 2486 | + echo "Done\n"; |
|
| 2487 | + } |
|
| 2205 | 2488 | return ''; |
| 2206 | 2489 | } |
| 2207 | 2490 | |
| 2208 | 2491 | public static function update_ModeS_ogn() { |
| 2209 | 2492 | global $tmp_dir, $globalDebug; |
| 2210 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 2493 | + if ($globalDebug) { |
|
| 2494 | + echo "Modes OGN: Download..."; |
|
| 2495 | + } |
|
| 2211 | 2496 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 2212 | 2497 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2213 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2498 | + if ($globalDebug) { |
|
| 2499 | + echo "Add to DB..."; |
|
| 2500 | + } |
|
| 2214 | 2501 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 2215 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2502 | + } else { |
|
| 2503 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2504 | + } |
|
| 2216 | 2505 | if ($error != '') { |
| 2217 | 2506 | return $error; |
| 2218 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2507 | + } elseif ($globalDebug) { |
|
| 2508 | + echo "Done\n"; |
|
| 2509 | + } |
|
| 2219 | 2510 | return ''; |
| 2220 | 2511 | } |
| 2221 | 2512 | |
| 2222 | 2513 | public static function update_owner() { |
| 2223 | 2514 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2224 | 2515 | |
| 2225 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 2516 | + if ($globalDebug) { |
|
| 2517 | + echo "Owner France: Download..."; |
|
| 2518 | + } |
|
| 2226 | 2519 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 2227 | 2520 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2228 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2521 | + if ($globalDebug) { |
|
| 2522 | + echo "Add to DB..."; |
|
| 2523 | + } |
|
| 2229 | 2524 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 2230 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2525 | + } else { |
|
| 2526 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2527 | + } |
|
| 2231 | 2528 | if ($error != '') { |
| 2232 | 2529 | return $error; |
| 2233 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2530 | + } elseif ($globalDebug) { |
|
| 2531 | + echo "Done\n"; |
|
| 2532 | + } |
|
| 2234 | 2533 | |
| 2235 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 2534 | + if ($globalDebug) { |
|
| 2535 | + echo "Owner Ireland: Download..."; |
|
| 2536 | + } |
|
| 2236 | 2537 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 2237 | 2538 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2238 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2539 | + if ($globalDebug) { |
|
| 2540 | + echo "Add to DB..."; |
|
| 2541 | + } |
|
| 2239 | 2542 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 2240 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2543 | + } else { |
|
| 2544 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2545 | + } |
|
| 2241 | 2546 | if ($error != '') { |
| 2242 | 2547 | return $error; |
| 2243 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2244 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 2548 | + } elseif ($globalDebug) { |
|
| 2549 | + echo "Done\n"; |
|
| 2550 | + } |
|
| 2551 | + if ($globalDebug) { |
|
| 2552 | + echo "Owner Switzerland: Download..."; |
|
| 2553 | + } |
|
| 2245 | 2554 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 2246 | 2555 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2247 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2556 | + if ($globalDebug) { |
|
| 2557 | + echo "Add to DB..."; |
|
| 2558 | + } |
|
| 2248 | 2559 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 2249 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2560 | + } else { |
|
| 2561 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2562 | + } |
|
| 2250 | 2563 | if ($error != '') { |
| 2251 | 2564 | return $error; |
| 2252 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2253 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 2565 | + } elseif ($globalDebug) { |
|
| 2566 | + echo "Done\n"; |
|
| 2567 | + } |
|
| 2568 | + if ($globalDebug) { |
|
| 2569 | + echo "Owner Czech Republic: Download..."; |
|
| 2570 | + } |
|
| 2254 | 2571 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 2255 | 2572 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2256 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2573 | + if ($globalDebug) { |
|
| 2574 | + echo "Add to DB..."; |
|
| 2575 | + } |
|
| 2257 | 2576 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 2258 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2577 | + } else { |
|
| 2578 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2579 | + } |
|
| 2259 | 2580 | if ($error != '') { |
| 2260 | 2581 | return $error; |
| 2261 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2262 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 2582 | + } elseif ($globalDebug) { |
|
| 2583 | + echo "Done\n"; |
|
| 2584 | + } |
|
| 2585 | + if ($globalDebug) { |
|
| 2586 | + echo "Owner Australia: Download..."; |
|
| 2587 | + } |
|
| 2263 | 2588 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 2264 | 2589 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2265 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2590 | + if ($globalDebug) { |
|
| 2591 | + echo "Add to DB..."; |
|
| 2592 | + } |
|
| 2266 | 2593 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 2267 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2594 | + } else { |
|
| 2595 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2596 | + } |
|
| 2268 | 2597 | if ($error != '') { |
| 2269 | 2598 | return $error; |
| 2270 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2271 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 2599 | + } elseif ($globalDebug) { |
|
| 2600 | + echo "Done\n"; |
|
| 2601 | + } |
|
| 2602 | + if ($globalDebug) { |
|
| 2603 | + echo "Owner Austria: Download..."; |
|
| 2604 | + } |
|
| 2272 | 2605 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 2273 | 2606 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2274 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2607 | + if ($globalDebug) { |
|
| 2608 | + echo "Add to DB..."; |
|
| 2609 | + } |
|
| 2275 | 2610 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 2276 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2611 | + } else { |
|
| 2612 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2613 | + } |
|
| 2277 | 2614 | if ($error != '') { |
| 2278 | 2615 | return $error; |
| 2279 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2280 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 2616 | + } elseif ($globalDebug) { |
|
| 2617 | + echo "Done\n"; |
|
| 2618 | + } |
|
| 2619 | + if ($globalDebug) { |
|
| 2620 | + echo "Owner Chile: Download..."; |
|
| 2621 | + } |
|
| 2281 | 2622 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 2282 | 2623 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2283 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2624 | + if ($globalDebug) { |
|
| 2625 | + echo "Add to DB..."; |
|
| 2626 | + } |
|
| 2284 | 2627 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 2285 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2628 | + } else { |
|
| 2629 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2630 | + } |
|
| 2286 | 2631 | if ($error != '') { |
| 2287 | 2632 | return $error; |
| 2288 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2289 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 2633 | + } elseif ($globalDebug) { |
|
| 2634 | + echo "Done\n"; |
|
| 2635 | + } |
|
| 2636 | + if ($globalDebug) { |
|
| 2637 | + echo "Owner Colombia: Download..."; |
|
| 2638 | + } |
|
| 2290 | 2639 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 2291 | 2640 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2292 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2641 | + if ($globalDebug) { |
|
| 2642 | + echo "Add to DB..."; |
|
| 2643 | + } |
|
| 2293 | 2644 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 2294 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2645 | + } else { |
|
| 2646 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2647 | + } |
|
| 2295 | 2648 | if ($error != '') { |
| 2296 | 2649 | return $error; |
| 2297 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2298 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2650 | + } elseif ($globalDebug) { |
|
| 2651 | + echo "Done\n"; |
|
| 2652 | + } |
|
| 2653 | + if ($globalDebug) { |
|
| 2654 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2655 | + } |
|
| 2299 | 2656 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 2300 | 2657 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2301 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2658 | + if ($globalDebug) { |
|
| 2659 | + echo "Add to DB..."; |
|
| 2660 | + } |
|
| 2302 | 2661 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 2303 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2662 | + } else { |
|
| 2663 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2664 | + } |
|
| 2304 | 2665 | if ($error != '') { |
| 2305 | 2666 | return $error; |
| 2306 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2307 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 2667 | + } elseif ($globalDebug) { |
|
| 2668 | + echo "Done\n"; |
|
| 2669 | + } |
|
| 2670 | + if ($globalDebug) { |
|
| 2671 | + echo "Owner Brazil: Download..."; |
|
| 2672 | + } |
|
| 2308 | 2673 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 2309 | 2674 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2310 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2675 | + if ($globalDebug) { |
|
| 2676 | + echo "Add to DB..."; |
|
| 2677 | + } |
|
| 2311 | 2678 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 2312 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2679 | + } else { |
|
| 2680 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2681 | + } |
|
| 2313 | 2682 | if ($error != '') { |
| 2314 | 2683 | return $error; |
| 2315 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2316 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 2684 | + } elseif ($globalDebug) { |
|
| 2685 | + echo "Done\n"; |
|
| 2686 | + } |
|
| 2687 | + if ($globalDebug) { |
|
| 2688 | + echo "Owner Cayman Islands: Download..."; |
|
| 2689 | + } |
|
| 2317 | 2690 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 2318 | 2691 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2319 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2692 | + if ($globalDebug) { |
|
| 2693 | + echo "Add to DB..."; |
|
| 2694 | + } |
|
| 2320 | 2695 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 2321 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2696 | + } else { |
|
| 2697 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2698 | + } |
|
| 2322 | 2699 | if ($error != '') { |
| 2323 | 2700 | return $error; |
| 2324 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2325 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 2701 | + } elseif ($globalDebug) { |
|
| 2702 | + echo "Done\n"; |
|
| 2703 | + } |
|
| 2704 | + if ($globalDebug) { |
|
| 2705 | + echo "Owner Croatia: Download..."; |
|
| 2706 | + } |
|
| 2326 | 2707 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 2327 | 2708 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2328 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2709 | + if ($globalDebug) { |
|
| 2710 | + echo "Add to DB..."; |
|
| 2711 | + } |
|
| 2329 | 2712 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 2330 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2713 | + } else { |
|
| 2714 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2715 | + } |
|
| 2331 | 2716 | if ($error != '') { |
| 2332 | 2717 | return $error; |
| 2333 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2334 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 2718 | + } elseif ($globalDebug) { |
|
| 2719 | + echo "Done\n"; |
|
| 2720 | + } |
|
| 2721 | + if ($globalDebug) { |
|
| 2722 | + echo "Owner Luxembourg: Download..."; |
|
| 2723 | + } |
|
| 2335 | 2724 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 2336 | 2725 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2337 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2726 | + if ($globalDebug) { |
|
| 2727 | + echo "Add to DB..."; |
|
| 2728 | + } |
|
| 2338 | 2729 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 2339 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2730 | + } else { |
|
| 2731 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2732 | + } |
|
| 2340 | 2733 | if ($error != '') { |
| 2341 | 2734 | return $error; |
| 2342 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2343 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 2735 | + } elseif ($globalDebug) { |
|
| 2736 | + echo "Done\n"; |
|
| 2737 | + } |
|
| 2738 | + if ($globalDebug) { |
|
| 2739 | + echo "Owner Maldives: Download..."; |
|
| 2740 | + } |
|
| 2344 | 2741 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 2345 | 2742 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2346 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2743 | + if ($globalDebug) { |
|
| 2744 | + echo "Add to DB..."; |
|
| 2745 | + } |
|
| 2347 | 2746 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 2348 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2747 | + } else { |
|
| 2748 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2749 | + } |
|
| 2349 | 2750 | if ($error != '') { |
| 2350 | 2751 | return $error; |
| 2351 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2352 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 2752 | + } elseif ($globalDebug) { |
|
| 2753 | + echo "Done\n"; |
|
| 2754 | + } |
|
| 2755 | + if ($globalDebug) { |
|
| 2756 | + echo "Owner New Zealand: Download..."; |
|
| 2757 | + } |
|
| 2353 | 2758 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 2354 | 2759 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2355 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2760 | + if ($globalDebug) { |
|
| 2761 | + echo "Add to DB..."; |
|
| 2762 | + } |
|
| 2356 | 2763 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 2357 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2764 | + } else { |
|
| 2765 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2766 | + } |
|
| 2358 | 2767 | if ($error != '') { |
| 2359 | 2768 | return $error; |
| 2360 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2361 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 2769 | + } elseif ($globalDebug) { |
|
| 2770 | + echo "Done\n"; |
|
| 2771 | + } |
|
| 2772 | + if ($globalDebug) { |
|
| 2773 | + echo "Owner Papua New Guinea: Download..."; |
|
| 2774 | + } |
|
| 2362 | 2775 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 2363 | 2776 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2364 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2777 | + if ($globalDebug) { |
|
| 2778 | + echo "Add to DB..."; |
|
| 2779 | + } |
|
| 2365 | 2780 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 2366 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2781 | + } else { |
|
| 2782 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2783 | + } |
|
| 2367 | 2784 | if ($error != '') { |
| 2368 | 2785 | return $error; |
| 2369 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2370 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 2786 | + } elseif ($globalDebug) { |
|
| 2787 | + echo "Done\n"; |
|
| 2788 | + } |
|
| 2789 | + if ($globalDebug) { |
|
| 2790 | + echo "Owner Slovakia: Download..."; |
|
| 2791 | + } |
|
| 2371 | 2792 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 2372 | 2793 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2373 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2794 | + if ($globalDebug) { |
|
| 2795 | + echo "Add to DB..."; |
|
| 2796 | + } |
|
| 2374 | 2797 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 2375 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2798 | + } else { |
|
| 2799 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2800 | + } |
|
| 2376 | 2801 | if ($error != '') { |
| 2377 | 2802 | return $error; |
| 2378 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2379 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 2803 | + } elseif ($globalDebug) { |
|
| 2804 | + echo "Done\n"; |
|
| 2805 | + } |
|
| 2806 | + if ($globalDebug) { |
|
| 2807 | + echo "Owner Ecuador: Download..."; |
|
| 2808 | + } |
|
| 2380 | 2809 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 2381 | 2810 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2382 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2811 | + if ($globalDebug) { |
|
| 2812 | + echo "Add to DB..."; |
|
| 2813 | + } |
|
| 2383 | 2814 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 2384 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2815 | + } else { |
|
| 2816 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2817 | + } |
|
| 2385 | 2818 | if ($error != '') { |
| 2386 | 2819 | return $error; |
| 2387 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2388 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 2820 | + } elseif ($globalDebug) { |
|
| 2821 | + echo "Done\n"; |
|
| 2822 | + } |
|
| 2823 | + if ($globalDebug) { |
|
| 2824 | + echo "Owner Iceland: Download..."; |
|
| 2825 | + } |
|
| 2389 | 2826 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 2390 | 2827 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2391 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2828 | + if ($globalDebug) { |
|
| 2829 | + echo "Add to DB..."; |
|
| 2830 | + } |
|
| 2392 | 2831 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 2393 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2832 | + } else { |
|
| 2833 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2834 | + } |
|
| 2394 | 2835 | if ($error != '') { |
| 2395 | 2836 | return $error; |
| 2396 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2397 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
| 2837 | + } elseif ($globalDebug) { |
|
| 2838 | + echo "Done\n"; |
|
| 2839 | + } |
|
| 2840 | + if ($globalDebug) { |
|
| 2841 | + echo "Owner Isle of Man: Download..."; |
|
| 2842 | + } |
|
| 2398 | 2843 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
| 2399 | 2844 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2400 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2845 | + if ($globalDebug) { |
|
| 2846 | + echo "Add to DB..."; |
|
| 2847 | + } |
|
| 2401 | 2848 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
| 2402 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2849 | + } else { |
|
| 2850 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2851 | + } |
|
| 2403 | 2852 | if ($error != '') { |
| 2404 | 2853 | return $error; |
| 2405 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2854 | + } elseif ($globalDebug) { |
|
| 2855 | + echo "Done\n"; |
|
| 2856 | + } |
|
| 2406 | 2857 | if ($globalMasterSource) { |
| 2407 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
| 2858 | + if ($globalDebug) { |
|
| 2859 | + echo "ModeS Netherlands: Download..."; |
|
| 2860 | + } |
|
| 2408 | 2861 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
| 2409 | 2862 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2410 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2863 | + if ($globalDebug) { |
|
| 2864 | + echo "Add to DB..."; |
|
| 2865 | + } |
|
| 2411 | 2866 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
| 2412 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2867 | + } else { |
|
| 2868 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2869 | + } |
|
| 2413 | 2870 | if ($error != '') { |
| 2414 | 2871 | return $error; |
| 2415 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2416 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
| 2872 | + } elseif ($globalDebug) { |
|
| 2873 | + echo "Done\n"; |
|
| 2874 | + } |
|
| 2875 | + if ($globalDebug) { |
|
| 2876 | + echo "ModeS Denmark: Download..."; |
|
| 2877 | + } |
|
| 2417 | 2878 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
| 2418 | 2879 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2419 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2880 | + if ($globalDebug) { |
|
| 2881 | + echo "Add to DB..."; |
|
| 2882 | + } |
|
| 2420 | 2883 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
| 2421 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2884 | + } else { |
|
| 2885 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2886 | + } |
|
| 2422 | 2887 | if ($error != '') { |
| 2423 | 2888 | return $error; |
| 2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2425 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2889 | + } elseif ($globalDebug) { |
|
| 2890 | + echo "Done\n"; |
|
| 2891 | + } |
|
| 2892 | + } elseif ($globalDebug) { |
|
| 2893 | + echo "Done\n"; |
|
| 2894 | + } |
|
| 2426 | 2895 | return ''; |
| 2427 | 2896 | } |
| 2428 | 2897 | |
| 2429 | 2898 | public static function update_translation() { |
| 2430 | 2899 | global $tmp_dir, $globalDebug; |
| 2431 | 2900 | $error = ''; |
| 2432 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 2901 | + if ($globalDebug) { |
|
| 2902 | + echo "Translation : Download..."; |
|
| 2903 | + } |
|
| 2433 | 2904 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 2434 | 2905 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2435 | - if ($globalDebug) echo "Unzip..."; |
|
| 2906 | + if ($globalDebug) { |
|
| 2907 | + echo "Unzip..."; |
|
| 2908 | + } |
|
| 2436 | 2909 | update_db::unzip($tmp_dir.'translation.zip'); |
| 2437 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2910 | + if ($globalDebug) { |
|
| 2911 | + echo "Add to DB..."; |
|
| 2912 | + } |
|
| 2438 | 2913 | $error = update_db::translation(); |
| 2439 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2914 | + } else { |
|
| 2915 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2916 | + } |
|
| 2440 | 2917 | if ($error != '') { |
| 2441 | 2918 | return $error; |
| 2442 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2919 | + } elseif ($globalDebug) { |
|
| 2920 | + echo "Done\n"; |
|
| 2921 | + } |
|
| 2443 | 2922 | return ''; |
| 2444 | 2923 | } |
| 2445 | 2924 | |
| 2446 | 2925 | public static function update_translation_fam() { |
| 2447 | 2926 | global $tmp_dir, $globalDebug; |
| 2448 | 2927 | $error = ''; |
| 2449 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 2928 | + if ($globalDebug) { |
|
| 2929 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 2930 | + } |
|
| 2450 | 2931 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 2451 | 2932 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
| 2452 | 2933 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2453 | 2934 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
| 2454 | 2935 | $translation_md5 = $translation_md5_file[0]; |
| 2455 | 2936 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2456 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2937 | + if ($globalDebug) { |
|
| 2938 | + echo "Gunzip..."; |
|
| 2939 | + } |
|
| 2457 | 2940 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 2458 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2941 | + if ($globalDebug) { |
|
| 2942 | + echo "Add to DB..."; |
|
| 2943 | + } |
|
| 2459 | 2944 | $error = update_db::translation_fam(); |
| 2460 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2461 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2945 | + } else { |
|
| 2946 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2947 | + } |
|
| 2948 | + } else { |
|
| 2949 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2950 | + } |
|
| 2462 | 2951 | if ($error != '') { |
| 2463 | 2952 | return $error; |
| 2464 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2953 | + } elseif ($globalDebug) { |
|
| 2954 | + echo "Done\n"; |
|
| 2955 | + } |
|
| 2465 | 2956 | return ''; |
| 2466 | 2957 | } |
| 2467 | 2958 | public static function update_ModeS_fam() { |
| 2468 | 2959 | global $tmp_dir, $globalDebug; |
| 2469 | 2960 | $error = ''; |
| 2470 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
| 2961 | + if ($globalDebug) { |
|
| 2962 | + echo "ModeS from FlightAirMap website : Download..."; |
|
| 2963 | + } |
|
| 2471 | 2964 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
| 2472 | 2965 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
| 2473 | 2966 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2474 | 2967 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
| 2475 | 2968 | $modes_md5 = $modes_md5_file[0]; |
| 2476 | 2969 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2477 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2970 | + if ($globalDebug) { |
|
| 2971 | + echo "Gunzip..."; |
|
| 2972 | + } |
|
| 2478 | 2973 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
| 2479 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2974 | + if ($globalDebug) { |
|
| 2975 | + echo "Add to DB..."; |
|
| 2976 | + } |
|
| 2480 | 2977 | $error = update_db::modes_fam(); |
| 2481 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2482 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2978 | + } else { |
|
| 2979 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2980 | + } |
|
| 2981 | + } else { |
|
| 2982 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2983 | + } |
|
| 2483 | 2984 | if ($error != '') { |
| 2484 | 2985 | return $error; |
| 2485 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2986 | + } elseif ($globalDebug) { |
|
| 2987 | + echo "Done\n"; |
|
| 2988 | + } |
|
| 2486 | 2989 | return ''; |
| 2487 | 2990 | } |
| 2488 | 2991 | |
| 2489 | 2992 | public static function update_airlines_fam() { |
| 2490 | 2993 | global $tmp_dir, $globalDebug; |
| 2491 | 2994 | $error = ''; |
| 2492 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
| 2995 | + if ($globalDebug) { |
|
| 2996 | + echo "Airlines from FlightAirMap website : Download..."; |
|
| 2997 | + } |
|
| 2493 | 2998 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
| 2494 | 2999 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2495 | 3000 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2498,26 +3003,42 @@ discard block |
||
| 2498 | 3003 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
| 2499 | 3004 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2500 | 3005 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2501 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3006 | + if ($globalDebug) { |
|
| 3007 | + echo "Gunzip..."; |
|
| 3008 | + } |
|
| 2502 | 3009 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
| 2503 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3010 | + if ($globalDebug) { |
|
| 3011 | + echo "Add to DB..."; |
|
| 3012 | + } |
|
| 2504 | 3013 | $error = update_db::airlines_fam(); |
| 2505 | 3014 | update_db::insert_airlines_version($airlines_md5); |
| 2506 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 2507 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2508 | - } elseif ($globalDebug) echo "No update."; |
|
| 2509 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3015 | + } else { |
|
| 3016 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 3017 | + } |
|
| 3018 | + } else { |
|
| 3019 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 3020 | + } |
|
| 3021 | + } elseif ($globalDebug) { |
|
| 3022 | + echo "No update."; |
|
| 3023 | + } |
|
| 3024 | + } else { |
|
| 3025 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3026 | + } |
|
| 2510 | 3027 | if ($error != '') { |
| 2511 | 3028 | return $error; |
| 2512 | 3029 | } else { |
| 2513 | - if ($globalDebug) echo "Done\n"; |
|
| 3030 | + if ($globalDebug) { |
|
| 3031 | + echo "Done\n"; |
|
| 3032 | + } |
|
| 2514 | 3033 | } |
| 2515 | 3034 | return ''; |
| 2516 | 3035 | } |
| 2517 | 3036 | |
| 2518 | 3037 | public static function update_owner_fam() { |
| 2519 | 3038 | global $tmp_dir, $globalDebug, $globalOwner; |
| 2520 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
| 3039 | + if ($globalDebug) { |
|
| 3040 | + echo "owner from FlightAirMap website : Download..."; |
|
| 3041 | + } |
|
| 2521 | 3042 | $error = ''; |
| 2522 | 3043 | if ($globalOwner === TRUE) { |
| 2523 | 3044 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2530,55 +3051,89 @@ discard block |
||
| 2530 | 3051 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
| 2531 | 3052 | $owners_md5 = $owners_md5_file[0]; |
| 2532 | 3053 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2533 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3054 | + if ($globalDebug) { |
|
| 3055 | + echo "Gunzip..."; |
|
| 3056 | + } |
|
| 2534 | 3057 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
| 2535 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3058 | + if ($globalDebug) { |
|
| 3059 | + echo "Add to DB..."; |
|
| 3060 | + } |
|
| 2536 | 3061 | $error = update_db::owner_fam(); |
| 2537 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 2538 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3062 | + } else { |
|
| 3063 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 3064 | + } |
|
| 3065 | + } else { |
|
| 3066 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3067 | + } |
|
| 2539 | 3068 | if ($error != '') { |
| 2540 | 3069 | return $error; |
| 2541 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3070 | + } elseif ($globalDebug) { |
|
| 3071 | + echo "Done\n"; |
|
| 3072 | + } |
|
| 2542 | 3073 | return ''; |
| 2543 | 3074 | } |
| 2544 | 3075 | public static function update_routes_fam() { |
| 2545 | 3076 | global $tmp_dir, $globalDebug; |
| 2546 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
| 3077 | + if ($globalDebug) { |
|
| 3078 | + echo "Routes from FlightAirMap website : Download..."; |
|
| 3079 | + } |
|
| 2547 | 3080 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
| 2548 | 3081 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
| 2549 | 3082 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2550 | 3083 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
| 2551 | 3084 | $routes_md5 = $routes_md5_file[0]; |
| 2552 | 3085 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2553 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3086 | + if ($globalDebug) { |
|
| 3087 | + echo "Gunzip..."; |
|
| 3088 | + } |
|
| 2554 | 3089 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
| 2555 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3090 | + if ($globalDebug) { |
|
| 3091 | + echo "Add to DB..."; |
|
| 3092 | + } |
|
| 2556 | 3093 | $error = update_db::routes_fam(); |
| 2557 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 2558 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3094 | + } else { |
|
| 3095 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 3096 | + } |
|
| 3097 | + } else { |
|
| 3098 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3099 | + } |
|
| 2559 | 3100 | if ($error != '') { |
| 2560 | 3101 | return $error; |
| 2561 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3102 | + } elseif ($globalDebug) { |
|
| 3103 | + echo "Done\n"; |
|
| 3104 | + } |
|
| 2562 | 3105 | return ''; |
| 2563 | 3106 | } |
| 2564 | 3107 | public static function update_block_fam() { |
| 2565 | 3108 | global $tmp_dir, $globalDebug; |
| 2566 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3109 | + if ($globalDebug) { |
|
| 3110 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3111 | + } |
|
| 2567 | 3112 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
| 2568 | 3113 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
| 2569 | 3114 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2570 | 3115 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
| 2571 | 3116 | $block_md5 = $block_md5_file[0]; |
| 2572 | 3117 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2573 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3118 | + if ($globalDebug) { |
|
| 3119 | + echo "Gunzip..."; |
|
| 3120 | + } |
|
| 2574 | 3121 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
| 2575 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3122 | + if ($globalDebug) { |
|
| 3123 | + echo "Add to DB..."; |
|
| 3124 | + } |
|
| 2576 | 3125 | $error = update_db::block_fam(); |
| 2577 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 2578 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3126 | + } else { |
|
| 3127 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 3128 | + } |
|
| 3129 | + } else { |
|
| 3130 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3131 | + } |
|
| 2579 | 3132 | if ($error != '') { |
| 2580 | 3133 | return $error; |
| 2581 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3134 | + } elseif ($globalDebug) { |
|
| 3135 | + echo "Done\n"; |
|
| 3136 | + } |
|
| 2582 | 3137 | return ''; |
| 2583 | 3138 | } |
| 2584 | 3139 | public static function update_marine_identity_fam() { |
@@ -2588,21 +3143,33 @@ discard block |
||
| 2588 | 3143 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
| 2589 | 3144 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2590 | 3145 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2591 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3146 | + if ($globalDebug) { |
|
| 3147 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3148 | + } |
|
| 2592 | 3149 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
| 2593 | 3150 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2594 | 3151 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2595 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3152 | + if ($globalDebug) { |
|
| 3153 | + echo "Gunzip..."; |
|
| 3154 | + } |
|
| 2596 | 3155 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
| 2597 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3156 | + if ($globalDebug) { |
|
| 3157 | + echo "Add to DB..."; |
|
| 3158 | + } |
|
| 2598 | 3159 | $error = update_db::marine_identity_fam(); |
| 2599 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 2600 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3160 | + } else { |
|
| 3161 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 3162 | + } |
|
| 3163 | + } else { |
|
| 3164 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3165 | + } |
|
| 2601 | 3166 | if ($error != '') { |
| 2602 | 3167 | return $error; |
| 2603 | 3168 | } else { |
| 2604 | 3169 | update_db::insert_marine_identity_version($marine_identity_md5); |
| 2605 | - if ($globalDebug) echo "Done\n"; |
|
| 3170 | + if ($globalDebug) { |
|
| 3171 | + echo "Done\n"; |
|
| 3172 | + } |
|
| 2606 | 3173 | } |
| 2607 | 3174 | } |
| 2608 | 3175 | } |
@@ -2616,21 +3183,33 @@ discard block |
||
| 2616 | 3183 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
| 2617 | 3184 | $satellite_md5 = $satellite_md5_file[0]; |
| 2618 | 3185 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2619 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
| 3186 | + if ($globalDebug) { |
|
| 3187 | + echo "Satellite from FlightAirMap website : Download..."; |
|
| 3188 | + } |
|
| 2620 | 3189 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
| 2621 | 3190 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2622 | 3191 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2623 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3192 | + if ($globalDebug) { |
|
| 3193 | + echo "Gunzip..."; |
|
| 3194 | + } |
|
| 2624 | 3195 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
| 2625 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3196 | + if ($globalDebug) { |
|
| 3197 | + echo "Add to DB..."; |
|
| 3198 | + } |
|
| 2626 | 3199 | $error = update_db::satellite_fam(); |
| 2627 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 2628 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3200 | + } else { |
|
| 3201 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 3202 | + } |
|
| 3203 | + } else { |
|
| 3204 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3205 | + } |
|
| 2629 | 3206 | if ($error != '') { |
| 2630 | 3207 | return $error; |
| 2631 | 3208 | } else { |
| 2632 | 3209 | update_db::insert_satellite_version($satellite_md5); |
| 2633 | - if ($globalDebug) echo "Done\n"; |
|
| 3210 | + if ($globalDebug) { |
|
| 3211 | + echo "Done\n"; |
|
| 3212 | + } |
|
| 2634 | 3213 | } |
| 2635 | 3214 | } |
| 2636 | 3215 | } |
@@ -2638,17 +3217,25 @@ discard block |
||
| 2638 | 3217 | } |
| 2639 | 3218 | public static function update_banned_fam() { |
| 2640 | 3219 | global $tmp_dir, $globalDebug; |
| 2641 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3220 | + if ($globalDebug) { |
|
| 3221 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3222 | + } |
|
| 2642 | 3223 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
| 2643 | 3224 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2644 | 3225 | //if ($globalDebug) echo "Gunzip..."; |
| 2645 | 3226 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
| 2646 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3227 | + if ($globalDebug) { |
|
| 3228 | + echo "Add to DB..."; |
|
| 3229 | + } |
|
| 2647 | 3230 | $error = update_db::banned_fam(); |
| 2648 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3231 | + } else { |
|
| 3232 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3233 | + } |
|
| 2649 | 3234 | if ($error != '') { |
| 2650 | 3235 | return $error; |
| 2651 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3236 | + } elseif ($globalDebug) { |
|
| 3237 | + echo "Done\n"; |
|
| 3238 | + } |
|
| 2652 | 3239 | return ''; |
| 2653 | 3240 | } |
| 2654 | 3241 | |
@@ -2656,7 +3243,9 @@ discard block |
||
| 2656 | 3243 | global $tmp_dir, $globalDebug, $globalDBdriver; |
| 2657 | 3244 | include_once('class.create_db.php'); |
| 2658 | 3245 | $error = ''; |
| 2659 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
| 3246 | + if ($globalDebug) { |
|
| 3247 | + echo "Airspace from FlightAirMap website : Download..."; |
|
| 3248 | + } |
|
| 2660 | 3249 | if ($globalDBdriver == 'mysql') { |
| 2661 | 3250 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
| 2662 | 3251 | } else { |
@@ -2673,9 +3262,13 @@ discard block |
||
| 2673 | 3262 | } |
| 2674 | 3263 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2675 | 3264 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
| 2676 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3265 | + if ($globalDebug) { |
|
| 3266 | + echo "Gunzip..."; |
|
| 3267 | + } |
|
| 2677 | 3268 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
| 2678 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3269 | + if ($globalDebug) { |
|
| 3270 | + echo "Add to DB..."; |
|
| 3271 | + } |
|
| 2679 | 3272 | $Connection = new Connection(); |
| 2680 | 3273 | if ($Connection->tableExists('airspace')) { |
| 2681 | 3274 | $query = 'DROP TABLE airspace'; |
@@ -2688,20 +3281,30 @@ discard block |
||
| 2688 | 3281 | } |
| 2689 | 3282 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 2690 | 3283 | update_db::insert_airspace_version($airspace_md5); |
| 2691 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 2692 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3284 | + } else { |
|
| 3285 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 3286 | + } |
|
| 3287 | + } else { |
|
| 3288 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3289 | + } |
|
| 2693 | 3290 | } |
| 2694 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3291 | + } else { |
|
| 3292 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3293 | + } |
|
| 2695 | 3294 | if ($error != '') { |
| 2696 | 3295 | return $error; |
| 2697 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3296 | + } elseif ($globalDebug) { |
|
| 3297 | + echo "Done\n"; |
|
| 3298 | + } |
|
| 2698 | 3299 | return ''; |
| 2699 | 3300 | } |
| 2700 | 3301 | |
| 2701 | 3302 | public static function update_geoid_fam() { |
| 2702 | 3303 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2703 | 3304 | $error = ''; |
| 2704 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
| 3305 | + if ($globalDebug) { |
|
| 3306 | + echo "Geoid from FlightAirMap website : Download..."; |
|
| 3307 | + } |
|
| 2705 | 3308 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
| 2706 | 3309 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2707 | 3310 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2710,76 +3313,120 @@ discard block |
||
| 2710 | 3313 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
| 2711 | 3314 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2712 | 3315 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2713 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3316 | + if ($globalDebug) { |
|
| 3317 | + echo "Gunzip..."; |
|
| 3318 | + } |
|
| 2714 | 3319 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
| 2715 | 3320 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2716 | 3321 | update_db::insert_geoid_version($geoid_md5); |
| 2717 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 2718 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 2719 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 2720 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
| 2721 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3322 | + } else { |
|
| 3323 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 3324 | + } |
|
| 3325 | + } else { |
|
| 3326 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 3327 | + } |
|
| 3328 | + } else { |
|
| 3329 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 3330 | + } |
|
| 3331 | + } elseif ($globalDebug) { |
|
| 3332 | + echo 'No new version'."\n"; |
|
| 3333 | + } |
|
| 3334 | + } else { |
|
| 3335 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3336 | + } |
|
| 2722 | 3337 | if ($error != '') { |
| 2723 | 3338 | return $error; |
| 2724 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3339 | + } elseif ($globalDebug) { |
|
| 3340 | + echo "Done\n"; |
|
| 3341 | + } |
|
| 2725 | 3342 | return ''; |
| 2726 | 3343 | } |
| 2727 | 3344 | |
| 2728 | 3345 | public static function update_tle() { |
| 2729 | 3346 | global $tmp_dir, $globalDebug; |
| 2730 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
| 3347 | + if ($globalDebug) { |
|
| 3348 | + echo "Download TLE : Download..."; |
|
| 3349 | + } |
|
| 2731 | 3350 | $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', |
| 2732 | 3351 | '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', |
| 2733 | 3352 | 'engineering.txt','education.txt','military.txt','radar.txt','cubesat.txt','other.txt','tle-new.txt','visual.txt','sarsat.txt','argos.txt','ses.txt','iridium-NEXT.txt','beidou.txt'); |
| 2734 | 3353 | foreach ($alltle as $filename) { |
| 2735 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
| 3354 | + if ($globalDebug) { |
|
| 3355 | + echo "downloading ".$filename.'...'; |
|
| 3356 | + } |
|
| 2736 | 3357 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
| 2737 | 3358 | if (file_exists($tmp_dir.$filename)) { |
| 2738 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
| 3359 | + if ($globalDebug) { |
|
| 3360 | + echo "Add to DB ".$filename."..."; |
|
| 3361 | + } |
|
| 2739 | 3362 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
| 2740 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3363 | + } else { |
|
| 3364 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3365 | + } |
|
| 2741 | 3366 | if ($error != '') { |
| 2742 | 3367 | echo $error."\n"; |
| 2743 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3368 | + } elseif ($globalDebug) { |
|
| 3369 | + echo "Done\n"; |
|
| 3370 | + } |
|
| 2744 | 3371 | } |
| 2745 | 3372 | return ''; |
| 2746 | 3373 | } |
| 2747 | 3374 | |
| 2748 | 3375 | public static function update_ucsdb() { |
| 2749 | 3376 | global $tmp_dir, $globalDebug; |
| 2750 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
| 3377 | + if ($globalDebug) { |
|
| 3378 | + echo "Download UCS DB : Download..."; |
|
| 3379 | + } |
|
| 2751 | 3380 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
| 2752 | 3381 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2753 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3382 | + if ($globalDebug) { |
|
| 3383 | + echo "Add to DB..."; |
|
| 3384 | + } |
|
| 2754 | 3385 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
| 2755 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
| 3386 | + } else { |
|
| 3387 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
| 3388 | + } |
|
| 2756 | 3389 | if ($error != '') { |
| 2757 | 3390 | echo $error."\n"; |
| 2758 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3391 | + } elseif ($globalDebug) { |
|
| 3392 | + echo "Done\n"; |
|
| 3393 | + } |
|
| 2759 | 3394 | return ''; |
| 2760 | 3395 | } |
| 2761 | 3396 | |
| 2762 | 3397 | public static function update_celestrak() { |
| 2763 | 3398 | global $tmp_dir, $globalDebug; |
| 2764 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
| 3399 | + if ($globalDebug) { |
|
| 3400 | + echo "Download Celestrak DB : Download..."; |
|
| 3401 | + } |
|
| 2765 | 3402 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
| 2766 | 3403 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2767 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3404 | + if ($globalDebug) { |
|
| 3405 | + echo "Add to DB..."; |
|
| 3406 | + } |
|
| 2768 | 3407 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
| 2769 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3408 | + } else { |
|
| 3409 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3410 | + } |
|
| 2770 | 3411 | if ($error != '') { |
| 2771 | 3412 | echo $error."\n"; |
| 2772 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3413 | + } elseif ($globalDebug) { |
|
| 3414 | + echo "Done\n"; |
|
| 3415 | + } |
|
| 2773 | 3416 | return ''; |
| 2774 | 3417 | } |
| 2775 | 3418 | |
| 2776 | 3419 | public static function update_models() { |
| 2777 | 3420 | global $tmp_dir, $globalDebug; |
| 2778 | 3421 | $error = ''; |
| 2779 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3422 | + if ($globalDebug) { |
|
| 3423 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3424 | + } |
|
| 2780 | 3425 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
| 2781 | 3426 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2782 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3427 | + if ($globalDebug) { |
|
| 3428 | + echo "Check files...\n"; |
|
| 3429 | + } |
|
| 2783 | 3430 | $newmodelsdb = array(); |
| 2784 | 3431 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
| 2785 | 3432 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2798,19 +3445,29 @@ discard block |
||
| 2798 | 3445 | } |
| 2799 | 3446 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2800 | 3447 | foreach ($diff as $key => $value) { |
| 2801 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3448 | + if ($globalDebug) { |
|
| 3449 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3450 | + } |
|
| 2802 | 3451 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
| 2803 | 3452 | |
| 2804 | 3453 | } |
| 2805 | 3454 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
| 2806 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3455 | + } else { |
|
| 3456 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3457 | + } |
|
| 2807 | 3458 | if ($error != '') { |
| 2808 | 3459 | return $error; |
| 2809 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2810 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3460 | + } elseif ($globalDebug) { |
|
| 3461 | + echo "Done\n"; |
|
| 3462 | + } |
|
| 3463 | + if ($globalDebug) { |
|
| 3464 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3465 | + } |
|
| 2811 | 3466 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
| 2812 | 3467 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2813 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3468 | + if ($globalDebug) { |
|
| 3469 | + echo "Check files...\n"; |
|
| 3470 | + } |
|
| 2814 | 3471 | $newmodelsdb = array(); |
| 2815 | 3472 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
| 2816 | 3473 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2829,25 +3486,35 @@ discard block |
||
| 2829 | 3486 | } |
| 2830 | 3487 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2831 | 3488 | foreach ($diff as $key => $value) { |
| 2832 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3489 | + if ($globalDebug) { |
|
| 3490 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3491 | + } |
|
| 2833 | 3492 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
| 2834 | 3493 | |
| 2835 | 3494 | } |
| 2836 | 3495 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
| 2837 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3496 | + } else { |
|
| 3497 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3498 | + } |
|
| 2838 | 3499 | if ($error != '') { |
| 2839 | 3500 | return $error; |
| 2840 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3501 | + } elseif ($globalDebug) { |
|
| 3502 | + echo "Done\n"; |
|
| 3503 | + } |
|
| 2841 | 3504 | return ''; |
| 2842 | 3505 | } |
| 2843 | 3506 | |
| 2844 | 3507 | public static function update_liveries() { |
| 2845 | 3508 | global $tmp_dir, $globalDebug; |
| 2846 | 3509 | $error = ''; |
| 2847 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
| 3510 | + if ($globalDebug) { |
|
| 3511 | + echo "Liveries from FlightAirMap website : Download..."; |
|
| 3512 | + } |
|
| 2848 | 3513 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
| 2849 | 3514 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2850 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3515 | + if ($globalDebug) { |
|
| 3516 | + echo "Check files...\n"; |
|
| 3517 | + } |
|
| 2851 | 3518 | $newmodelsdb = array(); |
| 2852 | 3519 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
| 2853 | 3520 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2866,25 +3533,35 @@ discard block |
||
| 2866 | 3533 | } |
| 2867 | 3534 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2868 | 3535 | foreach ($diff as $key => $value) { |
| 2869 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3536 | + if ($globalDebug) { |
|
| 3537 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3538 | + } |
|
| 2870 | 3539 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
| 2871 | 3540 | |
| 2872 | 3541 | } |
| 2873 | 3542 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
| 2874 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3543 | + } else { |
|
| 3544 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3545 | + } |
|
| 2875 | 3546 | if ($error != '') { |
| 2876 | 3547 | return $error; |
| 2877 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3548 | + } elseif ($globalDebug) { |
|
| 3549 | + echo "Done\n"; |
|
| 3550 | + } |
|
| 2878 | 3551 | return ''; |
| 2879 | 3552 | } |
| 2880 | 3553 | |
| 2881 | 3554 | public static function update_space_models() { |
| 2882 | 3555 | global $tmp_dir, $globalDebug; |
| 2883 | 3556 | $error = ''; |
| 2884 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
| 3557 | + if ($globalDebug) { |
|
| 3558 | + echo "Space models from FlightAirMap website : Download..."; |
|
| 3559 | + } |
|
| 2885 | 3560 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
| 2886 | 3561 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2887 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3562 | + if ($globalDebug) { |
|
| 3563 | + echo "Check files...\n"; |
|
| 3564 | + } |
|
| 2888 | 3565 | $newmodelsdb = array(); |
| 2889 | 3566 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
| 2890 | 3567 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2903,25 +3580,35 @@ discard block |
||
| 2903 | 3580 | } |
| 2904 | 3581 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2905 | 3582 | foreach ($diff as $key => $value) { |
| 2906 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3583 | + if ($globalDebug) { |
|
| 3584 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3585 | + } |
|
| 2907 | 3586 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
| 2908 | 3587 | |
| 2909 | 3588 | } |
| 2910 | 3589 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
| 2911 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3590 | + } else { |
|
| 3591 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3592 | + } |
|
| 2912 | 3593 | if ($error != '') { |
| 2913 | 3594 | return $error; |
| 2914 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3595 | + } elseif ($globalDebug) { |
|
| 3596 | + echo "Done\n"; |
|
| 3597 | + } |
|
| 2915 | 3598 | return ''; |
| 2916 | 3599 | } |
| 2917 | 3600 | |
| 2918 | 3601 | public static function update_vehicules_models() { |
| 2919 | 3602 | global $tmp_dir, $globalDebug; |
| 2920 | 3603 | $error = ''; |
| 2921 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3604 | + if ($globalDebug) { |
|
| 3605 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3606 | + } |
|
| 2922 | 3607 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
| 2923 | 3608 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2924 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3609 | + if ($globalDebug) { |
|
| 3610 | + echo "Check files...\n"; |
|
| 3611 | + } |
|
| 2925 | 3612 | $newmodelsdb = array(); |
| 2926 | 3613 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
| 2927 | 3614 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2940,15 +3627,21 @@ discard block |
||
| 2940 | 3627 | } |
| 2941 | 3628 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2942 | 3629 | foreach ($diff as $key => $value) { |
| 2943 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3630 | + if ($globalDebug) { |
|
| 3631 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3632 | + } |
|
| 2944 | 3633 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
| 2945 | 3634 | |
| 2946 | 3635 | } |
| 2947 | 3636 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
| 2948 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3637 | + } else { |
|
| 3638 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3639 | + } |
|
| 2949 | 3640 | if ($error != '') { |
| 2950 | 3641 | return $error; |
| 2951 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3642 | + } elseif ($globalDebug) { |
|
| 3643 | + echo "Done\n"; |
|
| 3644 | + } |
|
| 2952 | 3645 | return ''; |
| 2953 | 3646 | } |
| 2954 | 3647 | |
@@ -3021,7 +3714,9 @@ discard block |
||
| 3021 | 3714 | } |
| 3022 | 3715 | |
| 3023 | 3716 | $error = ''; |
| 3024 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 3717 | + if ($globalDebug) { |
|
| 3718 | + echo "Notam : Download..."; |
|
| 3719 | + } |
|
| 3025 | 3720 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 3026 | 3721 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3027 | 3722 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3036,14 +3731,30 @@ discard block |
||
| 3036 | 3731 | $data['fir'] = $q[0]; |
| 3037 | 3732 | $data['code'] = $q[1]; |
| 3038 | 3733 | $ifrvfr = $q[2]; |
| 3039 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 3040 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 3041 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 3042 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 3043 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 3044 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 3045 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 3046 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 3734 | + if ($ifrvfr == 'IV') { |
|
| 3735 | + $data['rules'] = 'IFR/VFR'; |
|
| 3736 | + } |
|
| 3737 | + if ($ifrvfr == 'I') { |
|
| 3738 | + $data['rules'] = 'IFR'; |
|
| 3739 | + } |
|
| 3740 | + if ($ifrvfr == 'V') { |
|
| 3741 | + $data['rules'] = 'VFR'; |
|
| 3742 | + } |
|
| 3743 | + if ($q[4] == 'A') { |
|
| 3744 | + $data['scope'] = 'Airport warning'; |
|
| 3745 | + } |
|
| 3746 | + if ($q[4] == 'E') { |
|
| 3747 | + $data['scope'] = 'Enroute warning'; |
|
| 3748 | + } |
|
| 3749 | + if ($q[4] == 'W') { |
|
| 3750 | + $data['scope'] = 'Navigation warning'; |
|
| 3751 | + } |
|
| 3752 | + if ($q[4] == 'AE') { |
|
| 3753 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 3754 | + } |
|
| 3755 | + if ($q[4] == 'AW') { |
|
| 3756 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 3757 | + } |
|
| 3047 | 3758 | //$data['scope'] = $q[4]; |
| 3048 | 3759 | $data['lower_limit'] = $q[5]; |
| 3049 | 3760 | $data['upper_limit'] = $q[6]; |
@@ -3051,8 +3762,12 @@ discard block |
||
| 3051 | 3762 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 3052 | 3763 | $latitude = $Common->convertDec($las,'latitude'); |
| 3053 | 3764 | $longitude = $Common->convertDec($lns,'longitude'); |
| 3054 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 3055 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 3765 | + if ($lac == 'S') { |
|
| 3766 | + $latitude = '-'.$latitude; |
|
| 3767 | + } |
|
| 3768 | + if ($lnc == 'W') { |
|
| 3769 | + $longitude = '-'.$longitude; |
|
| 3770 | + } |
|
| 3056 | 3771 | $data['center_latitude'] = $latitude; |
| 3057 | 3772 | $data['center_longitude'] = $longitude; |
| 3058 | 3773 | $data['radius'] = intval($radius); |
@@ -3082,10 +3797,14 @@ discard block |
||
| 3082 | 3797 | $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']); |
| 3083 | 3798 | unset($data); |
| 3084 | 3799 | } |
| 3085 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3800 | + } else { |
|
| 3801 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3802 | + } |
|
| 3086 | 3803 | if ($error != '') { |
| 3087 | 3804 | return $error; |
| 3088 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3805 | + } elseif ($globalDebug) { |
|
| 3806 | + echo "Done\n"; |
|
| 3807 | + } |
|
| 3089 | 3808 | return ''; |
| 3090 | 3809 | } |
| 3091 | 3810 | |
@@ -3110,7 +3829,9 @@ discard block |
||
| 3110 | 3829 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3111 | 3830 | $airspace_json = json_decode($airspace_lst,true); |
| 3112 | 3831 | foreach ($airspace_json['records'] as $airspace) { |
| 3113 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
| 3832 | + if ($globalDebug) { |
|
| 3833 | + echo $airspace['name']."...\n"; |
|
| 3834 | + } |
|
| 3114 | 3835 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
| 3115 | 3836 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3116 | 3837 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3154,8 +3875,11 @@ discard block |
||
| 3154 | 3875 | return "error : ".$e->getMessage(); |
| 3155 | 3876 | } |
| 3156 | 3877 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3157 | - if ($row['nb'] > 0) return false; |
|
| 3158 | - else return true; |
|
| 3878 | + if ($row['nb'] > 0) { |
|
| 3879 | + return false; |
|
| 3880 | + } else { |
|
| 3881 | + return true; |
|
| 3882 | + } |
|
| 3159 | 3883 | } |
| 3160 | 3884 | |
| 3161 | 3885 | public static function insert_last_update() { |
@@ -3180,8 +3904,11 @@ discard block |
||
| 3180 | 3904 | return "error : ".$e->getMessage(); |
| 3181 | 3905 | } |
| 3182 | 3906 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3183 | - if ($row['nb'] > 0) return true; |
|
| 3184 | - else return false; |
|
| 3907 | + if ($row['nb'] > 0) { |
|
| 3908 | + return true; |
|
| 3909 | + } else { |
|
| 3910 | + return false; |
|
| 3911 | + } |
|
| 3185 | 3912 | } |
| 3186 | 3913 | |
| 3187 | 3914 | public static function check_geoid_version($version) { |
@@ -3194,8 +3921,11 @@ discard block |
||
| 3194 | 3921 | return "error : ".$e->getMessage(); |
| 3195 | 3922 | } |
| 3196 | 3923 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3197 | - if ($row['nb'] > 0) return true; |
|
| 3198 | - else return false; |
|
| 3924 | + if ($row['nb'] > 0) { |
|
| 3925 | + return true; |
|
| 3926 | + } else { |
|
| 3927 | + return false; |
|
| 3928 | + } |
|
| 3199 | 3929 | } |
| 3200 | 3930 | |
| 3201 | 3931 | public static function check_marine_identity_version($version) { |
@@ -3208,8 +3938,11 @@ discard block |
||
| 3208 | 3938 | return "error : ".$e->getMessage(); |
| 3209 | 3939 | } |
| 3210 | 3940 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3211 | - if ($row['nb'] > 0) return true; |
|
| 3212 | - else return false; |
|
| 3941 | + if ($row['nb'] > 0) { |
|
| 3942 | + return true; |
|
| 3943 | + } else { |
|
| 3944 | + return false; |
|
| 3945 | + } |
|
| 3213 | 3946 | } |
| 3214 | 3947 | |
| 3215 | 3948 | public static function check_satellite_version($version) { |
@@ -3222,8 +3955,11 @@ discard block |
||
| 3222 | 3955 | return "error : ".$e->getMessage(); |
| 3223 | 3956 | } |
| 3224 | 3957 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3225 | - if ($row['nb'] > 0) return true; |
|
| 3226 | - else return false; |
|
| 3958 | + if ($row['nb'] > 0) { |
|
| 3959 | + return true; |
|
| 3960 | + } else { |
|
| 3961 | + return false; |
|
| 3962 | + } |
|
| 3227 | 3963 | } |
| 3228 | 3964 | |
| 3229 | 3965 | public static function check_airlines_version($version) { |
@@ -3236,8 +3972,11 @@ discard block |
||
| 3236 | 3972 | return "error : ".$e->getMessage(); |
| 3237 | 3973 | } |
| 3238 | 3974 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3239 | - if ($row['nb'] > 0) return true; |
|
| 3240 | - else return false; |
|
| 3975 | + if ($row['nb'] > 0) { |
|
| 3976 | + return true; |
|
| 3977 | + } else { |
|
| 3978 | + return false; |
|
| 3979 | + } |
|
| 3241 | 3980 | } |
| 3242 | 3981 | |
| 3243 | 3982 | public static function check_notam_version($version) { |
@@ -3250,8 +3989,11 @@ discard block |
||
| 3250 | 3989 | return "error : ".$e->getMessage(); |
| 3251 | 3990 | } |
| 3252 | 3991 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3253 | - if ($row['nb'] > 0) return true; |
|
| 3254 | - else return false; |
|
| 3992 | + if ($row['nb'] > 0) { |
|
| 3993 | + return true; |
|
| 3994 | + } else { |
|
| 3995 | + return false; |
|
| 3996 | + } |
|
| 3255 | 3997 | } |
| 3256 | 3998 | |
| 3257 | 3999 | public static function insert_airlines_version($version) { |
@@ -3341,8 +4083,11 @@ discard block |
||
| 3341 | 4083 | return "error : ".$e->getMessage(); |
| 3342 | 4084 | } |
| 3343 | 4085 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3344 | - if ($row['nb'] > 0) return false; |
|
| 3345 | - else return true; |
|
| 4086 | + if ($row['nb'] > 0) { |
|
| 4087 | + return false; |
|
| 4088 | + } else { |
|
| 4089 | + return true; |
|
| 4090 | + } |
|
| 3346 | 4091 | } |
| 3347 | 4092 | |
| 3348 | 4093 | public static function insert_last_notam_update() { |
@@ -3372,8 +4117,11 @@ discard block |
||
| 3372 | 4117 | return "error : ".$e->getMessage(); |
| 3373 | 4118 | } |
| 3374 | 4119 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3375 | - if ($row['nb'] > 0) return false; |
|
| 3376 | - else return true; |
|
| 4120 | + if ($row['nb'] > 0) { |
|
| 4121 | + return false; |
|
| 4122 | + } else { |
|
| 4123 | + return true; |
|
| 4124 | + } |
|
| 3377 | 4125 | } |
| 3378 | 4126 | |
| 3379 | 4127 | public static function insert_last_airspace_update() { |
@@ -3403,8 +4151,11 @@ discard block |
||
| 3403 | 4151 | return "error : ".$e->getMessage(); |
| 3404 | 4152 | } |
| 3405 | 4153 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3406 | - if ($row['nb'] > 0) return false; |
|
| 3407 | - else return true; |
|
| 4154 | + if ($row['nb'] > 0) { |
|
| 4155 | + return false; |
|
| 4156 | + } else { |
|
| 4157 | + return true; |
|
| 4158 | + } |
|
| 3408 | 4159 | } |
| 3409 | 4160 | |
| 3410 | 4161 | public static function insert_last_geoid_update() { |
@@ -3434,8 +4185,11 @@ discard block |
||
| 3434 | 4185 | return "error : ".$e->getMessage(); |
| 3435 | 4186 | } |
| 3436 | 4187 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3437 | - if ($row['nb'] > 0) return false; |
|
| 3438 | - else return true; |
|
| 4188 | + if ($row['nb'] > 0) { |
|
| 4189 | + return false; |
|
| 4190 | + } else { |
|
| 4191 | + return true; |
|
| 4192 | + } |
|
| 3439 | 4193 | } |
| 3440 | 4194 | |
| 3441 | 4195 | public static function insert_last_owner_update() { |
@@ -3465,8 +4219,11 @@ discard block |
||
| 3465 | 4219 | return "error : ".$e->getMessage(); |
| 3466 | 4220 | } |
| 3467 | 4221 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3468 | - if ($row['nb'] > 0) return false; |
|
| 3469 | - else return true; |
|
| 4222 | + if ($row['nb'] > 0) { |
|
| 4223 | + return false; |
|
| 4224 | + } else { |
|
| 4225 | + return true; |
|
| 4226 | + } |
|
| 3470 | 4227 | } |
| 3471 | 4228 | |
| 3472 | 4229 | public static function insert_last_fires_update() { |
@@ -3496,8 +4253,11 @@ discard block |
||
| 3496 | 4253 | return "error : ".$e->getMessage(); |
| 3497 | 4254 | } |
| 3498 | 4255 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3499 | - if ($row['nb'] > 0) return false; |
|
| 3500 | - else return true; |
|
| 4256 | + if ($row['nb'] > 0) { |
|
| 4257 | + return false; |
|
| 4258 | + } else { |
|
| 4259 | + return true; |
|
| 4260 | + } |
|
| 3501 | 4261 | } |
| 3502 | 4262 | |
| 3503 | 4263 | public static function insert_last_airlines_update() { |
@@ -3527,8 +4287,11 @@ discard block |
||
| 3527 | 4287 | return "error : ".$e->getMessage(); |
| 3528 | 4288 | } |
| 3529 | 4289 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3530 | - if ($row['nb'] > 0) return false; |
|
| 3531 | - else return true; |
|
| 4290 | + if ($row['nb'] > 0) { |
|
| 4291 | + return false; |
|
| 4292 | + } else { |
|
| 4293 | + return true; |
|
| 4294 | + } |
|
| 3532 | 4295 | } |
| 3533 | 4296 | |
| 3534 | 4297 | public static function insert_last_schedules_update() { |
@@ -3558,8 +4321,11 @@ discard block |
||
| 3558 | 4321 | return "error : ".$e->getMessage(); |
| 3559 | 4322 | } |
| 3560 | 4323 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3561 | - if ($row['nb'] > 0) return false; |
|
| 3562 | - else return true; |
|
| 4324 | + if ($row['nb'] > 0) { |
|
| 4325 | + return false; |
|
| 4326 | + } else { |
|
| 4327 | + return true; |
|
| 4328 | + } |
|
| 3563 | 4329 | } |
| 3564 | 4330 | |
| 3565 | 4331 | public static function insert_last_tle_update() { |
@@ -3589,8 +4355,11 @@ discard block |
||
| 3589 | 4355 | return "error : ".$e->getMessage(); |
| 3590 | 4356 | } |
| 3591 | 4357 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3592 | - if ($row['nb'] > 0) return false; |
|
| 3593 | - else return true; |
|
| 4358 | + if ($row['nb'] > 0) { |
|
| 4359 | + return false; |
|
| 4360 | + } else { |
|
| 4361 | + return true; |
|
| 4362 | + } |
|
| 3594 | 4363 | } |
| 3595 | 4364 | |
| 3596 | 4365 | public static function insert_last_ucsdb_update() { |
@@ -3620,8 +4389,11 @@ discard block |
||
| 3620 | 4389 | return "error : ".$e->getMessage(); |
| 3621 | 4390 | } |
| 3622 | 4391 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3623 | - if ($row['nb'] > 0) return false; |
|
| 3624 | - else return true; |
|
| 4392 | + if ($row['nb'] > 0) { |
|
| 4393 | + return false; |
|
| 4394 | + } else { |
|
| 4395 | + return true; |
|
| 4396 | + } |
|
| 3625 | 4397 | } |
| 3626 | 4398 | |
| 3627 | 4399 | public static function insert_last_celestrak_update() { |
@@ -3651,8 +4423,11 @@ discard block |
||
| 3651 | 4423 | return "error : ".$e->getMessage(); |
| 3652 | 4424 | } |
| 3653 | 4425 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3654 | - if ($row['nb'] > 0) return false; |
|
| 3655 | - else return true; |
|
| 4426 | + if ($row['nb'] > 0) { |
|
| 4427 | + return false; |
|
| 4428 | + } else { |
|
| 4429 | + return true; |
|
| 4430 | + } |
|
| 3656 | 4431 | } |
| 3657 | 4432 | |
| 3658 | 4433 | public static function check_last_satellite_update() { |
@@ -3670,8 +4445,11 @@ discard block |
||
| 3670 | 4445 | return "error : ".$e->getMessage(); |
| 3671 | 4446 | } |
| 3672 | 4447 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3673 | - if ($row['nb'] > 0) return false; |
|
| 3674 | - else return true; |
|
| 4448 | + if ($row['nb'] > 0) { |
|
| 4449 | + return false; |
|
| 4450 | + } else { |
|
| 4451 | + return true; |
|
| 4452 | + } |
|
| 3675 | 4453 | } |
| 3676 | 4454 | |
| 3677 | 4455 | public static function insert_last_marine_identity_update() { |
@@ -6,12 +6,19 @@ discard block |
||
| 6 | 6 | //gets the page file and stores it in a variable |
| 7 | 7 | $file_path = pathinfo($_SERVER['SCRIPT_NAME']); |
| 8 | 8 | $current_page = $file_path['filename']; |
| 9 | -if ($globalTimezone == '') $globalTimezone = 'UTC'; |
|
| 9 | +if ($globalTimezone == '') { |
|
| 10 | + $globalTimezone = 'UTC'; |
|
| 11 | +} |
|
| 10 | 12 | date_default_timezone_set($globalTimezone); |
| 11 | -if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') $MapType = $_COOKIE['MapType']; |
|
| 12 | -else $MapType = $globalMapProvider; |
|
| 13 | +if (isset($_COOKIE['MapType']) && $_COOKIE['MapType'] != '') { |
|
| 14 | + $MapType = $_COOKIE['MapType']; |
|
| 15 | +} else { |
|
| 16 | + $MapType = $globalMapProvider; |
|
| 17 | +} |
|
| 13 | 18 | |
| 14 | -if (isset($globalMapOffline) && $globalMapOffline) $MapType = 'offline'; |
|
| 19 | +if (isset($globalMapOffline) && $globalMapOffline) { |
|
| 20 | + $MapType = 'offline'; |
|
| 21 | +} |
|
| 15 | 22 | |
| 16 | 23 | if (isset($_GET['3d'])) { |
| 17 | 24 | setcookie('MapFormat','3d'); |
@@ -204,7 +211,10 @@ discard block |
||
| 204 | 211 | <?php |
| 205 | 212 | } else { |
| 206 | 213 | ?> |
| 207 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) print '&tsk='.$tsk; ?>"></script> |
|
| 214 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?<?php print time(); ?><?php if (isset($tsk)) { |
|
| 215 | + print '&tsk='.$tsk; |
|
| 216 | +} |
|
| 217 | +?>"></script> |
|
| 208 | 218 | <?php |
| 209 | 219 | } |
| 210 | 220 | if (!isset($globalAircraft) || $globalAircraft) { |
@@ -244,7 +254,13 @@ discard block |
||
| 244 | 254 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 245 | 255 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 246 | 256 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 247 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 257 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?ident=<?php print $ident; ?><?php if(isset($latitude)) { |
|
| 258 | + print '&latitude='.$latitude; |
|
| 259 | +} |
|
| 260 | +?><?php if(isset($longitude)) { |
|
| 261 | + print '&longitude='.$longitude; |
|
| 262 | +} |
|
| 263 | +?>&<?php print time(); ?>"></script> |
|
| 248 | 264 | <?php |
| 249 | 265 | if (!isset($type) || $type == 'aircraft') { |
| 250 | 266 | ?> |
@@ -317,7 +333,13 @@ discard block |
||
| 317 | 333 | <script src="<?php print $globalURL; ?>/js/MovingMarker.js"></script> |
| 318 | 334 | <script src="<?php print $globalURL; ?>/js/jquery.idle.min.js"></script> |
| 319 | 335 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 320 | -<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) print '&latitude='.$latitude; ?><?php if(isset($longitude)) print '&longitude='.$longitude; ?>&<?php print time(); ?>"></script> |
|
| 336 | +<script src="<?php print $globalURL; ?>/js/map.2d.js.php?flightaware_id=<?php print $flightaware_id; ?><?php if(isset($latitude)) { |
|
| 337 | + print '&latitude='.$latitude; |
|
| 338 | +} |
|
| 339 | +?><?php if(isset($longitude)) { |
|
| 340 | + print '&longitude='.$longitude; |
|
| 341 | +} |
|
| 342 | +?>&<?php print time(); ?>"></script> |
|
| 321 | 343 | <script src="<?php print $globalURL; ?>/js/map-aircraft.2d.js.php?flightaware_id=<?php print $flightaware_id; ?>&<?php print time(); ?>"></script> |
| 322 | 344 | <?php |
| 323 | 345 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '' && ($MapType == 'Google-Roadmap' || $MapType == 'Google-Satellite' || $MapType == 'Google-Hybrid' || $MapType == 'Google-Terrain')) { |
@@ -398,7 +420,12 @@ discard block |
||
| 398 | 420 | <span class="icon-bar"></span> |
| 399 | 421 | </button> |
| 400 | 422 | <a href="<?php print $globalURL; ?>/search" class="navbar-toggle search"><i class="fa fa-search"></i></a> |
| 401 | - <a class="navbar-brand" href="<?php if ($globalURL == '') print '/'; else print $globalURL; ?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
| 423 | + <a class="navbar-brand" href="<?php if ($globalURL == '') { |
|
| 424 | + print '/'; |
|
| 425 | +} else { |
|
| 426 | + print $globalURL; |
|
| 427 | +} |
|
| 428 | +?>"><img src="<?php print $globalURL.$logoURL; ?>" height="30px" /></a> |
|
| 402 | 429 | </div> |
| 403 | 430 | <div class="collapse navbar-collapse"> |
| 404 | 431 | |
@@ -453,7 +480,10 @@ discard block |
||
| 453 | 480 | } |
| 454 | 481 | ?> |
| 455 | 482 | |
| 456 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 483 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 484 | + echo 'right-'; |
|
| 485 | +} |
|
| 486 | +?>caret"></b></a> |
|
| 457 | 487 | <ul class="dropdown-menu"> |
| 458 | 488 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
| 459 | 489 | <?php |
@@ -524,8 +554,14 @@ discard block |
||
| 524 | 554 | </li> |
| 525 | 555 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
| 526 | 556 | <li><a href="<?php print $globalURL; ?>/statistics"><?php echo _("Statistics"); ?></a></li> |
| 527 | - <li class="dropdown<?php if ($sub) echo '-submenu'; ?>"> |
|
| 528 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 557 | + <li class="dropdown<?php if ($sub) { |
|
| 558 | + echo '-submenu'; |
|
| 559 | +} |
|
| 560 | +?>"> |
|
| 561 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Tools"); ?> <b class="<?php if ($sub) { |
|
| 562 | + echo 'right-'; |
|
| 563 | +} |
|
| 564 | +?>caret"></b></a> |
|
| 529 | 565 | <ul class="dropdown-menu"> |
| 530 | 566 | <li><a href="<?php print $globalURL; ?>/tools/acars"><?php echo _("ACARS translator"); ?></a></li> |
| 531 | 567 | <li><a href="<?php print $globalURL; ?>/tools/metar"><?php echo _("METAR translator"); ?></a></li> |
@@ -569,7 +605,10 @@ discard block |
||
| 569 | 605 | <?php |
| 570 | 606 | } |
| 571 | 607 | ?> |
| 572 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 608 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 609 | + echo 'right-'; |
|
| 610 | +} |
|
| 611 | +?>caret"></b></a> |
|
| 573 | 612 | <ul class="dropdown-menu"> |
| 574 | 613 | <li><a href="<?php print $globalURL; ?>/marine/currently"><?php echo _("Current Activity"); ?></a></li> |
| 575 | 614 | <li><a href="<?php print $globalURL; ?>/marine/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -610,7 +649,10 @@ discard block |
||
| 610 | 649 | <?php |
| 611 | 650 | } |
| 612 | 651 | ?> |
| 613 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 652 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 653 | + echo 'right-'; |
|
| 654 | +} |
|
| 655 | +?>caret"></b></a> |
|
| 614 | 656 | <ul class="dropdown-menu"> |
| 615 | 657 | <li><a href="<?php print $globalURL; ?>/tracker/currently"><?php echo _("Current Activity"); ?></a></li> |
| 616 | 658 | <li><a href="<?php print $globalURL; ?>/tracker/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -653,7 +695,10 @@ discard block |
||
| 653 | 695 | ?> |
| 654 | 696 | |
| 655 | 697 | <!-- |
| 656 | - <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
|
| 698 | + <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) { |
|
| 699 | + echo 'right-'; |
|
| 700 | +} |
|
| 701 | +?>caret"></b></a> |
|
| 657 | 702 | <ul class="dropdown-menu"> |
| 658 | 703 | <li><a href="<?php print $globalURL; ?>/satellite/currently"><?php echo _("Current Activity"); ?></a></li> |
| 659 | 704 | <li><a href="<?php print $globalURL; ?>/satellite/latest"><?php echo _("Latest Activity"); ?></a></li> |
@@ -711,9 +756,14 @@ discard block |
||
| 711 | 756 | <?php |
| 712 | 757 | foreach ($alllang as $key => $lang) { |
| 713 | 758 | print '<option value="'.$key.'"'; |
| 714 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 715 | - if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
| 716 | - else print '>'.$lang[0].'</option>'; |
|
| 759 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) { |
|
| 760 | + print ' selected '; |
|
| 761 | + } |
|
| 762 | + if ($lang[0] == 'Deutsch') { |
|
| 763 | + print '>'.$lang[0].' (βeta)</option>'; |
|
| 764 | + } else { |
|
| 765 | + print '>'.$lang[0].'</option>'; |
|
| 766 | + } |
|
| 717 | 767 | } |
| 718 | 768 | ?> |
| 719 | 769 | </select> |
@@ -861,9 +911,24 @@ discard block |
||
| 861 | 911 | $customid = $globalMapProvider; |
| 862 | 912 | ?> |
| 863 | 913 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
| 864 | - maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '18'; ?>, |
|
| 865 | - minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
| 866 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 914 | + maxZoom: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
| 915 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
| 916 | +} else { |
|
| 917 | + print '18'; |
|
| 918 | +} |
|
| 919 | +?>, |
|
| 920 | + minZoom: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
| 921 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
| 922 | +} else { |
|
| 923 | + print '0'; |
|
| 924 | +} |
|
| 925 | +?>, |
|
| 926 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 927 | + print 'false'; |
|
| 928 | +} else { |
|
| 929 | + print 'true'; |
|
| 930 | +} |
|
| 931 | +?>, |
|
| 867 | 932 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
| 868 | 933 | }).addTo(map); |
| 869 | 934 | <?php |
@@ -878,7 +943,12 @@ discard block |
||
| 878 | 943 | maxZoom: 5, |
| 879 | 944 | tms : true, |
| 880 | 945 | zindex : 3, |
| 881 | - noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) print 'false'; else print 'true'; ?>, |
|
| 946 | + noWrap: <?php if (isset($globalMapWrap) && !$globalMapWrap) { |
|
| 947 | + print 'false'; |
|
| 948 | +} else { |
|
| 949 | + print 'true'; |
|
| 950 | +} |
|
| 951 | +?>, |
|
| 882 | 952 | attribution: 'Natural Earth' |
| 883 | 953 | }).addTo(map); |
| 884 | 954 | <?php |
@@ -901,4 +971,7 @@ discard block |
||
| 901 | 971 | |
| 902 | 972 | ?> |
| 903 | 973 | |
| 904 | -<section class="container main-content <?php if (strtolower($current_page) == 'index') print 'index '; ?>clear"> |
|
| 974 | +<section class="container main-content <?php if (strtolower($current_page) == 'index') { |
|
| 975 | + print 'index '; |
|
| 976 | +} |
|
| 977 | +?>clear"> |
|
@@ -6,7 +6,9 @@ discard block |
||
| 6 | 6 | public function __construct($dbc = null) { |
| 7 | 7 | $Connection = new Connection($dbc); |
| 8 | 8 | $this->db = $Connection->db; |
| 9 | - if ($this->db === null) die('Error: No DB connection. (SpotterArchive)'); |
|
| 9 | + if ($this->db === null) { |
|
| 10 | + die('Error: No DB connection. (SpotterArchive)'); |
|
| 11 | + } |
|
| 10 | 12 | } |
| 11 | 13 | |
| 12 | 14 | /** |
@@ -27,7 +29,9 @@ discard block |
||
| 27 | 29 | if (isset($filter[0]['source'])) { |
| 28 | 30 | $filters = array_merge($filters,$filter); |
| 29 | 31 | } |
| 30 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 32 | + if (is_array($globalFilter)) { |
|
| 33 | + $filter = array_merge($filter,$globalFilter); |
|
| 34 | + } |
|
| 31 | 35 | $filter_query_join = ''; |
| 32 | 36 | $filter_query_where = ''; |
| 33 | 37 | foreach($filters as $flt) { |
@@ -119,8 +123,11 @@ discard block |
||
| 119 | 123 | } |
| 120 | 124 | $filter_query_join .= " INNER JOIN (SELECT flightaware_id FROM spotter_archive_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.flightaware_id = spotter_archive_output.flightaware_id"; |
| 121 | 125 | } |
| 122 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 123 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 126 | + if ($filter_query_where == '' && $where) { |
|
| 127 | + $filter_query_where = ' WHERE'; |
|
| 128 | + } elseif ($filter_query_where != '' && $and) { |
|
| 129 | + $filter_query_where .= ' AND'; |
|
| 130 | + } |
|
| 124 | 131 | if ($filter_query_where != '') { |
| 125 | 132 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 126 | 133 | } |
@@ -134,10 +141,17 @@ discard block |
||
| 134 | 141 | if ($over_country == '') { |
| 135 | 142 | $Spotter = new Spotter($this->db); |
| 136 | 143 | $data_country = $Spotter->getCountryFromLatitudeLongitude($latitude,$longitude); |
| 137 | - if (!empty($data_country)) $country = $data_country['iso2']; |
|
| 138 | - else $country = ''; |
|
| 139 | - } else $country = $over_country; |
|
| 140 | - if ($airline_type === NULL) $airline_type =''; |
|
| 144 | + if (!empty($data_country)) { |
|
| 145 | + $country = $data_country['iso2']; |
|
| 146 | + } else { |
|
| 147 | + $country = ''; |
|
| 148 | + } |
|
| 149 | + } else { |
|
| 150 | + $country = $over_country; |
|
| 151 | + } |
|
| 152 | + if ($airline_type === NULL) { |
|
| 153 | + $airline_type =''; |
|
| 154 | + } |
|
| 141 | 155 | |
| 142 | 156 | //if ($country == '') echo "\n".'************ UNKNOW COUNTRY ****************'."\n"; |
| 143 | 157 | //else echo "\n".'*/*/*/*/*/*/*/ Country : '.$country.' */*/*/*/*/*/*/*/*/'."\n"; |
@@ -598,7 +612,9 @@ discard block |
||
| 598 | 612 | $additional_query .= "(spotter_archive_output.pilot_name like '%".$q_item."%') OR "; |
| 599 | 613 | $additional_query .= "(spotter_archive_output.ident like '%".$q_item."%') OR "; |
| 600 | 614 | $translate = $Translation->ident2icao($q_item); |
| 601 | - if ($translate != $q_item) $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 615 | + if ($translate != $q_item) { |
|
| 616 | + $additional_query .= "(spotter_archive_output.ident like '%".$translate."%') OR "; |
|
| 617 | + } |
|
| 602 | 618 | $additional_query .= "(spotter_archive_output.highlight like '%".$q_item."%')"; |
| 603 | 619 | $additional_query .= ")"; |
| 604 | 620 | } |
@@ -778,7 +794,9 @@ discard block |
||
| 778 | 794 | date_default_timezone_set($globalTimezone); |
| 779 | 795 | $datetime = new DateTime(); |
| 780 | 796 | $offset = $datetime->format('P'); |
| 781 | - } else $offset = '+00:00'; |
|
| 797 | + } else { |
|
| 798 | + $offset = '+00:00'; |
|
| 799 | + } |
|
| 782 | 800 | if ($date_array[1] != "") { |
| 783 | 801 | $date_array[0] = date("Y-m-d H:i:s", strtotime($date_array[0])); |
| 784 | 802 | $date_array[1] = date("Y-m-d H:i:s", strtotime($date_array[1])); |
@@ -1021,9 +1039,13 @@ discard block |
||
| 1021 | 1039 | $query .= "AND date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1022 | 1040 | } |
| 1023 | 1041 | } |
| 1024 | - if ($sincedate != '') $query .= "AND date > '".$sincedate."' "; |
|
| 1042 | + if ($sincedate != '') { |
|
| 1043 | + $query .= "AND date > '".$sincedate."' "; |
|
| 1044 | + } |
|
| 1025 | 1045 | $query .= "GROUP BY c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1026 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1046 | + if ($limit) { |
|
| 1047 | + $query .= " LIMIT 0,10"; |
|
| 1048 | + } |
|
| 1027 | 1049 | |
| 1028 | 1050 | |
| 1029 | 1051 | $sth = $this->db->prepare($query); |
@@ -1065,9 +1087,13 @@ discard block |
||
| 1065 | 1087 | $query .= "AND s.date < CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$olderthanmonths." MONTHS'"; |
| 1066 | 1088 | } |
| 1067 | 1089 | } |
| 1068 | - if ($sincedate != '') $query .= "AND s.date > '".$sincedate."' "; |
|
| 1090 | + if ($sincedate != '') { |
|
| 1091 | + $query .= "AND s.date > '".$sincedate."' "; |
|
| 1092 | + } |
|
| 1069 | 1093 | $query .= "GROUP BY o.airline_icao,c.name, c.iso3, c.iso2 ORDER BY nb DESC"; |
| 1070 | - if ($limit) $query .= " LIMIT 0,10"; |
|
| 1094 | + if ($limit) { |
|
| 1095 | + $query .= " LIMIT 0,10"; |
|
| 1096 | + } |
|
| 1071 | 1097 | |
| 1072 | 1098 | |
| 1073 | 1099 | $sth = $this->db->prepare($query); |
@@ -275,7 +275,12 @@ discard block |
||
| 275 | 275 | <?php |
| 276 | 276 | } else { |
| 277 | 277 | ?> |
| 278 | - if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) print $globalMapRefresh*2000; else print '60000'; ?>)) { |
|
| 278 | + if (parseInt(lastupdateentity) < Math.floor(Date.now()-<?php if (isset($globalMapRefresh)) { |
|
| 279 | + print $globalMapRefresh*2000; |
|
| 280 | +} else { |
|
| 281 | + print '60000'; |
|
| 282 | +} |
|
| 283 | +?>)) { |
|
| 279 | 284 | viewer.dataSources.get(dsn).entities.remove(entity); |
| 280 | 285 | czmlds.entities.removeById(entityid); |
| 281 | 286 | } |
@@ -564,7 +569,12 @@ discard block |
||
| 564 | 569 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
| 565 | 570 | ?> |
| 566 | 571 | update_polarLayer(); |
| 567 | -setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 572 | +setInterval(function(){update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 573 | + print $globalMapRefresh*1000*2; |
|
| 574 | +} else { |
|
| 575 | + print '60000'; |
|
| 576 | +} |
|
| 577 | +?>); |
|
| 568 | 578 | <?php |
| 569 | 579 | } |
| 570 | 580 | ?> |
@@ -695,7 +705,12 @@ discard block |
||
| 695 | 705 | } |
| 696 | 706 | } |
| 697 | 707 | } |
| 698 | - ,<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 708 | + ,<?php if (isset($globalMapRefresh)) { |
|
| 709 | + print $globalMapRefresh*1000; |
|
| 710 | +} else { |
|
| 711 | + print '30000'; |
|
| 712 | +} |
|
| 713 | +?>); |
|
| 699 | 714 | } else { |
| 700 | 715 | var clockViewModel = new Cesium.ClockViewModel(viewer.clock); |
| 701 | 716 | var animationViewModel = new Cesium.AnimationViewModel(clockViewModel); |
@@ -724,7 +739,12 @@ discard block |
||
| 724 | 739 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 725 | 740 | ?> |
| 726 | 741 | update_atcLayer(); |
| 727 | -setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 742 | +setInterval(function(){update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 743 | + print $globalMapRefresh*1000*2; |
|
| 744 | +} else { |
|
| 745 | + print '60000'; |
|
| 746 | +} |
|
| 747 | +?>); |
|
| 728 | 748 | <?php |
| 729 | 749 | } |
| 730 | 750 | ?> |
@@ -25,12 +25,10 @@ discard block |
||
| 25 | 25 | if ($tracker) { |
| 26 | 26 | require_once('require/class.Tracker.php'); |
| 27 | 27 | require_once('require/class.TrackerArchive.php'); |
| 28 | -} |
|
| 29 | -elseif ($marine) { |
|
| 28 | +} elseif ($marine) { |
|
| 30 | 29 | require_once('require/class.Marine.php'); |
| 31 | 30 | require_once('require/class.MarineArchive.php'); |
| 32 | -} |
|
| 33 | -else { |
|
| 31 | +} else { |
|
| 34 | 32 | require_once('require/class.Spotter.php'); |
| 35 | 33 | require_once('require/class.SpotterArchive.php'); |
| 36 | 34 | } |
@@ -38,12 +36,10 @@ discard block |
||
| 38 | 36 | if ($tracker) { |
| 39 | 37 | $Tracker = new Tracker(); |
| 40 | 38 | $TrackerArchive = new TrackerArchive(); |
| 41 | -} |
|
| 42 | -elseif ($marine) { |
|
| 39 | +} elseif ($marine) { |
|
| 43 | 40 | $Marine = new Marine(); |
| 44 | 41 | $MarineArchive = new MarineArchive(); |
| 45 | -} |
|
| 46 | -else { |
|
| 42 | +} else { |
|
| 47 | 43 | $Spotter = new Spotter(); |
| 48 | 44 | $SpotterArchive = new SpotterArchive(); |
| 49 | 45 | } |
@@ -56,66 +52,92 @@ discard block |
||
| 56 | 52 | } |
| 57 | 53 | header('Content-Type: text/javascript'); |
| 58 | 54 | |
| 59 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 60 | -else $compress = $globalJsonCompress; |
|
| 55 | +if (!isset($globalJsonCompress)) { |
|
| 56 | + $compress = true; |
|
| 57 | +} else { |
|
| 58 | + $compress = $globalJsonCompress; |
|
| 59 | +} |
|
| 61 | 60 | |
| 62 | 61 | $from_archive = false; |
| 63 | 62 | $min = false; |
| 64 | 63 | $allhistory = false; |
| 65 | 64 | $filter['source'] = array(); |
| 66 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 67 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 68 | -if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 69 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 70 | -if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 71 | -if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 72 | -if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 73 | -if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 74 | -if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 75 | -if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 76 | -if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 65 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalVATSIM) && $globalVATSIM && isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') { |
|
| 66 | + $filter['source'] = array_merge($filter['source'],array('vatsimtxt')); |
|
| 67 | +} |
|
| 68 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalIVAO) && $globalIVAO && isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') { |
|
| 69 | + $filter['source'] = array_merge($filter['source'],array('whazzup')); |
|
| 70 | +} |
|
| 71 | +if ((!isset($globalMapVAchoose) || $globalMapVAchoose) && isset($globalphpVMS) && $globalphpVMS && isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') { |
|
| 72 | + $filter['source'] = array_merge($filter['source'],array('phpvmacars')); |
|
| 73 | +} |
|
| 74 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalSBS1) && $globalSBS1 && isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') { |
|
| 75 | + $filter['source'] = array_merge($filter['source'],array('sbs','famaprs')); |
|
| 76 | +} |
|
| 77 | +if ((!isset($globalMapchoose) || $globalMapchoose) && isset($globalAPRS) && $globalAPRS && isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') { |
|
| 78 | + $filter['source'] = array_merge($filter['source'],array('aprs')); |
|
| 79 | +} |
|
| 80 | +if (isset($_COOKIE['filter_ident']) && $_COOKIE['filter_ident'] != '') { |
|
| 81 | + $filter['ident'] = filter_var($_COOKIE['filter_ident'],FILTER_SANITIZE_STRING); |
|
| 82 | +} |
|
| 83 | +if (isset($_COOKIE['filter_mmsi']) && $_COOKIE['filter_mmsi'] != '') { |
|
| 84 | + $filter['mmsi'] = filter_var($_COOKIE['filter_mmsi'],FILTER_SANITIZE_STRING); |
|
| 85 | +} |
|
| 86 | +if (isset($_COOKIE['filter_Airlines']) && $_COOKIE['filter_Airlines'] != '') { |
|
| 87 | + $filter['airlines'] = filter_var_array(explode(',',$_COOKIE['filter_Airlines']),FILTER_SANITIZE_STRING); |
|
| 88 | +} |
|
| 89 | +if (isset($_COOKIE['filter_Sources']) && $_COOKIE['filter_Sources'] != '') { |
|
| 90 | + $filter['source_aprs'] = filter_var_array(explode(',',$_COOKIE['filter_Sources']),FILTER_SANITIZE_STRING); |
|
| 91 | +} |
|
| 92 | +if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] != 'all') { |
|
| 93 | + $filter['airlinestype'] = filter_var($_COOKIE['filter_airlinestype'],FILTER_SANITIZE_STRING); |
|
| 94 | +} |
|
| 95 | +if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] != 'all') { |
|
| 96 | + $filter['alliance'] = filter_var($_COOKIE['filter_alliance'],FILTER_SANITIZE_STRING); |
|
| 97 | +} |
|
| 77 | 98 | |
| 78 | 99 | if (isset($globalMapPopup) && !$globalMapPopup && !(isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true')) { |
| 79 | 100 | $min = true; |
| 80 | -} else $min = false; |
|
| 101 | +} else { |
|
| 102 | + $min = false; |
|
| 103 | +} |
|
| 81 | 104 | |
| 82 | 105 | if (isset($_GET['ident'])) { |
| 83 | 106 | $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
| 84 | 107 | $from_archive = true; |
| 85 | 108 | if ($tracker) { |
| 86 | 109 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataByIdent($ident); |
| 87 | - } |
|
| 88 | - elseif ($marine) { |
|
| 110 | + } elseif ($marine) { |
|
| 89 | 111 | $spotter_array = $MarineArchive->getLastArchiveMarineDataByIdent($ident); |
| 90 | - } |
|
| 91 | - else { |
|
| 112 | + } else { |
|
| 92 | 113 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataByIdent($ident); |
| 93 | 114 | } |
| 94 | 115 | $allhistory = true; |
| 95 | -} |
|
| 96 | -elseif (isset($_GET['flightaware_id'])) { |
|
| 116 | +} elseif (isset($_GET['flightaware_id'])) { |
|
| 97 | 117 | $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
| 98 | 118 | $from_archive = true; |
| 99 | 119 | if ($tracker) { |
| 100 | 120 | $spotter_array = $TrackerArchive->getLastArchiveTrackerDataById($flightaware_id); |
| 101 | - } |
|
| 102 | - elseif ($marine) { |
|
| 121 | + } elseif ($marine) { |
|
| 103 | 122 | $spotter_array = $MarineArchive->getLastArchiveMarineDataById($flightaware_id); |
| 104 | - } |
|
| 105 | - else { |
|
| 123 | + } else { |
|
| 106 | 124 | $spotter_array = $SpotterArchive->getLastArchiveSpotterDataById($flightaware_id); |
| 107 | 125 | } |
| 108 | 126 | $allhistory = true; |
| 109 | -} |
|
| 110 | -elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 127 | +} elseif (isset($_GET['archive']) && isset($_GET['begindate']) && isset($_GET['enddate']) && isset($_GET['speed'])) { |
|
| 111 | 128 | $from_archive = true; |
| 112 | 129 | $begindate = filter_input(INPUT_GET,'begindate',FILTER_SANITIZE_NUMBER_INT); |
| 113 | - if (isset($globalAircraftMaxUpdate)) $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 114 | - else $begindate = $begindate - 3000; |
|
| 130 | + if (isset($globalAircraftMaxUpdate)) { |
|
| 131 | + $begindate = $begindate - $globalAircraftMaxUpdate; |
|
| 132 | + } else { |
|
| 133 | + $begindate = $begindate - 3000; |
|
| 134 | + } |
|
| 115 | 135 | $enddate = filter_input(INPUT_GET,'enddate',FILTER_SANITIZE_NUMBER_INT); |
| 116 | 136 | $archivespeed = filter_input(INPUT_GET,'speed',FILTER_SANITIZE_NUMBER_INT); |
| 117 | 137 | $part = filter_input(INPUT_GET,'part',FILTER_SANITIZE_NUMBER_INT); |
| 118 | - if ($part == '') $part = 0; |
|
| 138 | + if ($part == '') { |
|
| 139 | + $part = 0; |
|
| 140 | + } |
|
| 119 | 141 | |
| 120 | 142 | if ($begindate != '' && $enddate != '') { |
| 121 | 143 | $begindate = date('Y-m-d H:i:s',$begindate); |
@@ -123,11 +145,9 @@ discard block |
||
| 123 | 145 | //$spotter_array = $SpotterArchive->getMinLiveSpotterDataPlayback($begindate,$enddate,$filter); |
| 124 | 146 | if ($tracker) { |
| 125 | 147 | $spotter_array = $TrackerArchive->getMinLiveTrackerData($begindate,$enddate,$filter); |
| 126 | - } |
|
| 127 | - elseif ($marine) { |
|
| 148 | + } elseif ($marine) { |
|
| 128 | 149 | $spotter_array = $MarineArchive->getMinLiveMarineData($begindate,$enddate,$filter); |
| 129 | - } |
|
| 130 | - else { |
|
| 150 | + } else { |
|
| 131 | 151 | $spotter_array = $SpotterArchive->getMinLiveSpotterData($begindate,$enddate,$filter,$part); |
| 132 | 152 | } |
| 133 | 153 | } |
@@ -136,8 +156,12 @@ discard block |
||
| 136 | 156 | if (!empty($spotter_array)) { |
| 137 | 157 | //$flightcnt = $SpotterArchive->getLiveSpotterCount($begindate,$enddate,$filter); |
| 138 | 158 | $flightcnt = 0; |
| 139 | - if ($flightcnt == '') $flightcnt = 0; |
|
| 140 | -} else $flightcnt = 0; |
|
| 159 | + if ($flightcnt == '') { |
|
| 160 | + $flightcnt = 0; |
|
| 161 | + } |
|
| 162 | + } else { |
|
| 163 | + $flightcnt = 0; |
|
| 164 | +} |
|
| 141 | 165 | |
| 142 | 166 | $sqltime = round(microtime(true)-$begintime,2); |
| 143 | 167 | |
@@ -147,8 +171,11 @@ discard block |
||
| 147 | 171 | $aircrafts_shadow = array(); |
| 148 | 172 | $output = '{'; |
| 149 | 173 | $output .= '"type": "FeatureCollection",'; |
| 150 | -if ($min) $output .= '"minimal": "true",'; |
|
| 151 | -else $output .= '"minimal": "false",'; |
|
| 174 | +if ($min) { |
|
| 175 | + $output .= '"minimal": "true",'; |
|
| 176 | +} else { |
|
| 177 | + $output .= '"minimal": "false",'; |
|
| 178 | +} |
|
| 152 | 179 | $output .= '"fc": "'.$flightcnt.'",'; |
| 153 | 180 | $output .= '"sqt": "'.$sqltime.'",'; |
| 154 | 181 | $begin = true; |
@@ -161,15 +188,17 @@ discard block |
||
| 161 | 188 | if ($pfi != $spotter_item['famtrackid']) { |
| 162 | 189 | $pfi = $spotter_item['famtrackid']; |
| 163 | 190 | $begin = true; |
| 164 | - } else $spotter_history_array = 0; |
|
| 165 | - } |
|
| 166 | - elseif ($marine) { |
|
| 191 | + } else { |
|
| 192 | + $spotter_history_array = 0; |
|
| 193 | + } |
|
| 194 | + } elseif ($marine) { |
|
| 167 | 195 | if ($pfi != $spotter_item['fammarine_d']) { |
| 168 | 196 | $pfi = $spotter_item['fammarine_id']; |
| 169 | 197 | $begin = true; |
| 170 | - } else $spotter_history_array = 0; |
|
| 171 | - } |
|
| 172 | - else { |
|
| 198 | + } else { |
|
| 199 | + $spotter_history_array = 0; |
|
| 200 | + } |
|
| 201 | + } else { |
|
| 173 | 202 | if ($pfi != $spotter_item['flightaware_id']) { |
| 174 | 203 | $pfi = $spotter_item['flightaware_id']; |
| 175 | 204 | $begin = true; |
@@ -206,7 +235,9 @@ discard block |
||
| 206 | 235 | $output_history .= '['.$spotter_item['longitude'].', '.$spotter_item['latitude'].'],'; |
| 207 | 236 | $output_time .= (strtotime($spotter_item['date'])*1000).','; |
| 208 | 237 | $previousts = strtotime($spotter_item['date']); |
| 209 | - if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) $end = true; |
|
| 238 | + if ($k > 1 && (strtotime($spotter_item['date'])*1000 > $enddate)) { |
|
| 239 | + $end = true; |
|
| 240 | + } |
|
| 210 | 241 | } |
| 211 | 242 | |
| 212 | 243 | if ($begin) { |
@@ -216,7 +247,9 @@ discard block |
||
| 216 | 247 | $output .= '"type": "Feature",'; |
| 217 | 248 | $output .= '"properties": {'; |
| 218 | 249 | $output .= '"fi": "'.$pfi.'",'; |
| 219 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 250 | + if (isset($begindate)) { |
|
| 251 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 252 | + } |
|
| 220 | 253 | if (isset($spotter_item['ident']) && $spotter_item['ident'] != '') { |
| 221 | 254 | $output .= '"c": "'.str_replace('\\','',$spotter_item['ident']).'",'; |
| 222 | 255 | //" |
@@ -224,14 +257,20 @@ discard block |
||
| 224 | 257 | $output .= '"c": "NA",'; |
| 225 | 258 | } |
| 226 | 259 | if (!isset($spotter_item['aircraft_shadow']) && !$tracker && !$marine) { |
| 227 | - if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') $spotter_item['aircraft_shadow'] = ''; |
|
| 228 | - else { |
|
| 260 | + if (!isset($spotter_item['aircraft_icao']) || $spotter_item['aircraft_icao'] == '') { |
|
| 261 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 262 | + } else { |
|
| 229 | 263 | $aircraft_icao = $spotter_item['aircraft_icao']; |
| 230 | 264 | $aircraft_info = $Spotter->getAllAircraftInfo($spotter_item['aircraft_icao']); |
| 231 | - if (count($aircraft_info) > 0) $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 232 | - elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 233 | - elseif ($aircraft_icao == 'PARAGLIDER') $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 234 | - else $spotter_item['aircraft_shadow'] = ''; |
|
| 265 | + if (count($aircraft_info) > 0) { |
|
| 266 | + $spotter_item['aircraft_shadow'] = $aircraft_info[0]['aircraft_shadow']; |
|
| 267 | + } elseif (isset($spotter_item['format_source']) && $spotter_item['format_source'] == 'aprs') { |
|
| 268 | + $spotter_item['aircraft_shadow'] = 'PA18.png'; |
|
| 269 | + } elseif ($aircraft_icao == 'PARAGLIDER') { |
|
| 270 | + $spotter_item['aircraft_shadow'] = 'PARAGLIDER.png'; |
|
| 271 | + } else { |
|
| 272 | + $spotter_item['aircraft_shadow'] = ''; |
|
| 273 | + } |
|
| 235 | 274 | $aircrafts_shadow[$aircraft_icao] = $spotter_item['aircraft_shadow']; |
| 236 | 275 | } |
| 237 | 276 | } |
@@ -239,93 +278,139 @@ discard block |
||
| 239 | 278 | if (!isset($spotter_item['aircraft_shadow']) || $spotter_item['aircraft_shadow'] == '') { |
| 240 | 279 | if ($tracker) { |
| 241 | 280 | if (isset($spotter_item['type']) && $spotter_item['type'] == 'Ambulance') { |
| 242 | - if ($compress) $output .= '"as": "ambulance.png",'; |
|
| 243 | - else $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 244 | - } |
|
| 245 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 246 | - if ($compress) $output .= '"as": "police.png",'; |
|
| 247 | - else $output .= '"aircraft_shadow": "police.png",'; |
|
| 248 | - } |
|
| 249 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 250 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 251 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 252 | - } |
|
| 253 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 254 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 255 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 256 | - } |
|
| 257 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 258 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 259 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 281 | + if ($compress) { |
|
| 282 | + $output .= '"as": "ambulance.png",'; |
|
| 283 | + } else { |
|
| 284 | + $output .= '"aircraft_shadow": "ambulance.png",'; |
|
| 285 | + } |
|
| 286 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Police') { |
|
| 287 | + if ($compress) { |
|
| 288 | + $output .= '"as": "police.png",'; |
|
| 289 | + } else { |
|
| 290 | + $output .= '"aircraft_shadow": "police.png",'; |
|
| 291 | + } |
|
| 292 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Yacht (Sail)') { |
|
| 293 | + if ($compress) { |
|
| 294 | + $output .= '"as": "ship.png",'; |
|
| 295 | + } else { |
|
| 296 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 297 | + } |
|
| 298 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Ship (Power Boat)') { |
|
| 299 | + if ($compress) { |
|
| 300 | + $output .= '"as": "ship.png",'; |
|
| 301 | + } else { |
|
| 302 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 303 | + } |
|
| 304 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Shuttle') { |
|
| 305 | + if ($compress) { |
|
| 306 | + $output .= '"as": "ship.png",'; |
|
| 307 | + } else { |
|
| 308 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 309 | + } |
|
| 310 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 311 | + if ($compress) { |
|
| 312 | + $output .= '"as": "truck.png",'; |
|
| 313 | + } else { |
|
| 314 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 315 | + } |
|
| 316 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 317 | + if ($compress) { |
|
| 318 | + $output .= '"as": "truck.png",'; |
|
| 319 | + } else { |
|
| 320 | + $output .= '"aircraft_shadow": "truck.png",'; |
|
| 321 | + } |
|
| 322 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 323 | + if ($compress) { |
|
| 324 | + $output .= '"as": "aircraft.png",'; |
|
| 325 | + } else { |
|
| 326 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 327 | + } |
|
| 328 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 329 | + if ($compress) { |
|
| 330 | + $output .= '"as": "aircraft.png",'; |
|
| 331 | + } else { |
|
| 332 | + $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 333 | + } |
|
| 334 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 335 | + if ($compress) { |
|
| 336 | + $output .= '"as": "helico.png",'; |
|
| 337 | + } else { |
|
| 338 | + $output .= '"aircraft_shadow": "helico.png",'; |
|
| 339 | + } |
|
| 340 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 341 | + if ($compress) { |
|
| 342 | + $output .= '"as": "rail.png",'; |
|
| 343 | + } else { |
|
| 344 | + $output .= '"aircraft_shadow": "rail.png",'; |
|
| 345 | + } |
|
| 346 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 347 | + if ($compress) { |
|
| 348 | + $output .= '"as": "firetruck.png",'; |
|
| 349 | + } else { |
|
| 350 | + $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 351 | + } |
|
| 352 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 353 | + if ($compress) { |
|
| 354 | + $output .= '"as": "bus.png",'; |
|
| 355 | + } else { |
|
| 356 | + $output .= '"aircraft_shadow": "bus.png",'; |
|
| 357 | + } |
|
| 358 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 359 | + if ($compress) { |
|
| 360 | + $output .= '"as": "phone.png",'; |
|
| 361 | + } else { |
|
| 362 | + $output .= '"aircraft_shadow": "phone.png",'; |
|
| 363 | + } |
|
| 364 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 365 | + if ($compress) { |
|
| 366 | + $output .= '"as": "jogger.png",'; |
|
| 367 | + } else { |
|
| 368 | + $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 369 | + } |
|
| 370 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 371 | + if ($compress) { |
|
| 372 | + $output .= '"as": "bike.png",'; |
|
| 373 | + } else { |
|
| 374 | + $output .= '"aircraft_shadow": "bike.png",'; |
|
| 375 | + } |
|
| 376 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 377 | + if ($compress) { |
|
| 378 | + $output .= '"as": "motorcycle.png",'; |
|
| 379 | + } else { |
|
| 380 | + $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 381 | + } |
|
| 382 | + } elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 383 | + if ($compress) { |
|
| 384 | + $output .= '"as": "balloon.png",'; |
|
| 385 | + } else { |
|
| 386 | + $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 387 | + } |
|
| 388 | + } else { |
|
| 389 | + if ($compress) { |
|
| 390 | + $output .= '"as": "car.png",'; |
|
| 391 | + } else { |
|
| 392 | + $output .= '"aircraft_shadow": "car.png",'; |
|
| 393 | + } |
|
| 260 | 394 | } |
| 261 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck') { |
|
| 262 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 263 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 395 | + } elseif ($marine) { |
|
| 396 | + if ($compress) { |
|
| 397 | + $output .= '"as": "ship.png",'; |
|
| 398 | + } else { |
|
| 399 | + $output .= '"aircraft_shadow": "ship.png",'; |
|
| 264 | 400 | } |
| 265 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Truck (18 Wheeler)') { |
|
| 266 | - if ($compress) $output .= '"as": "truck.png",'; |
|
| 267 | - else $output .= '"aircraft_shadow": "truck.png",'; |
|
| 268 | - } |
|
| 269 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Aircraft (small)') { |
|
| 270 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 271 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 272 | - } |
|
| 273 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Large Aircraft') { |
|
| 274 | - if ($compress) $output .= '"as": "aircraft.png",'; |
|
| 275 | - else $output .= '"aircraft_shadow": "aircraft.png",'; |
|
| 276 | - } |
|
| 277 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Helicopter') { |
|
| 278 | - if ($compress) $output .= '"as": "helico.png",'; |
|
| 279 | - else $output .= '"aircraft_shadow": "helico.png",'; |
|
| 280 | - } |
|
| 281 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Railroad Engine') { |
|
| 282 | - if ($compress) $output .= '"as": "rail.png",'; |
|
| 283 | - else $output .= '"aircraft_shadow": "rail.png",'; |
|
| 284 | - } |
|
| 285 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Firetruck') { |
|
| 286 | - if ($compress) $output .= '"as": "firetruck.png",'; |
|
| 287 | - else $output .= '"aircraft_shadow": "firetruck.png",'; |
|
| 288 | - } |
|
| 289 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bus') { |
|
| 290 | - if ($compress) $output .= '"as": "bus.png",'; |
|
| 291 | - else $output .= '"aircraft_shadow": "bus.png",'; |
|
| 292 | - } |
|
| 293 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Phone') { |
|
| 294 | - if ($compress) $output .= '"as": "phone.png",'; |
|
| 295 | - else $output .= '"aircraft_shadow": "phone.png",'; |
|
| 296 | - } |
|
| 297 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Jogger') { |
|
| 298 | - if ($compress) $output .= '"as": "jogger.png",'; |
|
| 299 | - else $output .= '"aircraft_shadow": "jogger.png",'; |
|
| 300 | - } |
|
| 301 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Bike') { |
|
| 302 | - if ($compress) $output .= '"as": "bike.png",'; |
|
| 303 | - else $output .= '"aircraft_shadow": "bike.png",'; |
|
| 304 | - } |
|
| 305 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Motorcycle') { |
|
| 306 | - if ($compress) $output .= '"as": "motorcycle.png",'; |
|
| 307 | - else $output .= '"aircraft_shadow": "motorcycle.png",'; |
|
| 308 | - } |
|
| 309 | - elseif (isset($spotter_item['type']) && $spotter_item['type'] == 'Balloon') { |
|
| 310 | - if ($compress) $output .= '"as": "balloon.png",'; |
|
| 311 | - else $output .= '"aircraft_shadow": "balloon.png",'; |
|
| 312 | - } |
|
| 313 | - else { |
|
| 314 | - if ($compress) $output .= '"as": "car.png",'; |
|
| 315 | - else $output .= '"aircraft_shadow": "car.png",'; |
|
| 401 | + } else { |
|
| 402 | + if ($compress) { |
|
| 403 | + $output .= '"as": "default.png",'; |
|
| 404 | + } else { |
|
| 405 | + $output .= '"aircraft_shadow": "default.png",'; |
|
| 316 | 406 | } |
| 317 | 407 | } |
| 318 | - elseif ($marine) { |
|
| 319 | - if ($compress) $output .= '"as": "ship.png",'; |
|
| 320 | - else $output .= '"aircraft_shadow": "ship.png",'; |
|
| 321 | - } |
|
| 322 | - else { |
|
| 323 | - if ($compress) $output .= '"as": "default.png",'; |
|
| 324 | - else $output .= '"aircraft_shadow": "default.png",'; |
|
| 325 | - } |
|
| 326 | 408 | } else { |
| 327 | - if ($compress) $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 328 | - else $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 409 | + if ($compress) { |
|
| 410 | + $output .= '"as": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 411 | + } else { |
|
| 412 | + $output .= '"aircraft_shadow": "'.$spotter_item['aircraft_shadow'].'",'; |
|
| 413 | + } |
|
| 329 | 414 | } |
| 330 | 415 | |
| 331 | 416 | if (isset($spotter_item['date_iso_8601'])) { |
@@ -373,7 +458,9 @@ discard block |
||
| 373 | 458 | $output .= ']'; |
| 374 | 459 | $output .= ',"initial_sqltime": "'.$sqltime.'",'; |
| 375 | 460 | $output .= '"totaltime": "'.round(microtime(true)-$begintime,2).'",'; |
| 376 | - if (isset($begindate)) $output .= '"archive_date": "'.$begindate.'",'; |
|
| 461 | + if (isset($begindate)) { |
|
| 462 | + $output .= '"archive_date": "'.$begindate.'",'; |
|
| 463 | + } |
|
| 377 | 464 | $output .= '"fc": "'.$flightcnt.'"'; |
| 378 | 465 | } else { |
| 379 | 466 | $output .= '"features": '; |
@@ -123,15 +123,21 @@ discard block |
||
| 123 | 123 | { |
| 124 | 124 | $title = sprintf(_("Detailed View for %s"),$spotter_array[0]['ident']); |
| 125 | 125 | $ident = $spotter_array[0]['ident']; |
| 126 | - if (isset($spotter_array[0]['latitude'])) $latitude = $spotter_array[0]['latitude']; |
|
| 127 | - if (isset($spotter_array[0]['longitude'])) $longitude = $spotter_array[0]['longitude']; |
|
| 126 | + if (isset($spotter_array[0]['latitude'])) { |
|
| 127 | + $latitude = $spotter_array[0]['latitude']; |
|
| 128 | + } |
|
| 129 | + if (isset($spotter_array[0]['longitude'])) { |
|
| 130 | + $longitude = $spotter_array[0]['longitude']; |
|
| 131 | + } |
|
| 128 | 132 | require_once('header.php'); |
| 129 | 133 | if (isset($globalArchive) && $globalArchive && $type == 'aircraft') { |
| 130 | 134 | // Requirement for altitude graph |
| 131 | 135 | $all_data = $SpotterArchive->getAltitudeSpeedArchiveSpotterDataById($spotter_array[0]['flightaware_id']); |
| 132 | 136 | if (isset($globalTimezone)) { |
| 133 | 137 | date_default_timezone_set($globalTimezone); |
| 134 | - } else date_default_timezone_set('UTC'); |
|
| 138 | + } else { |
|
| 139 | + date_default_timezone_set('UTC'); |
|
| 140 | + } |
|
| 135 | 141 | if (is_array($all_data) && count($all_data) > 1) { |
| 136 | 142 | print '<link href="'.$globalURL.'/css/c3.min.css" rel="stylesheet" type="text/css">'; |
| 137 | 143 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -205,18 +211,28 @@ discard block |
||
| 205 | 211 | print '<br/><br/><br/>'; |
| 206 | 212 | print '<h1>'.$spotter_array[0]['ident'].'</h1>'; |
| 207 | 213 | print '<div><span class="label">'._("Ident").'</span>'.$spotter_array[0]['ident'].'</div>'; |
| 208 | - if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
| 214 | + if (isset($spotter_array[0]['blocked']) && $spotter_array[0]['blocked'] === true) { |
|
| 215 | + print '<div>'._("Callsign is in blocked FAA list").'</div>'; |
|
| 216 | + } |
|
| 209 | 217 | if (isset($spotter_array[0]['airline_icao'])) { |
| 210 | 218 | print '<div><span class="label">'._("Airline").'</span><a href="'.$globalURL.'/airline/'.$spotter_array[0]['airline_icao'].'">'.$spotter_array[0]['airline_name'].'</a></div>'; |
| 211 | 219 | } |
| 212 | - if ($type == 'aircraft') print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
| 220 | + if ($type == 'aircraft') { |
|
| 221 | + print '<div><span class="label">'._("Flight History").'</span><a href="http://flightaware.com/live/flight/'.$spotter_array[0]['ident'].'" target="_blank">'._("View the Flight History of this callsign").'</a></div>'; |
|
| 222 | + } |
|
| 213 | 223 | print '</div>'; |
| 214 | 224 | |
| 215 | - if ($type == 'aircraft') include('ident-sub-menu.php'); |
|
| 225 | + if ($type == 'aircraft') { |
|
| 226 | + include('ident-sub-menu.php'); |
|
| 227 | + } |
|
| 216 | 228 | print '<div class="table column">'; |
| 217 | - if ($type == 'aircraft') print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 218 | - elseif ($type == 'marine') print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 219 | - elseif ($type == 'tracker') print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 229 | + if ($type == 'aircraft') { |
|
| 230 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 231 | + } elseif ($type == 'marine') { |
|
| 232 | + print '<p>'.sprintf(_("The table below shows the detailed information of all vessels with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 233 | + } elseif ($type == 'tracker') { |
|
| 234 | + print '<p>'.sprintf(_("The table below shows the detailed information of all trackers with the ident/callsign of <strong>%s</strong>."),$spotter_array[0]['ident']).'</p>'; |
|
| 235 | + } |
|
| 220 | 236 | |
| 221 | 237 | include('table-output.php'); |
| 222 | 238 | print '<div class="pagination">'; |
@@ -3,16 +3,27 @@ discard block |
||
| 3 | 3 | require_once('../require/class.Language.php'); |
| 4 | 4 | |
| 5 | 5 | // Compressed GeoJson is used if true |
| 6 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 7 | -else $compress = $globalJsonCompress; |
|
| 6 | +if (!isset($globalJsonCompress)) { |
|
| 7 | + $compress = true; |
|
| 8 | +} else { |
|
| 9 | + $compress = $globalJsonCompress; |
|
| 10 | +} |
|
| 8 | 11 | |
| 9 | -if (isset($_GET['ident'])) $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 10 | -if (isset($_GET['flightaware_id'])) $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 12 | +if (isset($_GET['ident'])) { |
|
| 13 | + $ident = filter_input(INPUT_GET,'ident',FILTER_SANITIZE_STRING); |
|
| 14 | +} |
|
| 15 | +if (isset($_GET['flightaware_id'])) { |
|
| 16 | + $flightaware_id = filter_input(INPUT_GET,'flightaware_id',FILTER_SANITIZE_STRING); |
|
| 17 | +} |
|
| 11 | 18 | ?> |
| 12 | 19 | <?php |
| 13 | -if (isset($_COOKIE['IconColor'])) $IconColor = $_COOKIE['IconColor']; |
|
| 14 | -elseif (isset($globalAircraftIconColor)) $IconColor = $globalAircraftIconColor; |
|
| 15 | -else $IconColor = '1a3151'; |
|
| 20 | +if (isset($_COOKIE['IconColor'])) { |
|
| 21 | + $IconColor = $_COOKIE['IconColor']; |
|
| 22 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 23 | + $IconColor = $globalAircraftIconColor; |
|
| 24 | +} else { |
|
| 25 | + $IconColor = '1a3151'; |
|
| 26 | +} |
|
| 16 | 27 | ?> |
| 17 | 28 | <?php |
| 18 | 29 | if (isset($globalDebug) && $globalDebug === TRUE) { |
@@ -90,9 +101,12 @@ discard block |
||
| 90 | 101 | |
| 91 | 102 | function update_airportsLayer() { |
| 92 | 103 | <?php |
| 93 | - if (isset($_COOKIE['AirportZoom'])) $getZoom = $_COOKIE['AirportZoom']; |
|
| 94 | - else $getZoom = '7'; |
|
| 95 | -?> |
|
| 104 | + if (isset($_COOKIE['AirportZoom'])) { |
|
| 105 | + $getZoom = $_COOKIE['AirportZoom']; |
|
| 106 | + } else { |
|
| 107 | + $getZoom = '7'; |
|
| 108 | + } |
|
| 109 | + ?> |
|
| 96 | 110 | if (typeof airportsLayer != 'undefined') { |
| 97 | 111 | if (map.hasLayer(airportsLayer) == true) { |
| 98 | 112 | map.removeLayer(airportsLayer); |
@@ -373,7 +387,12 @@ discard block |
||
| 373 | 387 | <?php |
| 374 | 388 | } else { |
| 375 | 389 | ?> |
| 376 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 390 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 391 | + print $archiveupdatetime*1000; |
|
| 392 | +} else { |
|
| 393 | + print $globalMapRefresh*1000+20000; |
|
| 394 | +} |
|
| 395 | +?>+feature.properties.sqt*1000); |
|
| 377 | 396 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 378 | 397 | <?php |
| 379 | 398 | } |
@@ -424,7 +443,12 @@ discard block |
||
| 424 | 443 | <?php |
| 425 | 444 | } else { |
| 426 | 445 | ?> |
| 427 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 446 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 447 | + print $archiveupdatetime*1000; |
|
| 448 | +} else { |
|
| 449 | + print $globalMapRefresh*1000+20000; |
|
| 450 | +} |
|
| 451 | +?>+feature.properties.sqt*1000); |
|
| 428 | 452 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 429 | 453 | <?php |
| 430 | 454 | } |
@@ -472,7 +496,12 @@ discard block |
||
| 472 | 496 | <?php |
| 473 | 497 | } else { |
| 474 | 498 | ?> |
| 475 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 499 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 500 | + print $archiveupdatetime*1000; |
|
| 501 | +} else { |
|
| 502 | + print $globalMapRefresh*1000+20000; |
|
| 503 | +} |
|
| 504 | +?>+feature.properties.sqt*1000); |
|
| 476 | 505 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 477 | 506 | <?php |
| 478 | 507 | } |
@@ -975,7 +1004,12 @@ discard block |
||
| 975 | 1004 | update_archiveLayer(0); |
| 976 | 1005 | } else { |
| 977 | 1006 | //then load it again every 30 seconds |
| 978 | - reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 1007 | + reloadPage = setInterval(function(){if (noTimeout) getLiveData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 1008 | + print $globalMapRefresh*1000; |
|
| 1009 | +} else { |
|
| 1010 | + print '30000'; |
|
| 1011 | +} |
|
| 1012 | +?>); |
|
| 979 | 1013 | var currentdate = new Date(); |
| 980 | 1014 | var currentyear = new Date().getFullYear(); |
| 981 | 1015 | var begindate = new Date(Date.UTC(currentyear,11,24,2,0,0,0)); |
@@ -987,7 +1021,12 @@ discard block |
||
| 987 | 1021 | if (!((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) && (isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
| 988 | 1022 | ?> |
| 989 | 1023 | update_polarLayer(); |
| 990 | - setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1024 | + setInterval(function(){map.removeLayer(polarLayer);update_polarLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1025 | + print $globalMapRefresh*1000*2; |
|
| 1026 | +} else { |
|
| 1027 | + print '60000'; |
|
| 1028 | +} |
|
| 1029 | +?>); |
|
| 991 | 1030 | <?php |
| 992 | 1031 | } |
| 993 | 1032 | ?> |
@@ -1000,7 +1039,12 @@ discard block |
||
| 1000 | 1039 | if ((isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM)) { |
| 1001 | 1040 | ?> |
| 1002 | 1041 | update_atcLayer(); |
| 1003 | - setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
| 1042 | + setInterval(function(){map.removeLayer(atcLayer);update_atcLayer()},<?php if (isset($globalMapRefresh)) { |
|
| 1043 | + print $globalMapRefresh*1000*2; |
|
| 1044 | +} else { |
|
| 1045 | + print '60000'; |
|
| 1046 | +} |
|
| 1047 | +?>); |
|
| 1004 | 1048 | <?php |
| 1005 | 1049 | } |
| 1006 | 1050 | ?> |
@@ -5,10 +5,15 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 10 | 13 | $archive = false; |
| 11 | -if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') $archive = true; |
|
| 14 | +if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
| 15 | + $archive = true; |
|
| 16 | +} |
|
| 12 | 17 | ?> |
| 13 | 18 | |
| 14 | 19 | |
@@ -166,9 +171,13 @@ discard block |
||
| 166 | 171 | if (callsign != ""){ markerTrackerLabel += callsign; } |
| 167 | 172 | if (type != ""){ markerTrackerLabel += ' - '+type; } |
| 168 | 173 | <?php |
| 169 | - if (isset($_COOKIE['TrackerIconColor'])) $IconColor = $_COOKIE['TrackerIconColor']; |
|
| 170 | - elseif (isset($globalTrackerIconColor)) $IconColor = $globalTrackerIconColor; |
|
| 171 | - else $IconColor = '1a3151'; |
|
| 174 | + if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 175 | + $IconColor = $_COOKIE['TrackerIconColor']; |
|
| 176 | + } elseif (isset($globalTrackerIconColor)) { |
|
| 177 | + $IconColor = $globalTrackerIconColor; |
|
| 178 | + } else { |
|
| 179 | + $IconColor = '1a3151'; |
|
| 180 | + } |
|
| 172 | 181 | if (!isset($ident) && !isset($famtrackid)) { |
| 173 | 182 | ?> |
| 174 | 183 | //info_tracker_update(feature.properties.fc); |
@@ -202,7 +211,12 @@ discard block |
||
| 202 | 211 | <?php |
| 203 | 212 | } else { |
| 204 | 213 | ?> |
| 205 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 214 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 215 | + print $archiveupdatetime*1000; |
|
| 216 | +} else { |
|
| 217 | + print $globalMapRefresh*1000+20000; |
|
| 218 | +} |
|
| 219 | +?>+feature.properties.sqt*1000); |
|
| 206 | 220 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 207 | 221 | <?php |
| 208 | 222 | } |
@@ -259,7 +273,12 @@ discard block |
||
| 259 | 273 | <?php |
| 260 | 274 | } else { |
| 261 | 275 | ?> |
| 262 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 276 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 277 | + print $archiveupdatetime*1000; |
|
| 278 | +} else { |
|
| 279 | + print $globalMapRefresh*1000+20000; |
|
| 280 | +} |
|
| 281 | +?>+feature.properties.sqt*1000); |
|
| 263 | 282 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 264 | 283 | <?php |
| 265 | 284 | } |
@@ -315,7 +334,12 @@ discard block |
||
| 315 | 334 | <?php |
| 316 | 335 | } else { |
| 317 | 336 | ?> |
| 318 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 337 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 338 | + print $archiveupdatetime*1000; |
|
| 339 | +} else { |
|
| 340 | + print $globalMapRefresh*1000+20000; |
|
| 341 | +} |
|
| 342 | +?>+feature.properties.sqt*1000); |
|
| 319 | 343 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 320 | 344 | <?php |
| 321 | 345 | } |
@@ -762,7 +786,12 @@ discard block |
||
| 762 | 786 | getLiveTrackerData(0); |
| 763 | 787 | //then load it again every 30 seconds |
| 764 | 788 | reloadTrackerPage = setInterval( |
| 765 | - function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 789 | + function(){if (noTimeout) getLiveTrackerData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 790 | + print $globalMapRefresh*1000; |
|
| 791 | +} else { |
|
| 792 | + print '30000'; |
|
| 793 | +} |
|
| 794 | +?>); |
|
| 766 | 795 | <?php |
| 767 | 796 | } |
| 768 | 797 | ?> |
@@ -5,11 +5,18 @@ discard block |
||
| 5 | 5 | setcookie("MapFormat",'2d'); |
| 6 | 6 | |
| 7 | 7 | // Compressed GeoJson is used if true |
| 8 | -if (!isset($globalJsonCompress)) $compress = true; |
|
| 9 | -else $compress = $globalJsonCompress; |
|
| 10 | -if (isset($_COOKIE['MarineIconColor'])) $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
| 11 | -elseif (isset($globalMarineIconColor)) $MarineIconColor = $globalMarineIconColor; |
|
| 12 | -else $MarineIconColor = '1a3151'; |
|
| 8 | +if (!isset($globalJsonCompress)) { |
|
| 9 | + $compress = true; |
|
| 10 | +} else { |
|
| 11 | + $compress = $globalJsonCompress; |
|
| 12 | +} |
|
| 13 | +if (isset($_COOKIE['MarineIconColor'])) { |
|
| 14 | + $MarineIconColor = $_COOKIE['MarineIconColor']; |
|
| 15 | +} elseif (isset($globalMarineIconColor)) { |
|
| 16 | + $MarineIconColor = $globalMarineIconColor; |
|
| 17 | +} else { |
|
| 18 | + $MarineIconColor = '1a3151'; |
|
| 19 | +} |
|
| 13 | 20 | |
| 14 | 21 | ?> |
| 15 | 22 | |
@@ -175,7 +182,12 @@ discard block |
||
| 175 | 182 | <?php |
| 176 | 183 | } else { |
| 177 | 184 | ?> |
| 178 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 185 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 186 | + print $archiveupdatetime*1000; |
|
| 187 | +} else { |
|
| 188 | + print $globalMapRefresh*1000+20000; |
|
| 189 | +} |
|
| 190 | +?>+feature.properties.sqt*1000); |
|
| 179 | 191 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 180 | 192 | <?php |
| 181 | 193 | } |
@@ -232,7 +244,12 @@ discard block |
||
| 232 | 244 | <?php |
| 233 | 245 | } else { |
| 234 | 246 | ?> |
| 235 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 247 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 248 | + print $archiveupdatetime*1000; |
|
| 249 | +} else { |
|
| 250 | + print $globalMapRefresh*1000+20000; |
|
| 251 | +} |
|
| 252 | +?>+feature.properties.sqt*1000); |
|
| 236 | 253 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 237 | 254 | <?php |
| 238 | 255 | } |
@@ -288,7 +305,12 @@ discard block |
||
| 288 | 305 | <?php |
| 289 | 306 | } else { |
| 290 | 307 | ?> |
| 291 | - var movingtime = Math.round(<?php if (isset($archiveupdatetime)) print $archiveupdatetime*1000; else print $globalMapRefresh*1000+20000; ?>+feature.properties.sqt*1000); |
|
| 308 | + var movingtime = Math.round(<?php if (isset($archiveupdatetime)) { |
|
| 309 | + print $archiveupdatetime*1000; |
|
| 310 | +} else { |
|
| 311 | + print $globalMapRefresh*1000+20000; |
|
| 312 | +} |
|
| 313 | +?>+feature.properties.sqt*1000); |
|
| 292 | 314 | return new L.Marker.movingMarker([latLng, feature.properties.nextlatlon],[movingtime],{ |
| 293 | 315 | <?php |
| 294 | 316 | } |
@@ -696,7 +718,12 @@ discard block |
||
| 696 | 718 | } else { |
| 697 | 719 | //then load it again every 30 seconds |
| 698 | 720 | reloadMarinePage = setInterval( |
| 699 | - function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000; else print '30000'; ?>); |
|
| 721 | + function(){if (noTimeout) getLiveMarineData(0)},<?php if (isset($globalMapRefresh)) { |
|
| 722 | + print $globalMapRefresh*1000; |
|
| 723 | +} else { |
|
| 724 | + print '30000'; |
|
| 725 | +} |
|
| 726 | +?>); |
|
| 700 | 727 | } |
| 701 | 728 | |
| 702 | 729 | function MarineiconColor(color) { |