@@ -179,6 +179,9 @@ |
||
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | + /** |
|
| 183 | + * @param string $type |
|
| 184 | + */ |
|
| 182 | 185 | public function deleteLocationByType($type) { |
| 183 | 186 | $query = "DELETE FROM source_location WHERE type = :type"; |
| 184 | 187 | $query_values = array(':type' => $type); |
@@ -18,7 +18,9 @@ discard block |
||
| 18 | 18 | public function __construct($dbc = null) { |
| 19 | 19 | $Connection = new Connection($dbc); |
| 20 | 20 | $this->db = $Connection->db; |
| 21 | - if ($this->db === null) die('Error: No DB connection. (Source)'); |
|
| 21 | + if ($this->db === null) { |
|
| 22 | + die('Error: No DB connection. (Source)'); |
|
| 23 | + } |
|
| 22 | 24 | } |
| 23 | 25 | |
| 24 | 26 | public function getAllLocationInfo() { |
@@ -83,7 +85,9 @@ discard block |
||
| 83 | 85 | $query .= " AND source_location.latitude BETWEEN ".$minlat." AND ".$maxlat." AND source_location.longitude BETWEEN ".$minlong." AND ".$maxlong." AND source_location.latitude <> 0 AND source_location.longitude <> 0"; |
| 84 | 86 | } |
| 85 | 87 | $query .= " ORDER BY last_seen DESC"; |
| 86 | - if ($limit) $query .= " LIMIT 600"; |
|
| 88 | + if ($limit) { |
|
| 89 | + $query .= " LIMIT 600"; |
|
| 90 | + } |
|
| 87 | 91 | $query_values = array(':type' => $type); |
| 88 | 92 | try { |
| 89 | 93 | $sth = $this->db->prepare($query); |
@@ -122,7 +126,9 @@ discard block |
||
| 122 | 126 | } |
| 123 | 127 | |
| 124 | 128 | public function addLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '', $description = '') { |
| 125 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 129 | + if ($last_seen == '') { |
|
| 130 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 131 | + } |
|
| 126 | 132 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
| 127 | 133 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 128 | 134 | try { |
@@ -134,7 +140,9 @@ discard block |
||
| 134 | 140 | } |
| 135 | 141 | |
| 136 | 142 | public function updateLocation($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0,$location_id = 0,$last_seen = '',$description = '') { |
| 137 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 143 | + if ($last_seen == '') { |
|
| 144 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 145 | + } |
|
| 138 | 146 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, source_id = :source_id, last_seen = :last_seen,location_id = :location_id, description = :description WHERE name = :name AND source = :source"; |
| 139 | 147 | $query_values = array(':name' => $name,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':source_id' => $source_id,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 140 | 148 | try { |
@@ -157,7 +165,9 @@ discard block |
||
| 157 | 165 | } |
| 158 | 166 | |
| 159 | 167 | public function updateLocationByLocationID($name,$latitude,$longitude,$altitude,$city,$country,$source,$logo = 'antenna.png',$type = '',$source_id = 0, $location_id,$last_seen = '',$description = '') { |
| 160 | - if ($last_seen == '') $last_seen = date('Y-m-d H:i:s'); |
|
| 168 | + if ($last_seen == '') { |
|
| 169 | + $last_seen = date('Y-m-d H:i:s'); |
|
| 170 | + } |
|
| 161 | 171 | $query = "UPDATE source_location SET latitude = :latitude,longitude = :longitude,altitude = :altitude,country = :country,city = :city,logo = :logo,type = :type, last_seen = :last_seen, description = :description WHERE location_id = :location_id AND source = :source AND source_id = :source_id"; |
| 162 | 172 | $query_values = array(':source_id' => $source_id,':latitude' => $latitude, ':longitude' => $longitude,':altitude' => $altitude,':city' => $city,':country' => $country,':logo' => $logo,':source' => $source,':type' => $type,':last_seen' => $last_seen,':location_id' => $location_id,':description' => $description); |
| 163 | 173 | try { |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $ch = curl_init(); |
| 17 | 17 | curl_setopt($ch, CURLOPT_URL, $url); |
| 18 | 18 | if (isset($globalForceIPv4) && $globalForceIPv4) { |
| 19 | - if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')){ |
|
| 19 | + if (defined('CURLOPT_IPRESOLVE') && defined('CURL_IPRESOLVE_V4')) { |
|
| 20 | 20 | curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -34,20 +34,20 @@ discard block |
||
| 34 | 34 | fclose($fp); |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - public static function gunzip($in_file,$out_file_name = '') { |
|
| 37 | + public static function gunzip($in_file, $out_file_name = '') { |
|
| 38 | 38 | //echo $in_file.' -> '.$out_file_name."\n"; |
| 39 | 39 | $buffer_size = 4096; // read 4kb at a time |
| 40 | 40 | if ($out_file_name == '') $out_file_name = str_replace('.gz', '', $in_file); |
| 41 | 41 | if ($in_file != '' && file_exists($in_file)) { |
| 42 | 42 | // 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'); |
|
| 43 | + if (function_exists('gzopen')) $file = gzopen($in_file, 'rb'); |
|
| 44 | + elseif (function_exists('gzopen64')) $file = gzopen64($in_file, 'rb'); |
|
| 45 | 45 | else { |
| 46 | 46 | echo 'gzopen not available'; |
| 47 | 47 | die; |
| 48 | 48 | } |
| 49 | 49 | $out_file = fopen($out_file_name, 'wb'); |
| 50 | - while(!gzeof($file)) { |
|
| 50 | + while (!gzeof($file)) { |
|
| 51 | 51 | fwrite($out_file, gzread($file, $buffer_size)); |
| 52 | 52 | } |
| 53 | 53 | fclose($out_file); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | try { |
| 72 | 72 | self::$db_sqlite = new PDO('sqlite:'.$database); |
| 73 | 73 | self::$db_sqlite->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
| 74 | - } catch(PDOException $e) { |
|
| 74 | + } catch (PDOException $e) { |
|
| 75 | 75 | return "error : ".$e->getMessage(); |
| 76 | 76 | } |
| 77 | 77 | } |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | //$Connection = new Connection(); |
| 87 | 87 | $sth = $Connection->db->prepare($query); |
| 88 | 88 | $sth->execute(array(':source' => $database_file)); |
| 89 | - } catch(PDOException $e) { |
|
| 89 | + } catch (PDOException $e) { |
|
| 90 | 90 | return "error : ".$e->getMessage(); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | try { |
| 98 | 98 | $sth = update_db::$db_sqlite->prepare($query); |
| 99 | 99 | $sth->execute(); |
| 100 | - } catch(PDOException $e) { |
|
| 100 | + } catch (PDOException $e) { |
|
| 101 | 101 | return "error : ".$e->getMessage(); |
| 102 | 102 | } |
| 103 | 103 | //$query_dest = 'INSERT INTO routes (`RouteID`,`CallSign`,`Operator_ICAO`,`FromAirport_ICAO`,`ToAirport_ICAO`,`RouteStop`,`Source`) VALUES (:RouteID, :CallSign, :Operator_ICAO, :FromAirport_ICAO, :ToAirport_ICAO, :routestop, :source)'; |
@@ -108,11 +108,11 @@ discard block |
||
| 108 | 108 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 109 | 109 | while ($values = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 110 | 110 | //$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 | - $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); |
|
| 111 | + $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 | 112 | $sth_dest->execute($query_dest_values); |
| 113 | 113 | } |
| 114 | 114 | if ($globalTransaction) $Connection->db->commit(); |
| 115 | - } catch(PDOException $e) { |
|
| 115 | + } catch (PDOException $e) { |
|
| 116 | 116 | if ($globalTransaction) $Connection->db->rollBack(); |
| 117 | 117 | return "error : ".$e->getMessage(); |
| 118 | 118 | } |
@@ -128,26 +128,26 @@ discard block |
||
| 128 | 128 | //$Connection = new Connection(); |
| 129 | 129 | $sth = $Connection->db->prepare($query); |
| 130 | 130 | $sth->execute(array(':source' => 'oneworld')); |
| 131 | - } catch(PDOException $e) { |
|
| 131 | + } catch (PDOException $e) { |
|
| 132 | 132 | return "error : ".$e->getMessage(); |
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | if ($globalDebug) echo " - Add routes to DB -"; |
| 136 | 136 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 137 | 137 | $Spotter = new Spotter(); |
| 138 | - if ($fh = fopen($database_file,"r")) { |
|
| 138 | + if ($fh = fopen($database_file, "r")) { |
|
| 139 | 139 | $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 | 140 | $Connection = new Connection(); |
| 141 | 141 | $sth_dest = $Connection->db->prepare($query_dest); |
| 142 | 142 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 143 | 143 | while (!feof($fh)) { |
| 144 | - $line = fgetcsv($fh,9999,','); |
|
| 144 | + $line = fgetcsv($fh, 9999, ','); |
|
| 145 | 145 | if ($line[0] != '') { |
| 146 | 146 | if (($line[2] == '-' || ($line[2] != '-' && (strtotime($line[2]) > time()))) && ($line[3] == '-' || ($line[3] != '-' && (strtotime($line[3]) < time())))) { |
| 147 | 147 | try { |
| 148 | - $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'); |
|
| 148 | + $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 | 149 | $sth_dest->execute($query_dest_values); |
| 150 | - } catch(PDOException $e) { |
|
| 150 | + } catch (PDOException $e) { |
|
| 151 | 151 | if ($globalTransaction) $Connection->db->rollBack(); |
| 152 | 152 | return "error : ".$e->getMessage(); |
| 153 | 153 | } |
@@ -169,7 +169,7 @@ discard block |
||
| 169 | 169 | //$Connection = new Connection(); |
| 170 | 170 | $sth = $Connection->db->prepare($query); |
| 171 | 171 | $sth->execute(array(':source' => 'skyteam')); |
| 172 | - } catch(PDOException $e) { |
|
| 172 | + } catch (PDOException $e) { |
|
| 173 | 173 | return "error : ".$e->getMessage(); |
| 174 | 174 | } |
| 175 | 175 | |
@@ -177,24 +177,24 @@ discard block |
||
| 177 | 177 | |
| 178 | 178 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 179 | 179 | $Spotter = new Spotter(); |
| 180 | - if ($fh = fopen($database_file,"r")) { |
|
| 180 | + if ($fh = fopen($database_file, "r")) { |
|
| 181 | 181 | $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)'; |
| 182 | 182 | $Connection = new Connection(); |
| 183 | 183 | $sth_dest = $Connection->db->prepare($query_dest); |
| 184 | 184 | try { |
| 185 | 185 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 186 | 186 | while (!feof($fh)) { |
| 187 | - $line = fgetcsv($fh,9999,','); |
|
| 187 | + $line = fgetcsv($fh, 9999, ','); |
|
| 188 | 188 | if ($line[0] != '') { |
| 189 | - $datebe = explode(' - ',$line[2]); |
|
| 189 | + $datebe = explode(' - ', $line[2]); |
|
| 190 | 190 | if (strtotime($datebe[0]) > time() && strtotime($datebe[1]) < time()) { |
| 191 | - $query_dest_values = array(':CallSign' => str_replace('*','',$line[6]),':Operator_ICAO' => '',':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]),':FromAirport_Time' => $line[4],':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]),':ToAirport_Time' => $line[5],':routestop' => '',':source' => 'skyteam'); |
|
| 191 | + $query_dest_values = array(':CallSign' => str_replace('*', '', $line[6]), ':Operator_ICAO' => '', ':FromAirport_ICAO' => $Spotter->getAirportICAO($line[0]), ':FromAirport_Time' => $line[4], ':ToAirport_ICAO' => $Spotter->getAirportICAO($line[1]), ':ToAirport_Time' => $line[5], ':routestop' => '', ':source' => 'skyteam'); |
|
| 192 | 192 | $sth_dest->execute($query_dest_values); |
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
| 196 | 196 | if ($globalTransaction) $Connection->db->commit(); |
| 197 | - } catch(PDOException $e) { |
|
| 197 | + } catch (PDOException $e) { |
|
| 198 | 198 | if ($globalTransaction) $Connection->db->rollBack(); |
| 199 | 199 | return "error : ".$e->getMessage(); |
| 200 | 200 | } |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | $Connection = new Connection(); |
| 210 | 210 | $sth = $Connection->db->prepare($query); |
| 211 | 211 | $sth->execute(array(':source' => $database_file)); |
| 212 | - } catch(PDOException $e) { |
|
| 212 | + } catch (PDOException $e) { |
|
| 213 | 213 | return "error : ".$e->getMessage(); |
| 214 | 214 | } |
| 215 | 215 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source"; |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | $Connection = new Connection(); |
| 218 | 218 | $sth = $Connection->db->prepare($query); |
| 219 | 219 | $sth->execute(array(':source' => $database_file)); |
| 220 | - } catch(PDOException $e) { |
|
| 220 | + } catch (PDOException $e) { |
|
| 221 | 221 | return "error : ".$e->getMessage(); |
| 222 | 222 | } |
| 223 | 223 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | try { |
| 227 | 227 | $sth = update_db::$db_sqlite->prepare($query); |
| 228 | 228 | $sth->execute(); |
| 229 | - } catch(PDOException $e) { |
|
| 229 | + } catch (PDOException $e) { |
|
| 230 | 230 | return "error : ".$e->getMessage(); |
| 231 | 231 | } |
| 232 | 232 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
@@ -243,15 +243,15 @@ discard block |
||
| 243 | 243 | //$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 | 244 | if ($values['UserString4'] == 'M') $type = 'military'; |
| 245 | 245 | else $type = null; |
| 246 | - $query_dest_values = array(':LastModified' => $values['LastModified'],':ModeS' => $values['ModeS'],':ModeSCountry' => $values['ModeSCountry'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':type' => $type); |
|
| 246 | + $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 | 247 | $sth_dest->execute($query_dest_values); |
| 248 | 248 | if ($values['RegisteredOwners'] != '' && $values['RegisteredOwners'] != NULL && $values['RegisteredOwners'] != 'Private') { |
| 249 | - $query_dest_owner_values = array(':registration' => $values['Registration'],':source' => $database_file,':owner' => $values['RegisteredOwners']); |
|
| 249 | + $query_dest_owner_values = array(':registration' => $values['Registration'], ':source' => $database_file, ':owner' => $values['RegisteredOwners']); |
|
| 250 | 250 | $sth_dest_owner->execute($query_dest_owner_values); |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | 253 | if ($globalTransaction) $Connection->db->commit(); |
| 254 | - } catch(PDOException $e) { |
|
| 254 | + } catch (PDOException $e) { |
|
| 255 | 255 | return "error : ".$e->getMessage(); |
| 256 | 256 | } |
| 257 | 257 | |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | $Connection = new Connection(); |
| 262 | 262 | $sth = $Connection->db->prepare($query); |
| 263 | 263 | $sth->execute(array(':source' => $database_file)); |
| 264 | - } catch(PDOException $e) { |
|
| 264 | + } catch (PDOException $e) { |
|
| 265 | 265 | return "error : ".$e->getMessage(); |
| 266 | 266 | } |
| 267 | 267 | return ''; |
@@ -276,11 +276,11 @@ discard block |
||
| 276 | 276 | $Connection = new Connection(); |
| 277 | 277 | $sth = $Connection->db->prepare($query); |
| 278 | 278 | $sth->execute(array(':source' => $database_file)); |
| 279 | - } catch(PDOException $e) { |
|
| 279 | + } catch (PDOException $e) { |
|
| 280 | 280 | return "error : ".$e->getMessage(); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - if ($fh = fopen($database_file,"r")) { |
|
| 283 | + if ($fh = fopen($database_file, "r")) { |
|
| 284 | 284 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 285 | 285 | $query_dest = 'INSERT INTO aircraft_modes (ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 286 | 286 | |
@@ -290,13 +290,13 @@ discard block |
||
| 290 | 290 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 291 | 291 | while (!feof($fh)) { |
| 292 | 292 | $values = array(); |
| 293 | - $line = $Common->hex2str(fgets($fh,9999)); |
|
| 293 | + $line = $Common->hex2str(fgets($fh, 9999)); |
|
| 294 | 294 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 295 | - $values['ModeS'] = substr($line,0,6); |
|
| 296 | - $values['Registration'] = trim(substr($line,69,6)); |
|
| 297 | - $aircraft_name = trim(substr($line,48,6)); |
|
| 295 | + $values['ModeS'] = substr($line, 0, 6); |
|
| 296 | + $values['Registration'] = trim(substr($line, 69, 6)); |
|
| 297 | + $aircraft_name = trim(substr($line, 48, 6)); |
|
| 298 | 298 | // Check if we can find ICAO, else set it to GLID |
| 299 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 299 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 300 | 300 | $search_more = ''; |
| 301 | 301 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 302 | 302 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | if (isset($result['icao']) && $result['icao'] != '') { |
| 309 | 309 | $values['ICAOTypeCode'] = $result['icao']; |
| 310 | 310 | } |
| 311 | - } catch(PDOException $e) { |
|
| 311 | + } catch (PDOException $e) { |
|
| 312 | 312 | return "error : ".$e->getMessage(); |
| 313 | 313 | } |
| 314 | 314 | if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 315 | 315 | // Add data to db |
| 316 | 316 | if ($values['Registration'] != '' && $values['Registration'] != '0000') { |
| 317 | 317 | //$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']); |
| 318 | - $query_dest_values = array(':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 318 | + $query_dest_values = array(':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 319 | 319 | //print_r($query_dest_values); |
| 320 | 320 | $sth_dest->execute($query_dest_values); |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | 323 | if ($globalTransaction) $Connection->db->commit(); |
| 324 | - } catch(PDOException $e) { |
|
| 324 | + } catch (PDOException $e) { |
|
| 325 | 325 | return "error : ".$e->getMessage(); |
| 326 | 326 | } |
| 327 | 327 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $Connection = new Connection(); |
| 332 | 332 | $sth = $Connection->db->prepare($query); |
| 333 | 333 | $sth->execute(array(':source' => $database_file)); |
| 334 | - } catch(PDOException $e) { |
|
| 334 | + } catch (PDOException $e) { |
|
| 335 | 335 | return "error : ".$e->getMessage(); |
| 336 | 336 | } |
| 337 | 337 | return ''; |
@@ -345,11 +345,11 @@ discard block |
||
| 345 | 345 | $Connection = new Connection(); |
| 346 | 346 | $sth = $Connection->db->prepare($query); |
| 347 | 347 | $sth->execute(array(':source' => $database_file)); |
| 348 | - } catch(PDOException $e) { |
|
| 348 | + } catch (PDOException $e) { |
|
| 349 | 349 | return "error : ".$e->getMessage(); |
| 350 | 350 | } |
| 351 | 351 | |
| 352 | - if ($fh = fopen($database_file,"r")) { |
|
| 352 | + if ($fh = fopen($database_file, "r")) { |
|
| 353 | 353 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 354 | 354 | $query_dest = 'INSERT INTO aircraft_modes (LastModified,ModeS,Registration,ICAOTypeCode,Source,source_type) VALUES (:lastmodified,:ModeS,:Registration,:ICAOTypeCode,:source,:source_type)'; |
| 355 | 355 | |
@@ -357,9 +357,9 @@ discard block |
||
| 357 | 357 | $sth_dest = $Connection->db->prepare($query_dest); |
| 358 | 358 | try { |
| 359 | 359 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 360 | - $tmp = fgetcsv($fh,9999,',',"'"); |
|
| 360 | + $tmp = fgetcsv($fh, 9999, ',', "'"); |
|
| 361 | 361 | while (!feof($fh)) { |
| 362 | - $line = fgetcsv($fh,9999,',',"'"); |
|
| 362 | + $line = fgetcsv($fh, 9999, ',', "'"); |
|
| 363 | 363 | |
| 364 | 364 | //FFFFFF RIDEAU VALLEY SOARINGASW-20 C-FBKN MZ 123.400 |
| 365 | 365 | //print_r($line); |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | $values['ICAOTypeCode'] = ''; |
| 369 | 369 | $aircraft_name = $line[2]; |
| 370 | 370 | // Check if we can find ICAO, else set it to GLID |
| 371 | - $aircraft_name_split = explode(' ',$aircraft_name); |
|
| 371 | + $aircraft_name_split = explode(' ', $aircraft_name); |
|
| 372 | 372 | $search_more = ''; |
| 373 | 373 | if (count($aircraft_name) > 1 && strlen($aircraft_name_split[1]) > 3) $search_more .= " AND LIKE '%".$aircraft_name_split[0]."%'"; |
| 374 | 374 | $query_search = "SELECT * FROM aircraft WHERE type LIKE '%".$aircraft_name."%'".$search_more; |
@@ -377,20 +377,20 @@ discard block |
||
| 377 | 377 | $sth_search->execute(); |
| 378 | 378 | $result = $sth_search->fetch(PDO::FETCH_ASSOC); |
| 379 | 379 | if (isset($result['icao']) && $result['icao'] != '') $values['ICAOTypeCode'] = $result['icao']; |
| 380 | - } catch(PDOException $e) { |
|
| 380 | + } catch (PDOException $e) { |
|
| 381 | 381 | return "error : ".$e->getMessage(); |
| 382 | 382 | } |
| 383 | 383 | //if (!isset($values['ICAOTypeCode'])) $values['ICAOTypeCode'] = 'GLID'; |
| 384 | 384 | // Add data to db |
| 385 | 385 | if ($values['Registration'] != '' && $values['Registration'] != '0000' && $values['ICAOTypeCode'] != '') { |
| 386 | 386 | //$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']); |
| 387 | - $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'),':ModeS' => $values['ModeS'],':Registration' => $values['Registration'],':ICAOTypeCode' => $values['ICAOTypeCode'],':source' => $database_file,':source_type' => 'flarm'); |
|
| 387 | + $query_dest_values = array(':lastmodified' => date('Y-m-d H:m:s'), ':ModeS' => $values['ModeS'], ':Registration' => $values['Registration'], ':ICAOTypeCode' => $values['ICAOTypeCode'], ':source' => $database_file, ':source_type' => 'flarm'); |
|
| 388 | 388 | //print_r($query_dest_values); |
| 389 | 389 | $sth_dest->execute($query_dest_values); |
| 390 | 390 | } |
| 391 | 391 | } |
| 392 | 392 | if ($globalTransaction) $Connection->db->commit(); |
| 393 | - } catch(PDOException $e) { |
|
| 393 | + } catch (PDOException $e) { |
|
| 394 | 394 | return "error : ".$e->getMessage(); |
| 395 | 395 | } |
| 396 | 396 | } |
@@ -400,13 +400,13 @@ discard block |
||
| 400 | 400 | $Connection = new Connection(); |
| 401 | 401 | $sth = $Connection->db->prepare($query); |
| 402 | 402 | $sth->execute(array(':source' => $database_file)); |
| 403 | - } catch(PDOException $e) { |
|
| 403 | + } catch (PDOException $e) { |
|
| 404 | 404 | return "error : ".$e->getMessage(); |
| 405 | 405 | } |
| 406 | 406 | return ''; |
| 407 | 407 | } |
| 408 | 408 | |
| 409 | - public static function retrieve_owner($database_file,$country = 'F') { |
|
| 409 | + public static function retrieve_owner($database_file, $country = 'F') { |
|
| 410 | 410 | global $globalTransaction, $globalMasterSource; |
| 411 | 411 | //$query = 'TRUNCATE TABLE aircraft_modes'; |
| 412 | 412 | $query = "DELETE FROM aircraft_owner WHERE Source = '' OR Source IS NULL OR Source = :source; DELETE FROM aircraft_modes WHERE Source = :source;"; |
@@ -414,12 +414,12 @@ discard block |
||
| 414 | 414 | $Connection = new Connection(); |
| 415 | 415 | $sth = $Connection->db->prepare($query); |
| 416 | 416 | $sth->execute(array(':source' => $database_file)); |
| 417 | - } catch(PDOException $e) { |
|
| 417 | + } catch (PDOException $e) { |
|
| 418 | 418 | return "error : ".$e->getMessage(); |
| 419 | 419 | } |
| 420 | 420 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 421 | 421 | $Spotter = new Spotter(); |
| 422 | - if ($fh = fopen($database_file,"r")) { |
|
| 422 | + if ($fh = fopen($database_file, "r")) { |
|
| 423 | 423 | //$query_dest = 'INSERT INTO aircraft_modes (`AircraftID`,`FirstCreated`,`LastModified`, `ModeS`,`ModeSCountry`,`Registration`,`ICAOTypeCode`,`SerialNo`, `OperatorFlagCode`, `Manufacturer`, `Type`, `FirstRegDate`, `CurrentRegDate`, `Country`, `PreviousID`, `DeRegDate`, `Status`, `PopularName`,`GenericName`,`AircraftClass`, `Engines`, `OwnershipStatus`,`RegisteredOwners`,`MTOW`, `TotalHours`, `YearBuilt`, `CofACategory`, `CofAExpiry`, `UserNotes`, `Interested`, `UserTag`, `InfoUrl`, `PictureUrl1`, `PictureUrl2`, `PictureUrl3`, `UserBool1`, `UserBool2`, `UserBool3`, `UserBool4`, `UserBool5`, `UserString1`, `UserString2`, `UserString3`, `UserString4`, `UserString5`, `UserInt1`, `UserInt2`, `UserInt3`, `UserInt4`, `UserInt5`) VALUES (:AircraftID,:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:SerialNo, :OperatorFlagCode, :Manufacturer, :Type, :FirstRegDate, :CurrentRegDate, :Country, :PreviousID, :DeRegDate, :Status, :PopularName,:GenericName,:AircraftClass, :Engines, :OwnershipStatus,:RegisteredOwners,:MTOW, :TotalHours,:YearBuilt, :CofACategory, :CofAExpiry, :UserNotes, :Interested, :UserTag, :InfoUrl, :PictureUrl1, :PictureUrl2, :PictureUrl3, :UserBool1, :UserBool2, :UserBool3, :UserBool4, :UserBool5, :UserString1, :UserString2, :UserString3, :UserString4, :UserString5, :UserInt1, :UserInt2, :UserInt3, :UserInt4, :UserInt5)'; |
| 424 | 424 | $query_dest = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 425 | 425 | $query_modes = 'INSERT INTO aircraft_modes (ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:modes,:modescountry,:registration,:icaotypecode,:source)'; |
@@ -429,9 +429,9 @@ discard block |
||
| 429 | 429 | $sth_modes = $Connection->db->prepare($query_modes); |
| 430 | 430 | try { |
| 431 | 431 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 432 | - $tmp = fgetcsv($fh,9999,',','"'); |
|
| 432 | + $tmp = fgetcsv($fh, 9999, ',', '"'); |
|
| 433 | 433 | while (!feof($fh)) { |
| 434 | - $line = fgetcsv($fh,9999,',','"'); |
|
| 434 | + $line = fgetcsv($fh, 9999, ',', '"'); |
|
| 435 | 435 | $values = array(); |
| 436 | 436 | //print_r($line); |
| 437 | 437 | if ($country == 'F') { |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | $values['base'] = $line[4]; |
| 440 | 440 | $values['owner'] = $line[5]; |
| 441 | 441 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 442 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 442 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 443 | 443 | $values['cancel'] = $line[7]; |
| 444 | 444 | } elseif ($country == 'EI') { |
| 445 | 445 | // TODO : add modeS & reg to aircraft_modes |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | $values['base'] = $line[3]; |
| 448 | 448 | $values['owner'] = $line[2]; |
| 449 | 449 | if ($line[1] == '') $values['date_first_reg'] = null; |
| 450 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[1])); |
|
| 450 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[1])); |
|
| 451 | 451 | $values['cancel'] = ''; |
| 452 | 452 | $values['modes'] = $line[7]; |
| 453 | 453 | $values['icao'] = $line[8]; |
@@ -467,7 +467,7 @@ discard block |
||
| 467 | 467 | $values['base'] = null; |
| 468 | 468 | $values['owner'] = $line[5]; |
| 469 | 469 | if ($line[18] == '') $values['date_first_reg'] = null; |
| 470 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[18])); |
|
| 470 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[18])); |
|
| 471 | 471 | $values['cancel'] = ''; |
| 472 | 472 | } elseif ($country == 'VH') { |
| 473 | 473 | // TODO : add modeS & reg to aircraft_modes |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | $values['base'] = null; |
| 476 | 476 | $values['owner'] = $line[12]; |
| 477 | 477 | if ($line[28] == '') $values['date_first_reg'] = null; |
| 478 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[28])); |
|
| 478 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[28])); |
|
| 479 | 479 | |
| 480 | 480 | $values['cancel'] = $line[39]; |
| 481 | 481 | } elseif ($country == 'OE' || $country == '9A' || $country == 'VP' || $country == 'LX' || $country == 'P2' || $country == 'HC') { |
@@ -495,28 +495,28 @@ discard block |
||
| 495 | 495 | $values['base'] = null; |
| 496 | 496 | $values['owner'] = $line[8]; |
| 497 | 497 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 498 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 498 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 499 | 499 | $values['cancel'] = ''; |
| 500 | 500 | } elseif ($country == 'PP') { |
| 501 | 501 | $values['registration'] = $line[0]; |
| 502 | 502 | $values['base'] = null; |
| 503 | 503 | $values['owner'] = $line[4]; |
| 504 | 504 | if ($line[6] == '') $values['date_first_reg'] = null; |
| 505 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[6])); |
|
| 505 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[6])); |
|
| 506 | 506 | $values['cancel'] = $line[7]; |
| 507 | 507 | } elseif ($country == 'E7') { |
| 508 | 508 | $values['registration'] = $line[0]; |
| 509 | 509 | $values['base'] = null; |
| 510 | 510 | $values['owner'] = $line[4]; |
| 511 | 511 | if ($line[5] == '') $values['date_first_reg'] = null; |
| 512 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 512 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 513 | 513 | $values['cancel'] = ''; |
| 514 | 514 | } elseif ($country == '8Q') { |
| 515 | 515 | $values['registration'] = $line[0]; |
| 516 | 516 | $values['base'] = null; |
| 517 | 517 | $values['owner'] = $line[3]; |
| 518 | 518 | if ($line[7] == '') $values['date_first_reg'] = null; |
| 519 | - else $values['date_first_reg'] = date("Y-m-d",strtotime($line[7])); |
|
| 519 | + else $values['date_first_reg'] = date("Y-m-d", strtotime($line[7])); |
|
| 520 | 520 | $values['cancel'] = ''; |
| 521 | 521 | } elseif ($country == 'ZK') { |
| 522 | 522 | $values['registration'] = $line[0]; |
@@ -530,18 +530,18 @@ discard block |
||
| 530 | 530 | $values['registration'] = $line[0]; |
| 531 | 531 | $values['base'] = null; |
| 532 | 532 | $values['owner'] = $line[6]; |
| 533 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[5])); |
|
| 534 | - $values['cancel'] = date("Y-m-d",strtotime($line[8])); |
|
| 533 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[5])); |
|
| 534 | + $values['cancel'] = date("Y-m-d", strtotime($line[8])); |
|
| 535 | 535 | $values['modes'] = $line[4]; |
| 536 | 536 | $values['icao'] = $line[10]; |
| 537 | 537 | } elseif ($country == 'OY') { |
| 538 | 538 | $values['registration'] = $line[0]; |
| 539 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[4])); |
|
| 539 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[4])); |
|
| 540 | 540 | $values['modes'] = $line[5]; |
| 541 | 541 | $values['icao'] = $line[6]; |
| 542 | 542 | } elseif ($country == 'PH') { |
| 543 | 543 | $values['registration'] = $line[0]; |
| 544 | - $values['date_first_reg'] = date("Y-m-d",strtotime($line[3])); |
|
| 544 | + $values['date_first_reg'] = date("Y-m-d", strtotime($line[3])); |
|
| 545 | 545 | $values['modes'] = $line[4]; |
| 546 | 546 | $values['icao'] = $line[5]; |
| 547 | 547 | } elseif ($country == 'OM' || $country == 'TF') { |
@@ -552,17 +552,17 @@ discard block |
||
| 552 | 552 | $values['cancel'] = ''; |
| 553 | 553 | } |
| 554 | 554 | if (isset($values['cancel']) && $values['cancel'] == '' && $values['registration'] != null && isset($values['owner'])) { |
| 555 | - $query_dest_values = array(':registration' => $values['registration'],':base' => $values['base'],':date_first_reg' => $values['date_first_reg'],':owner' => $values['owner'],':source' => $database_file); |
|
| 555 | + $query_dest_values = array(':registration' => $values['registration'], ':base' => $values['base'], ':date_first_reg' => $values['date_first_reg'], ':owner' => $values['owner'], ':source' => $database_file); |
|
| 556 | 556 | $sth_dest->execute($query_dest_values); |
| 557 | 557 | } |
| 558 | 558 | if ($globalMasterSource && $values['registration'] != null && isset($values['modes']) && $values['modes'] != '') { |
| 559 | 559 | $modescountry = $Spotter->countryFromAircraftRegistration($values['registration']); |
| 560 | - $query_modes_values = array(':registration' => $values['registration'],':modes' => $values['modes'],':modescountry' => $modescountry,':icaotypecode' => $values['icao'],':source' => $database_file); |
|
| 560 | + $query_modes_values = array(':registration' => $values['registration'], ':modes' => $values['modes'], ':modescountry' => $modescountry, ':icaotypecode' => $values['icao'], ':source' => $database_file); |
|
| 561 | 561 | $sth_modes->execute($query_modes_values); |
| 562 | 562 | } |
| 563 | 563 | } |
| 564 | 564 | if ($globalTransaction) $Connection->db->commit(); |
| 565 | - } catch(PDOException $e) { |
|
| 565 | + } catch (PDOException $e) { |
|
| 566 | 566 | return "error : ".$e->getMessage(); |
| 567 | 567 | } |
| 568 | 568 | } |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 701 | 701 | |
| 702 | 702 | $i = 0; |
| 703 | - while($row = sparql_fetch_array($result)) |
|
| 703 | + while ($row = sparql_fetch_array($result)) |
|
| 704 | 704 | { |
| 705 | 705 | if ($i >= 1) { |
| 706 | 706 | //print_r($row); |
@@ -720,33 +720,33 @@ discard block |
||
| 720 | 720 | $row['image'] = ''; |
| 721 | 721 | $row['image_thumb'] = ''; |
| 722 | 722 | } else { |
| 723 | - $image = str_replace(' ','_',$row['image']); |
|
| 723 | + $image = str_replace(' ', '_', $row['image']); |
|
| 724 | 724 | $digest = md5($image); |
| 725 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image . '/220px-' . $image; |
|
| 726 | - $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/' . $folder; |
|
| 727 | - $folder = $digest[0] . '/' . $digest[0] . $digest[1] . '/' . $image; |
|
| 728 | - $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/' . $folder; |
|
| 725 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image.'/220px-'.$image; |
|
| 726 | + $row['image_thumb'] = 'http://upload.wikimedia.org/wikipedia/commons/thumb/'.$folder; |
|
| 727 | + $folder = $digest[0].'/'.$digest[0].$digest[1].'/'.$image; |
|
| 728 | + $row['image'] = 'http://upload.wikimedia.org/wikipedia/commons/'.$folder; |
|
| 729 | 729 | } |
| 730 | 730 | |
| 731 | - $country = explode('-',$row['country']); |
|
| 731 | + $country = explode('-', $row['country']); |
|
| 732 | 732 | $row['country'] = $country[0]; |
| 733 | 733 | |
| 734 | 734 | $row['type'] = trim($row['type']); |
| 735 | - if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i',$row['name'])) { |
|
| 735 | + if ($row['type'] == 'Military: Naval Auxiliary Air Station' || $row['type'] == 'http://dbpedia.org/resource/Naval_air_station' || $row['type'] == 'Military: Naval Air Station' || $row['type'] == 'Military Northern Fleet' || $row['type'] == 'Military and industrial' || $row['type'] == 'Military: Royal Air Force station' || $row['type'] == 'http://dbpedia.org/resource/Military_airbase' || $row['type'] == 'Military: Naval air station' || preg_match('/air base/i', $row['name'])) { |
|
| 736 | 736 | $row['type'] = 'military'; |
| 737 | 737 | } elseif ($row['type'] == 'http://dbpedia.org/resource/Airport' || $row['type'] == 'Civil' || $row['type'] == 'Public use' || $row['type'] == 'Public' || $row['type'] == 'http://dbpedia.org/resource/Civilian' || $row['type'] == 'Public, Civilian' || $row['type'] == 'Public / Military' || $row['type'] == 'Private & Civilian' || $row['type'] == 'Civilian and Military' || $row['type'] == 'Public/military' || $row['type'] == 'Active With Few Facilities' || $row['type'] == '?ivilian' || $row['type'] == 'Civil/Military' || $row['type'] == 'NA' || $row['type'] == 'Public/Military') { |
| 738 | 738 | $row['type'] = 'small_airport'; |
| 739 | 739 | } |
| 740 | 740 | |
| 741 | - $row['city'] = urldecode(str_replace('_',' ',str_replace('http://dbpedia.org/resource/','',$row['city']))); |
|
| 742 | - $query_dest_values = array(':name' => $row['name'],':iata' => $row['iata'],':icao' => $row['icao'],':latitude' => $row['latitude'],':longitude' => $row['longitude'],':altitude' => round($row['altitude']),':type' => $row['type'],':city' => $row['city'],':country' => $row['country'],':home_link' => $row['homepage'],':wikipedia_link' => $row['wikipedia_page'],':image' => $row['image'],':image_thumb' => $row['image_thumb']); |
|
| 741 | + $row['city'] = urldecode(str_replace('_', ' ', str_replace('http://dbpedia.org/resource/', '', $row['city']))); |
|
| 742 | + $query_dest_values = array(':name' => $row['name'], ':iata' => $row['iata'], ':icao' => $row['icao'], ':latitude' => $row['latitude'], ':longitude' => $row['longitude'], ':altitude' => round($row['altitude']), ':type' => $row['type'], ':city' => $row['city'], ':country' => $row['country'], ':home_link' => $row['homepage'], ':wikipedia_link' => $row['wikipedia_page'], ':image' => $row['image'], ':image_thumb' => $row['image_thumb']); |
|
| 743 | 743 | //print_r($query_dest_values); |
| 744 | 744 | |
| 745 | 745 | if ($row['icao'] != '') { |
| 746 | 746 | try { |
| 747 | 747 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 748 | 748 | $sth->execute(array(':icao' => $row['icao'])); |
| 749 | - } catch(PDOException $e) { |
|
| 749 | + } catch (PDOException $e) { |
|
| 750 | 750 | return "error : ".$e->getMessage(); |
| 751 | 751 | } |
| 752 | 752 | if ($sth->fetchColumn() > 0) { |
@@ -754,15 +754,15 @@ discard block |
||
| 754 | 754 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 755 | 755 | try { |
| 756 | 756 | $sth = $Connection->db->prepare($query); |
| 757 | - $sth->execute(array(':icao' => $row['icao'],':type' => $row['type'])); |
|
| 758 | - } catch(PDOException $e) { |
|
| 757 | + $sth->execute(array(':icao' => $row['icao'], ':type' => $row['type'])); |
|
| 758 | + } catch (PDOException $e) { |
|
| 759 | 759 | return "error : ".$e->getMessage(); |
| 760 | 760 | } |
| 761 | 761 | echo $row['icao'].' : '.$row['type']."\n"; |
| 762 | 762 | } else { |
| 763 | 763 | try { |
| 764 | 764 | $sth_dest->execute($query_dest_values); |
| 765 | - } catch(PDOException $e) { |
|
| 765 | + } catch (PDOException $e) { |
|
| 766 | 766 | return "error : ".$e->getMessage(); |
| 767 | 767 | } |
| 768 | 768 | } |
@@ -813,7 +813,7 @@ discard block |
||
| 813 | 813 | echo "Download data from ourairports.com...\n"; |
| 814 | 814 | $delimiter = ','; |
| 815 | 815 | $out_file = $tmp_dir.'airports.csv'; |
| 816 | - update_db::download('http://ourairports.com/data/airports.csv',$out_file); |
|
| 816 | + update_db::download('http://ourairports.com/data/airports.csv', $out_file); |
|
| 817 | 817 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 818 | 818 | echo "Add data from ourairports.com...\n"; |
| 819 | 819 | |
@@ -824,33 +824,33 @@ discard block |
||
| 824 | 824 | //$Connection->db->beginTransaction(); |
| 825 | 825 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 826 | 826 | { |
| 827 | - if(!$header) $header = $row; |
|
| 827 | + if (!$header) $header = $row; |
|
| 828 | 828 | else { |
| 829 | 829 | $data = array(); |
| 830 | 830 | $data = array_combine($header, $row); |
| 831 | 831 | try { |
| 832 | 832 | $sth = $Connection->db->prepare('SELECT COUNT(*) FROM airport WHERE icao = :icao'); |
| 833 | 833 | $sth->execute(array(':icao' => $data['ident'])); |
| 834 | - } catch(PDOException $e) { |
|
| 834 | + } catch (PDOException $e) { |
|
| 835 | 835 | return "error : ".$e->getMessage(); |
| 836 | 836 | } |
| 837 | 837 | if ($sth->fetchColumn() > 0) { |
| 838 | 838 | $query = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 839 | 839 | try { |
| 840 | 840 | $sth = $Connection->db->prepare($query); |
| 841 | - $sth->execute(array(':icao' => $data['ident'],':type' => $data['type'])); |
|
| 842 | - } catch(PDOException $e) { |
|
| 841 | + $sth->execute(array(':icao' => $data['ident'], ':type' => $data['type'])); |
|
| 842 | + } catch (PDOException $e) { |
|
| 843 | 843 | return "error : ".$e->getMessage(); |
| 844 | 844 | } |
| 845 | 845 | } else { |
| 846 | 846 | if ($data['gps_code'] == $data['ident']) { |
| 847 | 847 | $query = "INSERT INTO airport (name,city,country,iata,icao,latitude,longitude,altitude,type,home_link,wikipedia_link) |
| 848 | 848 | VALUES (:name, :city, :country, :iata, :icao, :latitude, :longitude, :altitude, :type, :home_link, :wikipedia_link)"; |
| 849 | - $query_values = array(':name' => $data['name'],':iata' => $data['iata_code'],':icao' => $data['gps_code'],':latitude' => $data['latitude_deg'],':longitude' => $data['longitude_deg'],':altitude' => round($data['elevation_ft']),':type' => $data['type'],':city' => $data['municipality'],':country' => $data['iso_country'],':home_link' => $data['home_link'],':wikipedia_link' => $data['wikipedia_link']); |
|
| 849 | + $query_values = array(':name' => $data['name'], ':iata' => $data['iata_code'], ':icao' => $data['gps_code'], ':latitude' => $data['latitude_deg'], ':longitude' => $data['longitude_deg'], ':altitude' => round($data['elevation_ft']), ':type' => $data['type'], ':city' => $data['municipality'], ':country' => $data['iso_country'], ':home_link' => $data['home_link'], ':wikipedia_link' => $data['wikipedia_link']); |
|
| 850 | 850 | try { |
| 851 | 851 | $sth = $Connection->db->prepare($query); |
| 852 | 852 | $sth->execute($query_values); |
| 853 | - } catch(PDOException $e) { |
|
| 853 | + } catch (PDOException $e) { |
|
| 854 | 854 | return "error : ".$e->getMessage(); |
| 855 | 855 | } |
| 856 | 856 | $i++; |
@@ -865,7 +865,7 @@ discard block |
||
| 865 | 865 | |
| 866 | 866 | echo "Download data from another free database...\n"; |
| 867 | 867 | $out_file = $tmp_dir.'GlobalAirportDatabase.zip'; |
| 868 | - update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip',$out_file); |
|
| 868 | + update_db::download('http://www.partow.net/downloads/GlobalAirportDatabase.zip', $out_file); |
|
| 869 | 869 | if (!file_exists($out_file) || !is_readable($out_file)) return FALSE; |
| 870 | 870 | update_db::unzip($out_file); |
| 871 | 871 | $header = NULL; |
@@ -877,15 +877,15 @@ discard block |
||
| 877 | 877 | //$Connection->db->beginTransaction(); |
| 878 | 878 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 879 | 879 | { |
| 880 | - if(!$header) $header = $row; |
|
| 880 | + if (!$header) $header = $row; |
|
| 881 | 881 | else { |
| 882 | 882 | $data = $row; |
| 883 | 883 | |
| 884 | 884 | $query = 'UPDATE airport SET city = :city, country = :country WHERE icao = :icao'; |
| 885 | 885 | try { |
| 886 | 886 | $sth = $Connection->db->prepare($query); |
| 887 | - $sth->execute(array(':icao' => $data[0],':city' => ucwords(strtolower($data[3])),':country' => ucwords(strtolower($data[4])))); |
|
| 888 | - } catch(PDOException $e) { |
|
| 887 | + $sth->execute(array(':icao' => $data[0], ':city' => ucwords(strtolower($data[3])), ':country' => ucwords(strtolower($data[4])))); |
|
| 888 | + } catch (PDOException $e) { |
|
| 889 | 889 | return "error : ".$e->getMessage(); |
| 890 | 890 | } |
| 891 | 891 | } |
@@ -899,15 +899,15 @@ discard block |
||
| 899 | 899 | try { |
| 900 | 900 | $sth = $Connection->db->prepare("SELECT icao FROM airport WHERE name LIKE '%Air Base%'"); |
| 901 | 901 | $sth->execute(); |
| 902 | - } catch(PDOException $e) { |
|
| 902 | + } catch (PDOException $e) { |
|
| 903 | 903 | return "error : ".$e->getMessage(); |
| 904 | 904 | } |
| 905 | 905 | while ($row = $sth->fetch(PDO::FETCH_ASSOC)) { |
| 906 | 906 | $query2 = 'UPDATE airport SET type = :type WHERE icao = :icao'; |
| 907 | 907 | try { |
| 908 | 908 | $sth2 = $Connection->db->prepare($query2); |
| 909 | - $sth2->execute(array(':icao' => $row['icao'],':type' => 'military')); |
|
| 910 | - } catch(PDOException $e) { |
|
| 909 | + $sth2->execute(array(':icao' => $row['icao'], ':type' => 'military')); |
|
| 910 | + } catch (PDOException $e) { |
|
| 911 | 911 | return "error : ".$e->getMessage(); |
| 912 | 912 | } |
| 913 | 913 | } |
@@ -928,7 +928,7 @@ discard block |
||
| 928 | 928 | $Connection = new Connection(); |
| 929 | 929 | $sth = $Connection->db->prepare($query); |
| 930 | 930 | $sth->execute(array(':source' => 'translation.csv')); |
| 931 | - } catch(PDOException $e) { |
|
| 931 | + } catch (PDOException $e) { |
|
| 932 | 932 | return "error : ".$e->getMessage(); |
| 933 | 933 | } |
| 934 | 934 | |
@@ -945,7 +945,7 @@ discard block |
||
| 945 | 945 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 946 | 946 | { |
| 947 | 947 | $i++; |
| 948 | - if($i > 12) { |
|
| 948 | + if ($i > 12) { |
|
| 949 | 949 | $data = $row; |
| 950 | 950 | $operator = $data[2]; |
| 951 | 951 | if ($operator != '' && is_numeric(substr(substr($operator, 0, 3), -1, 1))) { |
@@ -953,7 +953,7 @@ discard block |
||
| 953 | 953 | //echo substr($operator, 0, 2)."\n";; |
| 954 | 954 | if (count($airline_array) > 0) { |
| 955 | 955 | //print_r($airline_array); |
| 956 | - $operator = $airline_array[0]['icao'].substr($operator,2); |
|
| 956 | + $operator = $airline_array[0]['icao'].substr($operator, 2); |
|
| 957 | 957 | } |
| 958 | 958 | } |
| 959 | 959 | |
@@ -961,14 +961,14 @@ discard block |
||
| 961 | 961 | if ($operator_correct != '' && is_numeric(substr(substr($operator_correct, 0, 3), -1, 1))) { |
| 962 | 962 | $airline_array = $Spotter->getAllAirlineInfo(substr($operator_correct, 0, 2)); |
| 963 | 963 | if (count($airline_array) > 0) { |
| 964 | - $operator_correct = $airline_array[0]['icao'].substr($operator_correct,2); |
|
| 964 | + $operator_correct = $airline_array[0]['icao'].substr($operator_correct, 2); |
|
| 965 | 965 | } |
| 966 | 966 | } |
| 967 | 967 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 968 | 968 | try { |
| 969 | 969 | $sth = $Connection->db->prepare($query); |
| 970 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $operator,':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 971 | - } catch(PDOException $e) { |
|
| 970 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $operator, ':Operator_correct' => $operator_correct, ':source' => 'translation.csv')); |
|
| 971 | + } catch (PDOException $e) { |
|
| 972 | 972 | return "error : ".$e->getMessage(); |
| 973 | 973 | } |
| 974 | 974 | } |
@@ -986,7 +986,7 @@ discard block |
||
| 986 | 986 | $Connection = new Connection(); |
| 987 | 987 | $sth = $Connection->db->prepare($query); |
| 988 | 988 | $sth->execute(array(':source' => 'website_fam')); |
| 989 | - } catch(PDOException $e) { |
|
| 989 | + } catch (PDOException $e) { |
|
| 990 | 990 | return "error : ".$e->getMessage(); |
| 991 | 991 | } |
| 992 | 992 | //update_db::unzip($out_file); |
@@ -1004,8 +1004,8 @@ discard block |
||
| 1004 | 1004 | $query = 'INSERT INTO translation (Reg,Reg_correct,Operator,Operator_correct,Source) VALUES (:Reg, :Reg_correct, :Operator, :Operator_correct, :source)'; |
| 1005 | 1005 | try { |
| 1006 | 1006 | $sth = $Connection->db->prepare($query); |
| 1007 | - $sth->execute(array(':Reg' => $data[0],':Reg_correct' => $data[1],':Operator' => $data[2],':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1008 | - } catch(PDOException $e) { |
|
| 1007 | + $sth->execute(array(':Reg' => $data[0], ':Reg_correct' => $data[1], ':Operator' => $data[2], ':Operator_correct' => $data[3], ':source' => 'website_fam')); |
|
| 1008 | + } catch (PDOException $e) { |
|
| 1009 | 1009 | return "error : ".$e->getMessage(); |
| 1010 | 1010 | } |
| 1011 | 1011 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
| 1028 | 1028 | $Connection = new Connection(); |
| 1029 | 1029 | $sth = $Connection->db->prepare($query); |
| 1030 | 1030 | $sth->execute(array(':source' => 'website_faa')); |
| 1031 | - } catch(PDOException $e) { |
|
| 1031 | + } catch (PDOException $e) { |
|
| 1032 | 1032 | return "error : ".$e->getMessage(); |
| 1033 | 1033 | } |
| 1034 | 1034 | |
@@ -1037,7 +1037,7 @@ discard block |
||
| 1037 | 1037 | $Connection = new Connection(); |
| 1038 | 1038 | $sth = $Connection->db->prepare($query); |
| 1039 | 1039 | $sth->execute(array(':source' => 'website_faa')); |
| 1040 | - } catch(PDOException $e) { |
|
| 1040 | + } catch (PDOException $e) { |
|
| 1041 | 1041 | return "error : ".$e->getMessage(); |
| 1042 | 1042 | } |
| 1043 | 1043 | |
@@ -1054,8 +1054,8 @@ discard block |
||
| 1054 | 1054 | $query_search = 'SELECT icaotypecode FROM aircraft_modes WHERE registration = :registration AND Source <> :source LIMIT 1'; |
| 1055 | 1055 | try { |
| 1056 | 1056 | $sths = $Connection->db->prepare($query_search); |
| 1057 | - $sths->execute(array(':registration' => 'N'.$data[0],':source' => 'website_faa')); |
|
| 1058 | - } catch(PDOException $e) { |
|
| 1057 | + $sths->execute(array(':registration' => 'N'.$data[0], ':source' => 'website_faa')); |
|
| 1058 | + } catch (PDOException $e) { |
|
| 1059 | 1059 | return "error s : ".$e->getMessage(); |
| 1060 | 1060 | } |
| 1061 | 1061 | $result_search = $sths->fetchAll(PDO::FETCH_ASSOC); |
@@ -1068,8 +1068,8 @@ discard block |
||
| 1068 | 1068 | //} |
| 1069 | 1069 | try { |
| 1070 | 1070 | $sthi = $Connection->db->prepare($queryi); |
| 1071 | - $sthi->execute(array(':mfr' => $data[2],':icao' => $result_search[0]['icaotypecode'])); |
|
| 1072 | - } catch(PDOException $e) { |
|
| 1071 | + $sthi->execute(array(':mfr' => $data[2], ':icao' => $result_search[0]['icaotypecode'])); |
|
| 1072 | + } catch (PDOException $e) { |
|
| 1073 | 1073 | return "error u : ".$e->getMessage(); |
| 1074 | 1074 | } |
| 1075 | 1075 | } else { |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | try { |
| 1078 | 1078 | $sthsm = $Connection->db->prepare($query_search_mfr); |
| 1079 | 1079 | $sthsm->execute(array(':mfr' => $data[2])); |
| 1080 | - } catch(PDOException $e) { |
|
| 1080 | + } catch (PDOException $e) { |
|
| 1081 | 1081 | return "error mfr : ".$e->getMessage(); |
| 1082 | 1082 | } |
| 1083 | 1083 | $result_search_mfr = $sthsm->fetchAll(PDO::FETCH_ASSOC); |
@@ -1087,8 +1087,8 @@ discard block |
||
| 1087 | 1087 | $queryf = 'INSERT INTO aircraft_modes (FirstCreated,LastModified,ModeS,ModeSCountry,Registration,ICAOTypeCode,Source) VALUES (:FirstCreated,:LastModified,:ModeS,:ModeSCountry,:Registration,:ICAOTypeCode,:source)'; |
| 1088 | 1088 | try { |
| 1089 | 1089 | $sthf = $Connection->db->prepare($queryf); |
| 1090 | - $sthf->execute(array(':FirstCreated' => $data[16],':LastModified' => $data[15],':ModeS' => $data[33],':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0],':ICAOTypeCode' => $result_search_mfr[0]['icao'],':source' => 'website_faa')); |
|
| 1091 | - } catch(PDOException $e) { |
|
| 1090 | + $sthf->execute(array(':FirstCreated' => $data[16], ':LastModified' => $data[15], ':ModeS' => $data[33], ':ModeSCountry' => $data[14], ':Registration' => 'N'.$data[0], ':ICAOTypeCode' => $result_search_mfr[0]['icao'], ':source' => 'website_faa')); |
|
| 1091 | + } catch (PDOException $e) { |
|
| 1092 | 1092 | return "error f : ".$e->getMessage(); |
| 1093 | 1093 | } |
| 1094 | 1094 | } |
@@ -1098,13 +1098,13 @@ discard block |
||
| 1098 | 1098 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,:date_first_reg,:source)'; |
| 1099 | 1099 | try { |
| 1100 | 1100 | $sth = $Connection->db->prepare($query); |
| 1101 | - $sth->execute(array(':registration' => 'N'.$data[0],':base' => $data[9],':owner' => ucwords(strtolower($data[6])),':date_first_reg' => date('Y-m-d',strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1102 | - } catch(PDOException $e) { |
|
| 1101 | + $sth->execute(array(':registration' => 'N'.$data[0], ':base' => $data[9], ':owner' => ucwords(strtolower($data[6])), ':date_first_reg' => date('Y-m-d', strtotime($data[23])), ':source' => 'website_faa')); |
|
| 1102 | + } catch (PDOException $e) { |
|
| 1103 | 1103 | return "error i : ".$e->getMessage(); |
| 1104 | 1104 | } |
| 1105 | 1105 | } |
| 1106 | 1106 | } |
| 1107 | - if ($i % 90 == 0) { |
|
| 1107 | + if ($i%90 == 0) { |
|
| 1108 | 1108 | if ($globalTransaction) $Connection->db->commit(); |
| 1109 | 1109 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1110 | 1110 | } |
@@ -1123,7 +1123,7 @@ discard block |
||
| 1123 | 1123 | $Connection = new Connection(); |
| 1124 | 1124 | $sth = $Connection->db->prepare($query); |
| 1125 | 1125 | $sth->execute(array(':source' => 'website_fam')); |
| 1126 | - } catch(PDOException $e) { |
|
| 1126 | + } catch (PDOException $e) { |
|
| 1127 | 1127 | return "error : ".$e->getMessage(); |
| 1128 | 1128 | } |
| 1129 | 1129 | $delimiter = "\t"; |
@@ -1139,8 +1139,8 @@ discard block |
||
| 1139 | 1139 | $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 | 1140 | try { |
| 1141 | 1141 | $sth = $Connection->db->prepare($query); |
| 1142 | - $sth->execute(array(':FirstCreated' => $data[0],':LastModified' => $data[1],':ModeS' => $data[2],':ModeSCountry' => $data[3], ':Registration' => $data[4],':ICAOTypeCode' => $data[5],':type_flight' => $data[6],':source' => 'website_fam')); |
|
| 1143 | - } catch(PDOException $e) { |
|
| 1142 | + $sth->execute(array(':FirstCreated' => $data[0], ':LastModified' => $data[1], ':ModeS' => $data[2], ':ModeSCountry' => $data[3], ':Registration' => $data[4], ':ICAOTypeCode' => $data[5], ':type_flight' => $data[6], ':source' => 'website_fam')); |
|
| 1143 | + } catch (PDOException $e) { |
|
| 1144 | 1144 | return "error : ".$e->getMessage(); |
| 1145 | 1145 | } |
| 1146 | 1146 | } |
@@ -1172,7 +1172,7 @@ discard block |
||
| 1172 | 1172 | try { |
| 1173 | 1173 | $sth = $Connection->db->prepare($query); |
| 1174 | 1174 | $sth->execute(); |
| 1175 | - } catch(PDOException $e) { |
|
| 1175 | + } catch (PDOException $e) { |
|
| 1176 | 1176 | return "error : ".$e->getMessage(); |
| 1177 | 1177 | } |
| 1178 | 1178 | $delimiter = "\t"; |
@@ -1187,8 +1187,8 @@ discard block |
||
| 1187 | 1187 | $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 | 1188 | try { |
| 1189 | 1189 | $sth = $Connection->db->prepare($query); |
| 1190 | - $sth->execute(array(':name' => $data[0],':alias' => $data[1],':iata' => $data[2],':icao' => $data[3], ':callsign' => $data[4],':country' => $data[5],':active' => $data[6],':type' => $data[7],':home' => $data[8],':wikipedia_link' => $data[9],':alliance' => $data[10],':ban_eu' => $data[11])); |
|
| 1191 | - } catch(PDOException $e) { |
|
| 1190 | + $sth->execute(array(':name' => $data[0], ':alias' => $data[1], ':iata' => $data[2], ':icao' => $data[3], ':callsign' => $data[4], ':country' => $data[5], ':active' => $data[6], ':type' => $data[7], ':home' => $data[8], ':wikipedia_link' => $data[9], ':alliance' => $data[10], ':ban_eu' => $data[11])); |
|
| 1191 | + } catch (PDOException $e) { |
|
| 1192 | 1192 | return "error : ".$e->getMessage(); |
| 1193 | 1193 | } |
| 1194 | 1194 | } |
@@ -1216,7 +1216,7 @@ discard block |
||
| 1216 | 1216 | $Connection = new Connection(); |
| 1217 | 1217 | $sth = $Connection->db->prepare($query); |
| 1218 | 1218 | $sth->execute(array(':source' => 'website_fam')); |
| 1219 | - } catch(PDOException $e) { |
|
| 1219 | + } catch (PDOException $e) { |
|
| 1220 | 1220 | return "error : ".$e->getMessage(); |
| 1221 | 1221 | } |
| 1222 | 1222 | |
@@ -1232,8 +1232,8 @@ discard block |
||
| 1232 | 1232 | $query = 'INSERT INTO aircraft_owner (registration,base,owner,date_first_reg,Source) VALUES (:registration,:base,:owner,NULL,:source)'; |
| 1233 | 1233 | try { |
| 1234 | 1234 | $sth = $Connection->db->prepare($query); |
| 1235 | - $sth->execute(array(':registration' => $data[0],':base' => $data[1],':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1236 | - } catch(PDOException $e) { |
|
| 1235 | + $sth->execute(array(':registration' => $data[0], ':base' => $data[1], ':owner' => $data[2], ':source' => 'website_fam')); |
|
| 1236 | + } catch (PDOException $e) { |
|
| 1237 | 1237 | //print_r($data); |
| 1238 | 1238 | return "error : ".$e->getMessage(); |
| 1239 | 1239 | } |
@@ -1253,7 +1253,7 @@ discard block |
||
| 1253 | 1253 | $Connection = new Connection(); |
| 1254 | 1254 | $sth = $Connection->db->prepare($query); |
| 1255 | 1255 | $sth->execute(array(':source' => 'website_fam')); |
| 1256 | - } catch(PDOException $e) { |
|
| 1256 | + } catch (PDOException $e) { |
|
| 1257 | 1257 | return "error : ".$e->getMessage(); |
| 1258 | 1258 | } |
| 1259 | 1259 | $delimiter = "\t"; |
@@ -1269,13 +1269,13 @@ discard block |
||
| 1269 | 1269 | $query = '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)'; |
| 1270 | 1270 | try { |
| 1271 | 1271 | $sth = $Connection->db->prepare($query); |
| 1272 | - $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 | - } catch(PDOException $e) { |
|
| 1274 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',',$data); |
|
| 1272 | + $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 | + } catch (PDOException $e) { |
|
| 1274 | + if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".implode(',', $data); |
|
| 1275 | 1275 | die(); |
| 1276 | 1276 | } |
| 1277 | 1277 | } |
| 1278 | - if ($globalTransaction && $i % 2000 == 0) { |
|
| 1278 | + if ($globalTransaction && $i%2000 == 0) { |
|
| 1279 | 1279 | $Connection->db->commit(); |
| 1280 | 1280 | if ($globalDebug) echo '.'; |
| 1281 | 1281 | $Connection->db->beginTransaction(); |
@@ -1295,7 +1295,7 @@ discard block |
||
| 1295 | 1295 | $Connection = new Connection(); |
| 1296 | 1296 | $sth = $Connection->db->prepare($query); |
| 1297 | 1297 | $sth->execute(array(':source' => 'website_fam')); |
| 1298 | - } catch(PDOException $e) { |
|
| 1298 | + } catch (PDOException $e) { |
|
| 1299 | 1299 | return "error : ".$e->getMessage(); |
| 1300 | 1300 | } |
| 1301 | 1301 | $Connection = new Connection(); |
@@ -1308,12 +1308,12 @@ discard block |
||
| 1308 | 1308 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
| 1309 | 1309 | try { |
| 1310 | 1310 | $sth = $Connection->db->prepare($query); |
| 1311 | - $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
|
| 1312 | - } catch(PDOException $e) { |
|
| 1311 | + $sth->execute(array(':callSign' => trim($data), ':source' => 'website_fam')); |
|
| 1312 | + } catch (PDOException $e) { |
|
| 1313 | 1313 | if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
| 1314 | 1314 | die(); |
| 1315 | 1315 | } |
| 1316 | - if ($globalTransaction && $i % 2000 == 0) { |
|
| 1316 | + if ($globalTransaction && $i%2000 == 0) { |
|
| 1317 | 1317 | $Connection->db->commit(); |
| 1318 | 1318 | if ($globalDebug) echo '.'; |
| 1319 | 1319 | $Connection->db->beginTransaction(); |
@@ -1333,7 +1333,7 @@ discard block |
||
| 1333 | 1333 | $Connection = new Connection(); |
| 1334 | 1334 | $sth = $Connection->db->prepare($query); |
| 1335 | 1335 | $sth->execute(); |
| 1336 | - } catch(PDOException $e) { |
|
| 1336 | + } catch (PDOException $e) { |
|
| 1337 | 1337 | return "error : ".$e->getMessage(); |
| 1338 | 1338 | } |
| 1339 | 1339 | |
@@ -1354,8 +1354,8 @@ discard block |
||
| 1354 | 1354 | $query = 'INSERT INTO marine_identity (mmsi,imo,call_sign,ship_name,length,gross_tonnage,dead_weight,width,country,engine_power,type) VALUES (:mmsi,:imo,:call_sign,:ship_name,:length,:gross_tonnage,:dead_weight,:width,:country,:engine_power,:type)'; |
| 1355 | 1355 | try { |
| 1356 | 1356 | $sth = $Connection->db->prepare($query); |
| 1357 | - $sth->execute(array(':mmsi' => $data[0],':imo' => $data[1],':call_sign' => $data[2],':ship_name' => $data[3], ':length' => $data[4],':gross_tonnage' => $data[5],':dead_weight' => $data[6],':width' => $data[7],':country' => $data[8],':engine_power' => $data[9],':type' => $data[10])); |
|
| 1358 | - } catch(PDOException $e) { |
|
| 1357 | + $sth->execute(array(':mmsi' => $data[0], ':imo' => $data[1], ':call_sign' => $data[2], ':ship_name' => $data[3], ':length' => $data[4], ':gross_tonnage' => $data[5], ':dead_weight' => $data[6], ':width' => $data[7], ':country' => $data[8], ':engine_power' => $data[9], ':type' => $data[10])); |
|
| 1358 | + } catch (PDOException $e) { |
|
| 1359 | 1359 | return "error : ".$e->getMessage(); |
| 1360 | 1360 | } |
| 1361 | 1361 | } |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | $Connection = new Connection(); |
| 1375 | 1375 | $sth = $Connection->db->prepare($query); |
| 1376 | 1376 | $sth->execute(); |
| 1377 | - } catch(PDOException $e) { |
|
| 1377 | + } catch (PDOException $e) { |
|
| 1378 | 1378 | return "error : ".$e->getMessage(); |
| 1379 | 1379 | } |
| 1380 | 1380 | $delimiter = "\t"; |
@@ -1391,8 +1391,8 @@ discard block |
||
| 1391 | 1391 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1392 | 1392 | try { |
| 1393 | 1393 | $sth = $Connection->db->prepare($query); |
| 1394 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21],':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1395 | - } catch(PDOException $e) { |
|
| 1394 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => $data[1], ':country_un' => $data[2], ':country_owner' => $data[3], ':owner' => $data[4], ':users' => $data[5], ':purpose' => $data[6], ':purpose_detailed' => $data[7], ':orbit' => $data[8], ':type' => $data[9], ':longitude_geo' => $data[10], ':perigee' => !empty($data[11]) ? $data[11] : NULL, ':apogee' => !empty($data[12]) ? $data[12] : NULL, ':eccentricity' => $data[13], ':inclination' => $data[14], ':period' => !empty($data[15]) ? $data[15] : NULL, ':launch_mass' => !empty($data[16]) ? $data[16] : NULL, ':dry_mass' => !empty($data[17]) ? $data[17] : NULL, ':power' => !empty($data[18]) ? $data[18] : NULL, ':launch_date' => $data[19], ':lifetime' => $data[20], ':contractor' => $data[21], ':country_contractor' => $data[22], ':launch_site' => $data[23], ':launch_vehicule' => $data[24], ':cospar' => $data[25], ':norad' => $data[26], ':comments' => $data[27], ':source_orbital' => $data[28], ':sources' => $data[29])); |
|
| 1395 | + } catch (PDOException $e) { |
|
| 1396 | 1396 | return "error : ".$e->getMessage(); |
| 1397 | 1397 | } |
| 1398 | 1398 | } |
@@ -1411,7 +1411,7 @@ discard block |
||
| 1411 | 1411 | $Connection = new Connection(); |
| 1412 | 1412 | $sth = $Connection->db->prepare($query); |
| 1413 | 1413 | $sth->execute(); |
| 1414 | - } catch(PDOException $e) { |
|
| 1414 | + } catch (PDOException $e) { |
|
| 1415 | 1415 | return "error : ".$e->getMessage(); |
| 1416 | 1416 | } |
| 1417 | 1417 | |
@@ -1427,7 +1427,7 @@ discard block |
||
| 1427 | 1427 | try { |
| 1428 | 1428 | $sth = $Connection->db->prepare($query); |
| 1429 | 1429 | $sth->execute(array(':icao' => $icao)); |
| 1430 | - } catch(PDOException $e) { |
|
| 1430 | + } catch (PDOException $e) { |
|
| 1431 | 1431 | return "error : ".$e->getMessage(); |
| 1432 | 1432 | } |
| 1433 | 1433 | } |
@@ -1438,7 +1438,7 @@ discard block |
||
| 1438 | 1438 | return ''; |
| 1439 | 1439 | } |
| 1440 | 1440 | |
| 1441 | - public static function tle($filename,$tletype) { |
|
| 1441 | + public static function tle($filename, $tletype) { |
|
| 1442 | 1442 | require_once(dirname(__FILE__).'/../require/class.Spotter.php'); |
| 1443 | 1443 | global $tmp_dir, $globalTransaction; |
| 1444 | 1444 | //$Spotter = new Spotter(); |
@@ -1448,7 +1448,7 @@ discard block |
||
| 1448 | 1448 | $Connection = new Connection(); |
| 1449 | 1449 | $sth = $Connection->db->prepare($query); |
| 1450 | 1450 | $sth->execute(array(':source' => $filename)); |
| 1451 | - } catch(PDOException $e) { |
|
| 1451 | + } catch (PDOException $e) { |
|
| 1452 | 1452 | return "error : ".$e->getMessage(); |
| 1453 | 1453 | } |
| 1454 | 1454 | |
@@ -1473,8 +1473,8 @@ discard block |
||
| 1473 | 1473 | $query = 'INSERT INTO tle (tle_name,tle_tle1,tle_tle2,tle_type,tle_source) VALUES (:name, :tle1, :tle2, :type, :source)'; |
| 1474 | 1474 | try { |
| 1475 | 1475 | $sth = $Connection->db->prepare($query); |
| 1476 | - $sth->execute(array(':name' => $dbdata['name'],':tle1' => $dbdata['tle1'],':tle2' => $dbdata['tle2'], ':type' => $tletype,':source' => $filename)); |
|
| 1477 | - } catch(PDOException $e) { |
|
| 1476 | + $sth->execute(array(':name' => $dbdata['name'], ':tle1' => $dbdata['tle1'], ':tle2' => $dbdata['tle2'], ':type' => $tletype, ':source' => $filename)); |
|
| 1477 | + } catch (PDOException $e) { |
|
| 1478 | 1478 | return "error : ".$e->getMessage(); |
| 1479 | 1479 | } |
| 1480 | 1480 | |
@@ -1495,7 +1495,7 @@ discard block |
||
| 1495 | 1495 | $Connection = new Connection(); |
| 1496 | 1496 | $sth = $Connection->db->prepare($query); |
| 1497 | 1497 | $sth->execute(array(':source' => $filename)); |
| 1498 | - } catch(PDOException $e) { |
|
| 1498 | + } catch (PDOException $e) { |
|
| 1499 | 1499 | return "error : ".$e->getMessage(); |
| 1500 | 1500 | } |
| 1501 | 1501 | |
@@ -1506,13 +1506,13 @@ discard block |
||
| 1506 | 1506 | $i = 0; |
| 1507 | 1507 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1508 | 1508 | //$Connection->db->beginTransaction(); |
| 1509 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
| 1509 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
| 1510 | 1510 | { |
| 1511 | 1511 | if ($i > 0 && $data[0] != '') { |
| 1512 | 1512 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1513 | - $period = str_replace(',','',$data[14]); |
|
| 1514 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1515 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1513 | + $period = str_replace(',', '', $data[14]); |
|
| 1514 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
| 1515 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
| 1516 | 1516 | else $launch_date = NULL; |
| 1517 | 1517 | $data = array_map(function($value) { |
| 1518 | 1518 | return trim($value) === '' ? null : $value; |
@@ -1522,8 +1522,8 @@ discard block |
||
| 1522 | 1522 | VALUES (:name, :name_alternate, :country_un, :country_owner, :owner, :users, :purpose, :purpose_detailed, :orbit, :type, :longitude_geo, :perigee, :apogee, :eccentricity, :inclination, :period, :launch_mass, :dry_mass, :power, :launch_date, :lifetime, :contractor, :country_contractor, :launch_site, :launch_vehicule, :cospar, :norad, :comments, :source_orbital, :sources)'; |
| 1523 | 1523 | try { |
| 1524 | 1524 | $sth = $Connection->db->prepare($query); |
| 1525 | - $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',','',$data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',','',$data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+',','),'',$data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',','-1900',' (BOL)',' (EOL)'),'',$data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',',' (BOL)',' (EOL)'),'',$data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20],':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1526 | - } catch(PDOException $e) { |
|
| 1525 | + $sth->execute(array(':name' => $data[0], ':name_alternate' => '', ':country_un' => $data[1], ':country_owner' => $data[2], ':owner' => $data[3], ':users' => $data[4], ':purpose' => $data[5], ':purpose_detailed' => $data[6], ':orbit' => $data[7], ':type' => $data[8], ':longitude_geo' => $data[9], ':perigee' => !empty($data[10]) ? str_replace(',', '', $data[10]) : NULL, ':apogee' => !empty($data[11]) ? str_replace(',', '', $data[11]) : NULL, ':eccentricity' => $data[12], ':inclination' => $data[13], ':period' => !empty($period) ? $period : NULL, ':launch_mass' => !empty($data[15]) ? str_replace(array('+', ','), '', $data[15]) : NULL, ':dry_mass' => !empty($data[16]) ? str_replace(array(',', '-1900', ' (BOL)', ' (EOL)'), '', $data[16]) : NULL, ':power' => !empty($data[17]) ? str_replace(array(',', ' (BOL)', ' (EOL)'), '', $data[17]) : NULL, ':launch_date' => $launch_date, ':lifetime' => $data[19], ':contractor' => $data[20], ':country_contractor' => $data[21], ':launch_site' => $data[22], ':launch_vehicule' => $data[23], ':cospar' => $data[24], ':norad' => $data[25], ':comments' => $data[26], ':source_orbital' => $data[27], ':sources' => $sources)); |
|
| 1526 | + } catch (PDOException $e) { |
|
| 1527 | 1527 | return "error : ".$e->getMessage(); |
| 1528 | 1528 | } |
| 1529 | 1529 | } |
@@ -1563,7 +1563,7 @@ discard block |
||
| 1563 | 1563 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
| 1564 | 1564 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
| 1565 | 1565 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
| 1566 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
| 1566 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
| 1567 | 1567 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
| 1568 | 1568 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
| 1569 | 1569 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1687,10 +1687,10 @@ discard block |
||
| 1687 | 1687 | { |
| 1688 | 1688 | if ($data != '') { |
| 1689 | 1689 | $result = array(); |
| 1690 | - $result['cospar'] = trim(substr($data,0,11)); |
|
| 1691 | - $result['norad'] = trim(substr($data,13,6)); |
|
| 1692 | - $result['operational'] = trim(substr($data,21,1)); |
|
| 1693 | - $result['name'] = trim(substr($data,23,24)); |
|
| 1690 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
| 1691 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
| 1692 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
| 1693 | + $result['name'] = trim(substr($data, 23, 24)); |
|
| 1694 | 1694 | /* |
| 1695 | 1695 | * R/B(1) = Rocket body, first stage |
| 1696 | 1696 | * R/B(2) = Rocket body, second stage |
@@ -1702,29 +1702,29 @@ discard block |
||
| 1702 | 1702 | * An ampersand (&) indicates two or more objects are attached |
| 1703 | 1703 | */ |
| 1704 | 1704 | |
| 1705 | - $owner_code = trim(substr($data,49,5)); |
|
| 1705 | + $owner_code = trim(substr($data, 49, 5)); |
|
| 1706 | 1706 | |
| 1707 | 1707 | if (!isset($satcat_sources[$owner_code])) { |
| 1708 | 1708 | echo $data; |
| 1709 | 1709 | echo 'owner_code: '.$owner_code."\n"; |
| 1710 | 1710 | } |
| 1711 | - if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
| 1712 | - echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
| 1711 | + if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
| 1712 | + echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n"; |
|
| 1713 | 1713 | } |
| 1714 | 1714 | |
| 1715 | - if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
| 1715 | + if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
| 1716 | 1716 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
| 1717 | 1717 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
| 1718 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
| 1719 | - $launch_site_code = trim(substr($data,68,5)); |
|
| 1718 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
| 1719 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
| 1720 | 1720 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
| 1721 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
| 1722 | - $result['period'] = trim(substr($data,87,7)); |
|
| 1723 | - $result['inclination'] = trim(substr($data,96,5)); |
|
| 1724 | - $result['apogee'] = trim(substr($data,103,6)); |
|
| 1725 | - $result['perigee'] = trim(substr($data,111,6)); |
|
| 1721 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
| 1722 | + $result['period'] = trim(substr($data, 87, 7)); |
|
| 1723 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
| 1724 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
| 1725 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
| 1726 | 1726 | //$result['radarcross'] = trim(substr($data,119,8)); |
| 1727 | - $result['status'] = trim(substr($data,129,3)); |
|
| 1727 | + $result['status'] = trim(substr($data, 129, 3)); |
|
| 1728 | 1728 | //print_r($result); |
| 1729 | 1729 | $result = array_map(function($value) { |
| 1730 | 1730 | return trim($value) === '' ? null : $value; |
@@ -1737,7 +1737,7 @@ discard block |
||
| 1737 | 1737 | $sth = $Connection->db->prepare($query); |
| 1738 | 1738 | $sth->execute(array(':cospar' => $result['cospar'])); |
| 1739 | 1739 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 1740 | - } catch(PDOException $e) { |
|
| 1740 | + } catch (PDOException $e) { |
|
| 1741 | 1741 | return "error : ".$e->getMessage(); |
| 1742 | 1742 | } |
| 1743 | 1743 | if (empty($exist)) { |
@@ -1749,10 +1749,10 @@ discard block |
||
| 1749 | 1749 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
| 1750 | 1750 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
| 1751 | 1751 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
| 1752 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1752 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
| 1753 | 1753 | ) |
| 1754 | 1754 | ); |
| 1755 | - } catch(PDOException $e) { |
|
| 1755 | + } catch (PDOException $e) { |
|
| 1756 | 1756 | return "error : ".$e->getMessage(); |
| 1757 | 1757 | } |
| 1758 | 1758 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1760,8 +1760,8 @@ discard block |
||
| 1760 | 1760 | try { |
| 1761 | 1761 | $Connection = new Connection(); |
| 1762 | 1762 | $sth = $Connection->db->prepare($query); |
| 1763 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
| 1764 | - } catch(PDOException $e) { |
|
| 1763 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
| 1764 | + } catch (PDOException $e) { |
|
| 1765 | 1765 | return "error : ".$e->getMessage(); |
| 1766 | 1766 | } |
| 1767 | 1767 | } |
@@ -1880,13 +1880,13 @@ discard block |
||
| 1880 | 1880 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1881 | 1881 | { |
| 1882 | 1882 | $i++; |
| 1883 | - if($i > 3 && count($row) > 2) { |
|
| 1883 | + if ($i > 3 && count($row) > 2) { |
|
| 1884 | 1884 | $data = array_values(array_filter($row)); |
| 1885 | 1885 | $cntdata = count($data); |
| 1886 | 1886 | if ($cntdata > 10) { |
| 1887 | 1887 | $value = $data[9]; |
| 1888 | 1888 | |
| 1889 | - for ($i =10;$i < $cntdata;$i++) { |
|
| 1889 | + for ($i = 10; $i < $cntdata; $i++) { |
|
| 1890 | 1890 | $value .= ' '.$data[$i]; |
| 1891 | 1891 | } |
| 1892 | 1892 | $data[9] = $value; |
@@ -1896,8 +1896,8 @@ discard block |
||
| 1896 | 1896 | $query = 'INSERT INTO waypoints (name_begin,latitude_begin,longitude_begin,name_end,latitude_end,longitude_end,high,base,top,segment_name) VALUES (:name_begin, :latitude_begin, :longitude_begin, :name_end, :latitude_end, :longitude_end, :high, :base, :top, :segment_name)'; |
| 1897 | 1897 | try { |
| 1898 | 1898 | $sth = $Connection->db->prepare($query); |
| 1899 | - $sth->execute(array(':name_begin' => $data[0],':latitude_begin' => $data[1],':longitude_begin' => $data[2],':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1900 | - } catch(PDOException $e) { |
|
| 1899 | + $sth->execute(array(':name_begin' => $data[0], ':latitude_begin' => $data[1], ':longitude_begin' => $data[2], ':name_end' => $data[3], ':latitude_end' => $data[4], ':longitude_end' => $data[5], ':high' => $data[6], ':base' => $data[7], ':top' => $data[8], ':segment_name' => $data[9])); |
|
| 1900 | + } catch (PDOException $e) { |
|
| 1901 | 1901 | return "error : ".$e->getMessage(); |
| 1902 | 1902 | } |
| 1903 | 1903 | } |
@@ -1914,22 +1914,22 @@ discard block |
||
| 1914 | 1914 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
| 1915 | 1915 | $delimiter = ','; |
| 1916 | 1916 | $Common = new Common(); |
| 1917 | - $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv'); |
|
| 1917 | + $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv'); |
|
| 1918 | 1918 | $Connection = new Connection(); |
| 1919 | 1919 | $Source = new Source(); |
| 1920 | 1920 | $Source->deleteLocationByType('fires'); |
| 1921 | 1921 | $i = 0; |
| 1922 | - if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
|
| 1922 | + if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) { |
|
| 1923 | 1923 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1924 | - while (($row = fgetcsv($handle,1000)) !== false) { |
|
| 1924 | + while (($row = fgetcsv($handle, 1000)) !== false) { |
|
| 1925 | 1925 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
| 1926 | - $description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]); |
|
| 1926 | + $description = array('bright_t14' => $row[2], 'scan' => $row[3], 'track' => $row[4], 'sat' => $row[7], 'confidence' => $row[8], 'version' => $row[9], 'bright_t15' => $row[10], 'frp' => $row[11], 'daynight' => $row[12]); |
|
| 1927 | 1927 | $query = "INSERT INTO source_location (name,latitude,longitude,altitude,country,city,logo,source,type,source_id,last_seen,location_id,description) VALUES (:name,:latitude,:longitude,:altitude,:country,:city,:logo,:source,:type,:source_id,:last_seen,:location_id,:description)"; |
| 1928 | - $query_values = array(':name' => '',':latitude' => $row[0], ':longitude' => $row[1],':altitude' => null,':city' => '',':country' => '',':logo' => 'fire.png',':source' => 'NASA',':type' => 'fires',':source_id' => 0,':last_seen' => $row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),':location_id' => 0,':description' => json_encode($description)); |
|
| 1928 | + $query_values = array(':name' => '', ':latitude' => $row[0], ':longitude' => $row[1], ':altitude' => null, ':city' => '', ':country' => '', ':logo' => 'fire.png', ':source' => 'NASA', ':type' => 'fires', ':source_id' => 0, ':last_seen' => $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), ':location_id' => 0, ':description' => json_encode($description)); |
|
| 1929 | 1929 | try { |
| 1930 | 1930 | $sth = $Connection->db->prepare($query); |
| 1931 | 1931 | $sth->execute($query_values); |
| 1932 | - } catch(PDOException $e) { |
|
| 1932 | + } catch (PDOException $e) { |
|
| 1933 | 1933 | echo "error : ".$e->getMessage(); |
| 1934 | 1934 | } |
| 1935 | 1935 | } |
@@ -1948,7 +1948,7 @@ discard block |
||
| 1948 | 1948 | $Connection = new Connection(); |
| 1949 | 1949 | $sth = $Connection->db->prepare($query); |
| 1950 | 1950 | $sth->execute(); |
| 1951 | - } catch(PDOException $e) { |
|
| 1951 | + } catch (PDOException $e) { |
|
| 1952 | 1952 | return "error : ".$e->getMessage(); |
| 1953 | 1953 | } |
| 1954 | 1954 | $header = NULL; |
@@ -1959,12 +1959,12 @@ discard block |
||
| 1959 | 1959 | if ($globalTransaction) $Connection->db->beginTransaction(); |
| 1960 | 1960 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1961 | 1961 | { |
| 1962 | - if(count($row) > 1) { |
|
| 1962 | + if (count($row) > 1) { |
|
| 1963 | 1963 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
| 1964 | 1964 | try { |
| 1965 | 1965 | $sth = $Connection->db->prepare($query); |
| 1966 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
| 1967 | - } catch(PDOException $e) { |
|
| 1966 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
| 1967 | + } catch (PDOException $e) { |
|
| 1968 | 1968 | return "error : ".$e->getMessage(); |
| 1969 | 1969 | } |
| 1970 | 1970 | } |
@@ -1984,21 +1984,21 @@ discard block |
||
| 1984 | 1984 | try { |
| 1985 | 1985 | $sth = $Connection->db->prepare($query); |
| 1986 | 1986 | $sth->execute(); |
| 1987 | - } catch(PDOException $e) { |
|
| 1987 | + } catch (PDOException $e) { |
|
| 1988 | 1988 | return "error : ".$e->getMessage(); |
| 1989 | 1989 | } |
| 1990 | 1990 | } |
| 1991 | 1991 | |
| 1992 | 1992 | |
| 1993 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1993 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1994 | 1994 | else { |
| 1995 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1995 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
| 1996 | 1996 | $query = "CREATE EXTENSION postgis"; |
| 1997 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
| 1997 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
| 1998 | 1998 | try { |
| 1999 | 1999 | $sth = $Connection->db->prepare($query); |
| 2000 | 2000 | $sth->execute(); |
| 2001 | - } catch(PDOException $e) { |
|
| 2001 | + } catch (PDOException $e) { |
|
| 2002 | 2002 | return "error : ".$e->getMessage(); |
| 2003 | 2003 | } |
| 2004 | 2004 | } |
@@ -2011,13 +2011,13 @@ discard block |
||
| 2011 | 2011 | include_once('class.create_db.php'); |
| 2012 | 2012 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2013 | 2013 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
| 2014 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
| 2014 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
| 2015 | 2015 | $error = ''; |
| 2016 | 2016 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
| 2017 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 2017 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
| 2018 | 2018 | $notam_md5 = $notam_md5_file[0]; |
| 2019 | 2019 | if (!update_db::check_notam_version($notam_md5)) { |
| 2020 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
| 2020 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
| 2021 | 2021 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2022 | 2022 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2023 | 2023 | if ($globalDebug) echo "Gunzip..."; |
@@ -2053,14 +2053,14 @@ discard block |
||
| 2053 | 2053 | try { |
| 2054 | 2054 | $sth = $Connection->db->prepare($query); |
| 2055 | 2055 | $sth->execute(); |
| 2056 | - } catch(PDOException $e) { |
|
| 2056 | + } catch (PDOException $e) { |
|
| 2057 | 2057 | echo "error : ".$e->getMessage(); |
| 2058 | 2058 | } |
| 2059 | 2059 | } |
| 2060 | 2060 | if ($globalDBdriver == 'mysql') { |
| 2061 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 2061 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 2062 | 2062 | } else { |
| 2063 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
| 2063 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
| 2064 | 2064 | } |
| 2065 | 2065 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
| 2066 | 2066 | return $error; |
@@ -2073,7 +2073,7 @@ discard block |
||
| 2073 | 2073 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
| 2074 | 2074 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
| 2075 | 2075 | // update_db::download('http://sourceforge.net/p/flightgear/fgdata/ci/next/tree/Navaids/awy.dat.gz?format=raw',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
| 2076 | - update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz',$tmp_dir.'awy.dat.gz','http://sourceforge.net'); |
|
| 2076 | + update_db::download('http://pkgs.fedoraproject.org/repo/extras/FlightGear-Atlas/awy.dat.gz/f530c9d1c4b31a288ba88dcc8224268b/awy.dat.gz', $tmp_dir.'awy.dat.gz', 'http://sourceforge.net'); |
|
| 2077 | 2077 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
| 2078 | 2078 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
| 2079 | 2079 | return $error; |
@@ -2094,7 +2094,7 @@ discard block |
||
| 2094 | 2094 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2095 | 2095 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
| 2096 | 2096 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2097 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2097 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2098 | 2098 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
| 2099 | 2099 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
| 2100 | 2100 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -2108,7 +2108,7 @@ discard block |
||
| 2108 | 2108 | global $tmp_dir, $globalDebug; |
| 2109 | 2109 | $error = ''; |
| 2110 | 2110 | if ($globalDebug) echo "Routes : Download..."; |
| 2111 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
| 2111 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
| 2112 | 2112 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2113 | 2113 | if ($globalDebug) echo "Gunzip..."; |
| 2114 | 2114 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -2124,7 +2124,7 @@ discard block |
||
| 2124 | 2124 | global $tmp_dir, $globalDebug; |
| 2125 | 2125 | $error = ''; |
| 2126 | 2126 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
| 2127 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
| 2127 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
| 2128 | 2128 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2129 | 2129 | if ($globalDebug) echo "Gunzip..."; |
| 2130 | 2130 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -2140,7 +2140,7 @@ discard block |
||
| 2140 | 2140 | global $tmp_dir, $globalDebug; |
| 2141 | 2141 | $error = ''; |
| 2142 | 2142 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
| 2143 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
| 2143 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
| 2144 | 2144 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2145 | 2145 | if ($globalDebug) echo "Gunzip..."; |
| 2146 | 2146 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2168,7 +2168,7 @@ discard block |
||
| 2168 | 2168 | */ |
| 2169 | 2169 | if ($globalDebug) echo "Modes : Download..."; |
| 2170 | 2170 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
| 2171 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
| 2171 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
| 2172 | 2172 | |
| 2173 | 2173 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2174 | 2174 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2188,7 +2188,7 @@ discard block |
||
| 2188 | 2188 | public static function update_ModeS_faa() { |
| 2189 | 2189 | global $tmp_dir, $globalDebug; |
| 2190 | 2190 | if ($globalDebug) echo "Modes FAA: Download..."; |
| 2191 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
| 2191 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
| 2192 | 2192 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2193 | 2193 | if ($globalDebug) echo "Unzip..."; |
| 2194 | 2194 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2204,7 +2204,7 @@ discard block |
||
| 2204 | 2204 | public static function update_ModeS_flarm() { |
| 2205 | 2205 | global $tmp_dir, $globalDebug; |
| 2206 | 2206 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
| 2207 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
| 2207 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
| 2208 | 2208 | if (file_exists($tmp_dir.'data.fln')) { |
| 2209 | 2209 | if ($globalDebug) echo "Add to DB..."; |
| 2210 | 2210 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2218,7 +2218,7 @@ discard block |
||
| 2218 | 2218 | public static function update_ModeS_ogn() { |
| 2219 | 2219 | global $tmp_dir, $globalDebug; |
| 2220 | 2220 | if ($globalDebug) echo "Modes OGN: Download..."; |
| 2221 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
| 2221 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
| 2222 | 2222 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2223 | 2223 | if ($globalDebug) echo "Add to DB..."; |
| 2224 | 2224 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2233,201 +2233,201 @@ discard block |
||
| 2233 | 2233 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2234 | 2234 | |
| 2235 | 2235 | if ($globalDebug) echo "Owner France: Download..."; |
| 2236 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
| 2236 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
| 2237 | 2237 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2238 | 2238 | if ($globalDebug) echo "Add to DB..."; |
| 2239 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
| 2239 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
| 2240 | 2240 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
| 2241 | 2241 | if ($error != '') { |
| 2242 | 2242 | return $error; |
| 2243 | 2243 | } elseif ($globalDebug) echo "Done\n"; |
| 2244 | 2244 | |
| 2245 | 2245 | if ($globalDebug) echo "Owner Ireland: Download..."; |
| 2246 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
| 2246 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
| 2247 | 2247 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2248 | 2248 | if ($globalDebug) echo "Add to DB..."; |
| 2249 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
| 2249 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
| 2250 | 2250 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
| 2251 | 2251 | if ($error != '') { |
| 2252 | 2252 | return $error; |
| 2253 | 2253 | } elseif ($globalDebug) echo "Done\n"; |
| 2254 | 2254 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
| 2255 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
| 2255 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
| 2256 | 2256 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2257 | 2257 | if ($globalDebug) echo "Add to DB..."; |
| 2258 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
| 2258 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
| 2259 | 2259 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
| 2260 | 2260 | if ($error != '') { |
| 2261 | 2261 | return $error; |
| 2262 | 2262 | } elseif ($globalDebug) echo "Done\n"; |
| 2263 | 2263 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
| 2264 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
| 2264 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
| 2265 | 2265 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2266 | 2266 | if ($globalDebug) echo "Add to DB..."; |
| 2267 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
| 2267 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
| 2268 | 2268 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
| 2269 | 2269 | if ($error != '') { |
| 2270 | 2270 | return $error; |
| 2271 | 2271 | } elseif ($globalDebug) echo "Done\n"; |
| 2272 | 2272 | if ($globalDebug) echo "Owner Australia: Download..."; |
| 2273 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
| 2273 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
| 2274 | 2274 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2275 | 2275 | if ($globalDebug) echo "Add to DB..."; |
| 2276 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
| 2276 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
| 2277 | 2277 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
| 2278 | 2278 | if ($error != '') { |
| 2279 | 2279 | return $error; |
| 2280 | 2280 | } elseif ($globalDebug) echo "Done\n"; |
| 2281 | 2281 | if ($globalDebug) echo "Owner Austria: Download..."; |
| 2282 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
| 2282 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
| 2283 | 2283 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2284 | 2284 | if ($globalDebug) echo "Add to DB..."; |
| 2285 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
| 2285 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
| 2286 | 2286 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
| 2287 | 2287 | if ($error != '') { |
| 2288 | 2288 | return $error; |
| 2289 | 2289 | } elseif ($globalDebug) echo "Done\n"; |
| 2290 | 2290 | if ($globalDebug) echo "Owner Chile: Download..."; |
| 2291 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
| 2291 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
| 2292 | 2292 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2293 | 2293 | if ($globalDebug) echo "Add to DB..."; |
| 2294 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
| 2294 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
| 2295 | 2295 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
| 2296 | 2296 | if ($error != '') { |
| 2297 | 2297 | return $error; |
| 2298 | 2298 | } elseif ($globalDebug) echo "Done\n"; |
| 2299 | 2299 | if ($globalDebug) echo "Owner Colombia: Download..."; |
| 2300 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
| 2300 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
| 2301 | 2301 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2302 | 2302 | if ($globalDebug) echo "Add to DB..."; |
| 2303 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
| 2303 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
| 2304 | 2304 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
| 2305 | 2305 | if ($error != '') { |
| 2306 | 2306 | return $error; |
| 2307 | 2307 | } elseif ($globalDebug) echo "Done\n"; |
| 2308 | 2308 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
| 2309 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
| 2309 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
| 2310 | 2310 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2311 | 2311 | if ($globalDebug) echo "Add to DB..."; |
| 2312 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
| 2312 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
| 2313 | 2313 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
| 2314 | 2314 | if ($error != '') { |
| 2315 | 2315 | return $error; |
| 2316 | 2316 | } elseif ($globalDebug) echo "Done\n"; |
| 2317 | 2317 | if ($globalDebug) echo "Owner Brazil: Download..."; |
| 2318 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
| 2318 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
| 2319 | 2319 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2320 | 2320 | if ($globalDebug) echo "Add to DB..."; |
| 2321 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
| 2321 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
| 2322 | 2322 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
| 2323 | 2323 | if ($error != '') { |
| 2324 | 2324 | return $error; |
| 2325 | 2325 | } elseif ($globalDebug) echo "Done\n"; |
| 2326 | 2326 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
| 2327 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
| 2327 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
| 2328 | 2328 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2329 | 2329 | if ($globalDebug) echo "Add to DB..."; |
| 2330 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
| 2330 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
| 2331 | 2331 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
| 2332 | 2332 | if ($error != '') { |
| 2333 | 2333 | return $error; |
| 2334 | 2334 | } elseif ($globalDebug) echo "Done\n"; |
| 2335 | 2335 | if ($globalDebug) echo "Owner Croatia: Download..."; |
| 2336 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
| 2336 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
| 2337 | 2337 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2338 | 2338 | if ($globalDebug) echo "Add to DB..."; |
| 2339 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
| 2339 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
| 2340 | 2340 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
| 2341 | 2341 | if ($error != '') { |
| 2342 | 2342 | return $error; |
| 2343 | 2343 | } elseif ($globalDebug) echo "Done\n"; |
| 2344 | 2344 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
| 2345 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
| 2345 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
| 2346 | 2346 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2347 | 2347 | if ($globalDebug) echo "Add to DB..."; |
| 2348 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
| 2348 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
| 2349 | 2349 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
| 2350 | 2350 | if ($error != '') { |
| 2351 | 2351 | return $error; |
| 2352 | 2352 | } elseif ($globalDebug) echo "Done\n"; |
| 2353 | 2353 | if ($globalDebug) echo "Owner Maldives: Download..."; |
| 2354 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
| 2354 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
| 2355 | 2355 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2356 | 2356 | if ($globalDebug) echo "Add to DB..."; |
| 2357 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
| 2357 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
| 2358 | 2358 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
| 2359 | 2359 | if ($error != '') { |
| 2360 | 2360 | return $error; |
| 2361 | 2361 | } elseif ($globalDebug) echo "Done\n"; |
| 2362 | 2362 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
| 2363 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
| 2363 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
| 2364 | 2364 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2365 | 2365 | if ($globalDebug) echo "Add to DB..."; |
| 2366 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
| 2366 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
| 2367 | 2367 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
| 2368 | 2368 | if ($error != '') { |
| 2369 | 2369 | return $error; |
| 2370 | 2370 | } elseif ($globalDebug) echo "Done\n"; |
| 2371 | 2371 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
| 2372 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
| 2372 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
| 2373 | 2373 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2374 | 2374 | if ($globalDebug) echo "Add to DB..."; |
| 2375 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
| 2375 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
| 2376 | 2376 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
| 2377 | 2377 | if ($error != '') { |
| 2378 | 2378 | return $error; |
| 2379 | 2379 | } elseif ($globalDebug) echo "Done\n"; |
| 2380 | 2380 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
| 2381 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
| 2381 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
| 2382 | 2382 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2383 | 2383 | if ($globalDebug) echo "Add to DB..."; |
| 2384 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
| 2384 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
| 2385 | 2385 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
| 2386 | 2386 | if ($error != '') { |
| 2387 | 2387 | return $error; |
| 2388 | 2388 | } elseif ($globalDebug) echo "Done\n"; |
| 2389 | 2389 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
| 2390 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
| 2390 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
| 2391 | 2391 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2392 | 2392 | if ($globalDebug) echo "Add to DB..."; |
| 2393 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
| 2393 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
| 2394 | 2394 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
| 2395 | 2395 | if ($error != '') { |
| 2396 | 2396 | return $error; |
| 2397 | 2397 | } elseif ($globalDebug) echo "Done\n"; |
| 2398 | 2398 | if ($globalDebug) echo "Owner Iceland: Download..."; |
| 2399 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
| 2399 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
| 2400 | 2400 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2401 | 2401 | if ($globalDebug) echo "Add to DB..."; |
| 2402 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
| 2402 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
| 2403 | 2403 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
| 2404 | 2404 | if ($error != '') { |
| 2405 | 2405 | return $error; |
| 2406 | 2406 | } elseif ($globalDebug) echo "Done\n"; |
| 2407 | 2407 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
| 2408 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
| 2408 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
| 2409 | 2409 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2410 | 2410 | if ($globalDebug) echo "Add to DB..."; |
| 2411 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
| 2411 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
| 2412 | 2412 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
| 2413 | 2413 | if ($error != '') { |
| 2414 | 2414 | return $error; |
| 2415 | 2415 | } elseif ($globalDebug) echo "Done\n"; |
| 2416 | 2416 | if ($globalMasterSource) { |
| 2417 | 2417 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
| 2418 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
| 2418 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
| 2419 | 2419 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2420 | 2420 | if ($globalDebug) echo "Add to DB..."; |
| 2421 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
| 2421 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
| 2422 | 2422 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
| 2423 | 2423 | if ($error != '') { |
| 2424 | 2424 | return $error; |
| 2425 | 2425 | } elseif ($globalDebug) echo "Done\n"; |
| 2426 | 2426 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
| 2427 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
| 2427 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
| 2428 | 2428 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2429 | 2429 | if ($globalDebug) echo "Add to DB..."; |
| 2430 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
| 2430 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
| 2431 | 2431 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
| 2432 | 2432 | if ($error != '') { |
| 2433 | 2433 | return $error; |
@@ -2440,7 +2440,7 @@ discard block |
||
| 2440 | 2440 | global $tmp_dir, $globalDebug; |
| 2441 | 2441 | $error = ''; |
| 2442 | 2442 | if ($globalDebug) echo "Translation : Download..."; |
| 2443 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
| 2443 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
| 2444 | 2444 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2445 | 2445 | if ($globalDebug) echo "Unzip..."; |
| 2446 | 2446 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2457,10 +2457,10 @@ discard block |
||
| 2457 | 2457 | global $tmp_dir, $globalDebug; |
| 2458 | 2458 | $error = ''; |
| 2459 | 2459 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
| 2460 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
| 2461 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
| 2460 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
| 2461 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
| 2462 | 2462 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2463 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2463 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
| 2464 | 2464 | $translation_md5 = $translation_md5_file[0]; |
| 2465 | 2465 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2466 | 2466 | if ($globalDebug) echo "Gunzip..."; |
@@ -2478,10 +2478,10 @@ discard block |
||
| 2478 | 2478 | global $tmp_dir, $globalDebug; |
| 2479 | 2479 | $error = ''; |
| 2480 | 2480 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
| 2481 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
| 2482 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
| 2481 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
| 2482 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
| 2483 | 2483 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2484 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2484 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
| 2485 | 2485 | $modes_md5 = $modes_md5_file[0]; |
| 2486 | 2486 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2487 | 2487 | if ($globalDebug) echo "Gunzip..."; |
@@ -2500,12 +2500,12 @@ discard block |
||
| 2500 | 2500 | global $tmp_dir, $globalDebug; |
| 2501 | 2501 | $error = ''; |
| 2502 | 2502 | if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
| 2503 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
| 2503 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
|
| 2504 | 2504 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2505 | - $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
| 2505 | + $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
| 2506 | 2506 | $airlines_md5 = $airlines_md5_file[0]; |
| 2507 | 2507 | if (!update_db::check_airlines_version($airlines_md5)) { |
| 2508 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
| 2508 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
|
| 2509 | 2509 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2510 | 2510 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2511 | 2511 | if ($globalDebug) echo "Gunzip..."; |
@@ -2530,14 +2530,14 @@ discard block |
||
| 2530 | 2530 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
| 2531 | 2531 | $error = ''; |
| 2532 | 2532 | if ($globalOwner === TRUE) { |
| 2533 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2534 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2533 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2534 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2535 | 2535 | } else { |
| 2536 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
| 2537 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
| 2536 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
| 2537 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
| 2538 | 2538 | } |
| 2539 | 2539 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
| 2540 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2540 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
| 2541 | 2541 | $owners_md5 = $owners_md5_file[0]; |
| 2542 | 2542 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2543 | 2543 | if ($globalDebug) echo "Gunzip..."; |
@@ -2554,10 +2554,10 @@ discard block |
||
| 2554 | 2554 | public static function update_routes_fam() { |
| 2555 | 2555 | global $tmp_dir, $globalDebug; |
| 2556 | 2556 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
| 2557 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
| 2558 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
| 2557 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
| 2558 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
| 2559 | 2559 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2560 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2560 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
| 2561 | 2561 | $routes_md5 = $routes_md5_file[0]; |
| 2562 | 2562 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2563 | 2563 | if ($globalDebug) echo "Gunzip..."; |
@@ -2574,10 +2574,10 @@ discard block |
||
| 2574 | 2574 | public static function update_block_fam() { |
| 2575 | 2575 | global $tmp_dir, $globalDebug; |
| 2576 | 2576 | if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
| 2577 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
|
| 2578 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
|
| 2577 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz'); |
|
| 2578 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5'); |
|
| 2579 | 2579 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2580 | - $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
| 2580 | + $block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
| 2581 | 2581 | $block_md5 = $block_md5_file[0]; |
| 2582 | 2582 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2583 | 2583 | if ($globalDebug) echo "Gunzip..."; |
@@ -2593,13 +2593,13 @@ discard block |
||
| 2593 | 2593 | } |
| 2594 | 2594 | public static function update_marine_identity_fam() { |
| 2595 | 2595 | global $tmp_dir, $globalDebug; |
| 2596 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2596 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
| 2597 | 2597 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
| 2598 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2598 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
| 2599 | 2599 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2600 | 2600 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2601 | 2601 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
| 2602 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
| 2602 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
| 2603 | 2603 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2604 | 2604 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2605 | 2605 | if ($globalDebug) echo "Gunzip..."; |
@@ -2621,13 +2621,13 @@ discard block |
||
| 2621 | 2621 | |
| 2622 | 2622 | public static function update_satellite_fam() { |
| 2623 | 2623 | global $tmp_dir, $globalDebug; |
| 2624 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2624 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
| 2625 | 2625 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
| 2626 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2626 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
| 2627 | 2627 | $satellite_md5 = $satellite_md5_file[0]; |
| 2628 | 2628 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2629 | 2629 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
| 2630 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
| 2630 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
| 2631 | 2631 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2632 | 2632 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2633 | 2633 | if ($globalDebug) echo "Gunzip..."; |
@@ -2649,7 +2649,7 @@ discard block |
||
| 2649 | 2649 | public static function update_banned_fam() { |
| 2650 | 2650 | global $tmp_dir, $globalDebug; |
| 2651 | 2651 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
| 2652 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
| 2652 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
| 2653 | 2653 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2654 | 2654 | //if ($globalDebug) echo "Gunzip..."; |
| 2655 | 2655 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2668,18 +2668,18 @@ discard block |
||
| 2668 | 2668 | $error = ''; |
| 2669 | 2669 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
| 2670 | 2670 | if ($globalDBdriver == 'mysql') { |
| 2671 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2671 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2672 | 2672 | } else { |
| 2673 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
| 2673 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
| 2674 | 2674 | } |
| 2675 | 2675 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
| 2676 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2676 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
| 2677 | 2677 | $airspace_md5 = $airspace_md5_file[0]; |
| 2678 | 2678 | if (!update_db::check_airspace_version($airspace_md5)) { |
| 2679 | 2679 | if ($globalDBdriver == 'mysql') { |
| 2680 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2680 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2681 | 2681 | } else { |
| 2682 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
| 2682 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
| 2683 | 2683 | } |
| 2684 | 2684 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2685 | 2685 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2692,7 +2692,7 @@ discard block |
||
| 2692 | 2692 | try { |
| 2693 | 2693 | $sth = $Connection->db->prepare($query); |
| 2694 | 2694 | $sth->execute(); |
| 2695 | - } catch(PDOException $e) { |
|
| 2695 | + } catch (PDOException $e) { |
|
| 2696 | 2696 | return "error : ".$e->getMessage(); |
| 2697 | 2697 | } |
| 2698 | 2698 | } |
@@ -2712,16 +2712,16 @@ discard block |
||
| 2712 | 2712 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2713 | 2713 | $error = ''; |
| 2714 | 2714 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
| 2715 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2715 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
| 2716 | 2716 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2717 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2717 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
| 2718 | 2718 | $geoid_md5 = $geoid_md5_file[0]; |
| 2719 | 2719 | if (!update_db::check_geoid_version($geoid_md5)) { |
| 2720 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2720 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
| 2721 | 2721 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2722 | 2722 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2723 | 2723 | if ($globalDebug) echo "Gunzip..."; |
| 2724 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2724 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
| 2725 | 2725 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2726 | 2726 | update_db::insert_geoid_version($geoid_md5); |
| 2727 | 2727 | } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
@@ -2738,15 +2738,15 @@ discard block |
||
| 2738 | 2738 | public static function update_tle() { |
| 2739 | 2739 | global $tmp_dir, $globalDebug; |
| 2740 | 2740 | if ($globalDebug) echo "Download TLE : Download..."; |
| 2741 | - $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', |
|
| 2742 | - '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', |
|
| 2743 | - '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'); |
|
| 2741 | + $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', |
|
| 2742 | + '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', |
|
| 2743 | + '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'); |
|
| 2744 | 2744 | foreach ($alltle as $filename) { |
| 2745 | 2745 | if ($globalDebug) echo "downloading ".$filename.'...'; |
| 2746 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
| 2746 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
| 2747 | 2747 | if (file_exists($tmp_dir.$filename)) { |
| 2748 | 2748 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
| 2749 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
| 2749 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
| 2750 | 2750 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
| 2751 | 2751 | if ($error != '') { |
| 2752 | 2752 | echo $error."\n"; |
@@ -2758,7 +2758,7 @@ discard block |
||
| 2758 | 2758 | public static function update_ucsdb() { |
| 2759 | 2759 | global $tmp_dir, $globalDebug; |
| 2760 | 2760 | if ($globalDebug) echo "Download UCS DB : Download..."; |
| 2761 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
| 2761 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt', $tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
|
| 2762 | 2762 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2763 | 2763 | if ($globalDebug) echo "Add to DB..."; |
| 2764 | 2764 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
@@ -2772,7 +2772,7 @@ discard block |
||
| 2772 | 2772 | public static function update_celestrak() { |
| 2773 | 2773 | global $tmp_dir, $globalDebug; |
| 2774 | 2774 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
| 2775 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
| 2775 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
| 2776 | 2776 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2777 | 2777 | if ($globalDebug) echo "Add to DB..."; |
| 2778 | 2778 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2791,62 +2791,62 @@ discard block |
||
| 2791 | 2791 | if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
| 2792 | 2792 | return ''; |
| 2793 | 2793 | } |
| 2794 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
| 2794 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
| 2795 | 2795 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2796 | 2796 | if ($globalDebug) echo "Check files...\n"; |
| 2797 | 2797 | $newmodelsdb = array(); |
| 2798 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
| 2799 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2798 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
| 2799 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2800 | 2800 | $model = trim($row[2]); |
| 2801 | 2801 | $newmodelsdb[$model] = trim($row[0]); |
| 2802 | 2802 | } |
| 2803 | 2803 | } |
| 2804 | 2804 | $modelsdb = array(); |
| 2805 | 2805 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
| 2806 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
| 2807 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2806 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
| 2807 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2808 | 2808 | $model = trim($row[2]); |
| 2809 | 2809 | $modelsdb[$model] = trim($row[0]); |
| 2810 | 2810 | } |
| 2811 | 2811 | } |
| 2812 | 2812 | } |
| 2813 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2813 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2814 | 2814 | foreach ($diff as $key => $value) { |
| 2815 | 2815 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2816 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
| 2816 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
| 2817 | 2817 | } |
| 2818 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2818 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
| 2819 | 2819 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2820 | 2820 | if ($error != '') { |
| 2821 | 2821 | return $error; |
| 2822 | 2822 | } elseif ($globalDebug) echo "Done\n"; |
| 2823 | 2823 | if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
| 2824 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
|
| 2824 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum'); |
|
| 2825 | 2825 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2826 | 2826 | if ($globalDebug) echo "Check files...\n"; |
| 2827 | 2827 | $newmodelsdb = array(); |
| 2828 | - if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
|
| 2829 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2828 | + if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) { |
|
| 2829 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2830 | 2830 | $model = trim($row[2]); |
| 2831 | 2831 | $newmodelsdb[$model] = trim($row[0]); |
| 2832 | 2832 | } |
| 2833 | 2833 | } |
| 2834 | 2834 | $modelsdb = array(); |
| 2835 | 2835 | if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) { |
| 2836 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) { |
|
| 2837 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2836 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) { |
|
| 2837 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2838 | 2838 | $model = trim($row[2]); |
| 2839 | 2839 | $modelsdb[$model] = trim($row[0]); |
| 2840 | 2840 | } |
| 2841 | 2841 | } |
| 2842 | 2842 | } |
| 2843 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2843 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2844 | 2844 | foreach ($diff as $key => $value) { |
| 2845 | 2845 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2846 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
|
| 2846 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key); |
|
| 2847 | 2847 | |
| 2848 | 2848 | } |
| 2849 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
| 2849 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
| 2850 | 2850 | } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
| 2851 | 2851 | if ($error != '') { |
| 2852 | 2852 | return $error; |
@@ -2862,32 +2862,32 @@ discard block |
||
| 2862 | 2862 | return ''; |
| 2863 | 2863 | } |
| 2864 | 2864 | if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
| 2865 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
|
| 2865 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum'); |
|
| 2866 | 2866 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
| 2867 | 2867 | if ($globalDebug) echo "Check files...\n"; |
| 2868 | 2868 | $newmodelsdb = array(); |
| 2869 | - if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
|
| 2870 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2869 | + if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) { |
|
| 2870 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2871 | 2871 | $model = trim($row[2]); |
| 2872 | 2872 | $newmodelsdb[$model] = trim($row[0]); |
| 2873 | 2873 | } |
| 2874 | 2874 | } |
| 2875 | 2875 | $modelsdb = array(); |
| 2876 | 2876 | if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) { |
| 2877 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) { |
|
| 2878 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2877 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) { |
|
| 2878 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2879 | 2879 | $model = trim($row[2]); |
| 2880 | 2880 | $modelsdb[$model] = trim($row[0]); |
| 2881 | 2881 | } |
| 2882 | 2882 | } |
| 2883 | 2883 | } |
| 2884 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2884 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2885 | 2885 | foreach ($diff as $key => $value) { |
| 2886 | 2886 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
| 2887 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
| 2887 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
| 2888 | 2888 | |
| 2889 | 2889 | } |
| 2890 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
| 2890 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
| 2891 | 2891 | } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
| 2892 | 2892 | if ($error != '') { |
| 2893 | 2893 | return $error; |
@@ -2899,32 +2899,32 @@ discard block |
||
| 2899 | 2899 | global $tmp_dir, $globalDebug; |
| 2900 | 2900 | $error = ''; |
| 2901 | 2901 | if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
| 2902 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
|
| 2902 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum'); |
|
| 2903 | 2903 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2904 | 2904 | if ($globalDebug) echo "Check files...\n"; |
| 2905 | 2905 | $newmodelsdb = array(); |
| 2906 | - if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
|
| 2907 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2906 | + if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) { |
|
| 2907 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2908 | 2908 | $model = trim($row[2]); |
| 2909 | 2909 | $newmodelsdb[$model] = trim($row[0]); |
| 2910 | 2910 | } |
| 2911 | 2911 | } |
| 2912 | 2912 | $modelsdb = array(); |
| 2913 | 2913 | if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) { |
| 2914 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) { |
|
| 2915 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2914 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) { |
|
| 2915 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2916 | 2916 | $model = trim($row[2]); |
| 2917 | 2917 | $modelsdb[$model] = trim($row[0]); |
| 2918 | 2918 | } |
| 2919 | 2919 | } |
| 2920 | 2920 | } |
| 2921 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2921 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2922 | 2922 | foreach ($diff as $key => $value) { |
| 2923 | 2923 | if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
| 2924 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
| 2924 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
| 2925 | 2925 | |
| 2926 | 2926 | } |
| 2927 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
| 2927 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
| 2928 | 2928 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2929 | 2929 | if ($error != '') { |
| 2930 | 2930 | return $error; |
@@ -2940,32 +2940,32 @@ discard block |
||
| 2940 | 2940 | return ''; |
| 2941 | 2941 | } |
| 2942 | 2942 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
| 2943 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
| 2943 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
| 2944 | 2944 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2945 | 2945 | if ($globalDebug) echo "Check files...\n"; |
| 2946 | 2946 | $newmodelsdb = array(); |
| 2947 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
| 2948 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2947 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
| 2948 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2949 | 2949 | $model = trim($row[2]); |
| 2950 | 2950 | $newmodelsdb[$model] = trim($row[0]); |
| 2951 | 2951 | } |
| 2952 | 2952 | } |
| 2953 | 2953 | $modelsdb = array(); |
| 2954 | 2954 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
| 2955 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
| 2956 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2955 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
| 2956 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2957 | 2957 | $model = trim($row[2]); |
| 2958 | 2958 | $modelsdb[$model] = trim($row[0]); |
| 2959 | 2959 | } |
| 2960 | 2960 | } |
| 2961 | 2961 | } |
| 2962 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 2962 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 2963 | 2963 | foreach ($diff as $key => $value) { |
| 2964 | 2964 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
| 2965 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
| 2965 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
| 2966 | 2966 | |
| 2967 | 2967 | } |
| 2968 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2968 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
| 2969 | 2969 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 2970 | 2970 | if ($error != '') { |
| 2971 | 2971 | return $error; |
@@ -2981,32 +2981,32 @@ discard block |
||
| 2981 | 2981 | return ''; |
| 2982 | 2982 | } |
| 2983 | 2983 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
| 2984 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
| 2984 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
| 2985 | 2985 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2986 | 2986 | if ($globalDebug) echo "Check files...\n"; |
| 2987 | 2987 | $newmodelsdb = array(); |
| 2988 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2989 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2988 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2989 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2990 | 2990 | $model = trim($row[2]); |
| 2991 | 2991 | $newmodelsdb[$model] = trim($row[0]); |
| 2992 | 2992 | } |
| 2993 | 2993 | } |
| 2994 | 2994 | $modelsdb = array(); |
| 2995 | 2995 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
| 2996 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
| 2997 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
| 2996 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
| 2997 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
| 2998 | 2998 | $model = trim($row[2]); |
| 2999 | 2999 | $modelsdb[$model] = trim($row[0]); |
| 3000 | 3000 | } |
| 3001 | 3001 | } |
| 3002 | 3002 | } |
| 3003 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
| 3003 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
| 3004 | 3004 | foreach ($diff as $key => $value) { |
| 3005 | 3005 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
| 3006 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 3006 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
| 3007 | 3007 | |
| 3008 | 3008 | } |
| 3009 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 3009 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
| 3010 | 3010 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
| 3011 | 3011 | if ($error != '') { |
| 3012 | 3012 | return $error; |
@@ -3018,8 +3018,8 @@ discard block |
||
| 3018 | 3018 | global $tmp_dir, $globalDebug; |
| 3019 | 3019 | date_default_timezone_set('UTC'); |
| 3020 | 3020 | $Common = new Common(); |
| 3021 | - $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes','post',array('X-Requested-With: XMLHttpRequest','Accept: application/json, text/javascript, */*; q=0.01','Host: www4.icao.int','Origin: https://www.icao.int','Content-Length: 0'),'','','https://www.icao.int/publications/DOC8643/Pages/Search.aspx',60); |
|
| 3022 | - $all = json_decode($data,true); |
|
| 3021 | + $data = $Common->getData('https://www4.icao.int/doc8643/External/AircraftTypes', 'post', array('X-Requested-With: XMLHttpRequest', 'Accept: application/json, text/javascript, */*; q=0.01', 'Host: www4.icao.int', 'Origin: https://www.icao.int', 'Content-Length: 0'), '', '', 'https://www.icao.int/publications/DOC8643/Pages/Search.aspx', 60); |
|
| 3022 | + $all = json_decode($data, true); |
|
| 3023 | 3023 | $Connection = new Connection(); |
| 3024 | 3024 | $querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao"; |
| 3025 | 3025 | $sth = $Connection->db->prepare($querychk); |
@@ -3031,8 +3031,8 @@ discard block |
||
| 3031 | 3031 | foreach ($all as $model) { |
| 3032 | 3032 | $icao = $model['Designator']; |
| 3033 | 3033 | if (!isset($allicao[$icao])) { |
| 3034 | - $aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png'; |
|
| 3035 | - $allicao[$icao] = array(':icao' => $icao,':type' => $model['ModelFullName'],':manufacturer' => $model['ManufacturerCode'],':aircraft_shadow' => $aircraft_shadow,':aircraft_description' => $model['AircraftDescription'],':engine_type' => $model['EngineType'],':engine_count' => $model['EngineCount'],':wake_category' => $model['WTC']); |
|
| 3034 | + $aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png'; |
|
| 3035 | + $allicao[$icao] = array(':icao' => $icao, ':type' => $model['ModelFullName'], ':manufacturer' => $model['ManufacturerCode'], ':aircraft_shadow' => $aircraft_shadow, ':aircraft_description' => $model['AircraftDescription'], ':engine_type' => $model['EngineType'], ':engine_count' => $model['EngineCount'], ':wake_category' => $model['WTC']); |
|
| 3036 | 3036 | } else { |
| 3037 | 3037 | $allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName']; |
| 3038 | 3038 | } |
@@ -3044,9 +3044,9 @@ discard block |
||
| 3044 | 3044 | if ($exist[0]['nb'] == 0) { |
| 3045 | 3045 | $sthins->execute($airdata); |
| 3046 | 3046 | } else { |
| 3047 | - $sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao)); |
|
| 3047 | + $sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao)); |
|
| 3048 | 3048 | } |
| 3049 | - } catch(PDOException $e) { |
|
| 3049 | + } catch (PDOException $e) { |
|
| 3050 | 3050 | return "error : ".$e->getMessage(); |
| 3051 | 3051 | } |
| 3052 | 3052 | } |
@@ -3078,23 +3078,23 @@ discard block |
||
| 3078 | 3078 | $Connection = new Connection(); |
| 3079 | 3079 | $sth = $Connection->db->prepare($query); |
| 3080 | 3080 | $sth->execute(); |
| 3081 | - } catch(PDOException $e) { |
|
| 3081 | + } catch (PDOException $e) { |
|
| 3082 | 3082 | return "error : ".$e->getMessage(); |
| 3083 | 3083 | } |
| 3084 | 3084 | |
| 3085 | 3085 | $error = ''; |
| 3086 | 3086 | if ($globalDebug) echo "Notam : Download..."; |
| 3087 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
| 3087 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
| 3088 | 3088 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3089 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
| 3089 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
| 3090 | 3090 | foreach ($notams['channel']['item'] as $notam) { |
| 3091 | - $title = explode(':',$notam['title']); |
|
| 3091 | + $title = explode(':', $notam['title']); |
|
| 3092 | 3092 | $data['ref'] = trim($title[0]); |
| 3093 | 3093 | unset($title[0]); |
| 3094 | - $data['title'] = trim(implode(':',$title)); |
|
| 3095 | - $description = strip_tags($notam['description'],'<pre>'); |
|
| 3096 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
| 3097 | - $q = explode('/',$match[1]); |
|
| 3094 | + $data['title'] = trim(implode(':', $title)); |
|
| 3095 | + $description = strip_tags($notam['description'], '<pre>'); |
|
| 3096 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
| 3097 | + $q = explode('/', $match[1]); |
|
| 3098 | 3098 | $data['fir'] = $q[0]; |
| 3099 | 3099 | $data['code'] = $q[1]; |
| 3100 | 3100 | $ifrvfr = $q[2]; |
@@ -3110,30 +3110,30 @@ discard block |
||
| 3110 | 3110 | $data['lower_limit'] = $q[5]; |
| 3111 | 3111 | $data['upper_limit'] = $q[6]; |
| 3112 | 3112 | $latlonrad = $q[7]; |
| 3113 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
| 3114 | - $latitude = $Common->convertDec($las,'latitude'); |
|
| 3115 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
| 3113 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
| 3114 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
| 3115 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
| 3116 | 3116 | if ($lac == 'S') $latitude = '-'.$latitude; |
| 3117 | 3117 | if ($lnc == 'W') $longitude = '-'.$longitude; |
| 3118 | 3118 | $data['center_latitude'] = $latitude; |
| 3119 | 3119 | $data['center_longitude'] = $longitude; |
| 3120 | 3120 | $data['radius'] = intval($radius); |
| 3121 | 3121 | |
| 3122 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
| 3122 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
| 3123 | 3123 | $data['text'] = $match[1]; |
| 3124 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
| 3124 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
| 3125 | 3125 | $fromto = $match[1]; |
| 3126 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
| 3126 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
| 3127 | 3127 | $fromall = trim($match[1]); |
| 3128 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
| 3128 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
| 3129 | 3129 | $from = trim($match[1]); |
| 3130 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
| 3131 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
| 3130 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
| 3131 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
| 3132 | 3132 | $toall = trim($match[1]); |
| 3133 | - if (!preg_match(':Permanent:',$toall)) { |
|
| 3134 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
| 3133 | + if (!preg_match(':Permanent:', $toall)) { |
|
| 3134 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
| 3135 | 3135 | $to = trim($match[1]); |
| 3136 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
| 3136 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
| 3137 | 3137 | $data['permanent'] = 0; |
| 3138 | 3138 | } else { |
| 3139 | 3139 | $data['date_end'] = NULL; |
@@ -3141,7 +3141,7 @@ discard block |
||
| 3141 | 3141 | } |
| 3142 | 3142 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
| 3143 | 3143 | $NOTAM = new NOTAM(); |
| 3144 | - $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']); |
|
| 3144 | + $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']); |
|
| 3145 | 3145 | unset($data); |
| 3146 | 3146 | } |
| 3147 | 3147 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -3164,16 +3164,16 @@ discard block |
||
| 3164 | 3164 | $Connection = new Connection(); |
| 3165 | 3165 | $sth = $Connection->db->prepare($query); |
| 3166 | 3166 | $sth->execute(); |
| 3167 | - } catch(PDOException $e) { |
|
| 3167 | + } catch (PDOException $e) { |
|
| 3168 | 3168 | return "error : ".$e->getMessage(); |
| 3169 | 3169 | } |
| 3170 | 3170 | } |
| 3171 | 3171 | $Common = new Common(); |
| 3172 | 3172 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3173 | - $airspace_json = json_decode($airspace_lst,true); |
|
| 3173 | + $airspace_json = json_decode($airspace_lst, true); |
|
| 3174 | 3174 | foreach ($airspace_json['records'] as $airspace) { |
| 3175 | 3175 | if ($globalDebug) echo $airspace['name']."...\n"; |
| 3176 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
| 3176 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
| 3177 | 3177 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3178 | 3178 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
| 3179 | 3179 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -3195,7 +3195,7 @@ discard block |
||
| 3195 | 3195 | $Connection = new Connection(); |
| 3196 | 3196 | $sth = $Connection->db->prepare($query); |
| 3197 | 3197 | $sth->execute(array(':new' => $new, ':old' => $old)); |
| 3198 | - } catch(PDOException $e) { |
|
| 3198 | + } catch (PDOException $e) { |
|
| 3199 | 3199 | return "error : ".$e->getMessage(); |
| 3200 | 3200 | } |
| 3201 | 3201 | } |
@@ -3212,7 +3212,7 @@ discard block |
||
| 3212 | 3212 | $Connection = new Connection(); |
| 3213 | 3213 | $sth = $Connection->db->prepare($query); |
| 3214 | 3214 | $sth->execute(); |
| 3215 | - } catch(PDOException $e) { |
|
| 3215 | + } catch (PDOException $e) { |
|
| 3216 | 3216 | return "error : ".$e->getMessage(); |
| 3217 | 3217 | } |
| 3218 | 3218 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3227,7 +3227,7 @@ discard block |
||
| 3227 | 3227 | $Connection = new Connection(); |
| 3228 | 3228 | $sth = $Connection->db->prepare($query); |
| 3229 | 3229 | $sth->execute(); |
| 3230 | - } catch(PDOException $e) { |
|
| 3230 | + } catch (PDOException $e) { |
|
| 3231 | 3231 | return "error : ".$e->getMessage(); |
| 3232 | 3232 | } |
| 3233 | 3233 | } |
@@ -3238,7 +3238,7 @@ discard block |
||
| 3238 | 3238 | $Connection = new Connection(); |
| 3239 | 3239 | $sth = $Connection->db->prepare($query); |
| 3240 | 3240 | $sth->execute(array(':version' => $version)); |
| 3241 | - } catch(PDOException $e) { |
|
| 3241 | + } catch (PDOException $e) { |
|
| 3242 | 3242 | return "error : ".$e->getMessage(); |
| 3243 | 3243 | } |
| 3244 | 3244 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3252,7 +3252,7 @@ discard block |
||
| 3252 | 3252 | $Connection = new Connection(); |
| 3253 | 3253 | $sth = $Connection->db->prepare($query); |
| 3254 | 3254 | $sth->execute(array(':version' => $version)); |
| 3255 | - } catch(PDOException $e) { |
|
| 3255 | + } catch (PDOException $e) { |
|
| 3256 | 3256 | return "error : ".$e->getMessage(); |
| 3257 | 3257 | } |
| 3258 | 3258 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3266,7 +3266,7 @@ discard block |
||
| 3266 | 3266 | $Connection = new Connection(); |
| 3267 | 3267 | $sth = $Connection->db->prepare($query); |
| 3268 | 3268 | $sth->execute(array(':version' => $version)); |
| 3269 | - } catch(PDOException $e) { |
|
| 3269 | + } catch (PDOException $e) { |
|
| 3270 | 3270 | return "error : ".$e->getMessage(); |
| 3271 | 3271 | } |
| 3272 | 3272 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3280,7 +3280,7 @@ discard block |
||
| 3280 | 3280 | $Connection = new Connection(); |
| 3281 | 3281 | $sth = $Connection->db->prepare($query); |
| 3282 | 3282 | $sth->execute(array(':version' => $version)); |
| 3283 | - } catch(PDOException $e) { |
|
| 3283 | + } catch (PDOException $e) { |
|
| 3284 | 3284 | return "error : ".$e->getMessage(); |
| 3285 | 3285 | } |
| 3286 | 3286 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3294,7 +3294,7 @@ discard block |
||
| 3294 | 3294 | $Connection = new Connection(); |
| 3295 | 3295 | $sth = $Connection->db->prepare($query); |
| 3296 | 3296 | $sth->execute(array(':version' => $version)); |
| 3297 | - } catch(PDOException $e) { |
|
| 3297 | + } catch (PDOException $e) { |
|
| 3298 | 3298 | return "error : ".$e->getMessage(); |
| 3299 | 3299 | } |
| 3300 | 3300 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3308,7 +3308,7 @@ discard block |
||
| 3308 | 3308 | $Connection = new Connection(); |
| 3309 | 3309 | $sth = $Connection->db->prepare($query); |
| 3310 | 3310 | $sth->execute(array(':version' => $version)); |
| 3311 | - } catch(PDOException $e) { |
|
| 3311 | + } catch (PDOException $e) { |
|
| 3312 | 3312 | return "error : ".$e->getMessage(); |
| 3313 | 3313 | } |
| 3314 | 3314 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3323,7 +3323,7 @@ discard block |
||
| 3323 | 3323 | $Connection = new Connection(); |
| 3324 | 3324 | $sth = $Connection->db->prepare($query); |
| 3325 | 3325 | $sth->execute(array(':version' => $version)); |
| 3326 | - } catch(PDOException $e) { |
|
| 3326 | + } catch (PDOException $e) { |
|
| 3327 | 3327 | return "error : ".$e->getMessage(); |
| 3328 | 3328 | } |
| 3329 | 3329 | } |
@@ -3335,7 +3335,7 @@ discard block |
||
| 3335 | 3335 | $Connection = new Connection(); |
| 3336 | 3336 | $sth = $Connection->db->prepare($query); |
| 3337 | 3337 | $sth->execute(array(':version' => $version)); |
| 3338 | - } catch(PDOException $e) { |
|
| 3338 | + } catch (PDOException $e) { |
|
| 3339 | 3339 | return "error : ".$e->getMessage(); |
| 3340 | 3340 | } |
| 3341 | 3341 | } |
@@ -3347,7 +3347,7 @@ discard block |
||
| 3347 | 3347 | $Connection = new Connection(); |
| 3348 | 3348 | $sth = $Connection->db->prepare($query); |
| 3349 | 3349 | $sth->execute(array(':version' => $version)); |
| 3350 | - } catch(PDOException $e) { |
|
| 3350 | + } catch (PDOException $e) { |
|
| 3351 | 3351 | return "error : ".$e->getMessage(); |
| 3352 | 3352 | } |
| 3353 | 3353 | } |
@@ -3359,7 +3359,7 @@ discard block |
||
| 3359 | 3359 | $Connection = new Connection(); |
| 3360 | 3360 | $sth = $Connection->db->prepare($query); |
| 3361 | 3361 | $sth->execute(array(':version' => $version)); |
| 3362 | - } catch(PDOException $e) { |
|
| 3362 | + } catch (PDOException $e) { |
|
| 3363 | 3363 | return "error : ".$e->getMessage(); |
| 3364 | 3364 | } |
| 3365 | 3365 | } |
@@ -3371,7 +3371,7 @@ discard block |
||
| 3371 | 3371 | $Connection = new Connection(); |
| 3372 | 3372 | $sth = $Connection->db->prepare($query); |
| 3373 | 3373 | $sth->execute(array(':version' => $version)); |
| 3374 | - } catch(PDOException $e) { |
|
| 3374 | + } catch (PDOException $e) { |
|
| 3375 | 3375 | return "error : ".$e->getMessage(); |
| 3376 | 3376 | } |
| 3377 | 3377 | } |
@@ -3383,7 +3383,7 @@ discard block |
||
| 3383 | 3383 | $Connection = new Connection(); |
| 3384 | 3384 | $sth = $Connection->db->prepare($query); |
| 3385 | 3385 | $sth->execute(array(':version' => $version)); |
| 3386 | - } catch(PDOException $e) { |
|
| 3386 | + } catch (PDOException $e) { |
|
| 3387 | 3387 | return "error : ".$e->getMessage(); |
| 3388 | 3388 | } |
| 3389 | 3389 | } |
@@ -3399,7 +3399,7 @@ discard block |
||
| 3399 | 3399 | $Connection = new Connection(); |
| 3400 | 3400 | $sth = $Connection->db->prepare($query); |
| 3401 | 3401 | $sth->execute(); |
| 3402 | - } catch(PDOException $e) { |
|
| 3402 | + } catch (PDOException $e) { |
|
| 3403 | 3403 | return "error : ".$e->getMessage(); |
| 3404 | 3404 | } |
| 3405 | 3405 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3414,7 +3414,7 @@ discard block |
||
| 3414 | 3414 | $Connection = new Connection(); |
| 3415 | 3415 | $sth = $Connection->db->prepare($query); |
| 3416 | 3416 | $sth->execute(); |
| 3417 | - } catch(PDOException $e) { |
|
| 3417 | + } catch (PDOException $e) { |
|
| 3418 | 3418 | return "error : ".$e->getMessage(); |
| 3419 | 3419 | } |
| 3420 | 3420 | } |
@@ -3430,7 +3430,7 @@ discard block |
||
| 3430 | 3430 | $Connection = new Connection(); |
| 3431 | 3431 | $sth = $Connection->db->prepare($query); |
| 3432 | 3432 | $sth->execute(); |
| 3433 | - } catch(PDOException $e) { |
|
| 3433 | + } catch (PDOException $e) { |
|
| 3434 | 3434 | return "error : ".$e->getMessage(); |
| 3435 | 3435 | } |
| 3436 | 3436 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3445,7 +3445,7 @@ discard block |
||
| 3445 | 3445 | $Connection = new Connection(); |
| 3446 | 3446 | $sth = $Connection->db->prepare($query); |
| 3447 | 3447 | $sth->execute(); |
| 3448 | - } catch(PDOException $e) { |
|
| 3448 | + } catch (PDOException $e) { |
|
| 3449 | 3449 | return "error : ".$e->getMessage(); |
| 3450 | 3450 | } |
| 3451 | 3451 | } |
@@ -3461,7 +3461,7 @@ discard block |
||
| 3461 | 3461 | $Connection = new Connection(); |
| 3462 | 3462 | $sth = $Connection->db->prepare($query); |
| 3463 | 3463 | $sth->execute(); |
| 3464 | - } catch(PDOException $e) { |
|
| 3464 | + } catch (PDOException $e) { |
|
| 3465 | 3465 | return "error : ".$e->getMessage(); |
| 3466 | 3466 | } |
| 3467 | 3467 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3476,7 +3476,7 @@ discard block |
||
| 3476 | 3476 | $Connection = new Connection(); |
| 3477 | 3477 | $sth = $Connection->db->prepare($query); |
| 3478 | 3478 | $sth->execute(); |
| 3479 | - } catch(PDOException $e) { |
|
| 3479 | + } catch (PDOException $e) { |
|
| 3480 | 3480 | return "error : ".$e->getMessage(); |
| 3481 | 3481 | } |
| 3482 | 3482 | } |
@@ -3492,7 +3492,7 @@ discard block |
||
| 3492 | 3492 | $Connection = new Connection(); |
| 3493 | 3493 | $sth = $Connection->db->prepare($query); |
| 3494 | 3494 | $sth->execute(); |
| 3495 | - } catch(PDOException $e) { |
|
| 3495 | + } catch (PDOException $e) { |
|
| 3496 | 3496 | return "error : ".$e->getMessage(); |
| 3497 | 3497 | } |
| 3498 | 3498 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3507,7 +3507,7 @@ discard block |
||
| 3507 | 3507 | $Connection = new Connection(); |
| 3508 | 3508 | $sth = $Connection->db->prepare($query); |
| 3509 | 3509 | $sth->execute(); |
| 3510 | - } catch(PDOException $e) { |
|
| 3510 | + } catch (PDOException $e) { |
|
| 3511 | 3511 | return "error : ".$e->getMessage(); |
| 3512 | 3512 | } |
| 3513 | 3513 | } |
@@ -3523,7 +3523,7 @@ discard block |
||
| 3523 | 3523 | $Connection = new Connection(); |
| 3524 | 3524 | $sth = $Connection->db->prepare($query); |
| 3525 | 3525 | $sth->execute(); |
| 3526 | - } catch(PDOException $e) { |
|
| 3526 | + } catch (PDOException $e) { |
|
| 3527 | 3527 | return "error : ".$e->getMessage(); |
| 3528 | 3528 | } |
| 3529 | 3529 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3538,7 +3538,7 @@ discard block |
||
| 3538 | 3538 | $Connection = new Connection(); |
| 3539 | 3539 | $sth = $Connection->db->prepare($query); |
| 3540 | 3540 | $sth->execute(); |
| 3541 | - } catch(PDOException $e) { |
|
| 3541 | + } catch (PDOException $e) { |
|
| 3542 | 3542 | return "error : ".$e->getMessage(); |
| 3543 | 3543 | } |
| 3544 | 3544 | } |
@@ -3554,7 +3554,7 @@ discard block |
||
| 3554 | 3554 | $Connection = new Connection(); |
| 3555 | 3555 | $sth = $Connection->db->prepare($query); |
| 3556 | 3556 | $sth->execute(); |
| 3557 | - } catch(PDOException $e) { |
|
| 3557 | + } catch (PDOException $e) { |
|
| 3558 | 3558 | return "error : ".$e->getMessage(); |
| 3559 | 3559 | } |
| 3560 | 3560 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3569,7 +3569,7 @@ discard block |
||
| 3569 | 3569 | $Connection = new Connection(); |
| 3570 | 3570 | $sth = $Connection->db->prepare($query); |
| 3571 | 3571 | $sth->execute(); |
| 3572 | - } catch(PDOException $e) { |
|
| 3572 | + } catch (PDOException $e) { |
|
| 3573 | 3573 | return "error : ".$e->getMessage(); |
| 3574 | 3574 | } |
| 3575 | 3575 | } |
@@ -3585,7 +3585,7 @@ discard block |
||
| 3585 | 3585 | $Connection = new Connection(); |
| 3586 | 3586 | $sth = $Connection->db->prepare($query); |
| 3587 | 3587 | $sth->execute(); |
| 3588 | - } catch(PDOException $e) { |
|
| 3588 | + } catch (PDOException $e) { |
|
| 3589 | 3589 | return "error : ".$e->getMessage(); |
| 3590 | 3590 | } |
| 3591 | 3591 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3600,7 +3600,7 @@ discard block |
||
| 3600 | 3600 | $Connection = new Connection(); |
| 3601 | 3601 | $sth = $Connection->db->prepare($query); |
| 3602 | 3602 | $sth->execute(); |
| 3603 | - } catch(PDOException $e) { |
|
| 3603 | + } catch (PDOException $e) { |
|
| 3604 | 3604 | return "error : ".$e->getMessage(); |
| 3605 | 3605 | } |
| 3606 | 3606 | } |
@@ -3616,7 +3616,7 @@ discard block |
||
| 3616 | 3616 | $Connection = new Connection(); |
| 3617 | 3617 | $sth = $Connection->db->prepare($query); |
| 3618 | 3618 | $sth->execute(); |
| 3619 | - } catch(PDOException $e) { |
|
| 3619 | + } catch (PDOException $e) { |
|
| 3620 | 3620 | return "error : ".$e->getMessage(); |
| 3621 | 3621 | } |
| 3622 | 3622 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3631,7 +3631,7 @@ discard block |
||
| 3631 | 3631 | $Connection = new Connection(); |
| 3632 | 3632 | $sth = $Connection->db->prepare($query); |
| 3633 | 3633 | $sth->execute(); |
| 3634 | - } catch(PDOException $e) { |
|
| 3634 | + } catch (PDOException $e) { |
|
| 3635 | 3635 | return "error : ".$e->getMessage(); |
| 3636 | 3636 | } |
| 3637 | 3637 | } |
@@ -3647,7 +3647,7 @@ discard block |
||
| 3647 | 3647 | $Connection = new Connection(); |
| 3648 | 3648 | $sth = $Connection->db->prepare($query); |
| 3649 | 3649 | $sth->execute(); |
| 3650 | - } catch(PDOException $e) { |
|
| 3650 | + } catch (PDOException $e) { |
|
| 3651 | 3651 | return "error : ".$e->getMessage(); |
| 3652 | 3652 | } |
| 3653 | 3653 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3662,7 +3662,7 @@ discard block |
||
| 3662 | 3662 | $Connection = new Connection(); |
| 3663 | 3663 | $sth = $Connection->db->prepare($query); |
| 3664 | 3664 | $sth->execute(); |
| 3665 | - } catch(PDOException $e) { |
|
| 3665 | + } catch (PDOException $e) { |
|
| 3666 | 3666 | return "error : ".$e->getMessage(); |
| 3667 | 3667 | } |
| 3668 | 3668 | } |
@@ -3678,7 +3678,7 @@ discard block |
||
| 3678 | 3678 | $Connection = new Connection(); |
| 3679 | 3679 | $sth = $Connection->db->prepare($query); |
| 3680 | 3680 | $sth->execute(); |
| 3681 | - } catch(PDOException $e) { |
|
| 3681 | + } catch (PDOException $e) { |
|
| 3682 | 3682 | return "error : ".$e->getMessage(); |
| 3683 | 3683 | } |
| 3684 | 3684 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3693,7 +3693,7 @@ discard block |
||
| 3693 | 3693 | $Connection = new Connection(); |
| 3694 | 3694 | $sth = $Connection->db->prepare($query); |
| 3695 | 3695 | $sth->execute(); |
| 3696 | - } catch(PDOException $e) { |
|
| 3696 | + } catch (PDOException $e) { |
|
| 3697 | 3697 | return "error : ".$e->getMessage(); |
| 3698 | 3698 | } |
| 3699 | 3699 | } |
@@ -3709,7 +3709,7 @@ discard block |
||
| 3709 | 3709 | $Connection = new Connection(); |
| 3710 | 3710 | $sth = $Connection->db->prepare($query); |
| 3711 | 3711 | $sth->execute(); |
| 3712 | - } catch(PDOException $e) { |
|
| 3712 | + } catch (PDOException $e) { |
|
| 3713 | 3713 | return "error : ".$e->getMessage(); |
| 3714 | 3714 | } |
| 3715 | 3715 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3728,7 +3728,7 @@ discard block |
||
| 3728 | 3728 | $Connection = new Connection(); |
| 3729 | 3729 | $sth = $Connection->db->prepare($query); |
| 3730 | 3730 | $sth->execute(); |
| 3731 | - } catch(PDOException $e) { |
|
| 3731 | + } catch (PDOException $e) { |
|
| 3732 | 3732 | return "error : ".$e->getMessage(); |
| 3733 | 3733 | } |
| 3734 | 3734 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3743,7 +3743,7 @@ discard block |
||
| 3743 | 3743 | $Connection = new Connection(); |
| 3744 | 3744 | $sth = $Connection->db->prepare($query); |
| 3745 | 3745 | $sth->execute(); |
| 3746 | - } catch(PDOException $e) { |
|
| 3746 | + } catch (PDOException $e) { |
|
| 3747 | 3747 | return "error : ".$e->getMessage(); |
| 3748 | 3748 | } |
| 3749 | 3749 | } |
@@ -3755,7 +3755,7 @@ discard block |
||
| 3755 | 3755 | $Connection = new Connection(); |
| 3756 | 3756 | $sth = $Connection->db->prepare($query); |
| 3757 | 3757 | $sth->execute(); |
| 3758 | - } catch(PDOException $e) { |
|
| 3758 | + } catch (PDOException $e) { |
|
| 3759 | 3759 | return "error : ".$e->getMessage(); |
| 3760 | 3760 | } |
| 3761 | 3761 | } |
@@ -3771,7 +3771,7 @@ discard block |
||
| 3771 | 3771 | $Connection = new Connection(); |
| 3772 | 3772 | $sth = $Connection->db->prepare($query); |
| 3773 | 3773 | $sth->execute(); |
| 3774 | - } catch(PDOException $e) { |
|
| 3774 | + } catch (PDOException $e) { |
|
| 3775 | 3775 | return "error : ".$e->getMessage(); |
| 3776 | 3776 | } |
| 3777 | 3777 | } |
@@ -3786,7 +3786,7 @@ discard block |
||
| 3786 | 3786 | $Connection = new Connection(); |
| 3787 | 3787 | $sth = $Connection->db->prepare($query); |
| 3788 | 3788 | $sth->execute(); |
| 3789 | - } catch(PDOException $e) { |
|
| 3789 | + } catch (PDOException $e) { |
|
| 3790 | 3790 | return "error : ".$e->getMessage(); |
| 3791 | 3791 | } |
| 3792 | 3792 | } |
@@ -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 | } |
@@ -1302,7 +1461,9 @@ discard block |
||
| 1302 | 1461 | if (($handle = fopen($tmp_dir.'block.tsv', 'r')) !== FALSE) |
| 1303 | 1462 | { |
| 1304 | 1463 | $i = 0; |
| 1305 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1464 | + if ($globalTransaction) { |
|
| 1465 | + $Connection->db->beginTransaction(); |
|
| 1466 | + } |
|
| 1306 | 1467 | while (($data = fgets($handle, 1000)) !== FALSE) |
| 1307 | 1468 | { |
| 1308 | 1469 | $query = 'INSERT INTO aircraft_block (callSign,Source) VALUES (:callSign,:source)'; |
@@ -1310,18 +1471,24 @@ discard block |
||
| 1310 | 1471 | $sth = $Connection->db->prepare($query); |
| 1311 | 1472 | $sth->execute(array(':callSign' => trim($data),':source' => 'website_fam')); |
| 1312 | 1473 | } catch(PDOException $e) { |
| 1313 | - if ($globalDebug) echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1474 | + if ($globalDebug) { |
|
| 1475 | + echo "error: ".$e->getMessage()." - data: ".$data; |
|
| 1476 | + } |
|
| 1314 | 1477 | die(); |
| 1315 | 1478 | } |
| 1316 | 1479 | if ($globalTransaction && $i % 2000 == 0) { |
| 1317 | 1480 | $Connection->db->commit(); |
| 1318 | - if ($globalDebug) echo '.'; |
|
| 1481 | + if ($globalDebug) { |
|
| 1482 | + echo '.'; |
|
| 1483 | + } |
|
| 1319 | 1484 | $Connection->db->beginTransaction(); |
| 1320 | 1485 | } |
| 1321 | 1486 | $i++; |
| 1322 | 1487 | } |
| 1323 | 1488 | fclose($handle); |
| 1324 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1489 | + if ($globalTransaction) { |
|
| 1490 | + $Connection->db->commit(); |
|
| 1491 | + } |
|
| 1325 | 1492 | } |
| 1326 | 1493 | return ''; |
| 1327 | 1494 | } |
@@ -1346,7 +1513,9 @@ discard block |
||
| 1346 | 1513 | $i = 0; |
| 1347 | 1514 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
| 1348 | 1515 | //$Connection->db->beginTransaction(); |
| 1349 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1516 | + if ($globalTransaction) { |
|
| 1517 | + $Connection->db->beginTransaction(); |
|
| 1518 | + } |
|
| 1350 | 1519 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1351 | 1520 | { |
| 1352 | 1521 | if ($i > 0) { |
@@ -1362,7 +1531,9 @@ discard block |
||
| 1362 | 1531 | $i++; |
| 1363 | 1532 | } |
| 1364 | 1533 | fclose($handle); |
| 1365 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1534 | + if ($globalTransaction) { |
|
| 1535 | + $Connection->db->commit(); |
|
| 1536 | + } |
|
| 1366 | 1537 | } |
| 1367 | 1538 | return ''; |
| 1368 | 1539 | } |
@@ -1382,7 +1553,9 @@ discard block |
||
| 1382 | 1553 | if (($handle = fopen($tmp_dir.'satellite.tsv', 'r')) !== FALSE) |
| 1383 | 1554 | { |
| 1384 | 1555 | $i = 0; |
| 1385 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1556 | + if ($globalTransaction) { |
|
| 1557 | + $Connection->db->beginTransaction(); |
|
| 1558 | + } |
|
| 1386 | 1559 | while (($data = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1387 | 1560 | { |
| 1388 | 1561 | if ($i > 0) { |
@@ -1399,7 +1572,9 @@ discard block |
||
| 1399 | 1572 | $i++; |
| 1400 | 1573 | } |
| 1401 | 1574 | fclose($handle); |
| 1402 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1575 | + if ($globalTransaction) { |
|
| 1576 | + $Connection->db->commit(); |
|
| 1577 | + } |
|
| 1403 | 1578 | } |
| 1404 | 1579 | return ''; |
| 1405 | 1580 | } |
@@ -1418,7 +1593,9 @@ discard block |
||
| 1418 | 1593 | $Connection = new Connection(); |
| 1419 | 1594 | if (($handle = fopen($tmp_dir.'ban_eu.csv', 'r')) !== FALSE) |
| 1420 | 1595 | { |
| 1421 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 1596 | + if ($globalTransaction) { |
|
| 1597 | + $Connection->db->beginTransaction(); |
|
| 1598 | + } |
|
| 1422 | 1599 | while (($data = fgetcsv($handle, 1000)) !== FALSE) |
| 1423 | 1600 | { |
| 1424 | 1601 | $query = 'UPDATE airlines SET ban_eu = 1 WHERE icao = :icao AND forsource IS NULL'; |
@@ -1433,7 +1610,9 @@ discard block |
||
| 1433 | 1610 | } |
| 1434 | 1611 | } |
| 1435 | 1612 | fclose($handle); |
| 1436 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 1613 | + if ($globalTransaction) { |
|
| 1614 | + $Connection->db->commit(); |
|
| 1615 | + } |
|
| 1437 | 1616 | } |
| 1438 | 1617 | return ''; |
| 1439 | 1618 | } |
@@ -1511,9 +1690,14 @@ discard block |
||
| 1511 | 1690 | if ($i > 0 && $data[0] != '') { |
| 1512 | 1691 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
| 1513 | 1692 | $period = str_replace(',','',$data[14]); |
| 1514 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
| 1515 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1516 | - else $launch_date = NULL; |
|
| 1693 | + if (!empty($period) && strpos($period,'days')) { |
|
| 1694 | + $period = str_replace(' days','',$period)*24*60; |
|
| 1695 | + } |
|
| 1696 | + if ($data[18] != '') { |
|
| 1697 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
| 1698 | + } else { |
|
| 1699 | + $launch_date = NULL; |
|
| 1700 | + } |
|
| 1517 | 1701 | $data = array_map(function($value) { |
| 1518 | 1702 | return trim($value) === '' ? null : $value; |
| 1519 | 1703 | }, $data); |
@@ -1876,7 +2060,9 @@ discard block |
||
| 1876 | 2060 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1877 | 2061 | { |
| 1878 | 2062 | $i = 0; |
| 1879 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2063 | + if ($globalTransaction) { |
|
| 2064 | + $Connection->db->beginTransaction(); |
|
| 2065 | + } |
|
| 1880 | 2066 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1881 | 2067 | { |
| 1882 | 2068 | $i++; |
@@ -1904,7 +2090,9 @@ discard block |
||
| 1904 | 2090 | } |
| 1905 | 2091 | } |
| 1906 | 2092 | fclose($handle); |
| 1907 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2093 | + if ($globalTransaction) { |
|
| 2094 | + $Connection->db->commit(); |
|
| 2095 | + } |
|
| 1908 | 2096 | } |
| 1909 | 2097 | return ''; |
| 1910 | 2098 | } |
@@ -1920,7 +2108,9 @@ discard block |
||
| 1920 | 2108 | $Source->deleteLocationByType('fires'); |
| 1921 | 2109 | $i = 0; |
| 1922 | 2110 | if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
| 1923 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2111 | + if ($globalTransaction) { |
|
| 2112 | + $Connection->db->beginTransaction(); |
|
| 2113 | + } |
|
| 1924 | 2114 | while (($row = fgetcsv($handle,1000)) !== false) { |
| 1925 | 2115 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
| 1926 | 2116 | $description = array('bright_t14' => $row[2],'scan' => $row[3],'track' => $row[4],'sat' => $row[7],'confidence' => $row[8],'version' => $row[9],'bright_t15' => $row[10],'frp' => $row[11],'daynight' => $row[12]); |
@@ -1935,7 +2125,9 @@ discard block |
||
| 1935 | 2125 | } |
| 1936 | 2126 | $i++; |
| 1937 | 2127 | } |
| 1938 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2128 | + if ($globalTransaction) { |
|
| 2129 | + $Connection->db->commit(); |
|
| 2130 | + } |
|
| 1939 | 2131 | } |
| 1940 | 2132 | } |
| 1941 | 2133 | |
@@ -1956,7 +2148,9 @@ discard block |
||
| 1956 | 2148 | $Connection = new Connection(); |
| 1957 | 2149 | if (($handle = fopen($filename, 'r')) !== FALSE) |
| 1958 | 2150 | { |
| 1959 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
| 2151 | + if ($globalTransaction) { |
|
| 2152 | + $Connection->db->beginTransaction(); |
|
| 2153 | + } |
|
| 1960 | 2154 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
| 1961 | 2155 | { |
| 1962 | 2156 | if(count($row) > 1) { |
@@ -1970,7 +2164,9 @@ discard block |
||
| 1970 | 2164 | } |
| 1971 | 2165 | } |
| 1972 | 2166 | fclose($handle); |
| 1973 | - if ($globalTransaction) $Connection->db->commit(); |
|
| 2167 | + if ($globalTransaction) { |
|
| 2168 | + $Connection->db->commit(); |
|
| 2169 | + } |
|
| 1974 | 2170 | } |
| 1975 | 2171 | return ''; |
| 1976 | 2172 | } |
@@ -1990,8 +2186,9 @@ discard block |
||
| 1990 | 2186 | } |
| 1991 | 2187 | |
| 1992 | 2188 | |
| 1993 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 1994 | - else { |
|
| 2189 | + if ($globalDBdriver == 'mysql') { |
|
| 2190 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
| 2191 | + } else { |
|
| 1995 | 2192 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
| 1996 | 2193 | $query = "CREATE EXTENSION postgis"; |
| 1997 | 2194 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -2010,7 +2207,9 @@ discard block |
||
| 2010 | 2207 | global $tmp_dir, $globalDebug; |
| 2011 | 2208 | include_once('class.create_db.php'); |
| 2012 | 2209 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
| 2013 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2210 | + if ($globalDebug) { |
|
| 2211 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
| 2212 | + } |
|
| 2014 | 2213 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
| 2015 | 2214 | $error = ''; |
| 2016 | 2215 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2020,20 +2219,34 @@ discard block |
||
| 2020 | 2219 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
| 2021 | 2220 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
| 2022 | 2221 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
| 2023 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2222 | + if ($globalDebug) { |
|
| 2223 | + echo "Gunzip..."; |
|
| 2224 | + } |
|
| 2024 | 2225 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
| 2025 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2226 | + if ($globalDebug) { |
|
| 2227 | + echo "Add to DB..."; |
|
| 2228 | + } |
|
| 2026 | 2229 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
| 2027 | 2230 | $NOTAM = new NOTAM(); |
| 2028 | 2231 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
| 2029 | 2232 | update_db::insert_notam_version($notam_md5); |
| 2030 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2031 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2032 | - } elseif ($globalDebug) echo "No new version."; |
|
| 2033 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2233 | + } else { |
|
| 2234 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
| 2235 | + } |
|
| 2236 | + } else { |
|
| 2237 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
| 2238 | + } |
|
| 2239 | + } elseif ($globalDebug) { |
|
| 2240 | + echo "No new version."; |
|
| 2241 | + } |
|
| 2242 | + } else { |
|
| 2243 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
| 2244 | + } |
|
| 2034 | 2245 | if ($error != '') { |
| 2035 | 2246 | return $error; |
| 2036 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2247 | + } elseif ($globalDebug) { |
|
| 2248 | + echo "Done\n"; |
|
| 2249 | + } |
|
| 2037 | 2250 | return ''; |
| 2038 | 2251 | } |
| 2039 | 2252 | |
@@ -2088,68 +2301,114 @@ discard block |
||
| 2088 | 2301 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
| 2089 | 2302 | if (extension_loaded('zip')) { |
| 2090 | 2303 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
| 2091 | - if ($globalDebug) echo "Unzip..."; |
|
| 2304 | + if ($globalDebug) { |
|
| 2305 | + echo "Unzip..."; |
|
| 2306 | + } |
|
| 2092 | 2307 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
| 2093 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2308 | + if ($globalDebug) { |
|
| 2309 | + echo "Add to DB..."; |
|
| 2310 | + } |
|
| 2094 | 2311 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
| 2095 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
| 2312 | + if ($globalDebug) { |
|
| 2313 | + echo "Copy airlines logos to airlines images directory..."; |
|
| 2314 | + } |
|
| 2096 | 2315 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
| 2097 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
| 2098 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2099 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2100 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
| 2316 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
| 2317 | + $error = "Failed to copy airlines logo."; |
|
| 2318 | + } |
|
| 2319 | + } else { |
|
| 2320 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
| 2321 | + } |
|
| 2322 | + } else { |
|
| 2323 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
| 2324 | + } |
|
| 2325 | + } else { |
|
| 2326 | + $error = "ZIP module not loaded but required for IVAO."; |
|
| 2327 | + } |
|
| 2101 | 2328 | if ($error != '') { |
| 2102 | 2329 | return $error; |
| 2103 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2330 | + } elseif ($globalDebug) { |
|
| 2331 | + echo "Done\n"; |
|
| 2332 | + } |
|
| 2104 | 2333 | return ''; |
| 2105 | 2334 | } |
| 2106 | 2335 | |
| 2107 | 2336 | public static function update_routes() { |
| 2108 | 2337 | global $tmp_dir, $globalDebug; |
| 2109 | 2338 | $error = ''; |
| 2110 | - if ($globalDebug) echo "Routes : Download..."; |
|
| 2339 | + if ($globalDebug) { |
|
| 2340 | + echo "Routes : Download..."; |
|
| 2341 | + } |
|
| 2111 | 2342 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
| 2112 | 2343 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
| 2113 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2344 | + if ($globalDebug) { |
|
| 2345 | + echo "Gunzip..."; |
|
| 2346 | + } |
|
| 2114 | 2347 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
| 2115 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2348 | + if ($globalDebug) { |
|
| 2349 | + echo "Add to DB..."; |
|
| 2350 | + } |
|
| 2116 | 2351 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
| 2117 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2352 | + } else { |
|
| 2353 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
| 2354 | + } |
|
| 2118 | 2355 | if ($error != '') { |
| 2119 | 2356 | return $error; |
| 2120 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2357 | + } elseif ($globalDebug) { |
|
| 2358 | + echo "Done\n"; |
|
| 2359 | + } |
|
| 2121 | 2360 | return ''; |
| 2122 | 2361 | } |
| 2123 | 2362 | public static function update_oneworld() { |
| 2124 | 2363 | global $tmp_dir, $globalDebug; |
| 2125 | 2364 | $error = ''; |
| 2126 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
| 2365 | + if ($globalDebug) { |
|
| 2366 | + echo "Schedules Oneworld : Download..."; |
|
| 2367 | + } |
|
| 2127 | 2368 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
| 2128 | 2369 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
| 2129 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2370 | + if ($globalDebug) { |
|
| 2371 | + echo "Gunzip..."; |
|
| 2372 | + } |
|
| 2130 | 2373 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
| 2131 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2374 | + if ($globalDebug) { |
|
| 2375 | + echo "Add to DB..."; |
|
| 2376 | + } |
|
| 2132 | 2377 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
| 2133 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2378 | + } else { |
|
| 2379 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
| 2380 | + } |
|
| 2134 | 2381 | if ($error != '') { |
| 2135 | 2382 | return $error; |
| 2136 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2383 | + } elseif ($globalDebug) { |
|
| 2384 | + echo "Done\n"; |
|
| 2385 | + } |
|
| 2137 | 2386 | return ''; |
| 2138 | 2387 | } |
| 2139 | 2388 | public static function update_skyteam() { |
| 2140 | 2389 | global $tmp_dir, $globalDebug; |
| 2141 | 2390 | $error = ''; |
| 2142 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
| 2391 | + if ($globalDebug) { |
|
| 2392 | + echo "Schedules Skyteam : Download..."; |
|
| 2393 | + } |
|
| 2143 | 2394 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
| 2144 | 2395 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
| 2145 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2396 | + if ($globalDebug) { |
|
| 2397 | + echo "Gunzip..."; |
|
| 2398 | + } |
|
| 2146 | 2399 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
| 2147 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2400 | + if ($globalDebug) { |
|
| 2401 | + echo "Add to DB..."; |
|
| 2402 | + } |
|
| 2148 | 2403 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
| 2149 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2404 | + } else { |
|
| 2405 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
| 2406 | + } |
|
| 2150 | 2407 | if ($error != '') { |
| 2151 | 2408 | return $error; |
| 2152 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2409 | + } elseif ($globalDebug) { |
|
| 2410 | + echo "Done\n"; |
|
| 2411 | + } |
|
| 2153 | 2412 | return ''; |
| 2154 | 2413 | } |
| 2155 | 2414 | public static function update_ModeS() { |
@@ -2166,340 +2425,590 @@ discard block |
||
| 2166 | 2425 | exit; |
| 2167 | 2426 | } elseif ($globalDebug) echo "Done\n"; |
| 2168 | 2427 | */ |
| 2169 | - if ($globalDebug) echo "Modes : Download..."; |
|
| 2170 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2428 | + if ($globalDebug) { |
|
| 2429 | + echo "Modes : Download..."; |
|
| 2430 | + } |
|
| 2431 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
| 2171 | 2432 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
| 2172 | 2433 | |
| 2173 | 2434 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
| 2174 | 2435 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
| 2175 | - if ($globalDebug) echo "Unzip..."; |
|
| 2176 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2436 | + if ($globalDebug) { |
|
| 2437 | + echo "Unzip..."; |
|
| 2438 | + } |
|
| 2439 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
| 2177 | 2440 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
| 2178 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2441 | + if ($globalDebug) { |
|
| 2442 | + echo "Add to DB..."; |
|
| 2443 | + } |
|
| 2179 | 2444 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
| 2180 | 2445 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
| 2181 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2446 | + } else { |
|
| 2447 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
| 2448 | + } |
|
| 2182 | 2449 | if ($error != '') { |
| 2183 | 2450 | return $error; |
| 2184 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2451 | + } elseif ($globalDebug) { |
|
| 2452 | + echo "Done\n"; |
|
| 2453 | + } |
|
| 2185 | 2454 | return ''; |
| 2186 | 2455 | } |
| 2187 | 2456 | |
| 2188 | 2457 | public static function update_ModeS_faa() { |
| 2189 | 2458 | global $tmp_dir, $globalDebug; |
| 2190 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
| 2459 | + if ($globalDebug) { |
|
| 2460 | + echo "Modes FAA: Download..."; |
|
| 2461 | + } |
|
| 2191 | 2462 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
| 2192 | 2463 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
| 2193 | - if ($globalDebug) echo "Unzip..."; |
|
| 2464 | + if ($globalDebug) { |
|
| 2465 | + echo "Unzip..."; |
|
| 2466 | + } |
|
| 2194 | 2467 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
| 2195 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2468 | + if ($globalDebug) { |
|
| 2469 | + echo "Add to DB..."; |
|
| 2470 | + } |
|
| 2196 | 2471 | $error = update_db::modes_faa(); |
| 2197 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2472 | + } else { |
|
| 2473 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
| 2474 | + } |
|
| 2198 | 2475 | if ($error != '') { |
| 2199 | 2476 | return $error; |
| 2200 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2477 | + } elseif ($globalDebug) { |
|
| 2478 | + echo "Done\n"; |
|
| 2479 | + } |
|
| 2201 | 2480 | return ''; |
| 2202 | 2481 | } |
| 2203 | 2482 | |
| 2204 | 2483 | public static function update_ModeS_flarm() { |
| 2205 | 2484 | global $tmp_dir, $globalDebug; |
| 2206 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
| 2485 | + if ($globalDebug) { |
|
| 2486 | + echo "Modes Flarmnet: Download..."; |
|
| 2487 | + } |
|
| 2207 | 2488 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
| 2208 | 2489 | if (file_exists($tmp_dir.'data.fln')) { |
| 2209 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2490 | + if ($globalDebug) { |
|
| 2491 | + echo "Add to DB..."; |
|
| 2492 | + } |
|
| 2210 | 2493 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
| 2211 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2494 | + } else { |
|
| 2495 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
| 2496 | + } |
|
| 2212 | 2497 | if ($error != '') { |
| 2213 | 2498 | return $error; |
| 2214 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2499 | + } elseif ($globalDebug) { |
|
| 2500 | + echo "Done\n"; |
|
| 2501 | + } |
|
| 2215 | 2502 | return ''; |
| 2216 | 2503 | } |
| 2217 | 2504 | |
| 2218 | 2505 | public static function update_ModeS_ogn() { |
| 2219 | 2506 | global $tmp_dir, $globalDebug; |
| 2220 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
| 2507 | + if ($globalDebug) { |
|
| 2508 | + echo "Modes OGN: Download..."; |
|
| 2509 | + } |
|
| 2221 | 2510 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
| 2222 | 2511 | if (file_exists($tmp_dir.'ogn.csv')) { |
| 2223 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2512 | + if ($globalDebug) { |
|
| 2513 | + echo "Add to DB..."; |
|
| 2514 | + } |
|
| 2224 | 2515 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
| 2225 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2516 | + } else { |
|
| 2517 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
| 2518 | + } |
|
| 2226 | 2519 | if ($error != '') { |
| 2227 | 2520 | return $error; |
| 2228 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2521 | + } elseif ($globalDebug) { |
|
| 2522 | + echo "Done\n"; |
|
| 2523 | + } |
|
| 2229 | 2524 | return ''; |
| 2230 | 2525 | } |
| 2231 | 2526 | |
| 2232 | 2527 | public static function update_owner() { |
| 2233 | 2528 | global $tmp_dir, $globalDebug, $globalMasterSource; |
| 2234 | 2529 | |
| 2235 | - if ($globalDebug) echo "Owner France: Download..."; |
|
| 2530 | + if ($globalDebug) { |
|
| 2531 | + echo "Owner France: Download..."; |
|
| 2532 | + } |
|
| 2236 | 2533 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
| 2237 | 2534 | if (file_exists($tmp_dir.'owner_f.csv')) { |
| 2238 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2535 | + if ($globalDebug) { |
|
| 2536 | + echo "Add to DB..."; |
|
| 2537 | + } |
|
| 2239 | 2538 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
| 2240 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2539 | + } else { |
|
| 2540 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
| 2541 | + } |
|
| 2241 | 2542 | if ($error != '') { |
| 2242 | 2543 | return $error; |
| 2243 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2544 | + } elseif ($globalDebug) { |
|
| 2545 | + echo "Done\n"; |
|
| 2546 | + } |
|
| 2244 | 2547 | |
| 2245 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
| 2548 | + if ($globalDebug) { |
|
| 2549 | + echo "Owner Ireland: Download..."; |
|
| 2550 | + } |
|
| 2246 | 2551 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
| 2247 | 2552 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
| 2248 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2553 | + if ($globalDebug) { |
|
| 2554 | + echo "Add to DB..."; |
|
| 2555 | + } |
|
| 2249 | 2556 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
| 2250 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2557 | + } else { |
|
| 2558 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
| 2559 | + } |
|
| 2251 | 2560 | if ($error != '') { |
| 2252 | 2561 | return $error; |
| 2253 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2254 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
| 2562 | + } elseif ($globalDebug) { |
|
| 2563 | + echo "Done\n"; |
|
| 2564 | + } |
|
| 2565 | + if ($globalDebug) { |
|
| 2566 | + echo "Owner Switzerland: Download..."; |
|
| 2567 | + } |
|
| 2255 | 2568 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
| 2256 | 2569 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
| 2257 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2570 | + if ($globalDebug) { |
|
| 2571 | + echo "Add to DB..."; |
|
| 2572 | + } |
|
| 2258 | 2573 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
| 2259 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2574 | + } else { |
|
| 2575 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
| 2576 | + } |
|
| 2260 | 2577 | if ($error != '') { |
| 2261 | 2578 | return $error; |
| 2262 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2263 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
| 2579 | + } elseif ($globalDebug) { |
|
| 2580 | + echo "Done\n"; |
|
| 2581 | + } |
|
| 2582 | + if ($globalDebug) { |
|
| 2583 | + echo "Owner Czech Republic: Download..."; |
|
| 2584 | + } |
|
| 2264 | 2585 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
| 2265 | 2586 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
| 2266 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2587 | + if ($globalDebug) { |
|
| 2588 | + echo "Add to DB..."; |
|
| 2589 | + } |
|
| 2267 | 2590 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
| 2268 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2591 | + } else { |
|
| 2592 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
| 2593 | + } |
|
| 2269 | 2594 | if ($error != '') { |
| 2270 | 2595 | return $error; |
| 2271 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2272 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
| 2596 | + } elseif ($globalDebug) { |
|
| 2597 | + echo "Done\n"; |
|
| 2598 | + } |
|
| 2599 | + if ($globalDebug) { |
|
| 2600 | + echo "Owner Australia: Download..."; |
|
| 2601 | + } |
|
| 2273 | 2602 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
| 2274 | 2603 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
| 2275 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2604 | + if ($globalDebug) { |
|
| 2605 | + echo "Add to DB..."; |
|
| 2606 | + } |
|
| 2276 | 2607 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
| 2277 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2608 | + } else { |
|
| 2609 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
| 2610 | + } |
|
| 2278 | 2611 | if ($error != '') { |
| 2279 | 2612 | return $error; |
| 2280 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2281 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
| 2613 | + } elseif ($globalDebug) { |
|
| 2614 | + echo "Done\n"; |
|
| 2615 | + } |
|
| 2616 | + if ($globalDebug) { |
|
| 2617 | + echo "Owner Austria: Download..."; |
|
| 2618 | + } |
|
| 2282 | 2619 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
| 2283 | 2620 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
| 2284 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2621 | + if ($globalDebug) { |
|
| 2622 | + echo "Add to DB..."; |
|
| 2623 | + } |
|
| 2285 | 2624 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
| 2286 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2625 | + } else { |
|
| 2626 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
| 2627 | + } |
|
| 2287 | 2628 | if ($error != '') { |
| 2288 | 2629 | return $error; |
| 2289 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2290 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
| 2630 | + } elseif ($globalDebug) { |
|
| 2631 | + echo "Done\n"; |
|
| 2632 | + } |
|
| 2633 | + if ($globalDebug) { |
|
| 2634 | + echo "Owner Chile: Download..."; |
|
| 2635 | + } |
|
| 2291 | 2636 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
| 2292 | 2637 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
| 2293 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2638 | + if ($globalDebug) { |
|
| 2639 | + echo "Add to DB..."; |
|
| 2640 | + } |
|
| 2294 | 2641 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
| 2295 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2642 | + } else { |
|
| 2643 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
| 2644 | + } |
|
| 2296 | 2645 | if ($error != '') { |
| 2297 | 2646 | return $error; |
| 2298 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2299 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
| 2647 | + } elseif ($globalDebug) { |
|
| 2648 | + echo "Done\n"; |
|
| 2649 | + } |
|
| 2650 | + if ($globalDebug) { |
|
| 2651 | + echo "Owner Colombia: Download..."; |
|
| 2652 | + } |
|
| 2300 | 2653 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
| 2301 | 2654 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
| 2302 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2655 | + if ($globalDebug) { |
|
| 2656 | + echo "Add to DB..."; |
|
| 2657 | + } |
|
| 2303 | 2658 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
| 2304 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2659 | + } else { |
|
| 2660 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
| 2661 | + } |
|
| 2305 | 2662 | if ($error != '') { |
| 2306 | 2663 | return $error; |
| 2307 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2308 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2664 | + } elseif ($globalDebug) { |
|
| 2665 | + echo "Done\n"; |
|
| 2666 | + } |
|
| 2667 | + if ($globalDebug) { |
|
| 2668 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
| 2669 | + } |
|
| 2309 | 2670 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
| 2310 | 2671 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
| 2311 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2672 | + if ($globalDebug) { |
|
| 2673 | + echo "Add to DB..."; |
|
| 2674 | + } |
|
| 2312 | 2675 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
| 2313 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2676 | + } else { |
|
| 2677 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
| 2678 | + } |
|
| 2314 | 2679 | if ($error != '') { |
| 2315 | 2680 | return $error; |
| 2316 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2317 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
| 2681 | + } elseif ($globalDebug) { |
|
| 2682 | + echo "Done\n"; |
|
| 2683 | + } |
|
| 2684 | + if ($globalDebug) { |
|
| 2685 | + echo "Owner Brazil: Download..."; |
|
| 2686 | + } |
|
| 2318 | 2687 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
| 2319 | 2688 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
| 2320 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2689 | + if ($globalDebug) { |
|
| 2690 | + echo "Add to DB..."; |
|
| 2691 | + } |
|
| 2321 | 2692 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
| 2322 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2693 | + } else { |
|
| 2694 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
| 2695 | + } |
|
| 2323 | 2696 | if ($error != '') { |
| 2324 | 2697 | return $error; |
| 2325 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2326 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
| 2698 | + } elseif ($globalDebug) { |
|
| 2699 | + echo "Done\n"; |
|
| 2700 | + } |
|
| 2701 | + if ($globalDebug) { |
|
| 2702 | + echo "Owner Cayman Islands: Download..."; |
|
| 2703 | + } |
|
| 2327 | 2704 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
| 2328 | 2705 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
| 2329 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2706 | + if ($globalDebug) { |
|
| 2707 | + echo "Add to DB..."; |
|
| 2708 | + } |
|
| 2330 | 2709 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
| 2331 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2710 | + } else { |
|
| 2711 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
| 2712 | + } |
|
| 2332 | 2713 | if ($error != '') { |
| 2333 | 2714 | return $error; |
| 2334 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2335 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
| 2715 | + } elseif ($globalDebug) { |
|
| 2716 | + echo "Done\n"; |
|
| 2717 | + } |
|
| 2718 | + if ($globalDebug) { |
|
| 2719 | + echo "Owner Croatia: Download..."; |
|
| 2720 | + } |
|
| 2336 | 2721 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
| 2337 | 2722 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
| 2338 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2723 | + if ($globalDebug) { |
|
| 2724 | + echo "Add to DB..."; |
|
| 2725 | + } |
|
| 2339 | 2726 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
| 2340 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2727 | + } else { |
|
| 2728 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
| 2729 | + } |
|
| 2341 | 2730 | if ($error != '') { |
| 2342 | 2731 | return $error; |
| 2343 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2344 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
| 2732 | + } elseif ($globalDebug) { |
|
| 2733 | + echo "Done\n"; |
|
| 2734 | + } |
|
| 2735 | + if ($globalDebug) { |
|
| 2736 | + echo "Owner Luxembourg: Download..."; |
|
| 2737 | + } |
|
| 2345 | 2738 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
| 2346 | 2739 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
| 2347 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2740 | + if ($globalDebug) { |
|
| 2741 | + echo "Add to DB..."; |
|
| 2742 | + } |
|
| 2348 | 2743 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
| 2349 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2744 | + } else { |
|
| 2745 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
| 2746 | + } |
|
| 2350 | 2747 | if ($error != '') { |
| 2351 | 2748 | return $error; |
| 2352 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2353 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
| 2749 | + } elseif ($globalDebug) { |
|
| 2750 | + echo "Done\n"; |
|
| 2751 | + } |
|
| 2752 | + if ($globalDebug) { |
|
| 2753 | + echo "Owner Maldives: Download..."; |
|
| 2754 | + } |
|
| 2354 | 2755 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
| 2355 | 2756 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
| 2356 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2757 | + if ($globalDebug) { |
|
| 2758 | + echo "Add to DB..."; |
|
| 2759 | + } |
|
| 2357 | 2760 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
| 2358 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2761 | + } else { |
|
| 2762 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
| 2763 | + } |
|
| 2359 | 2764 | if ($error != '') { |
| 2360 | 2765 | return $error; |
| 2361 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2362 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
| 2766 | + } elseif ($globalDebug) { |
|
| 2767 | + echo "Done\n"; |
|
| 2768 | + } |
|
| 2769 | + if ($globalDebug) { |
|
| 2770 | + echo "Owner New Zealand: Download..."; |
|
| 2771 | + } |
|
| 2363 | 2772 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
| 2364 | 2773 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
| 2365 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2774 | + if ($globalDebug) { |
|
| 2775 | + echo "Add to DB..."; |
|
| 2776 | + } |
|
| 2366 | 2777 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
| 2367 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2778 | + } else { |
|
| 2779 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
| 2780 | + } |
|
| 2368 | 2781 | if ($error != '') { |
| 2369 | 2782 | return $error; |
| 2370 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2371 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
| 2783 | + } elseif ($globalDebug) { |
|
| 2784 | + echo "Done\n"; |
|
| 2785 | + } |
|
| 2786 | + if ($globalDebug) { |
|
| 2787 | + echo "Owner Papua New Guinea: Download..."; |
|
| 2788 | + } |
|
| 2372 | 2789 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
| 2373 | 2790 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
| 2374 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2791 | + if ($globalDebug) { |
|
| 2792 | + echo "Add to DB..."; |
|
| 2793 | + } |
|
| 2375 | 2794 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
| 2376 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2795 | + } else { |
|
| 2796 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
| 2797 | + } |
|
| 2377 | 2798 | if ($error != '') { |
| 2378 | 2799 | return $error; |
| 2379 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2380 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
| 2800 | + } elseif ($globalDebug) { |
|
| 2801 | + echo "Done\n"; |
|
| 2802 | + } |
|
| 2803 | + if ($globalDebug) { |
|
| 2804 | + echo "Owner Slovakia: Download..."; |
|
| 2805 | + } |
|
| 2381 | 2806 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
| 2382 | 2807 | if (file_exists($tmp_dir.'owner_om.csv')) { |
| 2383 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2808 | + if ($globalDebug) { |
|
| 2809 | + echo "Add to DB..."; |
|
| 2810 | + } |
|
| 2384 | 2811 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
| 2385 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2812 | + } else { |
|
| 2813 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
| 2814 | + } |
|
| 2386 | 2815 | if ($error != '') { |
| 2387 | 2816 | return $error; |
| 2388 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2389 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
| 2817 | + } elseif ($globalDebug) { |
|
| 2818 | + echo "Done\n"; |
|
| 2819 | + } |
|
| 2820 | + if ($globalDebug) { |
|
| 2821 | + echo "Owner Ecuador: Download..."; |
|
| 2822 | + } |
|
| 2390 | 2823 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
| 2391 | 2824 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
| 2392 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2825 | + if ($globalDebug) { |
|
| 2826 | + echo "Add to DB..."; |
|
| 2827 | + } |
|
| 2393 | 2828 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
| 2394 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2829 | + } else { |
|
| 2830 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
| 2831 | + } |
|
| 2395 | 2832 | if ($error != '') { |
| 2396 | 2833 | return $error; |
| 2397 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2398 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
| 2834 | + } elseif ($globalDebug) { |
|
| 2835 | + echo "Done\n"; |
|
| 2836 | + } |
|
| 2837 | + if ($globalDebug) { |
|
| 2838 | + echo "Owner Iceland: Download..."; |
|
| 2839 | + } |
|
| 2399 | 2840 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
| 2400 | 2841 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
| 2401 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2842 | + if ($globalDebug) { |
|
| 2843 | + echo "Add to DB..."; |
|
| 2844 | + } |
|
| 2402 | 2845 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
| 2403 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2846 | + } else { |
|
| 2847 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
| 2848 | + } |
|
| 2404 | 2849 | if ($error != '') { |
| 2405 | 2850 | return $error; |
| 2406 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2407 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
| 2851 | + } elseif ($globalDebug) { |
|
| 2852 | + echo "Done\n"; |
|
| 2853 | + } |
|
| 2854 | + if ($globalDebug) { |
|
| 2855 | + echo "Owner Isle of Man: Download..."; |
|
| 2856 | + } |
|
| 2408 | 2857 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
| 2409 | 2858 | if (file_exists($tmp_dir.'owner_m.csv')) { |
| 2410 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2859 | + if ($globalDebug) { |
|
| 2860 | + echo "Add to DB..."; |
|
| 2861 | + } |
|
| 2411 | 2862 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
| 2412 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2863 | + } else { |
|
| 2864 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
| 2865 | + } |
|
| 2413 | 2866 | if ($error != '') { |
| 2414 | 2867 | return $error; |
| 2415 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2868 | + } elseif ($globalDebug) { |
|
| 2869 | + echo "Done\n"; |
|
| 2870 | + } |
|
| 2416 | 2871 | if ($globalMasterSource) { |
| 2417 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
| 2872 | + if ($globalDebug) { |
|
| 2873 | + echo "ModeS Netherlands: Download..."; |
|
| 2874 | + } |
|
| 2418 | 2875 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
| 2419 | 2876 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
| 2420 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2877 | + if ($globalDebug) { |
|
| 2878 | + echo "Add to DB..."; |
|
| 2879 | + } |
|
| 2421 | 2880 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
| 2422 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2881 | + } else { |
|
| 2882 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
| 2883 | + } |
|
| 2423 | 2884 | if ($error != '') { |
| 2424 | 2885 | return $error; |
| 2425 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2426 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
| 2886 | + } elseif ($globalDebug) { |
|
| 2887 | + echo "Done\n"; |
|
| 2888 | + } |
|
| 2889 | + if ($globalDebug) { |
|
| 2890 | + echo "ModeS Denmark: Download..."; |
|
| 2891 | + } |
|
| 2427 | 2892 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
| 2428 | 2893 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
| 2429 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2894 | + if ($globalDebug) { |
|
| 2895 | + echo "Add to DB..."; |
|
| 2896 | + } |
|
| 2430 | 2897 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
| 2431 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2898 | + } else { |
|
| 2899 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
| 2900 | + } |
|
| 2432 | 2901 | if ($error != '') { |
| 2433 | 2902 | return $error; |
| 2434 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2435 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2903 | + } elseif ($globalDebug) { |
|
| 2904 | + echo "Done\n"; |
|
| 2905 | + } |
|
| 2906 | + } elseif ($globalDebug) { |
|
| 2907 | + echo "Done\n"; |
|
| 2908 | + } |
|
| 2436 | 2909 | return ''; |
| 2437 | 2910 | } |
| 2438 | 2911 | |
| 2439 | 2912 | public static function update_translation() { |
| 2440 | 2913 | global $tmp_dir, $globalDebug; |
| 2441 | 2914 | $error = ''; |
| 2442 | - if ($globalDebug) echo "Translation : Download..."; |
|
| 2915 | + if ($globalDebug) { |
|
| 2916 | + echo "Translation : Download..."; |
|
| 2917 | + } |
|
| 2443 | 2918 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
| 2444 | 2919 | if (file_exists($tmp_dir.'translation.zip')) { |
| 2445 | - if ($globalDebug) echo "Unzip..."; |
|
| 2920 | + if ($globalDebug) { |
|
| 2921 | + echo "Unzip..."; |
|
| 2922 | + } |
|
| 2446 | 2923 | update_db::unzip($tmp_dir.'translation.zip'); |
| 2447 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2924 | + if ($globalDebug) { |
|
| 2925 | + echo "Add to DB..."; |
|
| 2926 | + } |
|
| 2448 | 2927 | $error = update_db::translation(); |
| 2449 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2928 | + } else { |
|
| 2929 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
| 2930 | + } |
|
| 2450 | 2931 | if ($error != '') { |
| 2451 | 2932 | return $error; |
| 2452 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2933 | + } elseif ($globalDebug) { |
|
| 2934 | + echo "Done\n"; |
|
| 2935 | + } |
|
| 2453 | 2936 | return ''; |
| 2454 | 2937 | } |
| 2455 | 2938 | |
| 2456 | 2939 | public static function update_translation_fam() { |
| 2457 | 2940 | global $tmp_dir, $globalDebug; |
| 2458 | 2941 | $error = ''; |
| 2459 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
| 2942 | + if ($globalDebug) { |
|
| 2943 | + echo "Translation from FlightAirMap website : Download..."; |
|
| 2944 | + } |
|
| 2460 | 2945 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
| 2461 | 2946 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
| 2462 | 2947 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
| 2463 | 2948 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
| 2464 | 2949 | $translation_md5 = $translation_md5_file[0]; |
| 2465 | 2950 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
| 2466 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2951 | + if ($globalDebug) { |
|
| 2952 | + echo "Gunzip..."; |
|
| 2953 | + } |
|
| 2467 | 2954 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
| 2468 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2955 | + if ($globalDebug) { |
|
| 2956 | + echo "Add to DB..."; |
|
| 2957 | + } |
|
| 2469 | 2958 | $error = update_db::translation_fam(); |
| 2470 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2471 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2959 | + } else { |
|
| 2960 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
| 2961 | + } |
|
| 2962 | + } else { |
|
| 2963 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
| 2964 | + } |
|
| 2472 | 2965 | if ($error != '') { |
| 2473 | 2966 | return $error; |
| 2474 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2967 | + } elseif ($globalDebug) { |
|
| 2968 | + echo "Done\n"; |
|
| 2969 | + } |
|
| 2475 | 2970 | return ''; |
| 2476 | 2971 | } |
| 2477 | 2972 | public static function update_ModeS_fam() { |
| 2478 | 2973 | global $tmp_dir, $globalDebug; |
| 2479 | 2974 | $error = ''; |
| 2480 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
| 2975 | + if ($globalDebug) { |
|
| 2976 | + echo "ModeS from FlightAirMap website : Download..."; |
|
| 2977 | + } |
|
| 2481 | 2978 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
| 2482 | 2979 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
| 2483 | 2980 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
| 2484 | 2981 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
| 2485 | 2982 | $modes_md5 = $modes_md5_file[0]; |
| 2486 | 2983 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
| 2487 | - if ($globalDebug) echo "Gunzip..."; |
|
| 2984 | + if ($globalDebug) { |
|
| 2985 | + echo "Gunzip..."; |
|
| 2986 | + } |
|
| 2488 | 2987 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
| 2489 | - if ($globalDebug) echo "Add to DB..."; |
|
| 2988 | + if ($globalDebug) { |
|
| 2989 | + echo "Add to DB..."; |
|
| 2990 | + } |
|
| 2490 | 2991 | $error = update_db::modes_fam(); |
| 2491 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2492 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2992 | + } else { |
|
| 2993 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
| 2994 | + } |
|
| 2995 | + } else { |
|
| 2996 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
| 2997 | + } |
|
| 2493 | 2998 | if ($error != '') { |
| 2494 | 2999 | return $error; |
| 2495 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3000 | + } elseif ($globalDebug) { |
|
| 3001 | + echo "Done\n"; |
|
| 3002 | + } |
|
| 2496 | 3003 | return ''; |
| 2497 | 3004 | } |
| 2498 | 3005 | |
| 2499 | 3006 | public static function update_airlines_fam() { |
| 2500 | 3007 | global $tmp_dir, $globalDebug; |
| 2501 | 3008 | $error = ''; |
| 2502 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
| 3009 | + if ($globalDebug) { |
|
| 3010 | + echo "Airlines from FlightAirMap website : Download..."; |
|
| 3011 | + } |
|
| 2503 | 3012 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
| 2504 | 3013 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
| 2505 | 3014 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2508,26 +3017,42 @@ discard block |
||
| 2508 | 3017 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
| 2509 | 3018 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
| 2510 | 3019 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
| 2511 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3020 | + if ($globalDebug) { |
|
| 3021 | + echo "Gunzip..."; |
|
| 3022 | + } |
|
| 2512 | 3023 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
| 2513 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3024 | + if ($globalDebug) { |
|
| 3025 | + echo "Add to DB..."; |
|
| 3026 | + } |
|
| 2514 | 3027 | $error = update_db::airlines_fam(); |
| 2515 | 3028 | update_db::insert_airlines_version($airlines_md5); |
| 2516 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 2517 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 2518 | - } elseif ($globalDebug) echo "No update."; |
|
| 2519 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3029 | + } else { |
|
| 3030 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
| 3031 | + } |
|
| 3032 | + } else { |
|
| 3033 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
| 3034 | + } |
|
| 3035 | + } elseif ($globalDebug) { |
|
| 3036 | + echo "No update."; |
|
| 3037 | + } |
|
| 3038 | + } else { |
|
| 3039 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
| 3040 | + } |
|
| 2520 | 3041 | if ($error != '') { |
| 2521 | 3042 | return $error; |
| 2522 | 3043 | } else { |
| 2523 | - if ($globalDebug) echo "Done\n"; |
|
| 3044 | + if ($globalDebug) { |
|
| 3045 | + echo "Done\n"; |
|
| 3046 | + } |
|
| 2524 | 3047 | } |
| 2525 | 3048 | return ''; |
| 2526 | 3049 | } |
| 2527 | 3050 | |
| 2528 | 3051 | public static function update_owner_fam() { |
| 2529 | 3052 | global $tmp_dir, $globalDebug, $globalOwner; |
| 2530 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
| 3053 | + if ($globalDebug) { |
|
| 3054 | + echo "owner from FlightAirMap website : Download..."; |
|
| 3055 | + } |
|
| 2531 | 3056 | $error = ''; |
| 2532 | 3057 | if ($globalOwner === TRUE) { |
| 2533 | 3058 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2540,55 +3065,89 @@ discard block |
||
| 2540 | 3065 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
| 2541 | 3066 | $owners_md5 = $owners_md5_file[0]; |
| 2542 | 3067 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
| 2543 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3068 | + if ($globalDebug) { |
|
| 3069 | + echo "Gunzip..."; |
|
| 3070 | + } |
|
| 2544 | 3071 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
| 2545 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3072 | + if ($globalDebug) { |
|
| 3073 | + echo "Add to DB..."; |
|
| 3074 | + } |
|
| 2546 | 3075 | $error = update_db::owner_fam(); |
| 2547 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 2548 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3076 | + } else { |
|
| 3077 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
| 3078 | + } |
|
| 3079 | + } else { |
|
| 3080 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
| 3081 | + } |
|
| 2549 | 3082 | if ($error != '') { |
| 2550 | 3083 | return $error; |
| 2551 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3084 | + } elseif ($globalDebug) { |
|
| 3085 | + echo "Done\n"; |
|
| 3086 | + } |
|
| 2552 | 3087 | return ''; |
| 2553 | 3088 | } |
| 2554 | 3089 | public static function update_routes_fam() { |
| 2555 | 3090 | global $tmp_dir, $globalDebug; |
| 2556 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
| 3091 | + if ($globalDebug) { |
|
| 3092 | + echo "Routes from FlightAirMap website : Download..."; |
|
| 3093 | + } |
|
| 2557 | 3094 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
| 2558 | 3095 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
| 2559 | 3096 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
| 2560 | 3097 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
| 2561 | 3098 | $routes_md5 = $routes_md5_file[0]; |
| 2562 | 3099 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
| 2563 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3100 | + if ($globalDebug) { |
|
| 3101 | + echo "Gunzip..."; |
|
| 3102 | + } |
|
| 2564 | 3103 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
| 2565 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3104 | + if ($globalDebug) { |
|
| 3105 | + echo "Add to DB..."; |
|
| 3106 | + } |
|
| 2566 | 3107 | $error = update_db::routes_fam(); |
| 2567 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 2568 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3108 | + } else { |
|
| 3109 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
| 3110 | + } |
|
| 3111 | + } else { |
|
| 3112 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
| 3113 | + } |
|
| 2569 | 3114 | if ($error != '') { |
| 2570 | 3115 | return $error; |
| 2571 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3116 | + } elseif ($globalDebug) { |
|
| 3117 | + echo "Done\n"; |
|
| 3118 | + } |
|
| 2572 | 3119 | return ''; |
| 2573 | 3120 | } |
| 2574 | 3121 | public static function update_block_fam() { |
| 2575 | 3122 | global $tmp_dir, $globalDebug; |
| 2576 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3123 | + if ($globalDebug) { |
|
| 3124 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
| 3125 | + } |
|
| 2577 | 3126 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
| 2578 | 3127 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
| 2579 | 3128 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
| 2580 | 3129 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
| 2581 | 3130 | $block_md5 = $block_md5_file[0]; |
| 2582 | 3131 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
| 2583 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3132 | + if ($globalDebug) { |
|
| 3133 | + echo "Gunzip..."; |
|
| 3134 | + } |
|
| 2584 | 3135 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
| 2585 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3136 | + if ($globalDebug) { |
|
| 3137 | + echo "Add to DB..."; |
|
| 3138 | + } |
|
| 2586 | 3139 | $error = update_db::block_fam(); |
| 2587 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 2588 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3140 | + } else { |
|
| 3141 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
| 3142 | + } |
|
| 3143 | + } else { |
|
| 3144 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
| 3145 | + } |
|
| 2589 | 3146 | if ($error != '') { |
| 2590 | 3147 | return $error; |
| 2591 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3148 | + } elseif ($globalDebug) { |
|
| 3149 | + echo "Done\n"; |
|
| 3150 | + } |
|
| 2592 | 3151 | return ''; |
| 2593 | 3152 | } |
| 2594 | 3153 | public static function update_marine_identity_fam() { |
@@ -2598,21 +3157,33 @@ discard block |
||
| 2598 | 3157 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
| 2599 | 3158 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
| 2600 | 3159 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
| 2601 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3160 | + if ($globalDebug) { |
|
| 3161 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
| 3162 | + } |
|
| 2602 | 3163 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
| 2603 | 3164 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
| 2604 | 3165 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
| 2605 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3166 | + if ($globalDebug) { |
|
| 3167 | + echo "Gunzip..."; |
|
| 3168 | + } |
|
| 2606 | 3169 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
| 2607 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3170 | + if ($globalDebug) { |
|
| 3171 | + echo "Add to DB..."; |
|
| 3172 | + } |
|
| 2608 | 3173 | $error = update_db::marine_identity_fam(); |
| 2609 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 2610 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3174 | + } else { |
|
| 3175 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
| 3176 | + } |
|
| 3177 | + } else { |
|
| 3178 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
| 3179 | + } |
|
| 2611 | 3180 | if ($error != '') { |
| 2612 | 3181 | return $error; |
| 2613 | 3182 | } else { |
| 2614 | 3183 | update_db::insert_marine_identity_version($marine_identity_md5); |
| 2615 | - if ($globalDebug) echo "Done\n"; |
|
| 3184 | + if ($globalDebug) { |
|
| 3185 | + echo "Done\n"; |
|
| 3186 | + } |
|
| 2616 | 3187 | } |
| 2617 | 3188 | } |
| 2618 | 3189 | } |
@@ -2626,21 +3197,33 @@ discard block |
||
| 2626 | 3197 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
| 2627 | 3198 | $satellite_md5 = $satellite_md5_file[0]; |
| 2628 | 3199 | if (!update_db::check_satellite_version($satellite_md5)) { |
| 2629 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
| 3200 | + if ($globalDebug) { |
|
| 3201 | + echo "Satellite from FlightAirMap website : Download..."; |
|
| 3202 | + } |
|
| 2630 | 3203 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
| 2631 | 3204 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
| 2632 | 3205 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
| 2633 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3206 | + if ($globalDebug) { |
|
| 3207 | + echo "Gunzip..."; |
|
| 3208 | + } |
|
| 2634 | 3209 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
| 2635 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3210 | + if ($globalDebug) { |
|
| 3211 | + echo "Add to DB..."; |
|
| 3212 | + } |
|
| 2636 | 3213 | $error = update_db::satellite_fam(); |
| 2637 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 2638 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3214 | + } else { |
|
| 3215 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
| 3216 | + } |
|
| 3217 | + } else { |
|
| 3218 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
| 3219 | + } |
|
| 2639 | 3220 | if ($error != '') { |
| 2640 | 3221 | return $error; |
| 2641 | 3222 | } else { |
| 2642 | 3223 | update_db::insert_satellite_version($satellite_md5); |
| 2643 | - if ($globalDebug) echo "Done\n"; |
|
| 3224 | + if ($globalDebug) { |
|
| 3225 | + echo "Done\n"; |
|
| 3226 | + } |
|
| 2644 | 3227 | } |
| 2645 | 3228 | } |
| 2646 | 3229 | } |
@@ -2648,17 +3231,25 @@ discard block |
||
| 2648 | 3231 | } |
| 2649 | 3232 | public static function update_banned_fam() { |
| 2650 | 3233 | global $tmp_dir, $globalDebug; |
| 2651 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3234 | + if ($globalDebug) { |
|
| 3235 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
| 3236 | + } |
|
| 2652 | 3237 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
| 2653 | 3238 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
| 2654 | 3239 | //if ($globalDebug) echo "Gunzip..."; |
| 2655 | 3240 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
| 2656 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3241 | + if ($globalDebug) { |
|
| 3242 | + echo "Add to DB..."; |
|
| 3243 | + } |
|
| 2657 | 3244 | $error = update_db::banned_fam(); |
| 2658 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3245 | + } else { |
|
| 3246 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
| 3247 | + } |
|
| 2659 | 3248 | if ($error != '') { |
| 2660 | 3249 | return $error; |
| 2661 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3250 | + } elseif ($globalDebug) { |
|
| 3251 | + echo "Done\n"; |
|
| 3252 | + } |
|
| 2662 | 3253 | return ''; |
| 2663 | 3254 | } |
| 2664 | 3255 | |
@@ -2666,7 +3257,9 @@ discard block |
||
| 2666 | 3257 | global $tmp_dir, $globalDebug, $globalDBdriver; |
| 2667 | 3258 | include_once('class.create_db.php'); |
| 2668 | 3259 | $error = ''; |
| 2669 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
| 3260 | + if ($globalDebug) { |
|
| 3261 | + echo "Airspace from FlightAirMap website : Download..."; |
|
| 3262 | + } |
|
| 2670 | 3263 | if ($globalDBdriver == 'mysql') { |
| 2671 | 3264 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
| 2672 | 3265 | } else { |
@@ -2683,9 +3276,13 @@ discard block |
||
| 2683 | 3276 | } |
| 2684 | 3277 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
| 2685 | 3278 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
| 2686 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3279 | + if ($globalDebug) { |
|
| 3280 | + echo "Gunzip..."; |
|
| 3281 | + } |
|
| 2687 | 3282 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
| 2688 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3283 | + if ($globalDebug) { |
|
| 3284 | + echo "Add to DB..."; |
|
| 3285 | + } |
|
| 2689 | 3286 | $Connection = new Connection(); |
| 2690 | 3287 | if ($Connection->tableExists('airspace')) { |
| 2691 | 3288 | $query = 'DROP TABLE airspace'; |
@@ -2698,20 +3295,30 @@ discard block |
||
| 2698 | 3295 | } |
| 2699 | 3296 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
| 2700 | 3297 | update_db::insert_airspace_version($airspace_md5); |
| 2701 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 2702 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3298 | + } else { |
|
| 3299 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
| 3300 | + } |
|
| 3301 | + } else { |
|
| 3302 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
| 3303 | + } |
|
| 2703 | 3304 | } |
| 2704 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3305 | + } else { |
|
| 3306 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
| 3307 | + } |
|
| 2705 | 3308 | if ($error != '') { |
| 2706 | 3309 | return $error; |
| 2707 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3310 | + } elseif ($globalDebug) { |
|
| 3311 | + echo "Done\n"; |
|
| 3312 | + } |
|
| 2708 | 3313 | return ''; |
| 2709 | 3314 | } |
| 2710 | 3315 | |
| 2711 | 3316 | public static function update_geoid_fam() { |
| 2712 | 3317 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
| 2713 | 3318 | $error = ''; |
| 2714 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
| 3319 | + if ($globalDebug) { |
|
| 3320 | + echo "Geoid from FlightAirMap website : Download..."; |
|
| 3321 | + } |
|
| 2715 | 3322 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
| 2716 | 3323 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
| 2717 | 3324 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2720,80 +3327,126 @@ discard block |
||
| 2720 | 3327 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
| 2721 | 3328 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
| 2722 | 3329 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
| 2723 | - if ($globalDebug) echo "Gunzip..."; |
|
| 3330 | + if ($globalDebug) { |
|
| 3331 | + echo "Gunzip..."; |
|
| 3332 | + } |
|
| 2724 | 3333 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
| 2725 | 3334 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
| 2726 | 3335 | update_db::insert_geoid_version($geoid_md5); |
| 2727 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 2728 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 2729 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 2730 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
| 2731 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3336 | + } else { |
|
| 3337 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
| 3338 | + } |
|
| 3339 | + } else { |
|
| 3340 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
| 3341 | + } |
|
| 3342 | + } else { |
|
| 3343 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
| 3344 | + } |
|
| 3345 | + } elseif ($globalDebug) { |
|
| 3346 | + echo 'No new version'."\n"; |
|
| 3347 | + } |
|
| 3348 | + } else { |
|
| 3349 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
| 3350 | + } |
|
| 2732 | 3351 | if ($error != '') { |
| 2733 | 3352 | return $error; |
| 2734 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3353 | + } elseif ($globalDebug) { |
|
| 3354 | + echo "Done\n"; |
|
| 3355 | + } |
|
| 2735 | 3356 | return ''; |
| 2736 | 3357 | } |
| 2737 | 3358 | |
| 2738 | 3359 | public static function update_tle() { |
| 2739 | 3360 | global $tmp_dir, $globalDebug; |
| 2740 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
| 3361 | + if ($globalDebug) { |
|
| 3362 | + echo "Download TLE : Download..."; |
|
| 3363 | + } |
|
| 2741 | 3364 | $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', |
| 2742 | 3365 | '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', |
| 2743 | 3366 | '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'); |
| 2744 | 3367 | foreach ($alltle as $filename) { |
| 2745 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
| 3368 | + if ($globalDebug) { |
|
| 3369 | + echo "downloading ".$filename.'...'; |
|
| 3370 | + } |
|
| 2746 | 3371 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
| 2747 | 3372 | if (file_exists($tmp_dir.$filename)) { |
| 2748 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
| 3373 | + if ($globalDebug) { |
|
| 3374 | + echo "Add to DB ".$filename."..."; |
|
| 3375 | + } |
|
| 2749 | 3376 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
| 2750 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3377 | + } else { |
|
| 3378 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
| 3379 | + } |
|
| 2751 | 3380 | if ($error != '') { |
| 2752 | 3381 | echo $error."\n"; |
| 2753 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3382 | + } elseif ($globalDebug) { |
|
| 3383 | + echo "Done\n"; |
|
| 3384 | + } |
|
| 2754 | 3385 | } |
| 2755 | 3386 | return ''; |
| 2756 | 3387 | } |
| 2757 | 3388 | |
| 2758 | 3389 | public static function update_ucsdb() { |
| 2759 | 3390 | global $tmp_dir, $globalDebug; |
| 2760 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
| 3391 | + if ($globalDebug) { |
|
| 3392 | + echo "Download UCS DB : Download..."; |
|
| 3393 | + } |
|
| 2761 | 3394 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/9-1-17-update/UCS_Satellite_Database_officialname_9-1-2017.txt',$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
| 2762 | 3395 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
| 2763 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3396 | + if ($globalDebug) { |
|
| 3397 | + echo "Add to DB..."; |
|
| 3398 | + } |
|
| 2764 | 3399 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'); |
| 2765 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3400 | + } else { |
|
| 3401 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_9-1-2017.txt'." doesn't exist. Download failed."; |
|
| 3402 | + } |
|
| 2766 | 3403 | if ($error != '') { |
| 2767 | 3404 | echo $error."\n"; |
| 2768 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3405 | + } elseif ($globalDebug) { |
|
| 3406 | + echo "Done\n"; |
|
| 3407 | + } |
|
| 2769 | 3408 | return ''; |
| 2770 | 3409 | } |
| 2771 | 3410 | |
| 2772 | 3411 | public static function update_celestrak() { |
| 2773 | 3412 | global $tmp_dir, $globalDebug; |
| 2774 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
| 3413 | + if ($globalDebug) { |
|
| 3414 | + echo "Download Celestrak DB : Download..."; |
|
| 3415 | + } |
|
| 2775 | 3416 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
| 2776 | 3417 | if (file_exists($tmp_dir.'satcat.txt')) { |
| 2777 | - if ($globalDebug) echo "Add to DB..."; |
|
| 3418 | + if ($globalDebug) { |
|
| 3419 | + echo "Add to DB..."; |
|
| 3420 | + } |
|
| 2778 | 3421 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
| 2779 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3422 | + } else { |
|
| 3423 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
| 3424 | + } |
|
| 2780 | 3425 | if ($error != '') { |
| 2781 | 3426 | echo $error."\n"; |
| 2782 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3427 | + } elseif ($globalDebug) { |
|
| 3428 | + echo "Done\n"; |
|
| 3429 | + } |
|
| 2783 | 3430 | return ''; |
| 2784 | 3431 | } |
| 2785 | 3432 | |
| 2786 | 3433 | public static function update_models() { |
| 2787 | 3434 | global $tmp_dir, $globalDebug; |
| 2788 | 3435 | $error = ''; |
| 2789 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3436 | + if ($globalDebug) { |
|
| 3437 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3438 | + } |
|
| 2790 | 3439 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2791 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3440 | + if ($globalDebug) { |
|
| 3441 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3442 | + } |
|
| 2792 | 3443 | return ''; |
| 2793 | 3444 | } |
| 2794 | 3445 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
| 2795 | 3446 | if (file_exists($tmp_dir.'models.md5sum')) { |
| 2796 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3447 | + if ($globalDebug) { |
|
| 3448 | + echo "Check files...\n"; |
|
| 3449 | + } |
|
| 2797 | 3450 | $newmodelsdb = array(); |
| 2798 | 3451 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
| 2799 | 3452 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2812,18 +3465,28 @@ discard block |
||
| 2812 | 3465 | } |
| 2813 | 3466 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2814 | 3467 | foreach ($diff as $key => $value) { |
| 2815 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3468 | + if ($globalDebug) { |
|
| 3469 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3470 | + } |
|
| 2816 | 3471 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
| 2817 | 3472 | } |
| 2818 | 3473 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
| 2819 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3474 | + } else { |
|
| 3475 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3476 | + } |
|
| 2820 | 3477 | if ($error != '') { |
| 2821 | 3478 | return $error; |
| 2822 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 2823 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3479 | + } elseif ($globalDebug) { |
|
| 3480 | + echo "Done\n"; |
|
| 3481 | + } |
|
| 3482 | + if ($globalDebug) { |
|
| 3483 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
| 3484 | + } |
|
| 2824 | 3485 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
| 2825 | 3486 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
| 2826 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3487 | + if ($globalDebug) { |
|
| 3488 | + echo "Check files...\n"; |
|
| 3489 | + } |
|
| 2827 | 3490 | $newmodelsdb = array(); |
| 2828 | 3491 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
| 2829 | 3492 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2842,29 +3505,43 @@ discard block |
||
| 2842 | 3505 | } |
| 2843 | 3506 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2844 | 3507 | foreach ($diff as $key => $value) { |
| 2845 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3508 | + if ($globalDebug) { |
|
| 3509 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3510 | + } |
|
| 2846 | 3511 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
| 2847 | 3512 | |
| 2848 | 3513 | } |
| 2849 | 3514 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
| 2850 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3515 | + } else { |
|
| 3516 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
| 3517 | + } |
|
| 2851 | 3518 | if ($error != '') { |
| 2852 | 3519 | return $error; |
| 2853 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3520 | + } elseif ($globalDebug) { |
|
| 3521 | + echo "Done\n"; |
|
| 3522 | + } |
|
| 2854 | 3523 | return ''; |
| 2855 | 3524 | } |
| 2856 | 3525 | public static function update_weather_models() { |
| 2857 | 3526 | global $tmp_dir, $globalDebug; |
| 2858 | 3527 | $error = ''; |
| 2859 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
| 3528 | + if ($globalDebug) { |
|
| 3529 | + echo "Models from FlightAirMap website : Download..."; |
|
| 3530 | + } |
|
| 2860 | 3531 | if (!is_writable(dirname(__FILE__).'/../models/gltf2/weather')) { |
| 2861 | - if ($globalDebug) echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3532 | + if ($globalDebug) { |
|
| 3533 | + echo dirname(__FILE__).'/../models/gltf2/weather'.' is not writable !'; |
|
| 3534 | + } |
|
| 2862 | 3535 | return ''; |
| 2863 | 3536 | } |
| 2864 | - if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3537 | + if ($globalDebug) { |
|
| 3538 | + echo "Weather Models from FlightAirMap website : Download..."; |
|
| 3539 | + } |
|
| 2865 | 3540 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
| 2866 | 3541 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
| 2867 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3542 | + if ($globalDebug) { |
|
| 3543 | + echo "Check files...\n"; |
|
| 3544 | + } |
|
| 2868 | 3545 | $newmodelsdb = array(); |
| 2869 | 3546 | if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
| 2870 | 3547 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2883,25 +3560,35 @@ discard block |
||
| 2883 | 3560 | } |
| 2884 | 3561 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2885 | 3562 | foreach ($diff as $key => $value) { |
| 2886 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3563 | + if ($globalDebug) { |
|
| 3564 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
| 3565 | + } |
|
| 2887 | 3566 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
| 2888 | 3567 | |
| 2889 | 3568 | } |
| 2890 | 3569 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
| 2891 | - } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3570 | + } else { |
|
| 3571 | + $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
| 3572 | + } |
|
| 2892 | 3573 | if ($error != '') { |
| 2893 | 3574 | return $error; |
| 2894 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3575 | + } elseif ($globalDebug) { |
|
| 3576 | + echo "Done\n"; |
|
| 3577 | + } |
|
| 2895 | 3578 | return ''; |
| 2896 | 3579 | } |
| 2897 | 3580 | |
| 2898 | 3581 | public static function update_liveries() { |
| 2899 | 3582 | global $tmp_dir, $globalDebug; |
| 2900 | 3583 | $error = ''; |
| 2901 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
| 3584 | + if ($globalDebug) { |
|
| 3585 | + echo "Liveries from FlightAirMap website : Download..."; |
|
| 3586 | + } |
|
| 2902 | 3587 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
| 2903 | 3588 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
| 2904 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3589 | + if ($globalDebug) { |
|
| 3590 | + echo "Check files...\n"; |
|
| 3591 | + } |
|
| 2905 | 3592 | $newmodelsdb = array(); |
| 2906 | 3593 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
| 2907 | 3594 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2920,15 +3607,21 @@ discard block |
||
| 2920 | 3607 | } |
| 2921 | 3608 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2922 | 3609 | foreach ($diff as $key => $value) { |
| 2923 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3610 | + if ($globalDebug) { |
|
| 3611 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
| 3612 | + } |
|
| 2924 | 3613 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
| 2925 | 3614 | |
| 2926 | 3615 | } |
| 2927 | 3616 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
| 2928 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3617 | + } else { |
|
| 3618 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3619 | + } |
|
| 2929 | 3620 | if ($error != '') { |
| 2930 | 3621 | return $error; |
| 2931 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3622 | + } elseif ($globalDebug) { |
|
| 3623 | + echo "Done\n"; |
|
| 3624 | + } |
|
| 2932 | 3625 | return ''; |
| 2933 | 3626 | } |
| 2934 | 3627 | |
@@ -2936,13 +3629,19 @@ discard block |
||
| 2936 | 3629 | global $tmp_dir, $globalDebug; |
| 2937 | 3630 | $error = ''; |
| 2938 | 3631 | if (!is_writable(dirname(__FILE__).'/../models')) { |
| 2939 | - if ($globalDebug) echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3632 | + if ($globalDebug) { |
|
| 3633 | + echo dirname(__FILE__).'/../models'.' is not writable !'; |
|
| 3634 | + } |
|
| 2940 | 3635 | return ''; |
| 2941 | 3636 | } |
| 2942 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
| 3637 | + if ($globalDebug) { |
|
| 3638 | + echo "Space models from FlightAirMap website : Download..."; |
|
| 3639 | + } |
|
| 2943 | 3640 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
| 2944 | 3641 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
| 2945 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3642 | + if ($globalDebug) { |
|
| 3643 | + echo "Check files...\n"; |
|
| 3644 | + } |
|
| 2946 | 3645 | $newmodelsdb = array(); |
| 2947 | 3646 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
| 2948 | 3647 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2961,15 +3660,21 @@ discard block |
||
| 2961 | 3660 | } |
| 2962 | 3661 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 2963 | 3662 | foreach ($diff as $key => $value) { |
| 2964 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3663 | + if ($globalDebug) { |
|
| 3664 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
| 3665 | + } |
|
| 2965 | 3666 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
| 2966 | 3667 | |
| 2967 | 3668 | } |
| 2968 | 3669 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
| 2969 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3670 | + } else { |
|
| 3671 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3672 | + } |
|
| 2970 | 3673 | if ($error != '') { |
| 2971 | 3674 | return $error; |
| 2972 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3675 | + } elseif ($globalDebug) { |
|
| 3676 | + echo "Done\n"; |
|
| 3677 | + } |
|
| 2973 | 3678 | return ''; |
| 2974 | 3679 | } |
| 2975 | 3680 | |
@@ -2977,13 +3682,19 @@ discard block |
||
| 2977 | 3682 | global $tmp_dir, $globalDebug; |
| 2978 | 3683 | $error = ''; |
| 2979 | 3684 | if (!is_writable(dirname(__FILE__).'/../models/vehicules')) { |
| 2980 | - if ($globalDebug) echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3685 | + if ($globalDebug) { |
|
| 3686 | + echo dirname(__FILE__).'/../models/vehicules'.' is not writable !'; |
|
| 3687 | + } |
|
| 2981 | 3688 | return ''; |
| 2982 | 3689 | } |
| 2983 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3690 | + if ($globalDebug) { |
|
| 3691 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
| 3692 | + } |
|
| 2984 | 3693 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
| 2985 | 3694 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
| 2986 | - if ($globalDebug) echo "Check files...\n"; |
|
| 3695 | + if ($globalDebug) { |
|
| 3696 | + echo "Check files...\n"; |
|
| 3697 | + } |
|
| 2987 | 3698 | $newmodelsdb = array(); |
| 2988 | 3699 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
| 2989 | 3700 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -3002,15 +3713,21 @@ discard block |
||
| 3002 | 3713 | } |
| 3003 | 3714 | $diff = array_diff($newmodelsdb,$modelsdb); |
| 3004 | 3715 | foreach ($diff as $key => $value) { |
| 3005 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3716 | + if ($globalDebug) { |
|
| 3717 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
| 3718 | + } |
|
| 3006 | 3719 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
| 3007 | 3720 | |
| 3008 | 3721 | } |
| 3009 | 3722 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
| 3010 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3723 | + } else { |
|
| 3724 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
| 3725 | + } |
|
| 3011 | 3726 | if ($error != '') { |
| 3012 | 3727 | return $error; |
| 3013 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3728 | + } elseif ($globalDebug) { |
|
| 3729 | + echo "Done\n"; |
|
| 3730 | + } |
|
| 3014 | 3731 | return ''; |
| 3015 | 3732 | } |
| 3016 | 3733 | |
@@ -3083,7 +3800,9 @@ discard block |
||
| 3083 | 3800 | } |
| 3084 | 3801 | |
| 3085 | 3802 | $error = ''; |
| 3086 | - if ($globalDebug) echo "Notam : Download..."; |
|
| 3803 | + if ($globalDebug) { |
|
| 3804 | + echo "Notam : Download..."; |
|
| 3805 | + } |
|
| 3087 | 3806 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
| 3088 | 3807 | if (file_exists($tmp_dir.'notam.rss')) { |
| 3089 | 3808 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3098,14 +3817,30 @@ discard block |
||
| 3098 | 3817 | $data['fir'] = $q[0]; |
| 3099 | 3818 | $data['code'] = $q[1]; |
| 3100 | 3819 | $ifrvfr = $q[2]; |
| 3101 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
| 3102 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
| 3103 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
| 3104 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
| 3105 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
| 3106 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
| 3107 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
| 3108 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
| 3820 | + if ($ifrvfr == 'IV') { |
|
| 3821 | + $data['rules'] = 'IFR/VFR'; |
|
| 3822 | + } |
|
| 3823 | + if ($ifrvfr == 'I') { |
|
| 3824 | + $data['rules'] = 'IFR'; |
|
| 3825 | + } |
|
| 3826 | + if ($ifrvfr == 'V') { |
|
| 3827 | + $data['rules'] = 'VFR'; |
|
| 3828 | + } |
|
| 3829 | + if ($q[4] == 'A') { |
|
| 3830 | + $data['scope'] = 'Airport warning'; |
|
| 3831 | + } |
|
| 3832 | + if ($q[4] == 'E') { |
|
| 3833 | + $data['scope'] = 'Enroute warning'; |
|
| 3834 | + } |
|
| 3835 | + if ($q[4] == 'W') { |
|
| 3836 | + $data['scope'] = 'Navigation warning'; |
|
| 3837 | + } |
|
| 3838 | + if ($q[4] == 'AE') { |
|
| 3839 | + $data['scope'] = 'Airport/Enroute warning'; |
|
| 3840 | + } |
|
| 3841 | + if ($q[4] == 'AW') { |
|
| 3842 | + $data['scope'] = 'Airport/Navigation warning'; |
|
| 3843 | + } |
|
| 3109 | 3844 | //$data['scope'] = $q[4]; |
| 3110 | 3845 | $data['lower_limit'] = $q[5]; |
| 3111 | 3846 | $data['upper_limit'] = $q[6]; |
@@ -3113,8 +3848,12 @@ discard block |
||
| 3113 | 3848 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
| 3114 | 3849 | $latitude = $Common->convertDec($las,'latitude'); |
| 3115 | 3850 | $longitude = $Common->convertDec($lns,'longitude'); |
| 3116 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
| 3117 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
| 3851 | + if ($lac == 'S') { |
|
| 3852 | + $latitude = '-'.$latitude; |
|
| 3853 | + } |
|
| 3854 | + if ($lnc == 'W') { |
|
| 3855 | + $longitude = '-'.$longitude; |
|
| 3856 | + } |
|
| 3118 | 3857 | $data['center_latitude'] = $latitude; |
| 3119 | 3858 | $data['center_longitude'] = $longitude; |
| 3120 | 3859 | $data['radius'] = intval($radius); |
@@ -3144,10 +3883,14 @@ discard block |
||
| 3144 | 3883 | $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']); |
| 3145 | 3884 | unset($data); |
| 3146 | 3885 | } |
| 3147 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3886 | + } else { |
|
| 3887 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
| 3888 | + } |
|
| 3148 | 3889 | if ($error != '') { |
| 3149 | 3890 | return $error; |
| 3150 | - } elseif ($globalDebug) echo "Done\n"; |
|
| 3891 | + } elseif ($globalDebug) { |
|
| 3892 | + echo "Done\n"; |
|
| 3893 | + } |
|
| 3151 | 3894 | return ''; |
| 3152 | 3895 | } |
| 3153 | 3896 | |
@@ -3172,7 +3915,9 @@ discard block |
||
| 3172 | 3915 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
| 3173 | 3916 | $airspace_json = json_decode($airspace_lst,true); |
| 3174 | 3917 | foreach ($airspace_json['records'] as $airspace) { |
| 3175 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
| 3918 | + if ($globalDebug) { |
|
| 3919 | + echo $airspace['name']."...\n"; |
|
| 3920 | + } |
|
| 3176 | 3921 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
| 3177 | 3922 | if (file_exists($tmp_dir.$airspace['name'])) { |
| 3178 | 3923 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3216,8 +3961,11 @@ discard block |
||
| 3216 | 3961 | return "error : ".$e->getMessage(); |
| 3217 | 3962 | } |
| 3218 | 3963 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3219 | - if ($row['nb'] > 0) return false; |
|
| 3220 | - else return true; |
|
| 3964 | + if ($row['nb'] > 0) { |
|
| 3965 | + return false; |
|
| 3966 | + } else { |
|
| 3967 | + return true; |
|
| 3968 | + } |
|
| 3221 | 3969 | } |
| 3222 | 3970 | |
| 3223 | 3971 | public static function insert_last_update() { |
@@ -3242,8 +3990,11 @@ discard block |
||
| 3242 | 3990 | return "error : ".$e->getMessage(); |
| 3243 | 3991 | } |
| 3244 | 3992 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3245 | - if ($row['nb'] > 0) return true; |
|
| 3246 | - else return false; |
|
| 3993 | + if ($row['nb'] > 0) { |
|
| 3994 | + return true; |
|
| 3995 | + } else { |
|
| 3996 | + return false; |
|
| 3997 | + } |
|
| 3247 | 3998 | } |
| 3248 | 3999 | |
| 3249 | 4000 | public static function check_geoid_version($version) { |
@@ -3256,8 +4007,11 @@ discard block |
||
| 3256 | 4007 | return "error : ".$e->getMessage(); |
| 3257 | 4008 | } |
| 3258 | 4009 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3259 | - if ($row['nb'] > 0) return true; |
|
| 3260 | - else return false; |
|
| 4010 | + if ($row['nb'] > 0) { |
|
| 4011 | + return true; |
|
| 4012 | + } else { |
|
| 4013 | + return false; |
|
| 4014 | + } |
|
| 3261 | 4015 | } |
| 3262 | 4016 | |
| 3263 | 4017 | public static function check_marine_identity_version($version) { |
@@ -3270,8 +4024,11 @@ discard block |
||
| 3270 | 4024 | return "error : ".$e->getMessage(); |
| 3271 | 4025 | } |
| 3272 | 4026 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3273 | - if ($row['nb'] > 0) return true; |
|
| 3274 | - else return false; |
|
| 4027 | + if ($row['nb'] > 0) { |
|
| 4028 | + return true; |
|
| 4029 | + } else { |
|
| 4030 | + return false; |
|
| 4031 | + } |
|
| 3275 | 4032 | } |
| 3276 | 4033 | |
| 3277 | 4034 | public static function check_satellite_version($version) { |
@@ -3284,8 +4041,11 @@ discard block |
||
| 3284 | 4041 | return "error : ".$e->getMessage(); |
| 3285 | 4042 | } |
| 3286 | 4043 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3287 | - if ($row['nb'] > 0) return true; |
|
| 3288 | - else return false; |
|
| 4044 | + if ($row['nb'] > 0) { |
|
| 4045 | + return true; |
|
| 4046 | + } else { |
|
| 4047 | + return false; |
|
| 4048 | + } |
|
| 3289 | 4049 | } |
| 3290 | 4050 | |
| 3291 | 4051 | public static function check_airlines_version($version) { |
@@ -3298,8 +4058,11 @@ discard block |
||
| 3298 | 4058 | return "error : ".$e->getMessage(); |
| 3299 | 4059 | } |
| 3300 | 4060 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3301 | - if ($row['nb'] > 0) return true; |
|
| 3302 | - else return false; |
|
| 4061 | + if ($row['nb'] > 0) { |
|
| 4062 | + return true; |
|
| 4063 | + } else { |
|
| 4064 | + return false; |
|
| 4065 | + } |
|
| 3303 | 4066 | } |
| 3304 | 4067 | |
| 3305 | 4068 | public static function check_notam_version($version) { |
@@ -3312,8 +4075,11 @@ discard block |
||
| 3312 | 4075 | return "error : ".$e->getMessage(); |
| 3313 | 4076 | } |
| 3314 | 4077 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3315 | - if ($row['nb'] > 0) return true; |
|
| 3316 | - else return false; |
|
| 4078 | + if ($row['nb'] > 0) { |
|
| 4079 | + return true; |
|
| 4080 | + } else { |
|
| 4081 | + return false; |
|
| 4082 | + } |
|
| 3317 | 4083 | } |
| 3318 | 4084 | |
| 3319 | 4085 | public static function insert_airlines_version($version) { |
@@ -3403,8 +4169,11 @@ discard block |
||
| 3403 | 4169 | return "error : ".$e->getMessage(); |
| 3404 | 4170 | } |
| 3405 | 4171 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3406 | - if ($row['nb'] > 0) return false; |
|
| 3407 | - else return true; |
|
| 4172 | + if ($row['nb'] > 0) { |
|
| 4173 | + return false; |
|
| 4174 | + } else { |
|
| 4175 | + return true; |
|
| 4176 | + } |
|
| 3408 | 4177 | } |
| 3409 | 4178 | |
| 3410 | 4179 | public static function insert_last_notam_update() { |
@@ -3434,8 +4203,11 @@ discard block |
||
| 3434 | 4203 | return "error : ".$e->getMessage(); |
| 3435 | 4204 | } |
| 3436 | 4205 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3437 | - if ($row['nb'] > 0) return false; |
|
| 3438 | - else return true; |
|
| 4206 | + if ($row['nb'] > 0) { |
|
| 4207 | + return false; |
|
| 4208 | + } else { |
|
| 4209 | + return true; |
|
| 4210 | + } |
|
| 3439 | 4211 | } |
| 3440 | 4212 | |
| 3441 | 4213 | public static function insert_last_airspace_update() { |
@@ -3465,8 +4237,11 @@ discard block |
||
| 3465 | 4237 | return "error : ".$e->getMessage(); |
| 3466 | 4238 | } |
| 3467 | 4239 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3468 | - if ($row['nb'] > 0) return false; |
|
| 3469 | - else return true; |
|
| 4240 | + if ($row['nb'] > 0) { |
|
| 4241 | + return false; |
|
| 4242 | + } else { |
|
| 4243 | + return true; |
|
| 4244 | + } |
|
| 3470 | 4245 | } |
| 3471 | 4246 | |
| 3472 | 4247 | public static function insert_last_geoid_update() { |
@@ -3496,8 +4271,11 @@ discard block |
||
| 3496 | 4271 | return "error : ".$e->getMessage(); |
| 3497 | 4272 | } |
| 3498 | 4273 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3499 | - if ($row['nb'] > 0) return false; |
|
| 3500 | - else return true; |
|
| 4274 | + if ($row['nb'] > 0) { |
|
| 4275 | + return false; |
|
| 4276 | + } else { |
|
| 4277 | + return true; |
|
| 4278 | + } |
|
| 3501 | 4279 | } |
| 3502 | 4280 | |
| 3503 | 4281 | public static function insert_last_owner_update() { |
@@ -3527,8 +4305,11 @@ discard block |
||
| 3527 | 4305 | return "error : ".$e->getMessage(); |
| 3528 | 4306 | } |
| 3529 | 4307 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3530 | - if ($row['nb'] > 0) return false; |
|
| 3531 | - else return true; |
|
| 4308 | + if ($row['nb'] > 0) { |
|
| 4309 | + return false; |
|
| 4310 | + } else { |
|
| 4311 | + return true; |
|
| 4312 | + } |
|
| 3532 | 4313 | } |
| 3533 | 4314 | |
| 3534 | 4315 | public static function insert_last_fires_update() { |
@@ -3558,8 +4339,11 @@ discard block |
||
| 3558 | 4339 | return "error : ".$e->getMessage(); |
| 3559 | 4340 | } |
| 3560 | 4341 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3561 | - if ($row['nb'] > 0) return false; |
|
| 3562 | - else return true; |
|
| 4342 | + if ($row['nb'] > 0) { |
|
| 4343 | + return false; |
|
| 4344 | + } else { |
|
| 4345 | + return true; |
|
| 4346 | + } |
|
| 3563 | 4347 | } |
| 3564 | 4348 | |
| 3565 | 4349 | public static function insert_last_airlines_update() { |
@@ -3589,8 +4373,11 @@ discard block |
||
| 3589 | 4373 | return "error : ".$e->getMessage(); |
| 3590 | 4374 | } |
| 3591 | 4375 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3592 | - if ($row['nb'] > 0) return false; |
|
| 3593 | - else return true; |
|
| 4376 | + if ($row['nb'] > 0) { |
|
| 4377 | + return false; |
|
| 4378 | + } else { |
|
| 4379 | + return true; |
|
| 4380 | + } |
|
| 3594 | 4381 | } |
| 3595 | 4382 | |
| 3596 | 4383 | public static function insert_last_schedules_update() { |
@@ -3620,8 +4407,11 @@ discard block |
||
| 3620 | 4407 | return "error : ".$e->getMessage(); |
| 3621 | 4408 | } |
| 3622 | 4409 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3623 | - if ($row['nb'] > 0) return false; |
|
| 3624 | - else return true; |
|
| 4410 | + if ($row['nb'] > 0) { |
|
| 4411 | + return false; |
|
| 4412 | + } else { |
|
| 4413 | + return true; |
|
| 4414 | + } |
|
| 3625 | 4415 | } |
| 3626 | 4416 | |
| 3627 | 4417 | public static function insert_last_tle_update() { |
@@ -3651,8 +4441,11 @@ discard block |
||
| 3651 | 4441 | return "error : ".$e->getMessage(); |
| 3652 | 4442 | } |
| 3653 | 4443 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3654 | - if ($row['nb'] > 0) return false; |
|
| 3655 | - else return true; |
|
| 4444 | + if ($row['nb'] > 0) { |
|
| 4445 | + return false; |
|
| 4446 | + } else { |
|
| 4447 | + return true; |
|
| 4448 | + } |
|
| 3656 | 4449 | } |
| 3657 | 4450 | |
| 3658 | 4451 | public static function insert_last_ucsdb_update() { |
@@ -3682,8 +4475,11 @@ discard block |
||
| 3682 | 4475 | return "error : ".$e->getMessage(); |
| 3683 | 4476 | } |
| 3684 | 4477 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3685 | - if ($row['nb'] > 0) return false; |
|
| 3686 | - else return true; |
|
| 4478 | + if ($row['nb'] > 0) { |
|
| 4479 | + return false; |
|
| 4480 | + } else { |
|
| 4481 | + return true; |
|
| 4482 | + } |
|
| 3687 | 4483 | } |
| 3688 | 4484 | |
| 3689 | 4485 | public static function insert_last_celestrak_update() { |
@@ -3713,8 +4509,11 @@ discard block |
||
| 3713 | 4509 | return "error : ".$e->getMessage(); |
| 3714 | 4510 | } |
| 3715 | 4511 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3716 | - if ($row['nb'] > 0) return false; |
|
| 3717 | - else return true; |
|
| 4512 | + if ($row['nb'] > 0) { |
|
| 4513 | + return false; |
|
| 4514 | + } else { |
|
| 4515 | + return true; |
|
| 4516 | + } |
|
| 3718 | 4517 | } |
| 3719 | 4518 | |
| 3720 | 4519 | public static function check_last_satellite_update() { |
@@ -3732,8 +4531,11 @@ discard block |
||
| 3732 | 4531 | return "error : ".$e->getMessage(); |
| 3733 | 4532 | } |
| 3734 | 4533 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
| 3735 | - if ($row['nb'] > 0) return false; |
|
| 3736 | - else return true; |
|
| 4534 | + if ($row['nb'] > 0) { |
|
| 4535 | + return false; |
|
| 4536 | + } else { |
|
| 4537 | + return true; |
|
| 4538 | + } |
|
| 3737 | 4539 | } |
| 3738 | 4540 | |
| 3739 | 4541 | public static function insert_last_marine_identity_update() { |
@@ -13,20 +13,20 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $coords = explode(',',$_GET['coord']); |
| 15 | 15 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
| 16 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 16 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 17 | 17 | //$spotter_array = $Source->getAllLocationInfo(); |
| 18 | 18 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
| 19 | 19 | } |
| 20 | 20 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
| 21 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 21 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 22 | 22 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
| 23 | 23 | } |
| 24 | 24 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
| 25 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 25 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 26 | 26 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
| 27 | 27 | } |
| 28 | 28 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
| 29 | - || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 29 | + || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 30 | 30 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
| 31 | 31 | } |
| 32 | 32 | if (!isset($globalDemo)) { |
@@ -34,20 +34,20 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | } else { |
| 36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
| 37 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 37 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
| 39 | 39 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
| 40 | 40 | } |
| 41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
| 42 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 42 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 43 | 43 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
| 44 | 44 | } |
| 45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
| 46 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 46 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 47 | 47 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
| 48 | 48 | } |
| 49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
| 50 | - || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 50 | + || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 51 | 51 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
| 52 | 52 | } |
| 53 | 53 | if (!isset($globalDemo)) { |
@@ -11,47 +11,47 @@ discard block |
||
| 11 | 11 | $spotter_array = array(); |
| 12 | 12 | if (isset($_GET['coord'])) |
| 13 | 13 | { |
| 14 | - $coords = explode(',',$_GET['coord']); |
|
| 14 | + $coords = explode(',', $_GET['coord']); |
|
| 15 | 15 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
| 16 | 16 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
| 17 | 17 | //$spotter_array = $Source->getAllLocationInfo(); |
| 18 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
|
| 18 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs', $coords)); |
|
| 19 | 19 | } |
| 20 | 20 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
| 21 | 21 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
| 22 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
|
| 22 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx', $coords)); |
|
| 23 | 23 | } |
| 24 | 24 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
| 25 | 25 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
| 26 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
|
| 26 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning', $coords)); |
|
| 27 | 27 | } |
| 28 | 28 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
| 29 | 29 | || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
| 30 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
|
| 30 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', $coords, true)); |
|
| 31 | 31 | } |
| 32 | 32 | if (!isset($globalDemo)) { |
| 33 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
| 33 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
| 34 | 34 | } |
| 35 | 35 | } else { |
| 36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
| 37 | 37 | || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
| 38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
| 39 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
|
| 39 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('gs')); |
|
| 40 | 40 | } |
| 41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
| 42 | 42 | || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
| 43 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
|
| 43 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('wx')); |
|
| 44 | 44 | } |
| 45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
| 46 | 46 | || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
| 47 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
|
| 47 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('lightning')); |
|
| 48 | 48 | } |
| 49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
| 50 | 50 | || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
| 51 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
|
| 51 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('fires', array(), true)); |
|
| 52 | 52 | } |
| 53 | 53 | if (!isset($globalDemo)) { |
| 54 | - $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('')); |
|
| 54 | + $spotter_array = array_merge($spotter_array, $Source->getLocationInfoByType('')); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $output = '{"type": "FeatureCollection","features": ['; |
| 60 | 60 | if (!empty($spotter_array) && count($spotter_array) > 0) |
| 61 | 61 | { |
| 62 | - foreach($spotter_array as $spotter_item) |
|
| 62 | + foreach ($spotter_array as $spotter_item) |
|
| 63 | 63 | { |
| 64 | 64 | date_default_timezone_set('UTC'); |
| 65 | 65 | $output .= '{"type": "Feature",'; |
@@ -78,8 +78,8 @@ discard block |
||
| 78 | 78 | $output .= '"icon": "'.$globalURL.'/images/'.$spotter_item['logo'].'",'; |
| 79 | 79 | $output .= '"type": "'.$spotter_item['type'].'",'; |
| 80 | 80 | if ($spotter_item['type'] == 'wx') { |
| 81 | - $weather = json_decode($spotter_item['description'],true); |
|
| 82 | - if (isset($weather['temp'])) $output.= '"temp": "'.$weather['temp'].'",'; |
|
| 81 | + $weather = json_decode($spotter_item['description'], true); |
|
| 82 | + if (isset($weather['temp'])) $output .= '"temp": "'.$weather['temp'].'",'; |
|
| 83 | 83 | } |
| 84 | 84 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
| 85 | 85 | $output .= '},'; |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | $output .= '}'; |
| 90 | 90 | $output .= '},'; |
| 91 | 91 | } |
| 92 | - $output = substr($output, 0, -1); |
|
| 92 | + $output = substr($output, 0, -1); |
|
| 93 | 93 | } |
| 94 | 94 | $output .= ']}'; |
| 95 | 95 | print $output; |
@@ -57,7 +57,10 @@ discard block |
||
| 57 | 57 | <?php |
| 58 | 58 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
| 59 | 59 | ?> |
| 60 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
| 60 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
| 61 | + print '?tsk='.$tsk; |
|
| 62 | +} |
|
| 63 | +?>"></script> |
|
| 61 | 64 | <script src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script> |
| 62 | 65 | <script src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script> |
| 63 | 66 | <?php |
@@ -137,9 +140,18 @@ discard block |
||
| 137 | 140 | <h1>Weather</h1> |
| 138 | 141 | <ul> |
| 139 | 142 | |
| 140 | - <li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li> |
|
| 141 | - <li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li> |
|
| 142 | - <!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> --> |
|
| 143 | + <li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') { |
|
| 144 | + print 'checked'; |
|
| 145 | +} |
|
| 146 | +?> /><?php echo _("Weather Winds"); ?></label></div></li> |
|
| 147 | + <li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') { |
|
| 148 | + print 'checked'; |
|
| 149 | +} |
|
| 150 | +?> /><?php echo _("Ocean surface currents"); ?></label></div></li> |
|
| 151 | + <!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') { |
|
| 152 | + print 'checked'; |
|
| 153 | +} |
|
| 154 | +?> /><?php echo _("Weather Waves height background"); ?></label></div></li> --> |
|
| 143 | 155 | |
| 144 | 156 | <?php |
| 145 | 157 | if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') { |
@@ -158,7 +170,10 @@ discard block |
||
| 158 | 170 | ?> |
| 159 | 171 | <h1>Weather</h1> |
| 160 | 172 | <ul> |
| 161 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
|
| 173 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) { |
|
| 174 | + print 'checked'; |
|
| 175 | +} |
|
| 176 | +?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
|
| 162 | 177 | <!-- <li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>--> |
| 163 | 178 | </ul> |
| 164 | 179 | <?php |
@@ -176,13 +191,22 @@ discard block |
||
| 176 | 191 | <?php |
| 177 | 192 | if (!isset($globalAircraft) || $globalAircraft) { |
| 178 | 193 | ?> |
| 179 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 180 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 194 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 195 | + print 'checked'; |
|
| 196 | +} |
|
| 197 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 198 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 199 | + print 'checked'; |
|
| 200 | +} |
|
| 201 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 181 | 202 | <?php |
| 182 | 203 | } |
| 183 | 204 | if (isset($globalMarine) && $globalMarine) { |
| 184 | 205 | ?> |
| 185 | - <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 206 | + <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') { |
|
| 207 | + print 'checked'; |
|
| 208 | +} |
|
| 209 | +?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 186 | 210 | <?php |
| 187 | 211 | } |
| 188 | 212 | ?> |
@@ -197,13 +221,22 @@ discard block |
||
| 197 | 221 | <?php |
| 198 | 222 | if (!isset($globalAircraft) || $globalAircraft) { |
| 199 | 223 | ?> |
| 200 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 201 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 224 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 225 | + print 'checked'; |
|
| 226 | +} |
|
| 227 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 228 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 229 | + print 'checked'; |
|
| 230 | +} |
|
| 231 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 202 | 232 | <?php |
| 203 | 233 | } |
| 204 | 234 | if (isset($globalMarine) && $globalMarine) { |
| 205 | 235 | ?> |
| 206 | - <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 236 | + <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') { |
|
| 237 | + print 'checked'; |
|
| 238 | +} |
|
| 239 | +?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 207 | 240 | <?php |
| 208 | 241 | } |
| 209 | 242 | ?> |
@@ -218,14 +251,32 @@ discard block |
||
| 218 | 251 | <h1>NOTAM</h1> |
| 219 | 252 | <form> |
| 220 | 253 | <ul> |
| 221 | - <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 254 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
| 255 | + print 'checked'; |
|
| 256 | +} |
|
| 257 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 222 | 258 | <li><?php echo _("NOTAM scope:"); ?> |
| 223 | 259 | <select class="selectpicker" onchange="notamscope(this);"> |
| 224 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
| 225 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
| 226 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
| 227 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
| 228 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
| 260 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
| 261 | + print ' selected'; |
|
| 262 | +} |
|
| 263 | +?>>All</option> |
|
| 264 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
| 265 | + print ' selected'; |
|
| 266 | +} |
|
| 267 | +?>>Airport/Enroute warning</option> |
|
| 268 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
| 269 | + print ' selected'; |
|
| 270 | +} |
|
| 271 | +?>>Airport warning</option> |
|
| 272 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
| 273 | + print ' selected'; |
|
| 274 | +} |
|
| 275 | +?>>Navigation warning</option> |
|
| 276 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
| 277 | + print ' selected'; |
|
| 278 | +} |
|
| 279 | +?>>Enroute warning</option> |
|
| 229 | 280 | </select |
| 230 | 281 | </li> |
| 231 | 282 | </ul> |
@@ -253,7 +304,10 @@ discard block |
||
| 253 | 304 | <div class="form-group"> |
| 254 | 305 | <label><?php echo _("From:"); ?></label> |
| 255 | 306 | <div class='input-group date' id='datetimepicker1'> |
| 256 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
| 307 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
| 308 | + print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; |
|
| 309 | +} |
|
| 310 | +?>" required /> |
|
| 257 | 311 | <span class="input-group-addon"> |
| 258 | 312 | <span class="glyphicon glyphicon-calendar"></span> |
| 259 | 313 | </span> |
@@ -262,7 +316,10 @@ discard block |
||
| 262 | 316 | <div class="form-group"> |
| 263 | 317 | <label><?php echo _("To:"); ?></label> |
| 264 | 318 | <div class='input-group date' id='datetimepicker2'> |
| 265 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
| 319 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') { |
|
| 320 | + print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; |
|
| 321 | +} |
|
| 322 | +?>" /> |
|
| 266 | 323 | <span class="input-group-addon"> |
| 267 | 324 | <span class="glyphicon glyphicon-calendar"></span> |
| 268 | 325 | </span> |
@@ -294,8 +351,20 @@ discard block |
||
| 294 | 351 | </script> |
| 295 | 352 | <li><?php echo _("Playback speed:"); ?> |
| 296 | 353 | <div class="range"> |
| 297 | - <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
| 298 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
| 354 | + <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
| 355 | + print $_POST['archivespeed']; |
|
| 356 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
| 357 | + print $_COOKIE['archive_speed']; |
|
| 358 | +} else { |
|
| 359 | + print '1'; |
|
| 360 | +} |
|
| 361 | +?>"> |
|
| 362 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
| 363 | + print $_COOKIE['archive_speed']; |
|
| 364 | +} else { |
|
| 365 | + print '1'; |
|
| 366 | +} |
|
| 367 | +?></output> |
|
| 299 | 368 | </div> |
| 300 | 369 | </li> |
| 301 | 370 | <?php |
@@ -324,14 +393,20 @@ discard block |
||
| 324 | 393 | <li><?php echo _("Type of Map:"); ?> |
| 325 | 394 | <?php |
| 326 | 395 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 327 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
| 328 | - else $MapType = $_COOKIE['MapType']; |
|
| 396 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
| 397 | + $MapType = $globalMapProvider; |
|
| 398 | + } else { |
|
| 399 | + $MapType = $_COOKIE['MapType']; |
|
| 400 | + } |
|
| 329 | 401 | ?> |
| 330 | 402 | <select class="selectpicker" onchange="mapType(this);"> |
| 331 | 403 | <?php |
| 332 | 404 | } else { |
| 333 | - if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
|
| 334 | - else $MapType = $_COOKIE['MapType3D']; |
|
| 405 | + if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') { |
|
| 406 | + $MapType = $globalMapProvider; |
|
| 407 | + } else { |
|
| 408 | + $MapType = $_COOKIE['MapType3D']; |
|
| 409 | + } |
|
| 335 | 410 | ?> |
| 336 | 411 | <select class="selectpicker" onchange="mapType3D(this);"> |
| 337 | 412 | <?php |
@@ -340,24 +415,48 @@ discard block |
||
| 340 | 415 | <?php |
| 341 | 416 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
| 342 | 417 | ?> |
| 343 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 418 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 419 | + print ' selected'; |
|
| 420 | +} |
|
| 421 | +?>>Natural Earth (local)</option> |
|
| 344 | 422 | <?php |
| 345 | 423 | } else { |
| 346 | 424 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
| 347 | 425 | ?> |
| 348 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 426 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 427 | + print ' selected'; |
|
| 428 | +} |
|
| 429 | +?>>Natural Earth (local)</option> |
|
| 349 | 430 | <?php |
| 350 | 431 | } |
| 351 | 432 | ?> |
| 352 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
| 353 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
| 354 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
|
| 433 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
| 434 | + print ' selected'; |
|
| 435 | +} |
|
| 436 | +?>>ArcGIS Streetmap</option> |
|
| 437 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
| 438 | + print ' selected'; |
|
| 439 | +} |
|
| 440 | +?>>ArcGIS Satellite</option> |
|
| 441 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') { |
|
| 442 | + print ' selected'; |
|
| 443 | +} |
|
| 444 | +?>>ArcGIS Ocean</option> |
|
| 355 | 445 | <?php |
| 356 | 446 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 357 | 447 | ?> |
| 358 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
| 359 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
| 360 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
| 448 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
| 449 | + print ' selected'; |
|
| 450 | +} |
|
| 451 | +?>>Bing-Aerial</option> |
|
| 452 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
| 453 | + print ' selected'; |
|
| 454 | +} |
|
| 455 | +?>>Bing-Hybrid</option> |
|
| 456 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
| 457 | + print ' selected'; |
|
| 458 | +} |
|
| 459 | +?>>Bing-Road</option> |
|
| 361 | 460 | <?php |
| 362 | 461 | } |
| 363 | 462 | ?> |
@@ -367,59 +466,143 @@ discard block |
||
| 367 | 466 | <?php |
| 368 | 467 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 369 | 468 | ?> |
| 370 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
| 371 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
| 372 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
| 469 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
| 470 | + print ' selected'; |
|
| 471 | +} |
|
| 472 | +?>>Here-Aerial</option> |
|
| 473 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
| 474 | + print ' selected'; |
|
| 475 | +} |
|
| 476 | +?>>Here-Hybrid</option> |
|
| 477 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
| 478 | + print ' selected'; |
|
| 479 | +} |
|
| 480 | +?>>Here-Road</option> |
|
| 373 | 481 | <?php |
| 374 | 482 | } |
| 375 | 483 | ?> |
| 376 | 484 | <?php |
| 377 | 485 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 378 | 486 | ?> |
| 379 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
| 380 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
| 381 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
| 382 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
| 487 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
| 488 | + print ' selected'; |
|
| 489 | +} |
|
| 490 | +?>>Google Roadmap</option> |
|
| 491 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
| 492 | + print ' selected'; |
|
| 493 | +} |
|
| 494 | +?>>Google Satellite</option> |
|
| 495 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
| 496 | + print ' selected'; |
|
| 497 | +} |
|
| 498 | +?>>Google Hybrid</option> |
|
| 499 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
| 500 | + print ' selected'; |
|
| 501 | +} |
|
| 502 | +?>>Google Terrain</option> |
|
| 383 | 503 | <?php |
| 384 | 504 | } |
| 385 | 505 | ?> |
| 386 | 506 | <?php |
| 387 | 507 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 388 | 508 | ?> |
| 389 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
| 390 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
| 391 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
| 509 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
| 510 | + print ' selected'; |
|
| 511 | +} |
|
| 512 | +?>>MapQuest-OSM</option> |
|
| 513 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
| 514 | + print ' selected'; |
|
| 515 | +} |
|
| 516 | +?>>MapQuest-Aerial</option> |
|
| 517 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
| 518 | + print ' selected'; |
|
| 519 | +} |
|
| 520 | +?>>MapQuest-Hybrid</option> |
|
| 392 | 521 | <?php |
| 393 | 522 | } |
| 394 | 523 | ?> |
| 395 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
| 396 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
| 524 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
| 525 | + print ' selected'; |
|
| 526 | +} |
|
| 527 | +?>>Yandex</option> |
|
| 528 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 529 | + print ' selected'; |
|
| 530 | +} |
|
| 531 | +?>>Natural Earth</option> |
|
| 397 | 532 | <?php |
| 398 | 533 | } |
| 399 | 534 | ?> |
| 400 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
| 535 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
| 536 | + print ' selected'; |
|
| 537 | +} |
|
| 538 | +?>>National Geographic Street</option> |
|
| 401 | 539 | <?php |
| 402 | 540 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
| 403 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
| 404 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 541 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
| 542 | + $MapBoxId = 'default'; |
|
| 543 | + } else { |
|
| 544 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 545 | + } |
|
| 405 | 546 | ?> |
| 406 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
| 407 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
| 408 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
| 409 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
| 410 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
| 411 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
| 412 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
| 413 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
| 414 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
| 415 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
| 416 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
| 417 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
| 418 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
| 547 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
| 548 | + print ' selected'; |
|
| 549 | +} |
|
| 550 | +?>>Mapbox GL</option> |
|
| 551 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
| 552 | + print ' selected'; |
|
| 553 | +} |
|
| 554 | +?>>Mapbox default</option> |
|
| 555 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
| 556 | + print ' selected'; |
|
| 557 | +} |
|
| 558 | +?>>Mapbox streets</option> |
|
| 559 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
| 560 | + print ' selected'; |
|
| 561 | +} |
|
| 562 | +?>>Mapbox light</option> |
|
| 563 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
| 564 | + print ' selected'; |
|
| 565 | +} |
|
| 566 | +?>>Mapbox dark</option> |
|
| 567 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
| 568 | + print ' selected'; |
|
| 569 | +} |
|
| 570 | +?>>Mapbox satellite</option> |
|
| 571 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
| 572 | + print ' selected'; |
|
| 573 | +} |
|
| 574 | +?>>Mapbox streets-satellite</option> |
|
| 575 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
| 576 | + print ' selected'; |
|
| 577 | +} |
|
| 578 | +?>>Mapbox streets-basic</option> |
|
| 579 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
| 580 | + print ' selected'; |
|
| 581 | +} |
|
| 582 | +?>>Mapbox comic</option> |
|
| 583 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
| 584 | + print ' selected'; |
|
| 585 | +} |
|
| 586 | +?>>Mapbox outdoors</option> |
|
| 587 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
| 588 | + print ' selected'; |
|
| 589 | +} |
|
| 590 | +?>>Mapbox pencil</option> |
|
| 591 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
| 592 | + print ' selected'; |
|
| 593 | +} |
|
| 594 | +?>>Mapbox pirates</option> |
|
| 595 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
| 596 | + print ' selected'; |
|
| 597 | +} |
|
| 598 | +?>>Mapbox emerald</option> |
|
| 419 | 599 | <?php |
| 420 | 600 | } |
| 421 | 601 | ?> |
| 422 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
| 602 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
| 603 | + print ' selected'; |
|
| 604 | +} |
|
| 605 | +?>>OpenStreetMap</option> |
|
| 423 | 606 | <?php |
| 424 | 607 | } |
| 425 | 608 | ?> |
@@ -430,10 +613,22 @@ discard block |
||
| 430 | 613 | ?> |
| 431 | 614 | <li><?php echo _("Type of Terrain:"); ?> |
| 432 | 615 | <select class="selectpicker" onchange="terrainType(this);"> |
| 433 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
| 434 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 435 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 436 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
| 616 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
| 617 | + print ' selected'; |
|
| 618 | +} |
|
| 619 | +?>>stk terrain</option> |
|
| 620 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
| 621 | + print ' selected'; |
|
| 622 | +} |
|
| 623 | +?>>ellipsoid</option> |
|
| 624 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
| 625 | + print ' selected'; |
|
| 626 | +} |
|
| 627 | +?>>vr terrain</option> |
|
| 628 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
| 629 | + print ' selected'; |
|
| 630 | +} |
|
| 631 | +?>>ArticDEM</option> |
|
| 437 | 632 | </select> |
| 438 | 633 | </li> |
| 439 | 634 | <?php |
@@ -443,59 +638,116 @@ discard block |
||
| 443 | 638 | <?php |
| 444 | 639 | if (isset($globalMap3D) && $globalMap3D) { |
| 445 | 640 | ?> |
| 446 | - <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 641 | + <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') { |
|
| 642 | + print 'checked'; |
|
| 643 | +} |
|
| 644 | +?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 447 | 645 | <?php |
| 448 | 646 | } |
| 449 | 647 | ?> |
| 450 | 648 | <?php |
| 451 | 649 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
| 452 | 650 | ?> |
| 453 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 651 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
| 652 | + print 'checked'; |
|
| 653 | +} |
|
| 654 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 454 | 655 | |
| 455 | 656 | <?php |
| 456 | 657 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 457 | 658 | ?> |
| 458 | - <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 459 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 460 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 461 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 462 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 659 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
| 660 | + print 'checked'; |
|
| 661 | +} |
|
| 662 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 663 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
| 664 | + print 'checked'; |
|
| 665 | +} |
|
| 666 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 667 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
| 668 | + print 'checked'; |
|
| 669 | +} |
|
| 670 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 671 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
| 672 | + print 'checked'; |
|
| 673 | +} |
|
| 674 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 675 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 676 | + print 'checked'; |
|
| 677 | +} |
|
| 678 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 463 | 679 | <?php |
| 464 | 680 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
| 465 | 681 | ?> |
| 466 | - <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 682 | + <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) { |
|
| 683 | + print 'checked'; |
|
| 684 | +} |
|
| 685 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 467 | 686 | <?php |
| 468 | 687 | } |
| 469 | 688 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
| 470 | 689 | ?> |
| 471 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 690 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 691 | + print 'checked'; |
|
| 692 | +} |
|
| 693 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 472 | 694 | <?php |
| 473 | 695 | } |
| 474 | 696 | } |
| 475 | 697 | ?> |
| 476 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 477 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 478 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 479 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 698 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
| 699 | + print 'checked'; |
|
| 700 | +} |
|
| 701 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 702 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 703 | + print 'checked'; |
|
| 704 | +} |
|
| 705 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 706 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 707 | + print 'checked'; |
|
| 708 | +} |
|
| 709 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 710 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 711 | + print 'checked'; |
|
| 712 | +} |
|
| 713 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 480 | 714 | <?php |
| 481 | 715 | if (isset($globalFires) && $globalFires) { |
| 482 | 716 | ?> |
| 483 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 717 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 718 | + print 'checked'; |
|
| 719 | +} |
|
| 720 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 484 | 721 | <?php |
| 485 | 722 | } |
| 486 | 723 | if (isset($globalMap3D) && $globalMap3D) { |
| 487 | 724 | ?> |
| 488 | - <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 725 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) { |
|
| 726 | + print 'checked'; |
|
| 727 | +} |
|
| 728 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 489 | 729 | <?php |
| 490 | 730 | } |
| 491 | 731 | ?> |
| 492 | 732 | <?php |
| 493 | 733 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
| 494 | 734 | ?> |
| 495 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 496 | - <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
| 497 | - <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 498 | - <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
| 735 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
| 736 | + print 'checked'; |
|
| 737 | +} |
|
| 738 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 739 | + <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) { |
|
| 740 | + print 'checked'; |
|
| 741 | +} |
|
| 742 | +?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
| 743 | + <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
|
| 744 | + print 'checked'; |
|
| 745 | +} |
|
| 746 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 747 | + <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) { |
|
| 748 | + print 'checked'; |
|
| 749 | +} |
|
| 750 | +?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
| 499 | 751 | <?php |
| 500 | 752 | } |
| 501 | 753 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -508,17 +760,25 @@ discard block |
||
| 508 | 760 | if (function_exists('array_column')) { |
| 509 | 761 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
| 510 | 762 | ?> |
| 511 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 763 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 764 | + print 'checked'; |
|
| 765 | +} |
|
| 766 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 512 | 767 | <?php |
| 513 | 768 | } |
| 514 | 769 | } elseif (isset($globalSources)) { |
| 515 | 770 | $dispolar = false; |
| 516 | 771 | foreach ($globalSources as $testsource) { |
| 517 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 772 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
| 773 | + $dispolar = true; |
|
| 774 | + } |
|
| 518 | 775 | } |
| 519 | 776 | if ($dispolar) { |
| 520 | 777 | ?> |
| 521 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 778 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 779 | + print 'checked'; |
|
| 780 | +} |
|
| 781 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 522 | 782 | <?php |
| 523 | 783 | } |
| 524 | 784 | } |
@@ -531,11 +791,21 @@ discard block |
||
| 531 | 791 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 532 | 792 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 533 | 793 | ?> |
| 534 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 794 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
| 795 | + print 'checked'; |
|
| 796 | +} |
|
| 797 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 535 | 798 | <?php |
| 536 | 799 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 537 | 800 | ?> |
| 538 | - <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
|
| 801 | + <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 802 | + print $_COOKIE['IconColor']; |
|
| 803 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 804 | + print $globalAircraftIconColor; |
|
| 805 | +} else { |
|
| 806 | + print '1a3151'; |
|
| 807 | +} |
|
| 808 | +?>"></li> |
|
| 539 | 809 | <?php |
| 540 | 810 | } |
| 541 | 811 | } |
@@ -546,7 +816,14 @@ discard block |
||
| 546 | 816 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 547 | 817 | ?> |
| 548 | 818 | <li><?php echo _("Marine icon color:"); ?> |
| 549 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
| 819 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 820 | + print $_COOKIE['MarineIconColor']; |
|
| 821 | +} elseif (isset($globalMarineIconColor)) { |
|
| 822 | + print $globalMarineIconColor; |
|
| 823 | +} else { |
|
| 824 | + print '1a3151'; |
|
| 825 | +} |
|
| 826 | +?>"> |
|
| 550 | 827 | </li> |
| 551 | 828 | <?php |
| 552 | 829 | } |
@@ -557,7 +834,14 @@ discard block |
||
| 557 | 834 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 558 | 835 | ?> |
| 559 | 836 | <li><?php echo _("Tracker icon color:"); ?> |
| 560 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
| 837 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 838 | + print $_COOKIE['TrackerIconColor']; |
|
| 839 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 840 | + print $globalTrackerIconColor; |
|
| 841 | +} else { |
|
| 842 | + print '1a3151'; |
|
| 843 | +} |
|
| 844 | +?>"> |
|
| 561 | 845 | </li> |
| 562 | 846 | <?php |
| 563 | 847 | } |
@@ -568,8 +852,22 @@ discard block |
||
| 568 | 852 | ?> |
| 569 | 853 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 570 | 854 | <div class="range"> |
| 571 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
| 572 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
| 855 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 856 | + print $_COOKIE['AirportZoom']; |
|
| 857 | +} elseif (isset($globalAirportZoom)) { |
|
| 858 | + print $globalAirportZoom; |
|
| 859 | +} else { |
|
| 860 | + print '7'; |
|
| 861 | +} |
|
| 862 | +?>"> |
|
| 863 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 864 | + print $_COOKIE['AirportZoom']; |
|
| 865 | +} elseif (isset($globalAirportZoom)) { |
|
| 866 | + print $globalAirportZoom; |
|
| 867 | +} else { |
|
| 868 | + print '7'; |
|
| 869 | +} |
|
| 870 | +?></output> |
|
| 573 | 871 | </div> |
| 574 | 872 | </li> |
| 575 | 873 | <?php |
@@ -580,17 +878,40 @@ discard block |
||
| 580 | 878 | ?> |
| 581 | 879 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
| 582 | 880 | <div class="range"> |
| 583 | - <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>"> |
|
| 584 | - <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output> |
|
| 881 | + <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 882 | + print $_COOKIE['resolutionScale']; |
|
| 883 | +} else { |
|
| 884 | + print '1'; |
|
| 885 | +} |
|
| 886 | +?>"> |
|
| 887 | + <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 888 | + print $_COOKIE['resolutionScale']; |
|
| 889 | +} else { |
|
| 890 | + print '1'; |
|
| 891 | +} |
|
| 892 | +?></output> |
|
| 585 | 893 | </div> |
| 586 | 894 | </li> |
| 587 | 895 | <?php |
| 588 | 896 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 589 | 897 | ?> |
| 590 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 591 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?> |
|
| 898 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
| 899 | + print 'checked'; |
|
| 900 | +} |
|
| 901 | +?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 902 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
| 903 | + print 'checked'; |
|
| 904 | +} |
|
| 905 | +?> > <?php echo _("Force Aircraft color"); ?> |
|
| 592 | 906 | <!--<li><?php echo _("Aircraft icon color:"); ?>--> |
| 593 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
| 907 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 908 | + print $_COOKIE['IconColor']; |
|
| 909 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 910 | + print $globalAircraftIconColor; |
|
| 911 | +} else { |
|
| 912 | + print 'ff0000'; |
|
| 913 | +} |
|
| 914 | +?>"> |
|
| 594 | 915 | </li> |
| 595 | 916 | <?php |
| 596 | 917 | } |
@@ -598,9 +919,19 @@ discard block |
||
| 598 | 919 | <?php |
| 599 | 920 | if (isset($globalMarine) && $globalMarine === TRUE) { |
| 600 | 921 | ?> |
| 601 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?> |
|
| 922 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
| 923 | + print 'checked'; |
|
| 924 | +} |
|
| 925 | +?> ><?php echo _("Force Marine color"); ?> |
|
| 602 | 926 | <!--<li><?php echo _("Marine icon color:"); ?>--> |
| 603 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
| 927 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 928 | + print $_COOKIE['MarineIconColor']; |
|
| 929 | +} elseif (isset($globalMarineIconColor)) { |
|
| 930 | + print $globalMarineIconColor; |
|
| 931 | +} else { |
|
| 932 | + print 'ff0000'; |
|
| 933 | +} |
|
| 934 | +?>"> |
|
| 604 | 935 | </li> |
| 605 | 936 | <?php |
| 606 | 937 | } |
@@ -608,9 +939,19 @@ discard block |
||
| 608 | 939 | <?php |
| 609 | 940 | if (isset($globalTracker) && $globalTracker === TRUE) { |
| 610 | 941 | ?> |
| 611 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?> |
|
| 942 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
| 943 | + print 'checked'; |
|
| 944 | +} |
|
| 945 | +?> ><?php echo _("Force Tracker color"); ?> |
|
| 612 | 946 | <!--<li><?php echo _("Tracker icon color:"); ?>--> |
| 613 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
| 947 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 948 | + print $_COOKIE['TrackerIconColor']; |
|
| 949 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 950 | + print $globalTrackerIconColor; |
|
| 951 | +} else { |
|
| 952 | + print 'ff0000'; |
|
| 953 | +} |
|
| 954 | +?>"> |
|
| 614 | 955 | </li> |
| 615 | 956 | <?php |
| 616 | 957 | } |
@@ -618,29 +959,62 @@ discard block |
||
| 618 | 959 | ?> |
| 619 | 960 | <li><?php echo _("Distance unit:"); ?> |
| 620 | 961 | <select class="selectpicker" onchange="unitdistance(this);"> |
| 621 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
| 622 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
| 623 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
| 962 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
| 963 | + echo ' selected'; |
|
| 964 | +} |
|
| 965 | +?>>km</option> |
|
| 966 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
| 967 | + echo ' selected'; |
|
| 968 | +} |
|
| 969 | +?>>nm</option> |
|
| 970 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
| 971 | + echo ' selected'; |
|
| 972 | +} |
|
| 973 | +?>>mi</option> |
|
| 624 | 974 | </select> |
| 625 | 975 | </li> |
| 626 | 976 | <li><?php echo _("Altitude unit:"); ?> |
| 627 | 977 | <select class="selectpicker" onchange="unitaltitude(this);"> |
| 628 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
| 629 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
| 978 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
| 979 | + echo ' selected'; |
|
| 980 | +} |
|
| 981 | +?>>m</option> |
|
| 982 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 983 | + echo ' selected'; |
|
| 984 | +} |
|
| 985 | +?>>feet</option> |
|
| 630 | 986 | </select> |
| 631 | 987 | </li> |
| 632 | 988 | <li><?php echo _("Speed unit:"); ?> |
| 633 | 989 | <select class="selectpicker" onchange="unitspeed(this);"> |
| 634 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
| 635 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
| 636 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
| 990 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
| 991 | + echo ' selected'; |
|
| 992 | +} |
|
| 993 | +?>>km/h</option> |
|
| 994 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
| 995 | + echo ' selected'; |
|
| 996 | +} |
|
| 997 | +?>>mph</option> |
|
| 998 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
| 999 | + echo ' selected'; |
|
| 1000 | +} |
|
| 1001 | +?>>knots</option> |
|
| 637 | 1002 | </select> |
| 638 | 1003 | </li> |
| 639 | 1004 | <li><?php echo _("Coordinate unit:"); ?> |
| 640 | 1005 | <select class="selectpicker" onchange="unitcoordinate(this);"> |
| 641 | - <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option> |
|
| 642 | - <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option> |
|
| 643 | - <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option> |
|
| 1006 | + <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) { |
|
| 1007 | + echo ' selected'; |
|
| 1008 | +} |
|
| 1009 | +?>>DD</option> |
|
| 1010 | + <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) { |
|
| 1011 | + echo ' selected'; |
|
| 1012 | +} |
|
| 1013 | +?>>DMS</option> |
|
| 1014 | + <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) { |
|
| 1015 | + echo ' selected'; |
|
| 1016 | +} |
|
| 1017 | +?>>DM</option> |
|
| 644 | 1018 | </select> |
| 645 | 1019 | </li> |
| 646 | 1020 | |
@@ -658,9 +1032,18 @@ discard block |
||
| 658 | 1032 | <?php |
| 659 | 1033 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 660 | 1034 | ?> |
| 661 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 662 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 663 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 1035 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) { |
|
| 1036 | + print 'checked'; |
|
| 1037 | +} |
|
| 1038 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 1039 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) { |
|
| 1040 | + print 'checked'; |
|
| 1041 | +} |
|
| 1042 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 1043 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) { |
|
| 1044 | + print 'checked'; |
|
| 1045 | +} |
|
| 1046 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 664 | 1047 | <?php |
| 665 | 1048 | } |
| 666 | 1049 | ?> |
@@ -668,12 +1051,21 @@ discard block |
||
| 668 | 1051 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 669 | 1052 | ?> |
| 670 | 1053 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 671 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 1054 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) { |
|
| 1055 | + print 'checked'; |
|
| 1056 | +} |
|
| 1057 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 672 | 1058 | <?php } ?> |
| 673 | 1059 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
| 674 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 1060 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) { |
|
| 1061 | + print 'checked'; |
|
| 1062 | +} |
|
| 1063 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 675 | 1064 | <?php } ?> |
| 676 | - <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
|
| 1065 | + <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') { |
|
| 1066 | + print 'checked'; |
|
| 1067 | +} |
|
| 1068 | +?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
|
| 677 | 1069 | <?php |
| 678 | 1070 | } |
| 679 | 1071 | ?> |
@@ -689,7 +1081,9 @@ discard block |
||
| 689 | 1081 | } |
| 690 | 1082 | foreach($allairlinenames as $airline) { |
| 691 | 1083 | $airline_name = $airline['airline_name']; |
| 692 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 1084 | + if (strlen($airline_name) > 30) { |
|
| 1085 | + $airline_name = substr($airline_name,0,30).'...'; |
|
| 1086 | + } |
|
| 693 | 1087 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
| 694 | 1088 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 695 | 1089 | } else { |
@@ -707,7 +1101,10 @@ discard block |
||
| 707 | 1101 | <li><?php echo _("Display alliance:"); ?> |
| 708 | 1102 | <br/> |
| 709 | 1103 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 710 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 1104 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
| 1105 | + echo ' selected'; |
|
| 1106 | +} |
|
| 1107 | +?>><?php echo _("All"); ?></option> |
|
| 711 | 1108 | <?php |
| 712 | 1109 | foreach($allalliancenames as $alliance) { |
| 713 | 1110 | $alliance_name = $alliance['alliance']; |
@@ -766,10 +1163,22 @@ discard block |
||
| 766 | 1163 | ?> |
| 767 | 1164 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 768 | 1165 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 769 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 770 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
| 771 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
| 772 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
| 1166 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
| 1167 | + echo ' selected'; |
|
| 1168 | +} |
|
| 1169 | +?>><?php echo _("All"); ?></option> |
|
| 1170 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
| 1171 | + echo ' selected'; |
|
| 1172 | +} |
|
| 1173 | +?>><?php echo _("Passenger"); ?></option> |
|
| 1174 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
| 1175 | + echo ' selected'; |
|
| 1176 | +} |
|
| 1177 | +?>><?php echo _("Cargo"); ?></option> |
|
| 1178 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
| 1179 | + echo ' selected'; |
|
| 1180 | +} |
|
| 1181 | +?>><?php echo _("Military"); ?></option> |
|
| 773 | 1182 | </select> |
| 774 | 1183 | </li> |
| 775 | 1184 | <?php |
@@ -783,7 +1192,10 @@ discard block |
||
| 783 | 1192 | ?> |
| 784 | 1193 | <li> |
| 785 | 1194 | <?php echo _("Display vessels with MMSI:"); ?> |
| 786 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
| 1195 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
| 1196 | + print $_COOKIE['filter_mmsi']; |
|
| 1197 | +} |
|
| 1198 | +?>" /> |
|
| 787 | 1199 | </li> |
| 788 | 1200 | <?php |
| 789 | 1201 | if (isset($globalVM) && $globalVM) { |
@@ -814,7 +1226,10 @@ discard block |
||
| 814 | 1226 | ?> |
| 815 | 1227 | <li> |
| 816 | 1228 | <?php echo _("Display with ident:"); ?> |
| 817 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
| 1229 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
| 1230 | + print $_COOKIE['filter_ident']; |
|
| 1231 | +} |
|
| 1232 | +?>" /> |
|
| 818 | 1233 | </li> |
| 819 | 1234 | </ul> |
| 820 | 1235 | </form> |
@@ -830,7 +1245,10 @@ discard block |
||
| 830 | 1245 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
| 831 | 1246 | <form> |
| 832 | 1247 | <ul> |
| 833 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 1248 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
| 1249 | + print 'checked'; |
|
| 1250 | +} |
|
| 1251 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 834 | 1252 | <li><?php echo _("Type:"); ?> |
| 835 | 1253 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
| 836 | 1254 | <?php |
@@ -838,25 +1256,45 @@ discard block |
||
| 838 | 1256 | $types = $Satellite->get_tle_types(); |
| 839 | 1257 | foreach ($types as $type) { |
| 840 | 1258 | $type_name = $type['tle_type']; |
| 841 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
| 842 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
| 843 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
| 844 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
| 845 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
| 846 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
| 847 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 848 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
| 849 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
| 850 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
| 851 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
| 852 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
| 853 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
| 854 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
| 855 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
| 856 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
| 857 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
| 858 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
| 859 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
| 1259 | + if ($type_name == 'musson') { |
|
| 1260 | + $type_name = 'Russian LEO Navigation'; |
|
| 1261 | + } else if ($type_name == 'nnss') { |
|
| 1262 | + $type_name = 'Navi Navigation Satellite System'; |
|
| 1263 | + } else if ($type_name == 'sbas') { |
|
| 1264 | + $type_name = 'Satellite-Based Augmentation System'; |
|
| 1265 | + } else if ($type_name == 'glo-ops') { |
|
| 1266 | + $type_name = 'Glonass Operational'; |
|
| 1267 | + } else if ($type_name == 'gps-ops') { |
|
| 1268 | + $type_name = 'GPS Operational'; |
|
| 1269 | + } else if ($type_name == 'argos') { |
|
| 1270 | + $type_name = 'ARGOS Data Collection System'; |
|
| 1271 | + } else if ($type_name == 'tdrss') { |
|
| 1272 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 1273 | + } else if ($type_name == 'sarsat') { |
|
| 1274 | + $type_name = 'Search & Rescue'; |
|
| 1275 | + } else if ($type_name == 'dmc') { |
|
| 1276 | + $type_name = 'Disaster Monitoring'; |
|
| 1277 | + } else if ($type_name == 'resource') { |
|
| 1278 | + $type_name = 'Earth Resources'; |
|
| 1279 | + } else if ($type_name == 'stations') { |
|
| 1280 | + $type_name = 'Space Stations'; |
|
| 1281 | + } else if ($type_name == 'geo') { |
|
| 1282 | + $type_name = 'Geostationary'; |
|
| 1283 | + } else if ($type_name == 'amateur') { |
|
| 1284 | + $type_name = 'Amateur Radio'; |
|
| 1285 | + } else if ($type_name == 'x-comm') { |
|
| 1286 | + $type_name = 'Experimental'; |
|
| 1287 | + } else if ($type_name == 'other-comm') { |
|
| 1288 | + $type_name = 'Other Comm'; |
|
| 1289 | + } else if ($type_name == 'science') { |
|
| 1290 | + $type_name = 'Space & Earth Science'; |
|
| 1291 | + } else if ($type_name == 'military') { |
|
| 1292 | + $type_name = 'Miscellaneous Military'; |
|
| 1293 | + } else if ($type_name == 'radar') { |
|
| 1294 | + $type_name = 'Radar Calibration'; |
|
| 1295 | + } else if ($type_name == 'tle-new') { |
|
| 1296 | + $type_name = 'Last 30 days launches'; |
|
| 1297 | + } |
|
| 860 | 1298 | |
| 861 | 1299 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
| 862 | 1300 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |