@@ -9,17 +9,17 @@ |
||
9 | 9 | header('Content-disposition: attachment; filename="weather.json"'); |
10 | 10 | } |
11 | 11 | header('Content-Type: text/javascript'); |
12 | -$latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
13 | -$longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
12 | +$latitude = filter_input(INPUT_GET, 'latitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
13 | +$longitude = filter_input(INPUT_GET, 'longitude', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
14 | 14 | if ($latitude == '' || $longitude == '') return ''; |
15 | 15 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
16 | -$airports = $Spotter->closestAirports($latitude,$longitude,200); |
|
16 | +$airports = $Spotter->closestAirports($latitude, $longitude, 200); |
|
17 | 17 | //print_r($airports); |
18 | 18 | $METAR = new METAR(); |
19 | 19 | $Weather = new Weather(); |
20 | 20 | $i = 0; |
21 | 21 | $ew = true; |
22 | -while($ew) { |
|
22 | +while ($ew) { |
|
23 | 23 | $met = $METAR->getMETAR($airports[$i]['icao']); |
24 | 24 | //print_r($met); |
25 | 25 | if (!empty($met)) { |
@@ -11,7 +11,9 @@ discard block |
||
11 | 11 | header('Content-Type: text/javascript'); |
12 | 12 | $latitude = filter_input(INPUT_GET,'latitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
13 | 13 | $longitude = filter_input(INPUT_GET,'longitude',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
14 | -if ($latitude == '' || $longitude == '') return ''; |
|
14 | +if ($latitude == '' || $longitude == '') { |
|
15 | + return ''; |
|
16 | +} |
|
15 | 17 | //echo 'latitude : '.$latitude.' - longitude : '.$longitude."\n"; |
16 | 18 | $airports = $Spotter->closestAirports($latitude,$longitude,200); |
17 | 19 | //print_r($airports); |
@@ -36,7 +38,9 @@ discard block |
||
36 | 38 | } |
37 | 39 | } |
38 | 40 | $i++; |
39 | - if ($i >= count($airports)) $ew = false; |
|
40 | -} |
|
41 | + if ($i >= count($airports)) { |
|
42 | + $ew = false; |
|
43 | + } |
|
44 | + } |
|
41 | 45 | |
42 | 46 | ?> |
43 | 47 | \ No newline at end of file |
@@ -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 | |
@@ -1494,7 +1494,7 @@ discard block |
||
1494 | 1494 | $Connection = new Connection(); |
1495 | 1495 | $sth = $Connection->db->prepare($query); |
1496 | 1496 | $sth->execute(array(':source' => $filename)); |
1497 | - } catch(PDOException $e) { |
|
1497 | + } catch (PDOException $e) { |
|
1498 | 1498 | return "error : ".$e->getMessage(); |
1499 | 1499 | } |
1500 | 1500 | |
@@ -1504,13 +1504,13 @@ discard block |
||
1504 | 1504 | $i = 0; |
1505 | 1505 | //$Connection->db->setAttribute(PDO::ATTR_AUTOCOMMIT, FALSE); |
1506 | 1506 | //$Connection->db->beginTransaction(); |
1507 | - while (($data = fgetcsv($handle, 1000,"\t")) !== FALSE) |
|
1507 | + while (($data = fgetcsv($handle, 1000, "\t")) !== FALSE) |
|
1508 | 1508 | { |
1509 | 1509 | if ($i > 0 && $data[0] != '') { |
1510 | 1510 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1511 | - $period = str_replace(',','',$data[14]); |
|
1512 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1513 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1511 | + $period = str_replace(',', '', $data[14]); |
|
1512 | + if (!empty($period) && strpos($period, 'days')) $period = str_replace(' days', '', $period)*24*60; |
|
1513 | + if ($data[18] != '') $launch_date = date('Y-m-d', strtotime($data[18])); |
|
1514 | 1514 | else $launch_date = NULL; |
1515 | 1515 | $data = array_map(function($value) { |
1516 | 1516 | return trim($value) === '' ? null : $value; |
@@ -1520,8 +1520,8 @@ discard block |
||
1520 | 1520 | 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)'; |
1521 | 1521 | try { |
1522 | 1522 | $sth = $Connection->db->prepare($query); |
1523 | - $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)); |
|
1524 | - } catch(PDOException $e) { |
|
1523 | + $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)); |
|
1524 | + } catch (PDOException $e) { |
|
1525 | 1525 | return "error : ".$e->getMessage(); |
1526 | 1526 | } |
1527 | 1527 | } |
@@ -1561,7 +1561,7 @@ discard block |
||
1561 | 1561 | 'EGYP' => array('country' => 'Egypt', 'owner' => ''), |
1562 | 1562 | 'ESA' => array('country' => 'Multinational', 'owner' => 'European Space Agency'), |
1563 | 1563 | 'ESRO' => array('country' => 'Multinational', 'owner' => 'European Space Research Organization'), |
1564 | - 'EST' => array('country' => 'Estonia','owner' => ''), |
|
1564 | + 'EST' => array('country' => 'Estonia', 'owner' => ''), |
|
1565 | 1565 | 'EUME' => array('country' => 'Multinational', 'owner' => 'EUMETSAT (European Organization for the Exploitation of Meteorological Satellites)'), |
1566 | 1566 | 'EUTE' => array('country' => 'Multinational', 'owner' => 'European Telecommunications Satellite Consortium (EUTELSAT)'), |
1567 | 1567 | 'FGER' => array('country' => 'France/Germany', 'owner' => ''), |
@@ -1685,10 +1685,10 @@ discard block |
||
1685 | 1685 | { |
1686 | 1686 | if ($data != '') { |
1687 | 1687 | $result = array(); |
1688 | - $result['cospar'] = trim(substr($data,0,11)); |
|
1689 | - $result['norad'] = trim(substr($data,13,6)); |
|
1690 | - $result['operational'] = trim(substr($data,21,1)); |
|
1691 | - $result['name'] = trim(substr($data,23,24)); |
|
1688 | + $result['cospar'] = trim(substr($data, 0, 11)); |
|
1689 | + $result['norad'] = trim(substr($data, 13, 6)); |
|
1690 | + $result['operational'] = trim(substr($data, 21, 1)); |
|
1691 | + $result['name'] = trim(substr($data, 23, 24)); |
|
1692 | 1692 | /* |
1693 | 1693 | * R/B(1) = Rocket body, first stage |
1694 | 1694 | * R/B(2) = Rocket body, second stage |
@@ -1700,29 +1700,29 @@ discard block |
||
1700 | 1700 | * An ampersand (&) indicates two or more objects are attached |
1701 | 1701 | */ |
1702 | 1702 | |
1703 | - $owner_code = trim(substr($data,49,5)); |
|
1703 | + $owner_code = trim(substr($data, 49, 5)); |
|
1704 | 1704 | |
1705 | 1705 | if (!isset($satcat_sources[$owner_code])) { |
1706 | 1706 | echo $data; |
1707 | 1707 | echo 'owner_code: '.$owner_code."\n"; |
1708 | 1708 | } |
1709 | - if (!isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
1710 | - echo 'launch_site_code: '.trim(substr($data,68,5))."\n"; |
|
1709 | + if (!isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
1710 | + echo 'launch_site_code: '.trim(substr($data, 68, 5))."\n"; |
|
1711 | 1711 | } |
1712 | 1712 | |
1713 | - if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data,68,5))])) { |
|
1713 | + if ($owner_code != 'TBD' && isset($satcat_sources[$owner_code]) && isset($satcat_launch_site[trim(substr($data, 68, 5))])) { |
|
1714 | 1714 | $result['country_owner'] = $satcat_sources[$owner_code]['country']; |
1715 | 1715 | $result['owner'] = $satcat_sources[$owner_code]['owner']; |
1716 | - $result['launch_date'] = trim(substr($data,56,10)); |
|
1717 | - $launch_site_code = trim(substr($data,68,5)); |
|
1716 | + $result['launch_date'] = trim(substr($data, 56, 10)); |
|
1717 | + $launch_site_code = trim(substr($data, 68, 5)); |
|
1718 | 1718 | $result['launch_site'] = $satcat_launch_site[$launch_site_code]; |
1719 | - $result['lifetime'] = trim(substr($data,75,10)); |
|
1720 | - $result['period'] = trim(substr($data,87,7)); |
|
1721 | - $result['inclination'] = trim(substr($data,96,5)); |
|
1722 | - $result['apogee'] = trim(substr($data,103,6)); |
|
1723 | - $result['perigee'] = trim(substr($data,111,6)); |
|
1719 | + $result['lifetime'] = trim(substr($data, 75, 10)); |
|
1720 | + $result['period'] = trim(substr($data, 87, 7)); |
|
1721 | + $result['inclination'] = trim(substr($data, 96, 5)); |
|
1722 | + $result['apogee'] = trim(substr($data, 103, 6)); |
|
1723 | + $result['perigee'] = trim(substr($data, 111, 6)); |
|
1724 | 1724 | //$result['radarcross'] = trim(substr($data,119,8)); |
1725 | - $result['status'] = trim(substr($data,129,3)); |
|
1725 | + $result['status'] = trim(substr($data, 129, 3)); |
|
1726 | 1726 | //print_r($result); |
1727 | 1727 | $result = array_map(function($value) { |
1728 | 1728 | return trim($value) === '' ? null : $value; |
@@ -1735,7 +1735,7 @@ discard block |
||
1735 | 1735 | $sth = $Connection->db->prepare($query); |
1736 | 1736 | $sth->execute(array(':cospar' => $result['cospar'])); |
1737 | 1737 | $exist = $sth->fetchAll(PDO::FETCH_ASSOC); |
1738 | - } catch(PDOException $e) { |
|
1738 | + } catch (PDOException $e) { |
|
1739 | 1739 | return "error : ".$e->getMessage(); |
1740 | 1740 | } |
1741 | 1741 | if (empty($exist)) { |
@@ -1747,10 +1747,10 @@ discard block |
||
1747 | 1747 | ':name' => $result['name'], ':name_alternate' => '', ':country_un' => '', ':country_owner' => $result['country_owner'], ':owner' => $result['owner'], ':users' => '', ':purpose' => '', ':purpose_detailed' => '', ':orbit' => $result['status'], |
1748 | 1748 | ':type' => '', ':longitude_geo' => NULL, ':perigee' => !empty($result['perigee']) ? $result['perigee'] : NULL, ':apogee' => !empty($result['apogee']) ? $result['apogee'] : NULL, ':eccentricity' => NULL, ':inclination' => $result['inclination'], |
1749 | 1749 | ':period' => !empty($result['period']) ? $result['period'] : NULL, ':launch_mass' => NULL, ':dry_mass' => NULL, ':power' => NULL, ':launch_date' => $result['launch_date'], ':lifetime' => $result['lifetime'], |
1750 | - ':contractor' => '',':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1750 | + ':contractor' => '', ':country_contractor' => '', ':launch_site' => $result['launch_site'], ':launch_vehicule' => '', ':cospar' => $result['cospar'], ':norad' => $result['norad'], ':comments' => '', ':source_orbital' => '', ':sources' => '' |
|
1751 | 1751 | ) |
1752 | 1752 | ); |
1753 | - } catch(PDOException $e) { |
|
1753 | + } catch (PDOException $e) { |
|
1754 | 1754 | return "error : ".$e->getMessage(); |
1755 | 1755 | } |
1756 | 1756 | } elseif ($exist[0]['name'] != $result['name'] && $exist[0]['name_alternate'] != $result['name']) { |
@@ -1758,8 +1758,8 @@ discard block |
||
1758 | 1758 | try { |
1759 | 1759 | $Connection = new Connection(); |
1760 | 1760 | $sth = $Connection->db->prepare($query); |
1761 | - $sth->execute(array(':name_alternate' => $result['name'],':cospar' => $result['cospar'])); |
|
1762 | - } catch(PDOException $e) { |
|
1761 | + $sth->execute(array(':name_alternate' => $result['name'], ':cospar' => $result['cospar'])); |
|
1762 | + } catch (PDOException $e) { |
|
1763 | 1763 | return "error : ".$e->getMessage(); |
1764 | 1764 | } |
1765 | 1765 | } |
@@ -1878,13 +1878,13 @@ discard block |
||
1878 | 1878 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1879 | 1879 | { |
1880 | 1880 | $i++; |
1881 | - if($i > 3 && count($row) > 2) { |
|
1881 | + if ($i > 3 && count($row) > 2) { |
|
1882 | 1882 | $data = array_values(array_filter($row)); |
1883 | 1883 | $cntdata = count($data); |
1884 | 1884 | if ($cntdata > 10) { |
1885 | 1885 | $value = $data[9]; |
1886 | 1886 | |
1887 | - for ($i =10;$i < $cntdata;$i++) { |
|
1887 | + for ($i = 10; $i < $cntdata; $i++) { |
|
1888 | 1888 | $value .= ' '.$data[$i]; |
1889 | 1889 | } |
1890 | 1890 | $data[9] = $value; |
@@ -1894,8 +1894,8 @@ discard block |
||
1894 | 1894 | $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)'; |
1895 | 1895 | try { |
1896 | 1896 | $sth = $Connection->db->prepare($query); |
1897 | - $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])); |
|
1898 | - } catch(PDOException $e) { |
|
1897 | + $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])); |
|
1898 | + } catch (PDOException $e) { |
|
1899 | 1899 | return "error : ".$e->getMessage(); |
1900 | 1900 | } |
1901 | 1901 | } |
@@ -1912,16 +1912,16 @@ discard block |
||
1912 | 1912 | require_once(dirname(__FILE__).'/../require/class.Source.php'); |
1913 | 1913 | $delimiter = ','; |
1914 | 1914 | $Common = new Common(); |
1915 | - $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv',$tmp_dir.'fires.csv'); |
|
1915 | + $Common->download('http://firms.modaps.eosdis.nasa.gov/active_fire/viirs/text/VNP14IMGTDL_NRT_Global_24h.csv', $tmp_dir.'fires.csv'); |
|
1916 | 1916 | $Connection = new Connection(); |
1917 | 1917 | $Source = new Source(); |
1918 | 1918 | $Source->deleteLocationByType('fires'); |
1919 | 1919 | $i = 0; |
1920 | - if (($handle = fopen($tmp_dir.'fires.csv','r')) !== false) { |
|
1921 | - while (($row = fgetcsv($handle,1000)) !== false) { |
|
1920 | + if (($handle = fopen($tmp_dir.'fires.csv', 'r')) !== false) { |
|
1921 | + while (($row = fgetcsv($handle, 1000)) !== false) { |
|
1922 | 1922 | if ($i > 0 && $row[0] != '' && $row[8] != 'low') { |
1923 | - $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]); |
|
1924 | - $Source->addLocation('',$row[0],$row[1],null,'','','fires','fire.png','fires',0,0,$row[5].' '.substr($row[6],0,2).':'.substr($row[6],2,2),json_encode($description)); |
|
1923 | + $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]); |
|
1924 | + $Source->addLocation('', $row[0], $row[1], null, '', '', 'fires', 'fire.png', 'fires', 0, 0, $row[5].' '.substr($row[6], 0, 2).':'.substr($row[6], 2, 2), json_encode($description)); |
|
1925 | 1925 | } |
1926 | 1926 | $i++; |
1927 | 1927 | } |
@@ -1937,7 +1937,7 @@ discard block |
||
1937 | 1937 | $Connection = new Connection(); |
1938 | 1938 | $sth = $Connection->db->prepare($query); |
1939 | 1939 | $sth->execute(); |
1940 | - } catch(PDOException $e) { |
|
1940 | + } catch (PDOException $e) { |
|
1941 | 1941 | return "error : ".$e->getMessage(); |
1942 | 1942 | } |
1943 | 1943 | $header = NULL; |
@@ -1948,12 +1948,12 @@ discard block |
||
1948 | 1948 | if ($globalTransaction) $Connection->db->beginTransaction(); |
1949 | 1949 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1950 | 1950 | { |
1951 | - if(count($row) > 1) { |
|
1951 | + if (count($row) > 1) { |
|
1952 | 1952 | $query = "INSERT INTO airlines (name,icao,active,forsource) VALUES (:name, :icao, 'Y','ivao')"; |
1953 | 1953 | try { |
1954 | 1954 | $sth = $Connection->db->prepare($query); |
1955 | - $sth->execute(array(':name' => $row[1],':icao' => $row[0])); |
|
1956 | - } catch(PDOException $e) { |
|
1955 | + $sth->execute(array(':name' => $row[1], ':icao' => $row[0])); |
|
1956 | + } catch (PDOException $e) { |
|
1957 | 1957 | return "error : ".$e->getMessage(); |
1958 | 1958 | } |
1959 | 1959 | } |
@@ -1973,21 +1973,21 @@ discard block |
||
1973 | 1973 | try { |
1974 | 1974 | $sth = $Connection->db->prepare($query); |
1975 | 1975 | $sth->execute(); |
1976 | - } catch(PDOException $e) { |
|
1976 | + } catch (PDOException $e) { |
|
1977 | 1977 | return "error : ".$e->getMessage(); |
1978 | 1978 | } |
1979 | 1979 | } |
1980 | 1980 | |
1981 | 1981 | |
1982 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1982 | + if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1983 | 1983 | else { |
1984 | - update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1984 | + update_db::gunzip('../db/pgsql/airspace.sql.gz', $tmp_dir.'airspace.sql'); |
|
1985 | 1985 | $query = "CREATE EXTENSION postgis"; |
1986 | - $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
|
1986 | + $Connection = new Connection(null, null, $_SESSION['database_root'], $_SESSION['database_rootpass']); |
|
1987 | 1987 | try { |
1988 | 1988 | $sth = $Connection->db->prepare($query); |
1989 | 1989 | $sth->execute(); |
1990 | - } catch(PDOException $e) { |
|
1990 | + } catch (PDOException $e) { |
|
1991 | 1991 | return "error : ".$e->getMessage(); |
1992 | 1992 | } |
1993 | 1993 | } |
@@ -2000,13 +2000,13 @@ discard block |
||
2000 | 2000 | include_once('class.create_db.php'); |
2001 | 2001 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
2002 | 2002 | if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
2003 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
|
2003 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5', $tmp_dir.'notam.txt.gz.md5'); |
|
2004 | 2004 | $error = ''; |
2005 | 2005 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
2006 | - $notam_md5_file = explode(' ',file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
2006 | + $notam_md5_file = explode(' ', file_get_contents($tmp_dir.'notam.txt.gz.md5')); |
|
2007 | 2007 | $notam_md5 = $notam_md5_file[0]; |
2008 | 2008 | if (!update_db::check_notam_version($notam_md5)) { |
2009 | - update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
|
2009 | + update_db::download('http://data.flightairmap.com/data/notam.txt.gz', $tmp_dir.'notam.txt.gz'); |
|
2010 | 2010 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
2011 | 2011 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
2012 | 2012 | if ($globalDebug) echo "Gunzip..."; |
@@ -2042,14 +2042,14 @@ discard block |
||
2042 | 2042 | try { |
2043 | 2043 | $sth = $Connection->db->prepare($query); |
2044 | 2044 | $sth->execute(); |
2045 | - } catch(PDOException $e) { |
|
2045 | + } catch (PDOException $e) { |
|
2046 | 2046 | echo "error : ".$e->getMessage(); |
2047 | 2047 | } |
2048 | 2048 | } |
2049 | 2049 | if ($globalDBdriver == 'mysql') { |
2050 | - update_db::gunzip('../db/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2050 | + update_db::gunzip('../db/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
2051 | 2051 | } else { |
2052 | - update_db::gunzip('../db/pgsql/countries.sql.gz',$tmp_dir.'countries.sql'); |
|
2052 | + update_db::gunzip('../db/pgsql/countries.sql.gz', $tmp_dir.'countries.sql'); |
|
2053 | 2053 | } |
2054 | 2054 | $error = create_db::import_file($tmp_dir.'countries.sql'); |
2055 | 2055 | return $error; |
@@ -2062,7 +2062,7 @@ discard block |
||
2062 | 2062 | // update_db::unzip($tmp_dir.'AptNav.zip'); |
2063 | 2063 | // update_db::download('https://gitorious.org/fg/fgdata/raw/e81f8a15424a175a7b715f8f7eb8f4147b802a27:Navaids/awy.dat.gz',$tmp_dir.'awy.dat.gz'); |
2064 | 2064 | // 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'); |
2065 | - 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'); |
|
2065 | + 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'); |
|
2066 | 2066 | update_db::gunzip($tmp_dir.'awy.dat.gz'); |
2067 | 2067 | $error = update_db::waypoints($tmp_dir.'awy.dat'); |
2068 | 2068 | return $error; |
@@ -2083,7 +2083,7 @@ discard block |
||
2083 | 2083 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2084 | 2084 | if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
2085 | 2085 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2086 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2086 | + if (!$Common->xcopy($tmp_dir.'logos/', dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2087 | 2087 | } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
2088 | 2088 | } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
2089 | 2089 | } else $error = "ZIP module not loaded but required for IVAO."; |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | global $tmp_dir, $globalDebug; |
2098 | 2098 | $error = ''; |
2099 | 2099 | if ($globalDebug) echo "Routes : Download..."; |
2100 | - update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
|
2100 | + update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz', $tmp_dir.'StandingData.sqb.gz'); |
|
2101 | 2101 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2102 | 2102 | if ($globalDebug) echo "Gunzip..."; |
2103 | 2103 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
@@ -2113,7 +2113,7 @@ discard block |
||
2113 | 2113 | global $tmp_dir, $globalDebug; |
2114 | 2114 | $error = ''; |
2115 | 2115 | if ($globalDebug) echo "Schedules Oneworld : Download..."; |
2116 | - update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
|
2116 | + update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz', $tmp_dir.'oneworld.csv.gz'); |
|
2117 | 2117 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2118 | 2118 | if ($globalDebug) echo "Gunzip..."; |
2119 | 2119 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
@@ -2129,7 +2129,7 @@ discard block |
||
2129 | 2129 | global $tmp_dir, $globalDebug; |
2130 | 2130 | $error = ''; |
2131 | 2131 | if ($globalDebug) echo "Schedules Skyteam : Download..."; |
2132 | - update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
|
2132 | + update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz', $tmp_dir.'skyteam.csv.gz'); |
|
2133 | 2133 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2134 | 2134 | if ($globalDebug) echo "Gunzip..."; |
2135 | 2135 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
@@ -2157,7 +2157,7 @@ discard block |
||
2157 | 2157 | */ |
2158 | 2158 | if ($globalDebug) echo "Modes : Download..."; |
2159 | 2159 | // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
2160 | - update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
|
2160 | + update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz', $tmp_dir.'BaseStation.sqb.gz'); |
|
2161 | 2161 | |
2162 | 2162 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2163 | 2163 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
@@ -2177,7 +2177,7 @@ discard block |
||
2177 | 2177 | public static function update_ModeS_faa() { |
2178 | 2178 | global $tmp_dir, $globalDebug; |
2179 | 2179 | if ($globalDebug) echo "Modes FAA: Download..."; |
2180 | - update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
|
2180 | + update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip', $tmp_dir.'ReleasableAircraft.zip'); |
|
2181 | 2181 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2182 | 2182 | if ($globalDebug) echo "Unzip..."; |
2183 | 2183 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
@@ -2193,7 +2193,7 @@ discard block |
||
2193 | 2193 | public static function update_ModeS_flarm() { |
2194 | 2194 | global $tmp_dir, $globalDebug; |
2195 | 2195 | if ($globalDebug) echo "Modes Flarmnet: Download..."; |
2196 | - update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
|
2196 | + update_db::download('http://flarmnet.org/files/data.fln', $tmp_dir.'data.fln'); |
|
2197 | 2197 | if (file_exists($tmp_dir.'data.fln')) { |
2198 | 2198 | if ($globalDebug) echo "Add to DB..."; |
2199 | 2199 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
@@ -2207,7 +2207,7 @@ discard block |
||
2207 | 2207 | public static function update_ModeS_ogn() { |
2208 | 2208 | global $tmp_dir, $globalDebug; |
2209 | 2209 | if ($globalDebug) echo "Modes OGN: Download..."; |
2210 | - update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
|
2210 | + update_db::download('http://ddb.glidernet.org/download/', $tmp_dir.'ogn.csv'); |
|
2211 | 2211 | if (file_exists($tmp_dir.'ogn.csv')) { |
2212 | 2212 | if ($globalDebug) echo "Add to DB..."; |
2213 | 2213 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
@@ -2222,201 +2222,201 @@ discard block |
||
2222 | 2222 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2223 | 2223 | |
2224 | 2224 | if ($globalDebug) echo "Owner France: Download..."; |
2225 | - update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
|
2225 | + update_db::download('http://antonakis.co.uk/registers/France.txt', $tmp_dir.'owner_f.csv'); |
|
2226 | 2226 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2227 | 2227 | if ($globalDebug) echo "Add to DB..."; |
2228 | - $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
|
2228 | + $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv', 'F'); |
|
2229 | 2229 | } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
2230 | 2230 | if ($error != '') { |
2231 | 2231 | return $error; |
2232 | 2232 | } elseif ($globalDebug) echo "Done\n"; |
2233 | 2233 | |
2234 | 2234 | if ($globalDebug) echo "Owner Ireland: Download..."; |
2235 | - update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
|
2235 | + update_db::download('http://antonakis.co.uk/registers/Ireland.txt', $tmp_dir.'owner_ei.csv'); |
|
2236 | 2236 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2237 | 2237 | if ($globalDebug) echo "Add to DB..."; |
2238 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
|
2238 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv', 'EI'); |
|
2239 | 2239 | } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
2240 | 2240 | if ($error != '') { |
2241 | 2241 | return $error; |
2242 | 2242 | } elseif ($globalDebug) echo "Done\n"; |
2243 | 2243 | if ($globalDebug) echo "Owner Switzerland: Download..."; |
2244 | - update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
|
2244 | + update_db::download('http://antonakis.co.uk/registers/Switzerland.txt', $tmp_dir.'owner_hb.csv'); |
|
2245 | 2245 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2246 | 2246 | if ($globalDebug) echo "Add to DB..."; |
2247 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
|
2247 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv', 'HB'); |
|
2248 | 2248 | } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
2249 | 2249 | if ($error != '') { |
2250 | 2250 | return $error; |
2251 | 2251 | } elseif ($globalDebug) echo "Done\n"; |
2252 | 2252 | if ($globalDebug) echo "Owner Czech Republic: Download..."; |
2253 | - update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
|
2253 | + update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt', $tmp_dir.'owner_ok.csv'); |
|
2254 | 2254 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2255 | 2255 | if ($globalDebug) echo "Add to DB..."; |
2256 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
|
2256 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv', 'OK'); |
|
2257 | 2257 | } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
2258 | 2258 | if ($error != '') { |
2259 | 2259 | return $error; |
2260 | 2260 | } elseif ($globalDebug) echo "Done\n"; |
2261 | 2261 | if ($globalDebug) echo "Owner Australia: Download..."; |
2262 | - update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
|
2262 | + update_db::download('http://antonakis.co.uk/registers/Australia.txt', $tmp_dir.'owner_vh.csv'); |
|
2263 | 2263 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2264 | 2264 | if ($globalDebug) echo "Add to DB..."; |
2265 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
|
2265 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv', 'VH'); |
|
2266 | 2266 | } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
2267 | 2267 | if ($error != '') { |
2268 | 2268 | return $error; |
2269 | 2269 | } elseif ($globalDebug) echo "Done\n"; |
2270 | 2270 | if ($globalDebug) echo "Owner Austria: Download..."; |
2271 | - update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
|
2271 | + update_db::download('http://antonakis.co.uk/registers/Austria.txt', $tmp_dir.'owner_oe.csv'); |
|
2272 | 2272 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2273 | 2273 | if ($globalDebug) echo "Add to DB..."; |
2274 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
|
2274 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv', 'OE'); |
|
2275 | 2275 | } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
2276 | 2276 | if ($error != '') { |
2277 | 2277 | return $error; |
2278 | 2278 | } elseif ($globalDebug) echo "Done\n"; |
2279 | 2279 | if ($globalDebug) echo "Owner Chile: Download..."; |
2280 | - update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
|
2280 | + update_db::download('http://antonakis.co.uk/registers/Chile.txt', $tmp_dir.'owner_cc.csv'); |
|
2281 | 2281 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2282 | 2282 | if ($globalDebug) echo "Add to DB..."; |
2283 | - $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
|
2283 | + $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv', 'CC'); |
|
2284 | 2284 | } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
2285 | 2285 | if ($error != '') { |
2286 | 2286 | return $error; |
2287 | 2287 | } elseif ($globalDebug) echo "Done\n"; |
2288 | 2288 | if ($globalDebug) echo "Owner Colombia: Download..."; |
2289 | - update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
|
2289 | + update_db::download('http://antonakis.co.uk/registers/Colombia.txt', $tmp_dir.'owner_hj.csv'); |
|
2290 | 2290 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2291 | 2291 | if ($globalDebug) echo "Add to DB..."; |
2292 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
|
2292 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv', 'HJ'); |
|
2293 | 2293 | } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
2294 | 2294 | if ($error != '') { |
2295 | 2295 | return $error; |
2296 | 2296 | } elseif ($globalDebug) echo "Done\n"; |
2297 | 2297 | if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
2298 | - update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
|
2298 | + update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt', $tmp_dir.'owner_e7.csv'); |
|
2299 | 2299 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2300 | 2300 | if ($globalDebug) echo "Add to DB..."; |
2301 | - $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
|
2301 | + $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv', 'E7'); |
|
2302 | 2302 | } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
2303 | 2303 | if ($error != '') { |
2304 | 2304 | return $error; |
2305 | 2305 | } elseif ($globalDebug) echo "Done\n"; |
2306 | 2306 | if ($globalDebug) echo "Owner Brazil: Download..."; |
2307 | - update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
|
2307 | + update_db::download('http://antonakis.co.uk/registers/Brazil.txt', $tmp_dir.'owner_pp.csv'); |
|
2308 | 2308 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2309 | 2309 | if ($globalDebug) echo "Add to DB..."; |
2310 | - $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
|
2310 | + $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv', 'PP'); |
|
2311 | 2311 | } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
2312 | 2312 | if ($error != '') { |
2313 | 2313 | return $error; |
2314 | 2314 | } elseif ($globalDebug) echo "Done\n"; |
2315 | 2315 | if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
2316 | - update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
|
2316 | + update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt', $tmp_dir.'owner_vp.csv'); |
|
2317 | 2317 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2318 | 2318 | if ($globalDebug) echo "Add to DB..."; |
2319 | - $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
|
2319 | + $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv', 'VP'); |
|
2320 | 2320 | } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
2321 | 2321 | if ($error != '') { |
2322 | 2322 | return $error; |
2323 | 2323 | } elseif ($globalDebug) echo "Done\n"; |
2324 | 2324 | if ($globalDebug) echo "Owner Croatia: Download..."; |
2325 | - update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
|
2325 | + update_db::download('http://antonakis.co.uk/registers/Croatia.txt', $tmp_dir.'owner_9a.csv'); |
|
2326 | 2326 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2327 | 2327 | if ($globalDebug) echo "Add to DB..."; |
2328 | - $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
|
2328 | + $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv', '9A'); |
|
2329 | 2329 | } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
2330 | 2330 | if ($error != '') { |
2331 | 2331 | return $error; |
2332 | 2332 | } elseif ($globalDebug) echo "Done\n"; |
2333 | 2333 | if ($globalDebug) echo "Owner Luxembourg: Download..."; |
2334 | - update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
|
2334 | + update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt', $tmp_dir.'owner_lx.csv'); |
|
2335 | 2335 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2336 | 2336 | if ($globalDebug) echo "Add to DB..."; |
2337 | - $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
|
2337 | + $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv', 'LX'); |
|
2338 | 2338 | } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
2339 | 2339 | if ($error != '') { |
2340 | 2340 | return $error; |
2341 | 2341 | } elseif ($globalDebug) echo "Done\n"; |
2342 | 2342 | if ($globalDebug) echo "Owner Maldives: Download..."; |
2343 | - update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
|
2343 | + update_db::download('http://antonakis.co.uk/registers/Maldives.txt', $tmp_dir.'owner_8q.csv'); |
|
2344 | 2344 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2345 | 2345 | if ($globalDebug) echo "Add to DB..."; |
2346 | - $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
|
2346 | + $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv', '8Q'); |
|
2347 | 2347 | } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
2348 | 2348 | if ($error != '') { |
2349 | 2349 | return $error; |
2350 | 2350 | } elseif ($globalDebug) echo "Done\n"; |
2351 | 2351 | if ($globalDebug) echo "Owner New Zealand: Download..."; |
2352 | - update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
|
2352 | + update_db::download('http://antonakis.co.uk/registers/NewZealand.txt', $tmp_dir.'owner_zk.csv'); |
|
2353 | 2353 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2354 | 2354 | if ($globalDebug) echo "Add to DB..."; |
2355 | - $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
|
2355 | + $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv', 'ZK'); |
|
2356 | 2356 | } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
2357 | 2357 | if ($error != '') { |
2358 | 2358 | return $error; |
2359 | 2359 | } elseif ($globalDebug) echo "Done\n"; |
2360 | 2360 | if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
2361 | - update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
|
2361 | + update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt', $tmp_dir.'owner_p2.csv'); |
|
2362 | 2362 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2363 | 2363 | if ($globalDebug) echo "Add to DB..."; |
2364 | - $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
|
2364 | + $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv', 'P2'); |
|
2365 | 2365 | } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
2366 | 2366 | if ($error != '') { |
2367 | 2367 | return $error; |
2368 | 2368 | } elseif ($globalDebug) echo "Done\n"; |
2369 | 2369 | if ($globalDebug) echo "Owner Slovakia: Download..."; |
2370 | - update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
|
2370 | + update_db::download('http://antonakis.co.uk/registers/Slovakia.txt', $tmp_dir.'owner_om.csv'); |
|
2371 | 2371 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2372 | 2372 | if ($globalDebug) echo "Add to DB..."; |
2373 | - $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
|
2373 | + $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv', 'OM'); |
|
2374 | 2374 | } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
2375 | 2375 | if ($error != '') { |
2376 | 2376 | return $error; |
2377 | 2377 | } elseif ($globalDebug) echo "Done\n"; |
2378 | 2378 | if ($globalDebug) echo "Owner Ecuador: Download..."; |
2379 | - update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
|
2379 | + update_db::download('http://antonakis.co.uk/registers/Ecuador.txt', $tmp_dir.'owner_hc.csv'); |
|
2380 | 2380 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2381 | 2381 | if ($globalDebug) echo "Add to DB..."; |
2382 | - $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
|
2382 | + $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv', 'HC'); |
|
2383 | 2383 | } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
2384 | 2384 | if ($error != '') { |
2385 | 2385 | return $error; |
2386 | 2386 | } elseif ($globalDebug) echo "Done\n"; |
2387 | 2387 | if ($globalDebug) echo "Owner Iceland: Download..."; |
2388 | - update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
|
2388 | + update_db::download('http://antonakis.co.uk/registers/Iceland.txt', $tmp_dir.'owner_tf.csv'); |
|
2389 | 2389 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2390 | 2390 | if ($globalDebug) echo "Add to DB..."; |
2391 | - $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
|
2391 | + $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv', 'TF'); |
|
2392 | 2392 | } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
2393 | 2393 | if ($error != '') { |
2394 | 2394 | return $error; |
2395 | 2395 | } elseif ($globalDebug) echo "Done\n"; |
2396 | 2396 | if ($globalDebug) echo "Owner Isle of Man: Download..."; |
2397 | - update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
|
2397 | + update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt', $tmp_dir.'owner_m.csv'); |
|
2398 | 2398 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2399 | 2399 | if ($globalDebug) echo "Add to DB..."; |
2400 | - $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
|
2400 | + $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv', 'M'); |
|
2401 | 2401 | } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
2402 | 2402 | if ($error != '') { |
2403 | 2403 | return $error; |
2404 | 2404 | } elseif ($globalDebug) echo "Done\n"; |
2405 | 2405 | if ($globalMasterSource) { |
2406 | 2406 | if ($globalDebug) echo "ModeS Netherlands: Download..."; |
2407 | - update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
|
2407 | + update_db::download('http://antonakis.co.uk/registers/Netherlands.txt', $tmp_dir.'owner_ph.csv'); |
|
2408 | 2408 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2409 | 2409 | if ($globalDebug) echo "Add to DB..."; |
2410 | - $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
|
2410 | + $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv', 'PH'); |
|
2411 | 2411 | } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
2412 | 2412 | if ($error != '') { |
2413 | 2413 | return $error; |
2414 | 2414 | } elseif ($globalDebug) echo "Done\n"; |
2415 | 2415 | if ($globalDebug) echo "ModeS Denmark: Download..."; |
2416 | - update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
|
2416 | + update_db::download('http://antonakis.co.uk/registers/Denmark.txt', $tmp_dir.'owner_oy.csv'); |
|
2417 | 2417 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2418 | 2418 | if ($globalDebug) echo "Add to DB..."; |
2419 | - $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
|
2419 | + $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv', 'OY'); |
|
2420 | 2420 | } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
2421 | 2421 | if ($error != '') { |
2422 | 2422 | return $error; |
@@ -2429,7 +2429,7 @@ discard block |
||
2429 | 2429 | global $tmp_dir, $globalDebug; |
2430 | 2430 | $error = ''; |
2431 | 2431 | if ($globalDebug) echo "Translation : Download..."; |
2432 | - update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
|
2432 | + update_db::download('http://www.acarsd.org/download/translation.php', $tmp_dir.'translation.zip'); |
|
2433 | 2433 | if (file_exists($tmp_dir.'translation.zip')) { |
2434 | 2434 | if ($globalDebug) echo "Unzip..."; |
2435 | 2435 | update_db::unzip($tmp_dir.'translation.zip'); |
@@ -2446,10 +2446,10 @@ discard block |
||
2446 | 2446 | global $tmp_dir, $globalDebug; |
2447 | 2447 | $error = ''; |
2448 | 2448 | if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
2449 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
|
2450 | - update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
|
2449 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz', $tmp_dir.'translation.tsv.gz'); |
|
2450 | + update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5', $tmp_dir.'translation.tsv.gz.md5'); |
|
2451 | 2451 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2452 | - $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2452 | + $translation_md5_file = explode(' ', file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
|
2453 | 2453 | $translation_md5 = $translation_md5_file[0]; |
2454 | 2454 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2455 | 2455 | if ($globalDebug) echo "Gunzip..."; |
@@ -2467,10 +2467,10 @@ discard block |
||
2467 | 2467 | global $tmp_dir, $globalDebug; |
2468 | 2468 | $error = ''; |
2469 | 2469 | if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
2470 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
|
2471 | - update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
|
2470 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz', $tmp_dir.'modes.tsv.gz'); |
|
2471 | + update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5', $tmp_dir.'modes.tsv.gz.md5'); |
|
2472 | 2472 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2473 | - $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2473 | + $modes_md5_file = explode(' ', file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
|
2474 | 2474 | $modes_md5 = $modes_md5_file[0]; |
2475 | 2475 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2476 | 2476 | if ($globalDebug) echo "Gunzip..."; |
@@ -2489,12 +2489,12 @@ discard block |
||
2489 | 2489 | global $tmp_dir, $globalDebug; |
2490 | 2490 | $error = ''; |
2491 | 2491 | if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
2492 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
|
2492 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5', $tmp_dir.'airlines.tsv.gz.md5'); |
|
2493 | 2493 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2494 | - $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2494 | + $airlines_md5_file = explode(' ', file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
|
2495 | 2495 | $airlines_md5 = $airlines_md5_file[0]; |
2496 | 2496 | if (!update_db::check_airlines_version($airlines_md5)) { |
2497 | - update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
|
2497 | + update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz', $tmp_dir.'airlines.tsv.gz'); |
|
2498 | 2498 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2499 | 2499 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2500 | 2500 | if ($globalDebug) echo "Gunzip..."; |
@@ -2519,14 +2519,14 @@ discard block |
||
2519 | 2519 | if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
2520 | 2520 | $error = ''; |
2521 | 2521 | if ($globalOwner === TRUE) { |
2522 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2523 | - update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2522 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2523 | + update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2524 | 2524 | } else { |
2525 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
|
2526 | - update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5',$tmp_dir.'owners.tsv.gz.md5'); |
|
2525 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz', $tmp_dir.'owners.tsv.gz'); |
|
2526 | + update_db::download('http://data.flightairmap.com/data/owners.tsv.gz.md5', $tmp_dir.'owners.tsv.gz.md5'); |
|
2527 | 2527 | } |
2528 | 2528 | if (file_exists($tmp_dir.'owners.tsv.gz') && file_exists($tmp_dir.'owners.tsv.gz.md5')) { |
2529 | - $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2529 | + $owners_md5_file = explode(' ', file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
|
2530 | 2530 | $owners_md5 = $owners_md5_file[0]; |
2531 | 2531 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2532 | 2532 | if ($globalDebug) echo "Gunzip..."; |
@@ -2543,10 +2543,10 @@ discard block |
||
2543 | 2543 | public static function update_routes_fam() { |
2544 | 2544 | global $tmp_dir, $globalDebug; |
2545 | 2545 | if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
2546 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
|
2547 | - update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
|
2546 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz', $tmp_dir.'routes.tsv.gz'); |
|
2547 | + update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5', $tmp_dir.'routes.tsv.gz.md5'); |
|
2548 | 2548 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2549 | - $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2549 | + $routes_md5_file = explode(' ', file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
|
2550 | 2550 | $routes_md5 = $routes_md5_file[0]; |
2551 | 2551 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2552 | 2552 | if ($globalDebug) echo "Gunzip..."; |
@@ -2563,10 +2563,10 @@ discard block |
||
2563 | 2563 | public static function update_block_fam() { |
2564 | 2564 | global $tmp_dir, $globalDebug; |
2565 | 2565 | if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
2566 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
|
2567 | - update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
|
2566 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz', $tmp_dir.'block.tsv.gz'); |
|
2567 | + update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5', $tmp_dir.'block.tsv.gz.md5'); |
|
2568 | 2568 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
2569 | - $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
2569 | + $block_md5_file = explode(' ', file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
|
2570 | 2570 | $block_md5 = $block_md5_file[0]; |
2571 | 2571 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
2572 | 2572 | if ($globalDebug) echo "Gunzip..."; |
@@ -2582,13 +2582,13 @@ discard block |
||
2582 | 2582 | } |
2583 | 2583 | public static function update_marine_identity_fam() { |
2584 | 2584 | global $tmp_dir, $globalDebug; |
2585 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5',$tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2585 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz.md5', $tmp_dir.'marine_identity.tsv.gz.md5'); |
|
2586 | 2586 | if (file_exists($tmp_dir.'marine_identity.tsv.gz.md5')) { |
2587 | - $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2587 | + $marine_identity_md5_file = explode(' ', file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
|
2588 | 2588 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2589 | 2589 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2590 | 2590 | if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
2591 | - update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
|
2591 | + update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz', $tmp_dir.'marine_identity.tsv.gz'); |
|
2592 | 2592 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2593 | 2593 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2594 | 2594 | if ($globalDebug) echo "Gunzip..."; |
@@ -2610,13 +2610,13 @@ discard block |
||
2610 | 2610 | |
2611 | 2611 | public static function update_satellite_fam() { |
2612 | 2612 | global $tmp_dir, $globalDebug; |
2613 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5',$tmp_dir.'satellite.tsv.gz.md5'); |
|
2613 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz.md5', $tmp_dir.'satellite.tsv.gz.md5'); |
|
2614 | 2614 | if (file_exists($tmp_dir.'satellite.tsv.gz.md5')) { |
2615 | - $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2615 | + $satellite_md5_file = explode(' ', file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
|
2616 | 2616 | $satellite_md5 = $satellite_md5_file[0]; |
2617 | 2617 | if (!update_db::check_satellite_version($satellite_md5)) { |
2618 | 2618 | if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
2619 | - update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
|
2619 | + update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz', $tmp_dir.'satellite.tsv.gz'); |
|
2620 | 2620 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2621 | 2621 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2622 | 2622 | if ($globalDebug) echo "Gunzip..."; |
@@ -2638,7 +2638,7 @@ discard block |
||
2638 | 2638 | public static function update_banned_fam() { |
2639 | 2639 | global $tmp_dir, $globalDebug; |
2640 | 2640 | if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
2641 | - update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
|
2641 | + update_db::download('http://data.flightairmap.com/data/ban-eu.csv', $tmp_dir.'ban_eu.csv'); |
|
2642 | 2642 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2643 | 2643 | //if ($globalDebug) echo "Gunzip..."; |
2644 | 2644 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
@@ -2657,18 +2657,18 @@ discard block |
||
2657 | 2657 | $error = ''; |
2658 | 2658 | if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
2659 | 2659 | if ($globalDBdriver == 'mysql') { |
2660 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2660 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2661 | 2661 | } else { |
2662 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
|
2662 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz.md5', $tmp_dir.'airspace.sql.gz.md5'); |
|
2663 | 2663 | } |
2664 | 2664 | if (file_exists($tmp_dir.'airspace.sql.gz.md5')) { |
2665 | - $airspace_md5_file = explode(' ',file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2665 | + $airspace_md5_file = explode(' ', file_get_contents($tmp_dir.'airspace.sql.gz.md5')); |
|
2666 | 2666 | $airspace_md5 = $airspace_md5_file[0]; |
2667 | 2667 | if (!update_db::check_airspace_version($airspace_md5)) { |
2668 | 2668 | if ($globalDBdriver == 'mysql') { |
2669 | - update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2669 | + update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2670 | 2670 | } else { |
2671 | - update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz',$tmp_dir.'airspace.sql.gz'); |
|
2671 | + update_db::download('http://data.flightairmap.com/data/airspace_pgsql.sql.gz', $tmp_dir.'airspace.sql.gz'); |
|
2672 | 2672 | } |
2673 | 2673 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2674 | 2674 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
@@ -2681,7 +2681,7 @@ discard block |
||
2681 | 2681 | try { |
2682 | 2682 | $sth = $Connection->db->prepare($query); |
2683 | 2683 | $sth->execute(); |
2684 | - } catch(PDOException $e) { |
|
2684 | + } catch (PDOException $e) { |
|
2685 | 2685 | return "error : ".$e->getMessage(); |
2686 | 2686 | } |
2687 | 2687 | } |
@@ -2701,16 +2701,16 @@ discard block |
||
2701 | 2701 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2702 | 2702 | $error = ''; |
2703 | 2703 | if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
2704 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2704 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5', $tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
|
2705 | 2705 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2706 | - $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2706 | + $geoid_md5_file = explode(' ', file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
|
2707 | 2707 | $geoid_md5 = $geoid_md5_file[0]; |
2708 | 2708 | if (!update_db::check_geoid_version($geoid_md5)) { |
2709 | - update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2709 | + update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz', $tmp_dir.$globalGeoidSource.'.pgm.gz'); |
|
2710 | 2710 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2711 | 2711 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2712 | 2712 | if ($globalDebug) echo "Gunzip..."; |
2713 | - update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2713 | + update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz', dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
|
2714 | 2714 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2715 | 2715 | update_db::insert_geoid_version($geoid_md5); |
2716 | 2716 | } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
@@ -2727,15 +2727,15 @@ discard block |
||
2727 | 2727 | public static function update_tle() { |
2728 | 2728 | global $tmp_dir, $globalDebug; |
2729 | 2729 | if ($globalDebug) echo "Download TLE : Download..."; |
2730 | - $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', |
|
2731 | - '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', |
|
2732 | - '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'); |
|
2730 | + $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', |
|
2731 | + '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', |
|
2732 | + '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'); |
|
2733 | 2733 | foreach ($alltle as $filename) { |
2734 | 2734 | if ($globalDebug) echo "downloading ".$filename.'...'; |
2735 | - update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
|
2735 | + update_db::download('http://celestrak.com/NORAD/elements/'.$filename, $tmp_dir.$filename); |
|
2736 | 2736 | if (file_exists($tmp_dir.$filename)) { |
2737 | 2737 | if ($globalDebug) echo "Add to DB ".$filename."..."; |
2738 | - $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
|
2738 | + $error = update_db::tle($tmp_dir.$filename, str_replace('.txt', '', $filename)); |
|
2739 | 2739 | } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
2740 | 2740 | if ($error != '') { |
2741 | 2741 | echo $error."\n"; |
@@ -2747,7 +2747,7 @@ discard block |
||
2747 | 2747 | public static function update_ucsdb() { |
2748 | 2748 | global $tmp_dir, $globalDebug; |
2749 | 2749 | if ($globalDebug) echo "Download UCS DB : Download..."; |
2750 | - update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2750 | + update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt', $tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
|
2751 | 2751 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2752 | 2752 | if ($globalDebug) echo "Add to DB..."; |
2753 | 2753 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
@@ -2761,7 +2761,7 @@ discard block |
||
2761 | 2761 | public static function update_celestrak() { |
2762 | 2762 | global $tmp_dir, $globalDebug; |
2763 | 2763 | if ($globalDebug) echo "Download Celestrak DB : Download..."; |
2764 | - update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
|
2764 | + update_db::download('http://celestrak.com/pub/satcat.txt', $tmp_dir.'satcat.txt'); |
|
2765 | 2765 | if (file_exists($tmp_dir.'satcat.txt')) { |
2766 | 2766 | if ($globalDebug) echo "Add to DB..."; |
2767 | 2767 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
@@ -2776,94 +2776,94 @@ discard block |
||
2776 | 2776 | global $tmp_dir, $globalDebug; |
2777 | 2777 | $error = ''; |
2778 | 2778 | if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
2779 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
|
2779 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', $tmp_dir.'models.md5sum'); |
|
2780 | 2780 | if (file_exists($tmp_dir.'models.md5sum')) { |
2781 | 2781 | if ($globalDebug) echo "Check files...\n"; |
2782 | 2782 | $newmodelsdb = array(); |
2783 | - if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
|
2784 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2783 | + if (($handle = fopen($tmp_dir.'models.md5sum', 'r')) !== FALSE) { |
|
2784 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2785 | 2785 | $model = trim($row[2]); |
2786 | 2786 | $newmodelsdb[$model] = trim($row[0]); |
2787 | 2787 | } |
2788 | 2788 | } |
2789 | 2789 | $modelsdb = array(); |
2790 | 2790 | if (file_exists(dirname(__FILE__).'/../models/models.md5sum')) { |
2791 | - if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum','r')) !== FALSE) { |
|
2792 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2791 | + if (($handle = fopen(dirname(__FILE__).'/../models/models.md5sum', 'r')) !== FALSE) { |
|
2792 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2793 | 2793 | $model = trim($row[2]); |
2794 | 2794 | $modelsdb[$model] = trim($row[0]); |
2795 | 2795 | } |
2796 | 2796 | } |
2797 | 2797 | } |
2798 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2798 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2799 | 2799 | foreach ($diff as $key => $value) { |
2800 | 2800 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2801 | - update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
|
2801 | + update_db::download('http://data.flightairmap.com/data/models/'.$key, dirname(__FILE__).'/../models/'.$key); |
|
2802 | 2802 | |
2803 | 2803 | } |
2804 | - update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
|
2804 | + update_db::download('http://data.flightairmap.com/data/models/models.md5sum', dirname(__FILE__).'/../models/models.md5sum'); |
|
2805 | 2805 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2806 | 2806 | if ($error != '') { |
2807 | 2807 | return $error; |
2808 | 2808 | } elseif ($globalDebug) echo "Done\n"; |
2809 | 2809 | if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
2810 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
|
2810 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', $tmp_dir.'modelsgltf2.md5sum'); |
|
2811 | 2811 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2812 | 2812 | if ($globalDebug) echo "Check files...\n"; |
2813 | 2813 | $newmodelsdb = array(); |
2814 | - if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
|
2815 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2814 | + if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum', 'r')) !== FALSE) { |
|
2815 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2816 | 2816 | $model = trim($row[2]); |
2817 | 2817 | $newmodelsdb[$model] = trim($row[0]); |
2818 | 2818 | } |
2819 | 2819 | } |
2820 | 2820 | $modelsdb = array(); |
2821 | 2821 | if (file_exists(dirname(__FILE__).'/../models/gltf2/models.md5sum')) { |
2822 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum','r')) !== FALSE) { |
|
2823 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2822 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/models.md5sum', 'r')) !== FALSE) { |
|
2823 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2824 | 2824 | $model = trim($row[2]); |
2825 | 2825 | $modelsdb[$model] = trim($row[0]); |
2826 | 2826 | } |
2827 | 2827 | } |
2828 | 2828 | } |
2829 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2829 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2830 | 2830 | foreach ($diff as $key => $value) { |
2831 | 2831 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2832 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
|
2832 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key, dirname(__FILE__).'/../models/gltf2/'.$key); |
|
2833 | 2833 | |
2834 | 2834 | } |
2835 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
2835 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum', dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
|
2836 | 2836 | } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
2837 | 2837 | if ($error != '') { |
2838 | 2838 | return $error; |
2839 | 2839 | } elseif ($globalDebug) echo "Done\n"; |
2840 | 2840 | if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
2841 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
|
2841 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', $tmp_dir.'modelsweather.md5sum'); |
|
2842 | 2842 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
2843 | 2843 | if ($globalDebug) echo "Check files...\n"; |
2844 | 2844 | $newmodelsdb = array(); |
2845 | - if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
|
2846 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2845 | + if (($handle = fopen($tmp_dir.'modelsweather.md5sum', 'r')) !== FALSE) { |
|
2846 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2847 | 2847 | $model = trim($row[2]); |
2848 | 2848 | $newmodelsdb[$model] = trim($row[0]); |
2849 | 2849 | } |
2850 | 2850 | } |
2851 | 2851 | $modelsdb = array(); |
2852 | 2852 | if (file_exists(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum')) { |
2853 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum','r')) !== FALSE) { |
|
2854 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2853 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/weather/models.md5sum', 'r')) !== FALSE) { |
|
2854 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2855 | 2855 | $model = trim($row[2]); |
2856 | 2856 | $modelsdb[$model] = trim($row[0]); |
2857 | 2857 | } |
2858 | 2858 | } |
2859 | 2859 | } |
2860 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2860 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2861 | 2861 | foreach ($diff as $key => $value) { |
2862 | 2862 | if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
2863 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
2863 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key, dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
|
2864 | 2864 | |
2865 | 2865 | } |
2866 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
2866 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum', dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
|
2867 | 2867 | } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
2868 | 2868 | if ($error != '') { |
2869 | 2869 | return $error; |
@@ -2875,32 +2875,32 @@ discard block |
||
2875 | 2875 | global $tmp_dir, $globalDebug; |
2876 | 2876 | $error = ''; |
2877 | 2877 | if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
2878 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
|
2878 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', $tmp_dir.'liveries.md5sum'); |
|
2879 | 2879 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
2880 | 2880 | if ($globalDebug) echo "Check files...\n"; |
2881 | 2881 | $newmodelsdb = array(); |
2882 | - if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
|
2883 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2882 | + if (($handle = fopen($tmp_dir.'liveries.md5sum', 'r')) !== FALSE) { |
|
2883 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2884 | 2884 | $model = trim($row[2]); |
2885 | 2885 | $newmodelsdb[$model] = trim($row[0]); |
2886 | 2886 | } |
2887 | 2887 | } |
2888 | 2888 | $modelsdb = array(); |
2889 | 2889 | if (file_exists(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum')) { |
2890 | - if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum','r')) !== FALSE) { |
|
2891 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2890 | + if (($handle = fopen(dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum', 'r')) !== FALSE) { |
|
2891 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2892 | 2892 | $model = trim($row[2]); |
2893 | 2893 | $modelsdb[$model] = trim($row[0]); |
2894 | 2894 | } |
2895 | 2895 | } |
2896 | 2896 | } |
2897 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2897 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2898 | 2898 | foreach ($diff as $key => $value) { |
2899 | 2899 | if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
2900 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
2900 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key, dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
|
2901 | 2901 | |
2902 | 2902 | } |
2903 | - update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
2903 | + update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum', dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
|
2904 | 2904 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2905 | 2905 | if ($error != '') { |
2906 | 2906 | return $error; |
@@ -2912,32 +2912,32 @@ discard block |
||
2912 | 2912 | global $tmp_dir, $globalDebug; |
2913 | 2913 | $error = ''; |
2914 | 2914 | if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
2915 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
|
2915 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', $tmp_dir.'space_models.md5sum'); |
|
2916 | 2916 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2917 | 2917 | if ($globalDebug) echo "Check files...\n"; |
2918 | 2918 | $newmodelsdb = array(); |
2919 | - if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
|
2920 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2919 | + if (($handle = fopen($tmp_dir.'space_models.md5sum', 'r')) !== FALSE) { |
|
2920 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2921 | 2921 | $model = trim($row[2]); |
2922 | 2922 | $newmodelsdb[$model] = trim($row[0]); |
2923 | 2923 | } |
2924 | 2924 | } |
2925 | 2925 | $modelsdb = array(); |
2926 | 2926 | if (file_exists(dirname(__FILE__).'/../models/space/space_models.md5sum')) { |
2927 | - if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum','r')) !== FALSE) { |
|
2928 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2927 | + if (($handle = fopen(dirname(__FILE__).'/../models/space/space_models.md5sum', 'r')) !== FALSE) { |
|
2928 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2929 | 2929 | $model = trim($row[2]); |
2930 | 2930 | $modelsdb[$model] = trim($row[0]); |
2931 | 2931 | } |
2932 | 2932 | } |
2933 | 2933 | } |
2934 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2934 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2935 | 2935 | foreach ($diff as $key => $value) { |
2936 | 2936 | if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
2937 | - update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
|
2937 | + update_db::download('http://data.flightairmap.com/data/models/space/'.$key, dirname(__FILE__).'/../models/space/'.$key); |
|
2938 | 2938 | |
2939 | 2939 | } |
2940 | - update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2940 | + update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum', dirname(__FILE__).'/../models/space/space_models.md5sum'); |
|
2941 | 2941 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2942 | 2942 | if ($error != '') { |
2943 | 2943 | return $error; |
@@ -2949,32 +2949,32 @@ discard block |
||
2949 | 2949 | global $tmp_dir, $globalDebug; |
2950 | 2950 | $error = ''; |
2951 | 2951 | if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
2952 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
|
2952 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', $tmp_dir.'vehicules_models.md5sum'); |
|
2953 | 2953 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2954 | 2954 | if ($globalDebug) echo "Check files...\n"; |
2955 | 2955 | $newmodelsdb = array(); |
2956 | - if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
|
2957 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2956 | + if (($handle = fopen($tmp_dir.'vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2957 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2958 | 2958 | $model = trim($row[2]); |
2959 | 2959 | $newmodelsdb[$model] = trim($row[0]); |
2960 | 2960 | } |
2961 | 2961 | } |
2962 | 2962 | $modelsdb = array(); |
2963 | 2963 | if (file_exists(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum')) { |
2964 | - if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum','r')) !== FALSE) { |
|
2965 | - while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
|
2964 | + if (($handle = fopen(dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum', 'r')) !== FALSE) { |
|
2965 | + while (($row = fgetcsv($handle, 1000, " ")) !== FALSE) { |
|
2966 | 2966 | $model = trim($row[2]); |
2967 | 2967 | $modelsdb[$model] = trim($row[0]); |
2968 | 2968 | } |
2969 | 2969 | } |
2970 | 2970 | } |
2971 | - $diff = array_diff($newmodelsdb,$modelsdb); |
|
2971 | + $diff = array_diff($newmodelsdb, $modelsdb); |
|
2972 | 2972 | foreach ($diff as $key => $value) { |
2973 | 2973 | if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
2974 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2974 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key, dirname(__FILE__).'/../models/vehicules/'.$key); |
|
2975 | 2975 | |
2976 | 2976 | } |
2977 | - update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2977 | + update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum', dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
|
2978 | 2978 | } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
2979 | 2979 | if ($error != '') { |
2980 | 2980 | return $error; |
@@ -2986,8 +2986,8 @@ discard block |
||
2986 | 2986 | global $tmp_dir, $globalDebug; |
2987 | 2987 | date_default_timezone_set('UTC'); |
2988 | 2988 | $Common = new Common(); |
2989 | - $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); |
|
2990 | - $all = json_decode($data,true); |
|
2989 | + $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); |
|
2990 | + $all = json_decode($data, true); |
|
2991 | 2991 | $Connection = new Connection(); |
2992 | 2992 | $querychk = "SELECT COUNT(1) as nb FROM aircraft WHERE icao = :icao"; |
2993 | 2993 | $sth = $Connection->db->prepare($querychk); |
@@ -2999,8 +2999,8 @@ discard block |
||
2999 | 2999 | foreach ($all as $model) { |
3000 | 3000 | $icao = $model['Designator']; |
3001 | 3001 | if (!isset($allicao[$icao])) { |
3002 | - $aircraft_shadow = 'generic_'.substr($model['EngineType'],0,1).$model['EngineCount'].$model['WTC'].'.png'; |
|
3003 | - $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']); |
|
3002 | + $aircraft_shadow = 'generic_'.substr($model['EngineType'], 0, 1).$model['EngineCount'].$model['WTC'].'.png'; |
|
3003 | + $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']); |
|
3004 | 3004 | } else { |
3005 | 3005 | $allicao[$icao][':type'] = $allicao[$icao][':type'].'/'.$model['ModelFullName']; |
3006 | 3006 | } |
@@ -3012,9 +3012,9 @@ discard block |
||
3012 | 3012 | if ($exist[0]['nb'] == 0) { |
3013 | 3013 | $sthins->execute($airdata); |
3014 | 3014 | } else { |
3015 | - $sthup->execute(array(':type' => $airdata[':type'],':icao' => $icao)); |
|
3015 | + $sthup->execute(array(':type' => $airdata[':type'], ':icao' => $icao)); |
|
3016 | 3016 | } |
3017 | - } catch(PDOException $e) { |
|
3017 | + } catch (PDOException $e) { |
|
3018 | 3018 | return "error : ".$e->getMessage(); |
3019 | 3019 | } |
3020 | 3020 | } |
@@ -3046,23 +3046,23 @@ discard block |
||
3046 | 3046 | $Connection = new Connection(); |
3047 | 3047 | $sth = $Connection->db->prepare($query); |
3048 | 3048 | $sth->execute(); |
3049 | - } catch(PDOException $e) { |
|
3049 | + } catch (PDOException $e) { |
|
3050 | 3050 | return "error : ".$e->getMessage(); |
3051 | 3051 | } |
3052 | 3052 | |
3053 | 3053 | $error = ''; |
3054 | 3054 | if ($globalDebug) echo "Notam : Download..."; |
3055 | - update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
|
3055 | + update_db::download($globalNOTAMSource, $tmp_dir.'notam.rss'); |
|
3056 | 3056 | if (file_exists($tmp_dir.'notam.rss')) { |
3057 | - $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
|
3057 | + $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')), true); |
|
3058 | 3058 | foreach ($notams['channel']['item'] as $notam) { |
3059 | - $title = explode(':',$notam['title']); |
|
3059 | + $title = explode(':', $notam['title']); |
|
3060 | 3060 | $data['ref'] = trim($title[0]); |
3061 | 3061 | unset($title[0]); |
3062 | - $data['title'] = trim(implode(':',$title)); |
|
3063 | - $description = strip_tags($notam['description'],'<pre>'); |
|
3064 | - preg_match(':^(.*?)<pre>:',$description,$match); |
|
3065 | - $q = explode('/',$match[1]); |
|
3062 | + $data['title'] = trim(implode(':', $title)); |
|
3063 | + $description = strip_tags($notam['description'], '<pre>'); |
|
3064 | + preg_match(':^(.*?)<pre>:', $description, $match); |
|
3065 | + $q = explode('/', $match[1]); |
|
3066 | 3066 | $data['fir'] = $q[0]; |
3067 | 3067 | $data['code'] = $q[1]; |
3068 | 3068 | $ifrvfr = $q[2]; |
@@ -3078,30 +3078,30 @@ discard block |
||
3078 | 3078 | $data['lower_limit'] = $q[5]; |
3079 | 3079 | $data['upper_limit'] = $q[6]; |
3080 | 3080 | $latlonrad = $q[7]; |
3081 | - sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
|
3082 | - $latitude = $Common->convertDec($las,'latitude'); |
|
3083 | - $longitude = $Common->convertDec($lns,'longitude'); |
|
3081 | + sscanf($latlonrad, '%4c%c%5c%c%3d', $las, $lac, $lns, $lnc, $radius); |
|
3082 | + $latitude = $Common->convertDec($las, 'latitude'); |
|
3083 | + $longitude = $Common->convertDec($lns, 'longitude'); |
|
3084 | 3084 | if ($lac == 'S') $latitude = '-'.$latitude; |
3085 | 3085 | if ($lnc == 'W') $longitude = '-'.$longitude; |
3086 | 3086 | $data['center_latitude'] = $latitude; |
3087 | 3087 | $data['center_longitude'] = $longitude; |
3088 | 3088 | $data['radius'] = intval($radius); |
3089 | 3089 | |
3090 | - preg_match(':<pre>(.*?)</pre>:',$description,$match); |
|
3090 | + preg_match(':<pre>(.*?)</pre>:', $description, $match); |
|
3091 | 3091 | $data['text'] = $match[1]; |
3092 | - preg_match(':</pre>(.*?)$:',$description,$match); |
|
3092 | + preg_match(':</pre>(.*?)$:', $description, $match); |
|
3093 | 3093 | $fromto = $match[1]; |
3094 | - preg_match('#FROM:(.*?)TO:#',$fromto,$match); |
|
3094 | + preg_match('#FROM:(.*?)TO:#', $fromto, $match); |
|
3095 | 3095 | $fromall = trim($match[1]); |
3096 | - preg_match('#^(.*?) \((.*?)\)$#',$fromall,$match); |
|
3096 | + preg_match('#^(.*?) \((.*?)\)$#', $fromall, $match); |
|
3097 | 3097 | $from = trim($match[1]); |
3098 | - $data['date_begin'] = date("Y-m-d H:i:s",strtotime($from)); |
|
3099 | - preg_match('#TO:(.*?)$#',$fromto,$match); |
|
3098 | + $data['date_begin'] = date("Y-m-d H:i:s", strtotime($from)); |
|
3099 | + preg_match('#TO:(.*?)$#', $fromto, $match); |
|
3100 | 3100 | $toall = trim($match[1]); |
3101 | - if (!preg_match(':Permanent:',$toall)) { |
|
3102 | - preg_match('#^(.*?) \((.*?)\)#',$toall,$match); |
|
3101 | + if (!preg_match(':Permanent:', $toall)) { |
|
3102 | + preg_match('#^(.*?) \((.*?)\)#', $toall, $match); |
|
3103 | 3103 | $to = trim($match[1]); |
3104 | - $data['date_end'] = date("Y-m-d H:i:s",strtotime($to)); |
|
3104 | + $data['date_end'] = date("Y-m-d H:i:s", strtotime($to)); |
|
3105 | 3105 | $data['permanent'] = 0; |
3106 | 3106 | } else { |
3107 | 3107 | $data['date_end'] = NULL; |
@@ -3109,7 +3109,7 @@ discard block |
||
3109 | 3109 | } |
3110 | 3110 | $data['full_notam'] = $notam['title'].'<br>'.$notam['description']; |
3111 | 3111 | $NOTAM = new NOTAM(); |
3112 | - $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']); |
|
3112 | + $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']); |
|
3113 | 3113 | unset($data); |
3114 | 3114 | } |
3115 | 3115 | } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
@@ -3132,16 +3132,16 @@ discard block |
||
3132 | 3132 | $Connection = new Connection(); |
3133 | 3133 | $sth = $Connection->db->prepare($query); |
3134 | 3134 | $sth->execute(); |
3135 | - } catch(PDOException $e) { |
|
3135 | + } catch (PDOException $e) { |
|
3136 | 3136 | return "error : ".$e->getMessage(); |
3137 | 3137 | } |
3138 | 3138 | } |
3139 | 3139 | $Common = new Common(); |
3140 | 3140 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3141 | - $airspace_json = json_decode($airspace_lst,true); |
|
3141 | + $airspace_json = json_decode($airspace_lst, true); |
|
3142 | 3142 | foreach ($airspace_json['records'] as $airspace) { |
3143 | 3143 | if ($globalDebug) echo $airspace['name']."...\n"; |
3144 | - update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
|
3144 | + update_db::download($airspace['uri'], $tmp_dir.$airspace['name']); |
|
3145 | 3145 | if (file_exists($tmp_dir.$airspace['name'])) { |
3146 | 3146 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
3147 | 3147 | //system('recode l9..utf8 '.$tmp_dir.$airspace['name']); |
@@ -3163,7 +3163,7 @@ discard block |
||
3163 | 3163 | $Connection = new Connection(); |
3164 | 3164 | $sth = $Connection->db->prepare($query); |
3165 | 3165 | $sth->execute(array(':new' => $new, ':old' => $old)); |
3166 | - } catch(PDOException $e) { |
|
3166 | + } catch (PDOException $e) { |
|
3167 | 3167 | return "error : ".$e->getMessage(); |
3168 | 3168 | } |
3169 | 3169 | } |
@@ -3180,7 +3180,7 @@ discard block |
||
3180 | 3180 | $Connection = new Connection(); |
3181 | 3181 | $sth = $Connection->db->prepare($query); |
3182 | 3182 | $sth->execute(); |
3183 | - } catch(PDOException $e) { |
|
3183 | + } catch (PDOException $e) { |
|
3184 | 3184 | return "error : ".$e->getMessage(); |
3185 | 3185 | } |
3186 | 3186 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3195,7 +3195,7 @@ discard block |
||
3195 | 3195 | $Connection = new Connection(); |
3196 | 3196 | $sth = $Connection->db->prepare($query); |
3197 | 3197 | $sth->execute(); |
3198 | - } catch(PDOException $e) { |
|
3198 | + } catch (PDOException $e) { |
|
3199 | 3199 | return "error : ".$e->getMessage(); |
3200 | 3200 | } |
3201 | 3201 | } |
@@ -3206,7 +3206,7 @@ discard block |
||
3206 | 3206 | $Connection = new Connection(); |
3207 | 3207 | $sth = $Connection->db->prepare($query); |
3208 | 3208 | $sth->execute(array(':version' => $version)); |
3209 | - } catch(PDOException $e) { |
|
3209 | + } catch (PDOException $e) { |
|
3210 | 3210 | return "error : ".$e->getMessage(); |
3211 | 3211 | } |
3212 | 3212 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3220,7 +3220,7 @@ discard block |
||
3220 | 3220 | $Connection = new Connection(); |
3221 | 3221 | $sth = $Connection->db->prepare($query); |
3222 | 3222 | $sth->execute(array(':version' => $version)); |
3223 | - } catch(PDOException $e) { |
|
3223 | + } catch (PDOException $e) { |
|
3224 | 3224 | return "error : ".$e->getMessage(); |
3225 | 3225 | } |
3226 | 3226 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3234,7 +3234,7 @@ discard block |
||
3234 | 3234 | $Connection = new Connection(); |
3235 | 3235 | $sth = $Connection->db->prepare($query); |
3236 | 3236 | $sth->execute(array(':version' => $version)); |
3237 | - } catch(PDOException $e) { |
|
3237 | + } catch (PDOException $e) { |
|
3238 | 3238 | return "error : ".$e->getMessage(); |
3239 | 3239 | } |
3240 | 3240 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3248,7 +3248,7 @@ discard block |
||
3248 | 3248 | $Connection = new Connection(); |
3249 | 3249 | $sth = $Connection->db->prepare($query); |
3250 | 3250 | $sth->execute(array(':version' => $version)); |
3251 | - } catch(PDOException $e) { |
|
3251 | + } catch (PDOException $e) { |
|
3252 | 3252 | return "error : ".$e->getMessage(); |
3253 | 3253 | } |
3254 | 3254 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3262,7 +3262,7 @@ discard block |
||
3262 | 3262 | $Connection = new Connection(); |
3263 | 3263 | $sth = $Connection->db->prepare($query); |
3264 | 3264 | $sth->execute(array(':version' => $version)); |
3265 | - } catch(PDOException $e) { |
|
3265 | + } catch (PDOException $e) { |
|
3266 | 3266 | return "error : ".$e->getMessage(); |
3267 | 3267 | } |
3268 | 3268 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3276,7 +3276,7 @@ discard block |
||
3276 | 3276 | $Connection = new Connection(); |
3277 | 3277 | $sth = $Connection->db->prepare($query); |
3278 | 3278 | $sth->execute(array(':version' => $version)); |
3279 | - } catch(PDOException $e) { |
|
3279 | + } catch (PDOException $e) { |
|
3280 | 3280 | return "error : ".$e->getMessage(); |
3281 | 3281 | } |
3282 | 3282 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3291,7 +3291,7 @@ discard block |
||
3291 | 3291 | $Connection = new Connection(); |
3292 | 3292 | $sth = $Connection->db->prepare($query); |
3293 | 3293 | $sth->execute(array(':version' => $version)); |
3294 | - } catch(PDOException $e) { |
|
3294 | + } catch (PDOException $e) { |
|
3295 | 3295 | return "error : ".$e->getMessage(); |
3296 | 3296 | } |
3297 | 3297 | } |
@@ -3303,7 +3303,7 @@ discard block |
||
3303 | 3303 | $Connection = new Connection(); |
3304 | 3304 | $sth = $Connection->db->prepare($query); |
3305 | 3305 | $sth->execute(array(':version' => $version)); |
3306 | - } catch(PDOException $e) { |
|
3306 | + } catch (PDOException $e) { |
|
3307 | 3307 | return "error : ".$e->getMessage(); |
3308 | 3308 | } |
3309 | 3309 | } |
@@ -3315,7 +3315,7 @@ discard block |
||
3315 | 3315 | $Connection = new Connection(); |
3316 | 3316 | $sth = $Connection->db->prepare($query); |
3317 | 3317 | $sth->execute(array(':version' => $version)); |
3318 | - } catch(PDOException $e) { |
|
3318 | + } catch (PDOException $e) { |
|
3319 | 3319 | return "error : ".$e->getMessage(); |
3320 | 3320 | } |
3321 | 3321 | } |
@@ -3327,7 +3327,7 @@ discard block |
||
3327 | 3327 | $Connection = new Connection(); |
3328 | 3328 | $sth = $Connection->db->prepare($query); |
3329 | 3329 | $sth->execute(array(':version' => $version)); |
3330 | - } catch(PDOException $e) { |
|
3330 | + } catch (PDOException $e) { |
|
3331 | 3331 | return "error : ".$e->getMessage(); |
3332 | 3332 | } |
3333 | 3333 | } |
@@ -3339,7 +3339,7 @@ discard block |
||
3339 | 3339 | $Connection = new Connection(); |
3340 | 3340 | $sth = $Connection->db->prepare($query); |
3341 | 3341 | $sth->execute(array(':version' => $version)); |
3342 | - } catch(PDOException $e) { |
|
3342 | + } catch (PDOException $e) { |
|
3343 | 3343 | return "error : ".$e->getMessage(); |
3344 | 3344 | } |
3345 | 3345 | } |
@@ -3351,7 +3351,7 @@ discard block |
||
3351 | 3351 | $Connection = new Connection(); |
3352 | 3352 | $sth = $Connection->db->prepare($query); |
3353 | 3353 | $sth->execute(array(':version' => $version)); |
3354 | - } catch(PDOException $e) { |
|
3354 | + } catch (PDOException $e) { |
|
3355 | 3355 | return "error : ".$e->getMessage(); |
3356 | 3356 | } |
3357 | 3357 | } |
@@ -3367,7 +3367,7 @@ discard block |
||
3367 | 3367 | $Connection = new Connection(); |
3368 | 3368 | $sth = $Connection->db->prepare($query); |
3369 | 3369 | $sth->execute(); |
3370 | - } catch(PDOException $e) { |
|
3370 | + } catch (PDOException $e) { |
|
3371 | 3371 | return "error : ".$e->getMessage(); |
3372 | 3372 | } |
3373 | 3373 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3382,7 +3382,7 @@ discard block |
||
3382 | 3382 | $Connection = new Connection(); |
3383 | 3383 | $sth = $Connection->db->prepare($query); |
3384 | 3384 | $sth->execute(); |
3385 | - } catch(PDOException $e) { |
|
3385 | + } catch (PDOException $e) { |
|
3386 | 3386 | return "error : ".$e->getMessage(); |
3387 | 3387 | } |
3388 | 3388 | } |
@@ -3398,7 +3398,7 @@ discard block |
||
3398 | 3398 | $Connection = new Connection(); |
3399 | 3399 | $sth = $Connection->db->prepare($query); |
3400 | 3400 | $sth->execute(); |
3401 | - } catch(PDOException $e) { |
|
3401 | + } catch (PDOException $e) { |
|
3402 | 3402 | return "error : ".$e->getMessage(); |
3403 | 3403 | } |
3404 | 3404 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3413,7 +3413,7 @@ discard block |
||
3413 | 3413 | $Connection = new Connection(); |
3414 | 3414 | $sth = $Connection->db->prepare($query); |
3415 | 3415 | $sth->execute(); |
3416 | - } catch(PDOException $e) { |
|
3416 | + } catch (PDOException $e) { |
|
3417 | 3417 | return "error : ".$e->getMessage(); |
3418 | 3418 | } |
3419 | 3419 | } |
@@ -3429,7 +3429,7 @@ discard block |
||
3429 | 3429 | $Connection = new Connection(); |
3430 | 3430 | $sth = $Connection->db->prepare($query); |
3431 | 3431 | $sth->execute(); |
3432 | - } catch(PDOException $e) { |
|
3432 | + } catch (PDOException $e) { |
|
3433 | 3433 | return "error : ".$e->getMessage(); |
3434 | 3434 | } |
3435 | 3435 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3444,7 +3444,7 @@ discard block |
||
3444 | 3444 | $Connection = new Connection(); |
3445 | 3445 | $sth = $Connection->db->prepare($query); |
3446 | 3446 | $sth->execute(); |
3447 | - } catch(PDOException $e) { |
|
3447 | + } catch (PDOException $e) { |
|
3448 | 3448 | return "error : ".$e->getMessage(); |
3449 | 3449 | } |
3450 | 3450 | } |
@@ -3460,7 +3460,7 @@ discard block |
||
3460 | 3460 | $Connection = new Connection(); |
3461 | 3461 | $sth = $Connection->db->prepare($query); |
3462 | 3462 | $sth->execute(); |
3463 | - } catch(PDOException $e) { |
|
3463 | + } catch (PDOException $e) { |
|
3464 | 3464 | return "error : ".$e->getMessage(); |
3465 | 3465 | } |
3466 | 3466 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3475,7 +3475,7 @@ discard block |
||
3475 | 3475 | $Connection = new Connection(); |
3476 | 3476 | $sth = $Connection->db->prepare($query); |
3477 | 3477 | $sth->execute(); |
3478 | - } catch(PDOException $e) { |
|
3478 | + } catch (PDOException $e) { |
|
3479 | 3479 | return "error : ".$e->getMessage(); |
3480 | 3480 | } |
3481 | 3481 | } |
@@ -3491,7 +3491,7 @@ discard block |
||
3491 | 3491 | $Connection = new Connection(); |
3492 | 3492 | $sth = $Connection->db->prepare($query); |
3493 | 3493 | $sth->execute(); |
3494 | - } catch(PDOException $e) { |
|
3494 | + } catch (PDOException $e) { |
|
3495 | 3495 | return "error : ".$e->getMessage(); |
3496 | 3496 | } |
3497 | 3497 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3506,7 +3506,7 @@ discard block |
||
3506 | 3506 | $Connection = new Connection(); |
3507 | 3507 | $sth = $Connection->db->prepare($query); |
3508 | 3508 | $sth->execute(); |
3509 | - } catch(PDOException $e) { |
|
3509 | + } catch (PDOException $e) { |
|
3510 | 3510 | return "error : ".$e->getMessage(); |
3511 | 3511 | } |
3512 | 3512 | } |
@@ -3522,7 +3522,7 @@ discard block |
||
3522 | 3522 | $Connection = new Connection(); |
3523 | 3523 | $sth = $Connection->db->prepare($query); |
3524 | 3524 | $sth->execute(); |
3525 | - } catch(PDOException $e) { |
|
3525 | + } catch (PDOException $e) { |
|
3526 | 3526 | return "error : ".$e->getMessage(); |
3527 | 3527 | } |
3528 | 3528 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3537,7 +3537,7 @@ discard block |
||
3537 | 3537 | $Connection = new Connection(); |
3538 | 3538 | $sth = $Connection->db->prepare($query); |
3539 | 3539 | $sth->execute(); |
3540 | - } catch(PDOException $e) { |
|
3540 | + } catch (PDOException $e) { |
|
3541 | 3541 | return "error : ".$e->getMessage(); |
3542 | 3542 | } |
3543 | 3543 | } |
@@ -3553,7 +3553,7 @@ discard block |
||
3553 | 3553 | $Connection = new Connection(); |
3554 | 3554 | $sth = $Connection->db->prepare($query); |
3555 | 3555 | $sth->execute(); |
3556 | - } catch(PDOException $e) { |
|
3556 | + } catch (PDOException $e) { |
|
3557 | 3557 | return "error : ".$e->getMessage(); |
3558 | 3558 | } |
3559 | 3559 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3568,7 +3568,7 @@ discard block |
||
3568 | 3568 | $Connection = new Connection(); |
3569 | 3569 | $sth = $Connection->db->prepare($query); |
3570 | 3570 | $sth->execute(); |
3571 | - } catch(PDOException $e) { |
|
3571 | + } catch (PDOException $e) { |
|
3572 | 3572 | return "error : ".$e->getMessage(); |
3573 | 3573 | } |
3574 | 3574 | } |
@@ -3584,7 +3584,7 @@ discard block |
||
3584 | 3584 | $Connection = new Connection(); |
3585 | 3585 | $sth = $Connection->db->prepare($query); |
3586 | 3586 | $sth->execute(); |
3587 | - } catch(PDOException $e) { |
|
3587 | + } catch (PDOException $e) { |
|
3588 | 3588 | return "error : ".$e->getMessage(); |
3589 | 3589 | } |
3590 | 3590 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3599,7 +3599,7 @@ discard block |
||
3599 | 3599 | $Connection = new Connection(); |
3600 | 3600 | $sth = $Connection->db->prepare($query); |
3601 | 3601 | $sth->execute(); |
3602 | - } catch(PDOException $e) { |
|
3602 | + } catch (PDOException $e) { |
|
3603 | 3603 | return "error : ".$e->getMessage(); |
3604 | 3604 | } |
3605 | 3605 | } |
@@ -3615,7 +3615,7 @@ discard block |
||
3615 | 3615 | $Connection = new Connection(); |
3616 | 3616 | $sth = $Connection->db->prepare($query); |
3617 | 3617 | $sth->execute(); |
3618 | - } catch(PDOException $e) { |
|
3618 | + } catch (PDOException $e) { |
|
3619 | 3619 | return "error : ".$e->getMessage(); |
3620 | 3620 | } |
3621 | 3621 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3630,7 +3630,7 @@ discard block |
||
3630 | 3630 | $Connection = new Connection(); |
3631 | 3631 | $sth = $Connection->db->prepare($query); |
3632 | 3632 | $sth->execute(); |
3633 | - } catch(PDOException $e) { |
|
3633 | + } catch (PDOException $e) { |
|
3634 | 3634 | return "error : ".$e->getMessage(); |
3635 | 3635 | } |
3636 | 3636 | } |
@@ -3646,7 +3646,7 @@ discard block |
||
3646 | 3646 | $Connection = new Connection(); |
3647 | 3647 | $sth = $Connection->db->prepare($query); |
3648 | 3648 | $sth->execute(); |
3649 | - } catch(PDOException $e) { |
|
3649 | + } catch (PDOException $e) { |
|
3650 | 3650 | return "error : ".$e->getMessage(); |
3651 | 3651 | } |
3652 | 3652 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3661,7 +3661,7 @@ discard block |
||
3661 | 3661 | $Connection = new Connection(); |
3662 | 3662 | $sth = $Connection->db->prepare($query); |
3663 | 3663 | $sth->execute(); |
3664 | - } catch(PDOException $e) { |
|
3664 | + } catch (PDOException $e) { |
|
3665 | 3665 | return "error : ".$e->getMessage(); |
3666 | 3666 | } |
3667 | 3667 | } |
@@ -3677,7 +3677,7 @@ discard block |
||
3677 | 3677 | $Connection = new Connection(); |
3678 | 3678 | $sth = $Connection->db->prepare($query); |
3679 | 3679 | $sth->execute(); |
3680 | - } catch(PDOException $e) { |
|
3680 | + } catch (PDOException $e) { |
|
3681 | 3681 | return "error : ".$e->getMessage(); |
3682 | 3682 | } |
3683 | 3683 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3696,7 +3696,7 @@ discard block |
||
3696 | 3696 | $Connection = new Connection(); |
3697 | 3697 | $sth = $Connection->db->prepare($query); |
3698 | 3698 | $sth->execute(); |
3699 | - } catch(PDOException $e) { |
|
3699 | + } catch (PDOException $e) { |
|
3700 | 3700 | return "error : ".$e->getMessage(); |
3701 | 3701 | } |
3702 | 3702 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -3711,7 +3711,7 @@ discard block |
||
3711 | 3711 | $Connection = new Connection(); |
3712 | 3712 | $sth = $Connection->db->prepare($query); |
3713 | 3713 | $sth->execute(); |
3714 | - } catch(PDOException $e) { |
|
3714 | + } catch (PDOException $e) { |
|
3715 | 3715 | return "error : ".$e->getMessage(); |
3716 | 3716 | } |
3717 | 3717 | } |
@@ -3723,7 +3723,7 @@ discard block |
||
3723 | 3723 | $Connection = new Connection(); |
3724 | 3724 | $sth = $Connection->db->prepare($query); |
3725 | 3725 | $sth->execute(); |
3726 | - } catch(PDOException $e) { |
|
3726 | + } catch (PDOException $e) { |
|
3727 | 3727 | return "error : ".$e->getMessage(); |
3728 | 3728 | } |
3729 | 3729 | } |
@@ -3739,7 +3739,7 @@ discard block |
||
3739 | 3739 | $Connection = new Connection(); |
3740 | 3740 | $sth = $Connection->db->prepare($query); |
3741 | 3741 | $sth->execute(); |
3742 | - } catch(PDOException $e) { |
|
3742 | + } catch (PDOException $e) { |
|
3743 | 3743 | return "error : ".$e->getMessage(); |
3744 | 3744 | } |
3745 | 3745 | } |
@@ -3754,7 +3754,7 @@ discard block |
||
3754 | 3754 | $Connection = new Connection(); |
3755 | 3755 | $sth = $Connection->db->prepare($query); |
3756 | 3756 | $sth->execute(); |
3757 | - } catch(PDOException $e) { |
|
3757 | + } catch (PDOException $e) { |
|
3758 | 3758 | return "error : ".$e->getMessage(); |
3759 | 3759 | } |
3760 | 3760 | } |
@@ -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 | } |
@@ -1509,9 +1688,14 @@ discard block |
||
1509 | 1688 | if ($i > 0 && $data[0] != '') { |
1510 | 1689 | $sources = trim($data[28].' '.$data[29].' '.$data[30].' '.$data[31].' '.$data[32].' '.$data[33]); |
1511 | 1690 | $period = str_replace(',','',$data[14]); |
1512 | - if (!empty($period) && strpos($period,'days')) $period = str_replace(' days','',$period)*24*60; |
|
1513 | - if ($data[18] != '') $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1514 | - else $launch_date = NULL; |
|
1691 | + if (!empty($period) && strpos($period,'days')) { |
|
1692 | + $period = str_replace(' days','',$period)*24*60; |
|
1693 | + } |
|
1694 | + if ($data[18] != '') { |
|
1695 | + $launch_date = date('Y-m-d',strtotime($data[18])); |
|
1696 | + } else { |
|
1697 | + $launch_date = NULL; |
|
1698 | + } |
|
1515 | 1699 | $data = array_map(function($value) { |
1516 | 1700 | return trim($value) === '' ? null : $value; |
1517 | 1701 | }, $data); |
@@ -1874,7 +2058,9 @@ discard block |
||
1874 | 2058 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1875 | 2059 | { |
1876 | 2060 | $i = 0; |
1877 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2061 | + if ($globalTransaction) { |
|
2062 | + $Connection->db->beginTransaction(); |
|
2063 | + } |
|
1878 | 2064 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1879 | 2065 | { |
1880 | 2066 | $i++; |
@@ -1902,7 +2088,9 @@ discard block |
||
1902 | 2088 | } |
1903 | 2089 | } |
1904 | 2090 | fclose($handle); |
1905 | - if ($globalTransaction) $Connection->db->commit(); |
|
2091 | + if ($globalTransaction) { |
|
2092 | + $Connection->db->commit(); |
|
2093 | + } |
|
1906 | 2094 | } |
1907 | 2095 | return ''; |
1908 | 2096 | } |
@@ -1945,7 +2133,9 @@ discard block |
||
1945 | 2133 | $Connection = new Connection(); |
1946 | 2134 | if (($handle = fopen($filename, 'r')) !== FALSE) |
1947 | 2135 | { |
1948 | - if ($globalTransaction) $Connection->db->beginTransaction(); |
|
2136 | + if ($globalTransaction) { |
|
2137 | + $Connection->db->beginTransaction(); |
|
2138 | + } |
|
1949 | 2139 | while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) |
1950 | 2140 | { |
1951 | 2141 | if(count($row) > 1) { |
@@ -1959,7 +2149,9 @@ discard block |
||
1959 | 2149 | } |
1960 | 2150 | } |
1961 | 2151 | fclose($handle); |
1962 | - if ($globalTransaction) $Connection->db->commit(); |
|
2152 | + if ($globalTransaction) { |
|
2153 | + $Connection->db->commit(); |
|
2154 | + } |
|
1963 | 2155 | } |
1964 | 2156 | return ''; |
1965 | 2157 | } |
@@ -1979,8 +2171,9 @@ discard block |
||
1979 | 2171 | } |
1980 | 2172 | |
1981 | 2173 | |
1982 | - if ($globalDBdriver == 'mysql') update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
1983 | - else { |
|
2174 | + if ($globalDBdriver == 'mysql') { |
|
2175 | + update_db::gunzip('../db/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
|
2176 | + } else { |
|
1984 | 2177 | update_db::gunzip('../db/pgsql/airspace.sql.gz',$tmp_dir.'airspace.sql'); |
1985 | 2178 | $query = "CREATE EXTENSION postgis"; |
1986 | 2179 | $Connection = new Connection(null,null,$_SESSION['database_root'],$_SESSION['database_rootpass']); |
@@ -1999,7 +2192,9 @@ discard block |
||
1999 | 2192 | global $tmp_dir, $globalDebug; |
2000 | 2193 | include_once('class.create_db.php'); |
2001 | 2194 | require_once(dirname(__FILE__).'/../require/class.NOTAM.php'); |
2002 | - if ($globalDebug) echo "NOTAM from FlightAirMap website : Download..."; |
|
2195 | + if ($globalDebug) { |
|
2196 | + echo "NOTAM from FlightAirMap website : Download..."; |
|
2197 | + } |
|
2003 | 2198 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz.md5',$tmp_dir.'notam.txt.gz.md5'); |
2004 | 2199 | $error = ''; |
2005 | 2200 | if (file_exists($tmp_dir.'notam.txt.gz.md5')) { |
@@ -2009,20 +2204,34 @@ discard block |
||
2009 | 2204 | update_db::download('http://data.flightairmap.com/data/notam.txt.gz',$tmp_dir.'notam.txt.gz'); |
2010 | 2205 | if (file_exists($tmp_dir.'notam.txt.gz')) { |
2011 | 2206 | if (md5_file($tmp_dir.'notam.txt.gz') == $notam_md5) { |
2012 | - if ($globalDebug) echo "Gunzip..."; |
|
2207 | + if ($globalDebug) { |
|
2208 | + echo "Gunzip..."; |
|
2209 | + } |
|
2013 | 2210 | update_db::gunzip($tmp_dir.'notam.txt.gz'); |
2014 | - if ($globalDebug) echo "Add to DB..."; |
|
2211 | + if ($globalDebug) { |
|
2212 | + echo "Add to DB..."; |
|
2213 | + } |
|
2015 | 2214 | //$error = create_db::import_file($tmp_dir.'notam.sql'); |
2016 | 2215 | $NOTAM = new NOTAM(); |
2017 | 2216 | $NOTAM->updateNOTAMfromTextFile($tmp_dir.'notam.txt'); |
2018 | 2217 | update_db::insert_notam_version($notam_md5); |
2019 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
2020 | - } else $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2021 | - } elseif ($globalDebug) echo "No new version."; |
|
2022 | - } else $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2218 | + } else { |
|
2219 | + $error = "File ".$tmp_dir.'notam.txt.gz'." md5 failed. Download failed."; |
|
2220 | + } |
|
2221 | + } else { |
|
2222 | + $error = "File ".$tmp_dir.'notam.txt.gz'." doesn't exist. Download failed."; |
|
2223 | + } |
|
2224 | + } elseif ($globalDebug) { |
|
2225 | + echo "No new version."; |
|
2226 | + } |
|
2227 | + } else { |
|
2228 | + $error = "File ".$tmp_dir.'notam.txt.gz.md5'." doesn't exist. Download failed."; |
|
2229 | + } |
|
2023 | 2230 | if ($error != '') { |
2024 | 2231 | return $error; |
2025 | - } elseif ($globalDebug) echo "Done\n"; |
|
2232 | + } elseif ($globalDebug) { |
|
2233 | + echo "Done\n"; |
|
2234 | + } |
|
2026 | 2235 | return ''; |
2027 | 2236 | } |
2028 | 2237 | |
@@ -2077,68 +2286,114 @@ discard block |
||
2077 | 2286 | //update_db::download('http://fr.mirror.ivao.aero/software/ivae_feb2013.zip',$tmp_dir.'ivae_feb2013.zip'); |
2078 | 2287 | if (extension_loaded('zip')) { |
2079 | 2288 | if (file_exists($tmp_dir.'ivae_feb2013.zip')) { |
2080 | - if ($globalDebug) echo "Unzip..."; |
|
2289 | + if ($globalDebug) { |
|
2290 | + echo "Unzip..."; |
|
2291 | + } |
|
2081 | 2292 | update_db::unzip($tmp_dir.'ivae_feb2013.zip'); |
2082 | - if ($globalDebug) echo "Add to DB..."; |
|
2293 | + if ($globalDebug) { |
|
2294 | + echo "Add to DB..."; |
|
2295 | + } |
|
2083 | 2296 | update_db::ivao_airlines($tmp_dir.'data/airlines.dat'); |
2084 | - if ($globalDebug) echo "Copy airlines logos to airlines images directory..."; |
|
2297 | + if ($globalDebug) { |
|
2298 | + echo "Copy airlines logos to airlines images directory..."; |
|
2299 | + } |
|
2085 | 2300 | if (is_writable(dirname(__FILE__).'/../images/airlines')) { |
2086 | - if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) $error = "Failed to copy airlines logo."; |
|
2087 | - } else $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2088 | - } else $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2089 | - } else $error = "ZIP module not loaded but required for IVAO."; |
|
2301 | + if (!$Common->xcopy($tmp_dir.'logos/',dirname(__FILE__).'/../images/airlines/')) { |
|
2302 | + $error = "Failed to copy airlines logo."; |
|
2303 | + } |
|
2304 | + } else { |
|
2305 | + $error = "The directory ".dirname(__FILE__).'/../images/airlines'." must be writable"; |
|
2306 | + } |
|
2307 | + } else { |
|
2308 | + $error = "File ".$tmp_dir.'ivao.zip'." doesn't exist. Download failed."; |
|
2309 | + } |
|
2310 | + } else { |
|
2311 | + $error = "ZIP module not loaded but required for IVAO."; |
|
2312 | + } |
|
2090 | 2313 | if ($error != '') { |
2091 | 2314 | return $error; |
2092 | - } elseif ($globalDebug) echo "Done\n"; |
|
2315 | + } elseif ($globalDebug) { |
|
2316 | + echo "Done\n"; |
|
2317 | + } |
|
2093 | 2318 | return ''; |
2094 | 2319 | } |
2095 | 2320 | |
2096 | 2321 | public static function update_routes() { |
2097 | 2322 | global $tmp_dir, $globalDebug; |
2098 | 2323 | $error = ''; |
2099 | - if ($globalDebug) echo "Routes : Download..."; |
|
2324 | + if ($globalDebug) { |
|
2325 | + echo "Routes : Download..."; |
|
2326 | + } |
|
2100 | 2327 | update_db::download('http://www.virtualradarserver.co.uk/Files/StandingData.sqb.gz',$tmp_dir.'StandingData.sqb.gz'); |
2101 | 2328 | if (file_exists($tmp_dir.'StandingData.sqb.gz')) { |
2102 | - if ($globalDebug) echo "Gunzip..."; |
|
2329 | + if ($globalDebug) { |
|
2330 | + echo "Gunzip..."; |
|
2331 | + } |
|
2103 | 2332 | update_db::gunzip($tmp_dir.'StandingData.sqb.gz'); |
2104 | - if ($globalDebug) echo "Add to DB..."; |
|
2333 | + if ($globalDebug) { |
|
2334 | + echo "Add to DB..."; |
|
2335 | + } |
|
2105 | 2336 | $error = update_db::retrieve_route_sqlite_to_dest($tmp_dir.'StandingData.sqb'); |
2106 | - } else $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2337 | + } else { |
|
2338 | + $error = "File ".$tmp_dir.'StandingData.sqb.gz'." doesn't exist. Download failed."; |
|
2339 | + } |
|
2107 | 2340 | if ($error != '') { |
2108 | 2341 | return $error; |
2109 | - } elseif ($globalDebug) echo "Done\n"; |
|
2342 | + } elseif ($globalDebug) { |
|
2343 | + echo "Done\n"; |
|
2344 | + } |
|
2110 | 2345 | return ''; |
2111 | 2346 | } |
2112 | 2347 | public static function update_oneworld() { |
2113 | 2348 | global $tmp_dir, $globalDebug; |
2114 | 2349 | $error = ''; |
2115 | - if ($globalDebug) echo "Schedules Oneworld : Download..."; |
|
2350 | + if ($globalDebug) { |
|
2351 | + echo "Schedules Oneworld : Download..."; |
|
2352 | + } |
|
2116 | 2353 | update_db::download('http://data.flightairmap.com/data/schedules/oneworld.csv.gz',$tmp_dir.'oneworld.csv.gz'); |
2117 | 2354 | if (file_exists($tmp_dir.'oneworld.csv.gz')) { |
2118 | - if ($globalDebug) echo "Gunzip..."; |
|
2355 | + if ($globalDebug) { |
|
2356 | + echo "Gunzip..."; |
|
2357 | + } |
|
2119 | 2358 | update_db::gunzip($tmp_dir.'oneworld.csv.gz'); |
2120 | - if ($globalDebug) echo "Add to DB..."; |
|
2359 | + if ($globalDebug) { |
|
2360 | + echo "Add to DB..."; |
|
2361 | + } |
|
2121 | 2362 | $error = update_db::retrieve_route_oneworld($tmp_dir.'oneworld.csv'); |
2122 | - } else $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2363 | + } else { |
|
2364 | + $error = "File ".$tmp_dir.'oneworld.csv.gz'." doesn't exist. Download failed."; |
|
2365 | + } |
|
2123 | 2366 | if ($error != '') { |
2124 | 2367 | return $error; |
2125 | - } elseif ($globalDebug) echo "Done\n"; |
|
2368 | + } elseif ($globalDebug) { |
|
2369 | + echo "Done\n"; |
|
2370 | + } |
|
2126 | 2371 | return ''; |
2127 | 2372 | } |
2128 | 2373 | public static function update_skyteam() { |
2129 | 2374 | global $tmp_dir, $globalDebug; |
2130 | 2375 | $error = ''; |
2131 | - if ($globalDebug) echo "Schedules Skyteam : Download..."; |
|
2376 | + if ($globalDebug) { |
|
2377 | + echo "Schedules Skyteam : Download..."; |
|
2378 | + } |
|
2132 | 2379 | update_db::download('http://data.flightairmap.com/data/schedules/skyteam.csv.gz',$tmp_dir.'skyteam.csv.gz'); |
2133 | 2380 | if (file_exists($tmp_dir.'skyteam.csv.gz')) { |
2134 | - if ($globalDebug) echo "Gunzip..."; |
|
2381 | + if ($globalDebug) { |
|
2382 | + echo "Gunzip..."; |
|
2383 | + } |
|
2135 | 2384 | update_db::gunzip($tmp_dir.'skyteam.csv.gz'); |
2136 | - if ($globalDebug) echo "Add to DB..."; |
|
2385 | + if ($globalDebug) { |
|
2386 | + echo "Add to DB..."; |
|
2387 | + } |
|
2137 | 2388 | $error = update_db::retrieve_route_skyteam($tmp_dir.'skyteam.csv'); |
2138 | - } else $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2389 | + } else { |
|
2390 | + $error = "File ".$tmp_dir.'skyteam.csv.gz'." doesn't exist. Download failed."; |
|
2391 | + } |
|
2139 | 2392 | if ($error != '') { |
2140 | 2393 | return $error; |
2141 | - } elseif ($globalDebug) echo "Done\n"; |
|
2394 | + } elseif ($globalDebug) { |
|
2395 | + echo "Done\n"; |
|
2396 | + } |
|
2142 | 2397 | return ''; |
2143 | 2398 | } |
2144 | 2399 | public static function update_ModeS() { |
@@ -2155,340 +2410,590 @@ discard block |
||
2155 | 2410 | exit; |
2156 | 2411 | } elseif ($globalDebug) echo "Done\n"; |
2157 | 2412 | */ |
2158 | - if ($globalDebug) echo "Modes : Download..."; |
|
2159 | -// update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2413 | + if ($globalDebug) { |
|
2414 | + echo "Modes : Download..."; |
|
2415 | + } |
|
2416 | + // update_db::download('http://planebase.biz/sqb.php?f=basestationall.zip',$tmp_dir.'basestation_latest.zip','http://planebase.biz/bstnsqb'); |
|
2160 | 2417 | update_db::download('http://data.flightairmap.com/data/BaseStation.sqb.gz',$tmp_dir.'BaseStation.sqb.gz'); |
2161 | 2418 | |
2162 | 2419 | // if (file_exists($tmp_dir.'basestation_latest.zip')) { |
2163 | 2420 | if (file_exists($tmp_dir.'BaseStation.sqb.gz')) { |
2164 | - if ($globalDebug) echo "Unzip..."; |
|
2165 | -// update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2421 | + if ($globalDebug) { |
|
2422 | + echo "Unzip..."; |
|
2423 | + } |
|
2424 | + // update_db::unzip($tmp_dir.'basestation_latest.zip'); |
|
2166 | 2425 | update_db::gunzip($tmp_dir.'BaseStation.sqb.gz'); |
2167 | - if ($globalDebug) echo "Add to DB..."; |
|
2426 | + if ($globalDebug) { |
|
2427 | + echo "Add to DB..."; |
|
2428 | + } |
|
2168 | 2429 | $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'BaseStation.sqb'); |
2169 | 2430 | // $error = update_db::retrieve_modes_sqlite_to_dest($tmp_dir.'basestation.sqb'); |
2170 | - } else $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2431 | + } else { |
|
2432 | + $error = "File ".$tmp_dir.'basestation_latest.zip'." doesn't exist. Download failed."; |
|
2433 | + } |
|
2171 | 2434 | if ($error != '') { |
2172 | 2435 | return $error; |
2173 | - } elseif ($globalDebug) echo "Done\n"; |
|
2436 | + } elseif ($globalDebug) { |
|
2437 | + echo "Done\n"; |
|
2438 | + } |
|
2174 | 2439 | return ''; |
2175 | 2440 | } |
2176 | 2441 | |
2177 | 2442 | public static function update_ModeS_faa() { |
2178 | 2443 | global $tmp_dir, $globalDebug; |
2179 | - if ($globalDebug) echo "Modes FAA: Download..."; |
|
2444 | + if ($globalDebug) { |
|
2445 | + echo "Modes FAA: Download..."; |
|
2446 | + } |
|
2180 | 2447 | update_db::download('http://registry.faa.gov/database/ReleasableAircraft.zip',$tmp_dir.'ReleasableAircraft.zip'); |
2181 | 2448 | if (file_exists($tmp_dir.'ReleasableAircraft.zip')) { |
2182 | - if ($globalDebug) echo "Unzip..."; |
|
2449 | + if ($globalDebug) { |
|
2450 | + echo "Unzip..."; |
|
2451 | + } |
|
2183 | 2452 | update_db::unzip($tmp_dir.'ReleasableAircraft.zip'); |
2184 | - if ($globalDebug) echo "Add to DB..."; |
|
2453 | + if ($globalDebug) { |
|
2454 | + echo "Add to DB..."; |
|
2455 | + } |
|
2185 | 2456 | $error = update_db::modes_faa(); |
2186 | - } else $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2457 | + } else { |
|
2458 | + $error = "File ".$tmp_dir.'ReleasableAircraft.zip'." doesn't exist. Download failed."; |
|
2459 | + } |
|
2187 | 2460 | if ($error != '') { |
2188 | 2461 | return $error; |
2189 | - } elseif ($globalDebug) echo "Done\n"; |
|
2462 | + } elseif ($globalDebug) { |
|
2463 | + echo "Done\n"; |
|
2464 | + } |
|
2190 | 2465 | return ''; |
2191 | 2466 | } |
2192 | 2467 | |
2193 | 2468 | public static function update_ModeS_flarm() { |
2194 | 2469 | global $tmp_dir, $globalDebug; |
2195 | - if ($globalDebug) echo "Modes Flarmnet: Download..."; |
|
2470 | + if ($globalDebug) { |
|
2471 | + echo "Modes Flarmnet: Download..."; |
|
2472 | + } |
|
2196 | 2473 | update_db::download('http://flarmnet.org/files/data.fln',$tmp_dir.'data.fln'); |
2197 | 2474 | if (file_exists($tmp_dir.'data.fln')) { |
2198 | - if ($globalDebug) echo "Add to DB..."; |
|
2475 | + if ($globalDebug) { |
|
2476 | + echo "Add to DB..."; |
|
2477 | + } |
|
2199 | 2478 | $error = update_db::retrieve_modes_flarmnet($tmp_dir.'data.fln'); |
2200 | - } else $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2479 | + } else { |
|
2480 | + $error = "File ".$tmp_dir.'data.fln'." doesn't exist. Download failed."; |
|
2481 | + } |
|
2201 | 2482 | if ($error != '') { |
2202 | 2483 | return $error; |
2203 | - } elseif ($globalDebug) echo "Done\n"; |
|
2484 | + } elseif ($globalDebug) { |
|
2485 | + echo "Done\n"; |
|
2486 | + } |
|
2204 | 2487 | return ''; |
2205 | 2488 | } |
2206 | 2489 | |
2207 | 2490 | public static function update_ModeS_ogn() { |
2208 | 2491 | global $tmp_dir, $globalDebug; |
2209 | - if ($globalDebug) echo "Modes OGN: Download..."; |
|
2492 | + if ($globalDebug) { |
|
2493 | + echo "Modes OGN: Download..."; |
|
2494 | + } |
|
2210 | 2495 | update_db::download('http://ddb.glidernet.org/download/',$tmp_dir.'ogn.csv'); |
2211 | 2496 | if (file_exists($tmp_dir.'ogn.csv')) { |
2212 | - if ($globalDebug) echo "Add to DB..."; |
|
2497 | + if ($globalDebug) { |
|
2498 | + echo "Add to DB..."; |
|
2499 | + } |
|
2213 | 2500 | $error = update_db::retrieve_modes_ogn($tmp_dir.'ogn.csv'); |
2214 | - } else $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2501 | + } else { |
|
2502 | + $error = "File ".$tmp_dir.'ogn.csv'." doesn't exist. Download failed."; |
|
2503 | + } |
|
2215 | 2504 | if ($error != '') { |
2216 | 2505 | return $error; |
2217 | - } elseif ($globalDebug) echo "Done\n"; |
|
2506 | + } elseif ($globalDebug) { |
|
2507 | + echo "Done\n"; |
|
2508 | + } |
|
2218 | 2509 | return ''; |
2219 | 2510 | } |
2220 | 2511 | |
2221 | 2512 | public static function update_owner() { |
2222 | 2513 | global $tmp_dir, $globalDebug, $globalMasterSource; |
2223 | 2514 | |
2224 | - if ($globalDebug) echo "Owner France: Download..."; |
|
2515 | + if ($globalDebug) { |
|
2516 | + echo "Owner France: Download..."; |
|
2517 | + } |
|
2225 | 2518 | update_db::download('http://antonakis.co.uk/registers/France.txt',$tmp_dir.'owner_f.csv'); |
2226 | 2519 | if (file_exists($tmp_dir.'owner_f.csv')) { |
2227 | - if ($globalDebug) echo "Add to DB..."; |
|
2520 | + if ($globalDebug) { |
|
2521 | + echo "Add to DB..."; |
|
2522 | + } |
|
2228 | 2523 | $error = update_db::retrieve_owner($tmp_dir.'owner_f.csv','F'); |
2229 | - } else $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2524 | + } else { |
|
2525 | + $error = "File ".$tmp_dir.'owner_f.csv'." doesn't exist. Download failed."; |
|
2526 | + } |
|
2230 | 2527 | if ($error != '') { |
2231 | 2528 | return $error; |
2232 | - } elseif ($globalDebug) echo "Done\n"; |
|
2529 | + } elseif ($globalDebug) { |
|
2530 | + echo "Done\n"; |
|
2531 | + } |
|
2233 | 2532 | |
2234 | - if ($globalDebug) echo "Owner Ireland: Download..."; |
|
2533 | + if ($globalDebug) { |
|
2534 | + echo "Owner Ireland: Download..."; |
|
2535 | + } |
|
2235 | 2536 | update_db::download('http://antonakis.co.uk/registers/Ireland.txt',$tmp_dir.'owner_ei.csv'); |
2236 | 2537 | if (file_exists($tmp_dir.'owner_ei.csv')) { |
2237 | - if ($globalDebug) echo "Add to DB..."; |
|
2538 | + if ($globalDebug) { |
|
2539 | + echo "Add to DB..."; |
|
2540 | + } |
|
2238 | 2541 | $error = update_db::retrieve_owner($tmp_dir.'owner_ei.csv','EI'); |
2239 | - } else $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2542 | + } else { |
|
2543 | + $error = "File ".$tmp_dir.'owner_ei.csv'." doesn't exist. Download failed."; |
|
2544 | + } |
|
2240 | 2545 | if ($error != '') { |
2241 | 2546 | return $error; |
2242 | - } elseif ($globalDebug) echo "Done\n"; |
|
2243 | - if ($globalDebug) echo "Owner Switzerland: Download..."; |
|
2547 | + } elseif ($globalDebug) { |
|
2548 | + echo "Done\n"; |
|
2549 | + } |
|
2550 | + if ($globalDebug) { |
|
2551 | + echo "Owner Switzerland: Download..."; |
|
2552 | + } |
|
2244 | 2553 | update_db::download('http://antonakis.co.uk/registers/Switzerland.txt',$tmp_dir.'owner_hb.csv'); |
2245 | 2554 | if (file_exists($tmp_dir.'owner_hb.csv')) { |
2246 | - if ($globalDebug) echo "Add to DB..."; |
|
2555 | + if ($globalDebug) { |
|
2556 | + echo "Add to DB..."; |
|
2557 | + } |
|
2247 | 2558 | $error = update_db::retrieve_owner($tmp_dir.'owner_hb.csv','HB'); |
2248 | - } else $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2559 | + } else { |
|
2560 | + $error = "File ".$tmp_dir.'owner_hb.csv'." doesn't exist. Download failed."; |
|
2561 | + } |
|
2249 | 2562 | if ($error != '') { |
2250 | 2563 | return $error; |
2251 | - } elseif ($globalDebug) echo "Done\n"; |
|
2252 | - if ($globalDebug) echo "Owner Czech Republic: Download..."; |
|
2564 | + } elseif ($globalDebug) { |
|
2565 | + echo "Done\n"; |
|
2566 | + } |
|
2567 | + if ($globalDebug) { |
|
2568 | + echo "Owner Czech Republic: Download..."; |
|
2569 | + } |
|
2253 | 2570 | update_db::download('http://antonakis.co.uk/registers/CzechRepublic.txt',$tmp_dir.'owner_ok.csv'); |
2254 | 2571 | if (file_exists($tmp_dir.'owner_ok.csv')) { |
2255 | - if ($globalDebug) echo "Add to DB..."; |
|
2572 | + if ($globalDebug) { |
|
2573 | + echo "Add to DB..."; |
|
2574 | + } |
|
2256 | 2575 | $error = update_db::retrieve_owner($tmp_dir.'owner_ok.csv','OK'); |
2257 | - } else $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2576 | + } else { |
|
2577 | + $error = "File ".$tmp_dir.'owner_ok.csv'." doesn't exist. Download failed."; |
|
2578 | + } |
|
2258 | 2579 | if ($error != '') { |
2259 | 2580 | return $error; |
2260 | - } elseif ($globalDebug) echo "Done\n"; |
|
2261 | - if ($globalDebug) echo "Owner Australia: Download..."; |
|
2581 | + } elseif ($globalDebug) { |
|
2582 | + echo "Done\n"; |
|
2583 | + } |
|
2584 | + if ($globalDebug) { |
|
2585 | + echo "Owner Australia: Download..."; |
|
2586 | + } |
|
2262 | 2587 | update_db::download('http://antonakis.co.uk/registers/Australia.txt',$tmp_dir.'owner_vh.csv'); |
2263 | 2588 | if (file_exists($tmp_dir.'owner_vh.csv')) { |
2264 | - if ($globalDebug) echo "Add to DB..."; |
|
2589 | + if ($globalDebug) { |
|
2590 | + echo "Add to DB..."; |
|
2591 | + } |
|
2265 | 2592 | $error = update_db::retrieve_owner($tmp_dir.'owner_vh.csv','VH'); |
2266 | - } else $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2593 | + } else { |
|
2594 | + $error = "File ".$tmp_dir.'owner_vh.csv'." doesn't exist. Download failed."; |
|
2595 | + } |
|
2267 | 2596 | if ($error != '') { |
2268 | 2597 | return $error; |
2269 | - } elseif ($globalDebug) echo "Done\n"; |
|
2270 | - if ($globalDebug) echo "Owner Austria: Download..."; |
|
2598 | + } elseif ($globalDebug) { |
|
2599 | + echo "Done\n"; |
|
2600 | + } |
|
2601 | + if ($globalDebug) { |
|
2602 | + echo "Owner Austria: Download..."; |
|
2603 | + } |
|
2271 | 2604 | update_db::download('http://antonakis.co.uk/registers/Austria.txt',$tmp_dir.'owner_oe.csv'); |
2272 | 2605 | if (file_exists($tmp_dir.'owner_oe.csv')) { |
2273 | - if ($globalDebug) echo "Add to DB..."; |
|
2606 | + if ($globalDebug) { |
|
2607 | + echo "Add to DB..."; |
|
2608 | + } |
|
2274 | 2609 | $error = update_db::retrieve_owner($tmp_dir.'owner_oe.csv','OE'); |
2275 | - } else $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2610 | + } else { |
|
2611 | + $error = "File ".$tmp_dir.'owner_oe.csv'." doesn't exist. Download failed."; |
|
2612 | + } |
|
2276 | 2613 | if ($error != '') { |
2277 | 2614 | return $error; |
2278 | - } elseif ($globalDebug) echo "Done\n"; |
|
2279 | - if ($globalDebug) echo "Owner Chile: Download..."; |
|
2615 | + } elseif ($globalDebug) { |
|
2616 | + echo "Done\n"; |
|
2617 | + } |
|
2618 | + if ($globalDebug) { |
|
2619 | + echo "Owner Chile: Download..."; |
|
2620 | + } |
|
2280 | 2621 | update_db::download('http://antonakis.co.uk/registers/Chile.txt',$tmp_dir.'owner_cc.csv'); |
2281 | 2622 | if (file_exists($tmp_dir.'owner_cc.csv')) { |
2282 | - if ($globalDebug) echo "Add to DB..."; |
|
2623 | + if ($globalDebug) { |
|
2624 | + echo "Add to DB..."; |
|
2625 | + } |
|
2283 | 2626 | $error = update_db::retrieve_owner($tmp_dir.'owner_cc.csv','CC'); |
2284 | - } else $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2627 | + } else { |
|
2628 | + $error = "File ".$tmp_dir.'owner_cc.csv'." doesn't exist. Download failed."; |
|
2629 | + } |
|
2285 | 2630 | if ($error != '') { |
2286 | 2631 | return $error; |
2287 | - } elseif ($globalDebug) echo "Done\n"; |
|
2288 | - if ($globalDebug) echo "Owner Colombia: Download..."; |
|
2632 | + } elseif ($globalDebug) { |
|
2633 | + echo "Done\n"; |
|
2634 | + } |
|
2635 | + if ($globalDebug) { |
|
2636 | + echo "Owner Colombia: Download..."; |
|
2637 | + } |
|
2289 | 2638 | update_db::download('http://antonakis.co.uk/registers/Colombia.txt',$tmp_dir.'owner_hj.csv'); |
2290 | 2639 | if (file_exists($tmp_dir.'owner_hj.csv')) { |
2291 | - if ($globalDebug) echo "Add to DB..."; |
|
2640 | + if ($globalDebug) { |
|
2641 | + echo "Add to DB..."; |
|
2642 | + } |
|
2292 | 2643 | $error = update_db::retrieve_owner($tmp_dir.'owner_hj.csv','HJ'); |
2293 | - } else $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2644 | + } else { |
|
2645 | + $error = "File ".$tmp_dir.'owner_hj.csv'." doesn't exist. Download failed."; |
|
2646 | + } |
|
2294 | 2647 | if ($error != '') { |
2295 | 2648 | return $error; |
2296 | - } elseif ($globalDebug) echo "Done\n"; |
|
2297 | - if ($globalDebug) echo "Owner Bosnia Herzegobina: Download..."; |
|
2649 | + } elseif ($globalDebug) { |
|
2650 | + echo "Done\n"; |
|
2651 | + } |
|
2652 | + if ($globalDebug) { |
|
2653 | + echo "Owner Bosnia Herzegobina: Download..."; |
|
2654 | + } |
|
2298 | 2655 | update_db::download('http://antonakis.co.uk/registers/BosniaHerzegovina.txt',$tmp_dir.'owner_e7.csv'); |
2299 | 2656 | if (file_exists($tmp_dir.'owner_e7.csv')) { |
2300 | - if ($globalDebug) echo "Add to DB..."; |
|
2657 | + if ($globalDebug) { |
|
2658 | + echo "Add to DB..."; |
|
2659 | + } |
|
2301 | 2660 | $error = update_db::retrieve_owner($tmp_dir.'owner_e7.csv','E7'); |
2302 | - } else $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2661 | + } else { |
|
2662 | + $error = "File ".$tmp_dir.'owner_e7.csv'." doesn't exist. Download failed."; |
|
2663 | + } |
|
2303 | 2664 | if ($error != '') { |
2304 | 2665 | return $error; |
2305 | - } elseif ($globalDebug) echo "Done\n"; |
|
2306 | - if ($globalDebug) echo "Owner Brazil: Download..."; |
|
2666 | + } elseif ($globalDebug) { |
|
2667 | + echo "Done\n"; |
|
2668 | + } |
|
2669 | + if ($globalDebug) { |
|
2670 | + echo "Owner Brazil: Download..."; |
|
2671 | + } |
|
2307 | 2672 | update_db::download('http://antonakis.co.uk/registers/Brazil.txt',$tmp_dir.'owner_pp.csv'); |
2308 | 2673 | if (file_exists($tmp_dir.'owner_pp.csv')) { |
2309 | - if ($globalDebug) echo "Add to DB..."; |
|
2674 | + if ($globalDebug) { |
|
2675 | + echo "Add to DB..."; |
|
2676 | + } |
|
2310 | 2677 | $error = update_db::retrieve_owner($tmp_dir.'owner_pp.csv','PP'); |
2311 | - } else $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2678 | + } else { |
|
2679 | + $error = "File ".$tmp_dir.'owner_pp.csv'." doesn't exist. Download failed."; |
|
2680 | + } |
|
2312 | 2681 | if ($error != '') { |
2313 | 2682 | return $error; |
2314 | - } elseif ($globalDebug) echo "Done\n"; |
|
2315 | - if ($globalDebug) echo "Owner Cayman Islands: Download..."; |
|
2683 | + } elseif ($globalDebug) { |
|
2684 | + echo "Done\n"; |
|
2685 | + } |
|
2686 | + if ($globalDebug) { |
|
2687 | + echo "Owner Cayman Islands: Download..."; |
|
2688 | + } |
|
2316 | 2689 | update_db::download('http://antonakis.co.uk/registers/CaymanIslands.txt',$tmp_dir.'owner_vp.csv'); |
2317 | 2690 | if (file_exists($tmp_dir.'owner_vp.csv')) { |
2318 | - if ($globalDebug) echo "Add to DB..."; |
|
2691 | + if ($globalDebug) { |
|
2692 | + echo "Add to DB..."; |
|
2693 | + } |
|
2319 | 2694 | $error = update_db::retrieve_owner($tmp_dir.'owner_vp.csv','VP'); |
2320 | - } else $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2695 | + } else { |
|
2696 | + $error = "File ".$tmp_dir.'owner_vp.csv'." doesn't exist. Download failed."; |
|
2697 | + } |
|
2321 | 2698 | if ($error != '') { |
2322 | 2699 | return $error; |
2323 | - } elseif ($globalDebug) echo "Done\n"; |
|
2324 | - if ($globalDebug) echo "Owner Croatia: Download..."; |
|
2700 | + } elseif ($globalDebug) { |
|
2701 | + echo "Done\n"; |
|
2702 | + } |
|
2703 | + if ($globalDebug) { |
|
2704 | + echo "Owner Croatia: Download..."; |
|
2705 | + } |
|
2325 | 2706 | update_db::download('http://antonakis.co.uk/registers/Croatia.txt',$tmp_dir.'owner_9a.csv'); |
2326 | 2707 | if (file_exists($tmp_dir.'owner_9a.csv')) { |
2327 | - if ($globalDebug) echo "Add to DB..."; |
|
2708 | + if ($globalDebug) { |
|
2709 | + echo "Add to DB..."; |
|
2710 | + } |
|
2328 | 2711 | $error = update_db::retrieve_owner($tmp_dir.'owner_9a.csv','9A'); |
2329 | - } else $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2712 | + } else { |
|
2713 | + $error = "File ".$tmp_dir.'owner_9a.csv'." doesn't exist. Download failed."; |
|
2714 | + } |
|
2330 | 2715 | if ($error != '') { |
2331 | 2716 | return $error; |
2332 | - } elseif ($globalDebug) echo "Done\n"; |
|
2333 | - if ($globalDebug) echo "Owner Luxembourg: Download..."; |
|
2717 | + } elseif ($globalDebug) { |
|
2718 | + echo "Done\n"; |
|
2719 | + } |
|
2720 | + if ($globalDebug) { |
|
2721 | + echo "Owner Luxembourg: Download..."; |
|
2722 | + } |
|
2334 | 2723 | update_db::download('http://antonakis.co.uk/registers/Luxembourg.txt',$tmp_dir.'owner_lx.csv'); |
2335 | 2724 | if (file_exists($tmp_dir.'owner_lx.csv')) { |
2336 | - if ($globalDebug) echo "Add to DB..."; |
|
2725 | + if ($globalDebug) { |
|
2726 | + echo "Add to DB..."; |
|
2727 | + } |
|
2337 | 2728 | $error = update_db::retrieve_owner($tmp_dir.'owner_lx.csv','LX'); |
2338 | - } else $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2729 | + } else { |
|
2730 | + $error = "File ".$tmp_dir.'owner_lx.csv'." doesn't exist. Download failed."; |
|
2731 | + } |
|
2339 | 2732 | if ($error != '') { |
2340 | 2733 | return $error; |
2341 | - } elseif ($globalDebug) echo "Done\n"; |
|
2342 | - if ($globalDebug) echo "Owner Maldives: Download..."; |
|
2734 | + } elseif ($globalDebug) { |
|
2735 | + echo "Done\n"; |
|
2736 | + } |
|
2737 | + if ($globalDebug) { |
|
2738 | + echo "Owner Maldives: Download..."; |
|
2739 | + } |
|
2343 | 2740 | update_db::download('http://antonakis.co.uk/registers/Maldives.txt',$tmp_dir.'owner_8q.csv'); |
2344 | 2741 | if (file_exists($tmp_dir.'owner_8q.csv')) { |
2345 | - if ($globalDebug) echo "Add to DB..."; |
|
2742 | + if ($globalDebug) { |
|
2743 | + echo "Add to DB..."; |
|
2744 | + } |
|
2346 | 2745 | $error = update_db::retrieve_owner($tmp_dir.'owner_8q.csv','8Q'); |
2347 | - } else $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2746 | + } else { |
|
2747 | + $error = "File ".$tmp_dir.'owner_8q.csv'." doesn't exist. Download failed."; |
|
2748 | + } |
|
2348 | 2749 | if ($error != '') { |
2349 | 2750 | return $error; |
2350 | - } elseif ($globalDebug) echo "Done\n"; |
|
2351 | - if ($globalDebug) echo "Owner New Zealand: Download..."; |
|
2751 | + } elseif ($globalDebug) { |
|
2752 | + echo "Done\n"; |
|
2753 | + } |
|
2754 | + if ($globalDebug) { |
|
2755 | + echo "Owner New Zealand: Download..."; |
|
2756 | + } |
|
2352 | 2757 | update_db::download('http://antonakis.co.uk/registers/NewZealand.txt',$tmp_dir.'owner_zk.csv'); |
2353 | 2758 | if (file_exists($tmp_dir.'owner_zk.csv')) { |
2354 | - if ($globalDebug) echo "Add to DB..."; |
|
2759 | + if ($globalDebug) { |
|
2760 | + echo "Add to DB..."; |
|
2761 | + } |
|
2355 | 2762 | $error = update_db::retrieve_owner($tmp_dir.'owner_zk.csv','ZK'); |
2356 | - } else $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2763 | + } else { |
|
2764 | + $error = "File ".$tmp_dir.'owner_zk.csv'." doesn't exist. Download failed."; |
|
2765 | + } |
|
2357 | 2766 | if ($error != '') { |
2358 | 2767 | return $error; |
2359 | - } elseif ($globalDebug) echo "Done\n"; |
|
2360 | - if ($globalDebug) echo "Owner Papua New Guinea: Download..."; |
|
2768 | + } elseif ($globalDebug) { |
|
2769 | + echo "Done\n"; |
|
2770 | + } |
|
2771 | + if ($globalDebug) { |
|
2772 | + echo "Owner Papua New Guinea: Download..."; |
|
2773 | + } |
|
2361 | 2774 | update_db::download('http://antonakis.co.uk/registers/PapuaNewGuinea.txt',$tmp_dir.'owner_p2.csv'); |
2362 | 2775 | if (file_exists($tmp_dir.'owner_p2.csv')) { |
2363 | - if ($globalDebug) echo "Add to DB..."; |
|
2776 | + if ($globalDebug) { |
|
2777 | + echo "Add to DB..."; |
|
2778 | + } |
|
2364 | 2779 | $error = update_db::retrieve_owner($tmp_dir.'owner_p2.csv','P2'); |
2365 | - } else $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2780 | + } else { |
|
2781 | + $error = "File ".$tmp_dir.'owner_p2.csv'." doesn't exist. Download failed."; |
|
2782 | + } |
|
2366 | 2783 | if ($error != '') { |
2367 | 2784 | return $error; |
2368 | - } elseif ($globalDebug) echo "Done\n"; |
|
2369 | - if ($globalDebug) echo "Owner Slovakia: Download..."; |
|
2785 | + } elseif ($globalDebug) { |
|
2786 | + echo "Done\n"; |
|
2787 | + } |
|
2788 | + if ($globalDebug) { |
|
2789 | + echo "Owner Slovakia: Download..."; |
|
2790 | + } |
|
2370 | 2791 | update_db::download('http://antonakis.co.uk/registers/Slovakia.txt',$tmp_dir.'owner_om.csv'); |
2371 | 2792 | if (file_exists($tmp_dir.'owner_om.csv')) { |
2372 | - if ($globalDebug) echo "Add to DB..."; |
|
2793 | + if ($globalDebug) { |
|
2794 | + echo "Add to DB..."; |
|
2795 | + } |
|
2373 | 2796 | $error = update_db::retrieve_owner($tmp_dir.'owner_om.csv','OM'); |
2374 | - } else $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2797 | + } else { |
|
2798 | + $error = "File ".$tmp_dir.'owner_om.csv'." doesn't exist. Download failed."; |
|
2799 | + } |
|
2375 | 2800 | if ($error != '') { |
2376 | 2801 | return $error; |
2377 | - } elseif ($globalDebug) echo "Done\n"; |
|
2378 | - if ($globalDebug) echo "Owner Ecuador: Download..."; |
|
2802 | + } elseif ($globalDebug) { |
|
2803 | + echo "Done\n"; |
|
2804 | + } |
|
2805 | + if ($globalDebug) { |
|
2806 | + echo "Owner Ecuador: Download..."; |
|
2807 | + } |
|
2379 | 2808 | update_db::download('http://antonakis.co.uk/registers/Ecuador.txt',$tmp_dir.'owner_hc.csv'); |
2380 | 2809 | if (file_exists($tmp_dir.'owner_hc.csv')) { |
2381 | - if ($globalDebug) echo "Add to DB..."; |
|
2810 | + if ($globalDebug) { |
|
2811 | + echo "Add to DB..."; |
|
2812 | + } |
|
2382 | 2813 | $error = update_db::retrieve_owner($tmp_dir.'owner_hc.csv','HC'); |
2383 | - } else $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2814 | + } else { |
|
2815 | + $error = "File ".$tmp_dir.'owner_hc.csv'." doesn't exist. Download failed."; |
|
2816 | + } |
|
2384 | 2817 | if ($error != '') { |
2385 | 2818 | return $error; |
2386 | - } elseif ($globalDebug) echo "Done\n"; |
|
2387 | - if ($globalDebug) echo "Owner Iceland: Download..."; |
|
2819 | + } elseif ($globalDebug) { |
|
2820 | + echo "Done\n"; |
|
2821 | + } |
|
2822 | + if ($globalDebug) { |
|
2823 | + echo "Owner Iceland: Download..."; |
|
2824 | + } |
|
2388 | 2825 | update_db::download('http://antonakis.co.uk/registers/Iceland.txt',$tmp_dir.'owner_tf.csv'); |
2389 | 2826 | if (file_exists($tmp_dir.'owner_tf.csv')) { |
2390 | - if ($globalDebug) echo "Add to DB..."; |
|
2827 | + if ($globalDebug) { |
|
2828 | + echo "Add to DB..."; |
|
2829 | + } |
|
2391 | 2830 | $error = update_db::retrieve_owner($tmp_dir.'owner_tf.csv','TF'); |
2392 | - } else $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2831 | + } else { |
|
2832 | + $error = "File ".$tmp_dir.'owner_tf.csv'." doesn't exist. Download failed."; |
|
2833 | + } |
|
2393 | 2834 | if ($error != '') { |
2394 | 2835 | return $error; |
2395 | - } elseif ($globalDebug) echo "Done\n"; |
|
2396 | - if ($globalDebug) echo "Owner Isle of Man: Download..."; |
|
2836 | + } elseif ($globalDebug) { |
|
2837 | + echo "Done\n"; |
|
2838 | + } |
|
2839 | + if ($globalDebug) { |
|
2840 | + echo "Owner Isle of Man: Download..."; |
|
2841 | + } |
|
2397 | 2842 | update_db::download('http://antonakis.co.uk/registers/IsleOfMan.txt',$tmp_dir.'owner_m.csv'); |
2398 | 2843 | if (file_exists($tmp_dir.'owner_m.csv')) { |
2399 | - if ($globalDebug) echo "Add to DB..."; |
|
2844 | + if ($globalDebug) { |
|
2845 | + echo "Add to DB..."; |
|
2846 | + } |
|
2400 | 2847 | $error = update_db::retrieve_owner($tmp_dir.'owner_m.csv','M'); |
2401 | - } else $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2848 | + } else { |
|
2849 | + $error = "File ".$tmp_dir.'owner_m.csv'." doesn't exist. Download failed."; |
|
2850 | + } |
|
2402 | 2851 | if ($error != '') { |
2403 | 2852 | return $error; |
2404 | - } elseif ($globalDebug) echo "Done\n"; |
|
2853 | + } elseif ($globalDebug) { |
|
2854 | + echo "Done\n"; |
|
2855 | + } |
|
2405 | 2856 | if ($globalMasterSource) { |
2406 | - if ($globalDebug) echo "ModeS Netherlands: Download..."; |
|
2857 | + if ($globalDebug) { |
|
2858 | + echo "ModeS Netherlands: Download..."; |
|
2859 | + } |
|
2407 | 2860 | update_db::download('http://antonakis.co.uk/registers/Netherlands.txt',$tmp_dir.'owner_ph.csv'); |
2408 | 2861 | if (file_exists($tmp_dir.'owner_ph.csv')) { |
2409 | - if ($globalDebug) echo "Add to DB..."; |
|
2862 | + if ($globalDebug) { |
|
2863 | + echo "Add to DB..."; |
|
2864 | + } |
|
2410 | 2865 | $error = update_db::retrieve_owner($tmp_dir.'owner_ph.csv','PH'); |
2411 | - } else $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2866 | + } else { |
|
2867 | + $error = "File ".$tmp_dir.'owner_ph.csv'." doesn't exist. Download failed."; |
|
2868 | + } |
|
2412 | 2869 | if ($error != '') { |
2413 | 2870 | return $error; |
2414 | - } elseif ($globalDebug) echo "Done\n"; |
|
2415 | - if ($globalDebug) echo "ModeS Denmark: Download..."; |
|
2871 | + } elseif ($globalDebug) { |
|
2872 | + echo "Done\n"; |
|
2873 | + } |
|
2874 | + if ($globalDebug) { |
|
2875 | + echo "ModeS Denmark: Download..."; |
|
2876 | + } |
|
2416 | 2877 | update_db::download('http://antonakis.co.uk/registers/Denmark.txt',$tmp_dir.'owner_oy.csv'); |
2417 | 2878 | if (file_exists($tmp_dir.'owner_oy.csv')) { |
2418 | - if ($globalDebug) echo "Add to DB..."; |
|
2879 | + if ($globalDebug) { |
|
2880 | + echo "Add to DB..."; |
|
2881 | + } |
|
2419 | 2882 | $error = update_db::retrieve_owner($tmp_dir.'owner_oy.csv','OY'); |
2420 | - } else $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2883 | + } else { |
|
2884 | + $error = "File ".$tmp_dir.'owner_oy.csv'." doesn't exist. Download failed."; |
|
2885 | + } |
|
2421 | 2886 | if ($error != '') { |
2422 | 2887 | return $error; |
2423 | - } elseif ($globalDebug) echo "Done\n"; |
|
2424 | - } elseif ($globalDebug) echo "Done\n"; |
|
2888 | + } elseif ($globalDebug) { |
|
2889 | + echo "Done\n"; |
|
2890 | + } |
|
2891 | + } elseif ($globalDebug) { |
|
2892 | + echo "Done\n"; |
|
2893 | + } |
|
2425 | 2894 | return ''; |
2426 | 2895 | } |
2427 | 2896 | |
2428 | 2897 | public static function update_translation() { |
2429 | 2898 | global $tmp_dir, $globalDebug; |
2430 | 2899 | $error = ''; |
2431 | - if ($globalDebug) echo "Translation : Download..."; |
|
2900 | + if ($globalDebug) { |
|
2901 | + echo "Translation : Download..."; |
|
2902 | + } |
|
2432 | 2903 | update_db::download('http://www.acarsd.org/download/translation.php',$tmp_dir.'translation.zip'); |
2433 | 2904 | if (file_exists($tmp_dir.'translation.zip')) { |
2434 | - if ($globalDebug) echo "Unzip..."; |
|
2905 | + if ($globalDebug) { |
|
2906 | + echo "Unzip..."; |
|
2907 | + } |
|
2435 | 2908 | update_db::unzip($tmp_dir.'translation.zip'); |
2436 | - if ($globalDebug) echo "Add to DB..."; |
|
2909 | + if ($globalDebug) { |
|
2910 | + echo "Add to DB..."; |
|
2911 | + } |
|
2437 | 2912 | $error = update_db::translation(); |
2438 | - } else $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2913 | + } else { |
|
2914 | + $error = "File ".$tmp_dir.'translation.zip'." doesn't exist. Download failed."; |
|
2915 | + } |
|
2439 | 2916 | if ($error != '') { |
2440 | 2917 | return $error; |
2441 | - } elseif ($globalDebug) echo "Done\n"; |
|
2918 | + } elseif ($globalDebug) { |
|
2919 | + echo "Done\n"; |
|
2920 | + } |
|
2442 | 2921 | return ''; |
2443 | 2922 | } |
2444 | 2923 | |
2445 | 2924 | public static function update_translation_fam() { |
2446 | 2925 | global $tmp_dir, $globalDebug; |
2447 | 2926 | $error = ''; |
2448 | - if ($globalDebug) echo "Translation from FlightAirMap website : Download..."; |
|
2927 | + if ($globalDebug) { |
|
2928 | + echo "Translation from FlightAirMap website : Download..."; |
|
2929 | + } |
|
2449 | 2930 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz',$tmp_dir.'translation.tsv.gz'); |
2450 | 2931 | update_db::download('http://data.flightairmap.com/data/translation.tsv.gz.md5',$tmp_dir.'translation.tsv.gz.md5'); |
2451 | 2932 | if (file_exists($tmp_dir.'translation.tsv.gz') && file_exists($tmp_dir.'translation.tsv.gz')) { |
2452 | 2933 | $translation_md5_file = explode(' ',file_get_contents($tmp_dir.'translation.tsv.gz.md5')); |
2453 | 2934 | $translation_md5 = $translation_md5_file[0]; |
2454 | 2935 | if (md5_file($tmp_dir.'translation.tsv.gz') == $translation_md5) { |
2455 | - if ($globalDebug) echo "Gunzip..."; |
|
2936 | + if ($globalDebug) { |
|
2937 | + echo "Gunzip..."; |
|
2938 | + } |
|
2456 | 2939 | update_db::gunzip($tmp_dir.'translation.tsv.gz'); |
2457 | - if ($globalDebug) echo "Add to DB..."; |
|
2940 | + if ($globalDebug) { |
|
2941 | + echo "Add to DB..."; |
|
2942 | + } |
|
2458 | 2943 | $error = update_db::translation_fam(); |
2459 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2460 | - } else $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2944 | + } else { |
|
2945 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." md5 failed. Download failed."; |
|
2946 | + } |
|
2947 | + } else { |
|
2948 | + $error = "File ".$tmp_dir.'translation.tsv.gz'." doesn't exist. Download failed."; |
|
2949 | + } |
|
2461 | 2950 | if ($error != '') { |
2462 | 2951 | return $error; |
2463 | - } elseif ($globalDebug) echo "Done\n"; |
|
2952 | + } elseif ($globalDebug) { |
|
2953 | + echo "Done\n"; |
|
2954 | + } |
|
2464 | 2955 | return ''; |
2465 | 2956 | } |
2466 | 2957 | public static function update_ModeS_fam() { |
2467 | 2958 | global $tmp_dir, $globalDebug; |
2468 | 2959 | $error = ''; |
2469 | - if ($globalDebug) echo "ModeS from FlightAirMap website : Download..."; |
|
2960 | + if ($globalDebug) { |
|
2961 | + echo "ModeS from FlightAirMap website : Download..."; |
|
2962 | + } |
|
2470 | 2963 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz',$tmp_dir.'modes.tsv.gz'); |
2471 | 2964 | update_db::download('http://data.flightairmap.com/data/modes.tsv.gz.md5',$tmp_dir.'modes.tsv.gz.md5'); |
2472 | 2965 | if (file_exists($tmp_dir.'modes.tsv.gz') && file_exists($tmp_dir.'modes.tsv.gz.md5')) { |
2473 | 2966 | $modes_md5_file = explode(' ',file_get_contents($tmp_dir.'modes.tsv.gz.md5')); |
2474 | 2967 | $modes_md5 = $modes_md5_file[0]; |
2475 | 2968 | if (md5_file($tmp_dir.'modes.tsv.gz') == $modes_md5) { |
2476 | - if ($globalDebug) echo "Gunzip..."; |
|
2969 | + if ($globalDebug) { |
|
2970 | + echo "Gunzip..."; |
|
2971 | + } |
|
2477 | 2972 | update_db::gunzip($tmp_dir.'modes.tsv.gz'); |
2478 | - if ($globalDebug) echo "Add to DB..."; |
|
2973 | + if ($globalDebug) { |
|
2974 | + echo "Add to DB..."; |
|
2975 | + } |
|
2479 | 2976 | $error = update_db::modes_fam(); |
2480 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2481 | - } else $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2977 | + } else { |
|
2978 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." md5 failed. Download failed."; |
|
2979 | + } |
|
2980 | + } else { |
|
2981 | + $error = "File ".$tmp_dir.'modes.tsv.gz'." doesn't exist. Download failed."; |
|
2982 | + } |
|
2482 | 2983 | if ($error != '') { |
2483 | 2984 | return $error; |
2484 | - } elseif ($globalDebug) echo "Done\n"; |
|
2985 | + } elseif ($globalDebug) { |
|
2986 | + echo "Done\n"; |
|
2987 | + } |
|
2485 | 2988 | return ''; |
2486 | 2989 | } |
2487 | 2990 | |
2488 | 2991 | public static function update_airlines_fam() { |
2489 | 2992 | global $tmp_dir, $globalDebug; |
2490 | 2993 | $error = ''; |
2491 | - if ($globalDebug) echo "Airlines from FlightAirMap website : Download..."; |
|
2994 | + if ($globalDebug) { |
|
2995 | + echo "Airlines from FlightAirMap website : Download..."; |
|
2996 | + } |
|
2492 | 2997 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz.md5',$tmp_dir.'airlines.tsv.gz.md5'); |
2493 | 2998 | if (file_exists($tmp_dir.'airlines.tsv.gz.md5')) { |
2494 | 2999 | $airlines_md5_file = explode(' ',file_get_contents($tmp_dir.'airlines.tsv.gz.md5')); |
@@ -2497,26 +3002,42 @@ discard block |
||
2497 | 3002 | update_db::download('http://data.flightairmap.com/data/airlines.tsv.gz',$tmp_dir.'airlines.tsv.gz'); |
2498 | 3003 | if (file_exists($tmp_dir.'airlines.tsv.gz')) { |
2499 | 3004 | if (md5_file($tmp_dir.'airlines.tsv.gz') == $airlines_md5) { |
2500 | - if ($globalDebug) echo "Gunzip..."; |
|
3005 | + if ($globalDebug) { |
|
3006 | + echo "Gunzip..."; |
|
3007 | + } |
|
2501 | 3008 | update_db::gunzip($tmp_dir.'airlines.tsv.gz'); |
2502 | - if ($globalDebug) echo "Add to DB..."; |
|
3009 | + if ($globalDebug) { |
|
3010 | + echo "Add to DB..."; |
|
3011 | + } |
|
2503 | 3012 | $error = update_db::airlines_fam(); |
2504 | 3013 | update_db::insert_airlines_version($airlines_md5); |
2505 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
2506 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
2507 | - } elseif ($globalDebug) echo "No update."; |
|
2508 | - } else $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
3014 | + } else { |
|
3015 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." md5 failed. Download failed."; |
|
3016 | + } |
|
3017 | + } else { |
|
3018 | + $error = "File ".$tmp_dir.'airlines.tsv.gz'." doesn't exist. Download failed."; |
|
3019 | + } |
|
3020 | + } elseif ($globalDebug) { |
|
3021 | + echo "No update."; |
|
3022 | + } |
|
3023 | + } else { |
|
3024 | + $error = "File ".$tmp_dir.'airlines.tsv.gz.md5'." doesn't exist. Download failed."; |
|
3025 | + } |
|
2509 | 3026 | if ($error != '') { |
2510 | 3027 | return $error; |
2511 | 3028 | } else { |
2512 | - if ($globalDebug) echo "Done\n"; |
|
3029 | + if ($globalDebug) { |
|
3030 | + echo "Done\n"; |
|
3031 | + } |
|
2513 | 3032 | } |
2514 | 3033 | return ''; |
2515 | 3034 | } |
2516 | 3035 | |
2517 | 3036 | public static function update_owner_fam() { |
2518 | 3037 | global $tmp_dir, $globalDebug, $globalOwner; |
2519 | - if ($globalDebug) echo "owner from FlightAirMap website : Download..."; |
|
3038 | + if ($globalDebug) { |
|
3039 | + echo "owner from FlightAirMap website : Download..."; |
|
3040 | + } |
|
2520 | 3041 | $error = ''; |
2521 | 3042 | if ($globalOwner === TRUE) { |
2522 | 3043 | update_db::download('http://data.flightairmap.com/data/owners_all.tsv.gz',$tmp_dir.'owners.tsv.gz'); |
@@ -2529,55 +3050,89 @@ discard block |
||
2529 | 3050 | $owners_md5_file = explode(' ',file_get_contents($tmp_dir.'owners.tsv.gz.md5')); |
2530 | 3051 | $owners_md5 = $owners_md5_file[0]; |
2531 | 3052 | if (md5_file($tmp_dir.'owners.tsv.gz') == $owners_md5) { |
2532 | - if ($globalDebug) echo "Gunzip..."; |
|
3053 | + if ($globalDebug) { |
|
3054 | + echo "Gunzip..."; |
|
3055 | + } |
|
2533 | 3056 | update_db::gunzip($tmp_dir.'owners.tsv.gz'); |
2534 | - if ($globalDebug) echo "Add to DB..."; |
|
3057 | + if ($globalDebug) { |
|
3058 | + echo "Add to DB..."; |
|
3059 | + } |
|
2535 | 3060 | $error = update_db::owner_fam(); |
2536 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
2537 | - } else $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3061 | + } else { |
|
3062 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." md5 failed. Download failed."; |
|
3063 | + } |
|
3064 | + } else { |
|
3065 | + $error = "File ".$tmp_dir.'owners.tsv.gz'." doesn't exist. Download failed."; |
|
3066 | + } |
|
2538 | 3067 | if ($error != '') { |
2539 | 3068 | return $error; |
2540 | - } elseif ($globalDebug) echo "Done\n"; |
|
3069 | + } elseif ($globalDebug) { |
|
3070 | + echo "Done\n"; |
|
3071 | + } |
|
2541 | 3072 | return ''; |
2542 | 3073 | } |
2543 | 3074 | public static function update_routes_fam() { |
2544 | 3075 | global $tmp_dir, $globalDebug; |
2545 | - if ($globalDebug) echo "Routes from FlightAirMap website : Download..."; |
|
3076 | + if ($globalDebug) { |
|
3077 | + echo "Routes from FlightAirMap website : Download..."; |
|
3078 | + } |
|
2546 | 3079 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz',$tmp_dir.'routes.tsv.gz'); |
2547 | 3080 | update_db::download('http://data.flightairmap.com/data/routes.tsv.gz.md5',$tmp_dir.'routes.tsv.gz.md5'); |
2548 | 3081 | if (file_exists($tmp_dir.'routes.tsv.gz') && file_exists($tmp_dir.'routes.tsv.gz.md5')) { |
2549 | 3082 | $routes_md5_file = explode(' ',file_get_contents($tmp_dir.'routes.tsv.gz.md5')); |
2550 | 3083 | $routes_md5 = $routes_md5_file[0]; |
2551 | 3084 | if (md5_file($tmp_dir.'routes.tsv.gz') == $routes_md5) { |
2552 | - if ($globalDebug) echo "Gunzip..."; |
|
3085 | + if ($globalDebug) { |
|
3086 | + echo "Gunzip..."; |
|
3087 | + } |
|
2553 | 3088 | update_db::gunzip($tmp_dir.'routes.tsv.gz'); |
2554 | - if ($globalDebug) echo "Add to DB..."; |
|
3089 | + if ($globalDebug) { |
|
3090 | + echo "Add to DB..."; |
|
3091 | + } |
|
2555 | 3092 | $error = update_db::routes_fam(); |
2556 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
2557 | - } else $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3093 | + } else { |
|
3094 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." md5 failed. Download failed."; |
|
3095 | + } |
|
3096 | + } else { |
|
3097 | + $error = "File ".$tmp_dir.'routes.tsv.gz'." doesn't exist. Download failed."; |
|
3098 | + } |
|
2558 | 3099 | if ($error != '') { |
2559 | 3100 | return $error; |
2560 | - } elseif ($globalDebug) echo "Done\n"; |
|
3101 | + } elseif ($globalDebug) { |
|
3102 | + echo "Done\n"; |
|
3103 | + } |
|
2561 | 3104 | return ''; |
2562 | 3105 | } |
2563 | 3106 | public static function update_block_fam() { |
2564 | 3107 | global $tmp_dir, $globalDebug; |
2565 | - if ($globalDebug) echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
3108 | + if ($globalDebug) { |
|
3109 | + echo "Blocked aircraft from FlightAirMap website : Download..."; |
|
3110 | + } |
|
2566 | 3111 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz',$tmp_dir.'block.tsv.gz'); |
2567 | 3112 | update_db::download('http://data.flightairmap.com/data/block.tsv.gz.md5',$tmp_dir.'block.tsv.gz.md5'); |
2568 | 3113 | if (file_exists($tmp_dir.'block.tsv.gz') && file_exists($tmp_dir.'block.tsv.gz.md5')) { |
2569 | 3114 | $block_md5_file = explode(' ',file_get_contents($tmp_dir.'block.tsv.gz.md5')); |
2570 | 3115 | $block_md5 = $block_md5_file[0]; |
2571 | 3116 | if (md5_file($tmp_dir.'block.tsv.gz') == $block_md5) { |
2572 | - if ($globalDebug) echo "Gunzip..."; |
|
3117 | + if ($globalDebug) { |
|
3118 | + echo "Gunzip..."; |
|
3119 | + } |
|
2573 | 3120 | update_db::gunzip($tmp_dir.'block.tsv.gz'); |
2574 | - if ($globalDebug) echo "Add to DB..."; |
|
3121 | + if ($globalDebug) { |
|
3122 | + echo "Add to DB..."; |
|
3123 | + } |
|
2575 | 3124 | $error = update_db::block_fam(); |
2576 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
2577 | - } else $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
3125 | + } else { |
|
3126 | + $error = "File ".$tmp_dir.'block.tsv.gz'." md5 failed. Download failed."; |
|
3127 | + } |
|
3128 | + } else { |
|
3129 | + $error = "File ".$tmp_dir.'block.tsv.gz'." doesn't exist. Download failed."; |
|
3130 | + } |
|
2578 | 3131 | if ($error != '') { |
2579 | 3132 | return $error; |
2580 | - } elseif ($globalDebug) echo "Done\n"; |
|
3133 | + } elseif ($globalDebug) { |
|
3134 | + echo "Done\n"; |
|
3135 | + } |
|
2581 | 3136 | return ''; |
2582 | 3137 | } |
2583 | 3138 | public static function update_marine_identity_fam() { |
@@ -2587,21 +3142,33 @@ discard block |
||
2587 | 3142 | $marine_identity_md5_file = explode(' ',file_get_contents($tmp_dir.'marine_identity.tsv.gz.md5')); |
2588 | 3143 | $marine_identity_md5 = $marine_identity_md5_file[0]; |
2589 | 3144 | if (!update_db::check_marine_identity_version($marine_identity_md5)) { |
2590 | - if ($globalDebug) echo "Marine identity from FlightAirMap website : Download..."; |
|
3145 | + if ($globalDebug) { |
|
3146 | + echo "Marine identity from FlightAirMap website : Download..."; |
|
3147 | + } |
|
2591 | 3148 | update_db::download('http://data.flightairmap.com/data/marine_identity.tsv.gz',$tmp_dir.'marine_identity.tsv.gz'); |
2592 | 3149 | if (file_exists($tmp_dir.'marine_identity.tsv.gz')) { |
2593 | 3150 | if (md5_file($tmp_dir.'marine_identity.tsv.gz') == $marine_identity_md5) { |
2594 | - if ($globalDebug) echo "Gunzip..."; |
|
3151 | + if ($globalDebug) { |
|
3152 | + echo "Gunzip..."; |
|
3153 | + } |
|
2595 | 3154 | update_db::gunzip($tmp_dir.'marine_identity.tsv.gz'); |
2596 | - if ($globalDebug) echo "Add to DB..."; |
|
3155 | + if ($globalDebug) { |
|
3156 | + echo "Add to DB..."; |
|
3157 | + } |
|
2597 | 3158 | $error = update_db::marine_identity_fam(); |
2598 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
2599 | - } else $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3159 | + } else { |
|
3160 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." md5 failed. Download failed."; |
|
3161 | + } |
|
3162 | + } else { |
|
3163 | + $error = "File ".$tmp_dir.'marine_identity.tsv.gz'." doesn't exist. Download failed."; |
|
3164 | + } |
|
2600 | 3165 | if ($error != '') { |
2601 | 3166 | return $error; |
2602 | 3167 | } else { |
2603 | 3168 | update_db::insert_marine_identity_version($marine_identity_md5); |
2604 | - if ($globalDebug) echo "Done\n"; |
|
3169 | + if ($globalDebug) { |
|
3170 | + echo "Done\n"; |
|
3171 | + } |
|
2605 | 3172 | } |
2606 | 3173 | } |
2607 | 3174 | } |
@@ -2615,21 +3182,33 @@ discard block |
||
2615 | 3182 | $satellite_md5_file = explode(' ',file_get_contents($tmp_dir.'satellite.tsv.gz.md5')); |
2616 | 3183 | $satellite_md5 = $satellite_md5_file[0]; |
2617 | 3184 | if (!update_db::check_satellite_version($satellite_md5)) { |
2618 | - if ($globalDebug) echo "Satellite from FlightAirMap website : Download..."; |
|
3185 | + if ($globalDebug) { |
|
3186 | + echo "Satellite from FlightAirMap website : Download..."; |
|
3187 | + } |
|
2619 | 3188 | update_db::download('http://data.flightairmap.com/data/satellite.tsv.gz',$tmp_dir.'satellite.tsv.gz'); |
2620 | 3189 | if (file_exists($tmp_dir.'satellite.tsv.gz')) { |
2621 | 3190 | if (md5_file($tmp_dir.'satellite.tsv.gz') == $satellite_md5) { |
2622 | - if ($globalDebug) echo "Gunzip..."; |
|
3191 | + if ($globalDebug) { |
|
3192 | + echo "Gunzip..."; |
|
3193 | + } |
|
2623 | 3194 | update_db::gunzip($tmp_dir.'satellite.tsv.gz'); |
2624 | - if ($globalDebug) echo "Add to DB..."; |
|
3195 | + if ($globalDebug) { |
|
3196 | + echo "Add to DB..."; |
|
3197 | + } |
|
2625 | 3198 | $error = update_db::satellite_fam(); |
2626 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
2627 | - } else $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3199 | + } else { |
|
3200 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." md5 failed. Download failed."; |
|
3201 | + } |
|
3202 | + } else { |
|
3203 | + $error = "File ".$tmp_dir.'satellite.tsv.gz'." doesn't exist. Download failed."; |
|
3204 | + } |
|
2628 | 3205 | if ($error != '') { |
2629 | 3206 | return $error; |
2630 | 3207 | } else { |
2631 | 3208 | update_db::insert_satellite_version($satellite_md5); |
2632 | - if ($globalDebug) echo "Done\n"; |
|
3209 | + if ($globalDebug) { |
|
3210 | + echo "Done\n"; |
|
3211 | + } |
|
2633 | 3212 | } |
2634 | 3213 | } |
2635 | 3214 | } |
@@ -2637,17 +3216,25 @@ discard block |
||
2637 | 3216 | } |
2638 | 3217 | public static function update_banned_fam() { |
2639 | 3218 | global $tmp_dir, $globalDebug; |
2640 | - if ($globalDebug) echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3219 | + if ($globalDebug) { |
|
3220 | + echo "Banned airlines in Europe from FlightAirMap website : Download..."; |
|
3221 | + } |
|
2641 | 3222 | update_db::download('http://data.flightairmap.com/data/ban-eu.csv',$tmp_dir.'ban_eu.csv'); |
2642 | 3223 | if (file_exists($tmp_dir.'ban_eu.csv')) { |
2643 | 3224 | //if ($globalDebug) echo "Gunzip..."; |
2644 | 3225 | //update_db::gunzip($tmp_dir.'ban_ue.csv'); |
2645 | - if ($globalDebug) echo "Add to DB..."; |
|
3226 | + if ($globalDebug) { |
|
3227 | + echo "Add to DB..."; |
|
3228 | + } |
|
2646 | 3229 | $error = update_db::banned_fam(); |
2647 | - } else $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3230 | + } else { |
|
3231 | + $error = "File ".$tmp_dir.'ban_eu.csv'." doesn't exist. Download failed."; |
|
3232 | + } |
|
2648 | 3233 | if ($error != '') { |
2649 | 3234 | return $error; |
2650 | - } elseif ($globalDebug) echo "Done\n"; |
|
3235 | + } elseif ($globalDebug) { |
|
3236 | + echo "Done\n"; |
|
3237 | + } |
|
2651 | 3238 | return ''; |
2652 | 3239 | } |
2653 | 3240 | |
@@ -2655,7 +3242,9 @@ discard block |
||
2655 | 3242 | global $tmp_dir, $globalDebug, $globalDBdriver; |
2656 | 3243 | include_once('class.create_db.php'); |
2657 | 3244 | $error = ''; |
2658 | - if ($globalDebug) echo "Airspace from FlightAirMap website : Download..."; |
|
3245 | + if ($globalDebug) { |
|
3246 | + echo "Airspace from FlightAirMap website : Download..."; |
|
3247 | + } |
|
2659 | 3248 | if ($globalDBdriver == 'mysql') { |
2660 | 3249 | update_db::download('http://data.flightairmap.com/data/airspace_mysql.sql.gz.md5',$tmp_dir.'airspace.sql.gz.md5'); |
2661 | 3250 | } else { |
@@ -2672,9 +3261,13 @@ discard block |
||
2672 | 3261 | } |
2673 | 3262 | if (file_exists($tmp_dir.'airspace.sql.gz')) { |
2674 | 3263 | if (md5_file($tmp_dir.'airspace.sql.gz') == $airspace_md5) { |
2675 | - if ($globalDebug) echo "Gunzip..."; |
|
3264 | + if ($globalDebug) { |
|
3265 | + echo "Gunzip..."; |
|
3266 | + } |
|
2676 | 3267 | update_db::gunzip($tmp_dir.'airspace.sql.gz'); |
2677 | - if ($globalDebug) echo "Add to DB..."; |
|
3268 | + if ($globalDebug) { |
|
3269 | + echo "Add to DB..."; |
|
3270 | + } |
|
2678 | 3271 | $Connection = new Connection(); |
2679 | 3272 | if ($Connection->tableExists('airspace')) { |
2680 | 3273 | $query = 'DROP TABLE airspace'; |
@@ -2687,20 +3280,30 @@ discard block |
||
2687 | 3280 | } |
2688 | 3281 | $error = create_db::import_file($tmp_dir.'airspace.sql'); |
2689 | 3282 | update_db::insert_airspace_version($airspace_md5); |
2690 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
2691 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3283 | + } else { |
|
3284 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." md5 failed. Download failed."; |
|
3285 | + } |
|
3286 | + } else { |
|
3287 | + $error = "File ".$tmp_dir.'airspace.sql.gz'." doesn't exist. Download failed."; |
|
3288 | + } |
|
2692 | 3289 | } |
2693 | - } else $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3290 | + } else { |
|
3291 | + $error = "File ".$tmp_dir.'airspace.sql.gz.md5'." doesn't exist. Download failed."; |
|
3292 | + } |
|
2694 | 3293 | if ($error != '') { |
2695 | 3294 | return $error; |
2696 | - } elseif ($globalDebug) echo "Done\n"; |
|
3295 | + } elseif ($globalDebug) { |
|
3296 | + echo "Done\n"; |
|
3297 | + } |
|
2697 | 3298 | return ''; |
2698 | 3299 | } |
2699 | 3300 | |
2700 | 3301 | public static function update_geoid_fam() { |
2701 | 3302 | global $tmp_dir, $globalDebug, $globalGeoidSource; |
2702 | 3303 | $error = ''; |
2703 | - if ($globalDebug) echo "Geoid from FlightAirMap website : Download..."; |
|
3304 | + if ($globalDebug) { |
|
3305 | + echo "Geoid from FlightAirMap website : Download..."; |
|
3306 | + } |
|
2704 | 3307 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz.md5',$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'); |
2705 | 3308 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')) { |
2706 | 3309 | $geoid_md5_file = explode(' ',file_get_contents($tmp_dir.$globalGeoidSource.'.pgm.gz.md5')); |
@@ -2709,76 +3312,120 @@ discard block |
||
2709 | 3312 | update_db::download('http://data.flightairmap.com/data/geoid/'.$globalGeoidSource.'.pgm.gz',$tmp_dir.$globalGeoidSource.'.pgm.gz'); |
2710 | 3313 | if (file_exists($tmp_dir.$globalGeoidSource.'.pgm.gz')) { |
2711 | 3314 | if (md5_file($tmp_dir.$globalGeoidSource.'.pgm.gz') == $geoid_md5) { |
2712 | - if ($globalDebug) echo "Gunzip..."; |
|
3315 | + if ($globalDebug) { |
|
3316 | + echo "Gunzip..."; |
|
3317 | + } |
|
2713 | 3318 | update_db::gunzip($tmp_dir.$globalGeoidSource.'.pgm.gz',dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm'); |
2714 | 3319 | if (file_exists(dirname(__FILE__).'/../data/'.$globalGeoidSource.'.pgm')) { |
2715 | 3320 | update_db::insert_geoid_version($geoid_md5); |
2716 | - } else $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
2717 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
2718 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
2719 | - } elseif ($globalDebug) echo 'No new version'."\n"; |
|
2720 | - } else $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3321 | + } else { |
|
3322 | + $error = "File data/".$globalGeoidSource.'.pgm'." doesn't exist. Gunzip failed."; |
|
3323 | + } |
|
3324 | + } else { |
|
3325 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." md5 failed. Download failed."; |
|
3326 | + } |
|
3327 | + } else { |
|
3328 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz'." doesn't exist. Download failed."; |
|
3329 | + } |
|
3330 | + } elseif ($globalDebug) { |
|
3331 | + echo 'No new version'."\n"; |
|
3332 | + } |
|
3333 | + } else { |
|
3334 | + $error = "File ".$tmp_dir.$globalGeoidSource.'.pgm.gz.md5'." doesn't exist. Download failed."; |
|
3335 | + } |
|
2721 | 3336 | if ($error != '') { |
2722 | 3337 | return $error; |
2723 | - } elseif ($globalDebug) echo "Done\n"; |
|
3338 | + } elseif ($globalDebug) { |
|
3339 | + echo "Done\n"; |
|
3340 | + } |
|
2724 | 3341 | return ''; |
2725 | 3342 | } |
2726 | 3343 | |
2727 | 3344 | public static function update_tle() { |
2728 | 3345 | global $tmp_dir, $globalDebug; |
2729 | - if ($globalDebug) echo "Download TLE : Download..."; |
|
3346 | + if ($globalDebug) { |
|
3347 | + echo "Download TLE : Download..."; |
|
3348 | + } |
|
2730 | 3349 | $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', |
2731 | 3350 | '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', |
2732 | 3351 | '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'); |
2733 | 3352 | foreach ($alltle as $filename) { |
2734 | - if ($globalDebug) echo "downloading ".$filename.'...'; |
|
3353 | + if ($globalDebug) { |
|
3354 | + echo "downloading ".$filename.'...'; |
|
3355 | + } |
|
2735 | 3356 | update_db::download('http://celestrak.com/NORAD/elements/'.$filename,$tmp_dir.$filename); |
2736 | 3357 | if (file_exists($tmp_dir.$filename)) { |
2737 | - if ($globalDebug) echo "Add to DB ".$filename."..."; |
|
3358 | + if ($globalDebug) { |
|
3359 | + echo "Add to DB ".$filename."..."; |
|
3360 | + } |
|
2738 | 3361 | $error = update_db::tle($tmp_dir.$filename,str_replace('.txt','',$filename)); |
2739 | - } else $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3362 | + } else { |
|
3363 | + $error = "File ".$tmp_dir.$filename." doesn't exist. Download failed."; |
|
3364 | + } |
|
2740 | 3365 | if ($error != '') { |
2741 | 3366 | echo $error."\n"; |
2742 | - } elseif ($globalDebug) echo "Done\n"; |
|
3367 | + } elseif ($globalDebug) { |
|
3368 | + echo "Done\n"; |
|
3369 | + } |
|
2743 | 3370 | } |
2744 | 3371 | return ''; |
2745 | 3372 | } |
2746 | 3373 | |
2747 | 3374 | public static function update_ucsdb() { |
2748 | 3375 | global $tmp_dir, $globalDebug; |
2749 | - if ($globalDebug) echo "Download UCS DB : Download..."; |
|
3376 | + if ($globalDebug) { |
|
3377 | + echo "Download UCS DB : Download..."; |
|
3378 | + } |
|
2750 | 3379 | update_db::download('https://s3.amazonaws.com/ucs-documents/nuclear-weapons/sat-database/4-11-17-update/UCS_Satellite_Database_officialname_1-1-17.txt',$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2751 | 3380 | if (file_exists($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt')) { |
2752 | - if ($globalDebug) echo "Add to DB..."; |
|
3381 | + if ($globalDebug) { |
|
3382 | + echo "Add to DB..."; |
|
3383 | + } |
|
2753 | 3384 | $error = update_db::satellite_ucsdb($tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'); |
2754 | - } else $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3385 | + } else { |
|
3386 | + $error = "File ".$tmp_dir.'UCS_Satellite_Database_officialname_1-1-17.txt'." doesn't exist. Download failed."; |
|
3387 | + } |
|
2755 | 3388 | if ($error != '') { |
2756 | 3389 | echo $error."\n"; |
2757 | - } elseif ($globalDebug) echo "Done\n"; |
|
3390 | + } elseif ($globalDebug) { |
|
3391 | + echo "Done\n"; |
|
3392 | + } |
|
2758 | 3393 | return ''; |
2759 | 3394 | } |
2760 | 3395 | |
2761 | 3396 | public static function update_celestrak() { |
2762 | 3397 | global $tmp_dir, $globalDebug; |
2763 | - if ($globalDebug) echo "Download Celestrak DB : Download..."; |
|
3398 | + if ($globalDebug) { |
|
3399 | + echo "Download Celestrak DB : Download..."; |
|
3400 | + } |
|
2764 | 3401 | update_db::download('http://celestrak.com/pub/satcat.txt',$tmp_dir.'satcat.txt'); |
2765 | 3402 | if (file_exists($tmp_dir.'satcat.txt')) { |
2766 | - if ($globalDebug) echo "Add to DB..."; |
|
3403 | + if ($globalDebug) { |
|
3404 | + echo "Add to DB..."; |
|
3405 | + } |
|
2767 | 3406 | $error = update_db::satellite_celestrak($tmp_dir.'satcat.txt'); |
2768 | - } else $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3407 | + } else { |
|
3408 | + $error = "File ".$tmp_dir.'satcat.txt'." doesn't exist. Download failed."; |
|
3409 | + } |
|
2769 | 3410 | if ($error != '') { |
2770 | 3411 | echo $error."\n"; |
2771 | - } elseif ($globalDebug) echo "Done\n"; |
|
3412 | + } elseif ($globalDebug) { |
|
3413 | + echo "Done\n"; |
|
3414 | + } |
|
2772 | 3415 | return ''; |
2773 | 3416 | } |
2774 | 3417 | |
2775 | 3418 | public static function update_models() { |
2776 | 3419 | global $tmp_dir, $globalDebug; |
2777 | 3420 | $error = ''; |
2778 | - if ($globalDebug) echo "Models from FlightAirMap website : Download..."; |
|
3421 | + if ($globalDebug) { |
|
3422 | + echo "Models from FlightAirMap website : Download..."; |
|
3423 | + } |
|
2779 | 3424 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',$tmp_dir.'models.md5sum'); |
2780 | 3425 | if (file_exists($tmp_dir.'models.md5sum')) { |
2781 | - if ($globalDebug) echo "Check files...\n"; |
|
3426 | + if ($globalDebug) { |
|
3427 | + echo "Check files...\n"; |
|
3428 | + } |
|
2782 | 3429 | $newmodelsdb = array(); |
2783 | 3430 | if (($handle = fopen($tmp_dir.'models.md5sum','r')) !== FALSE) { |
2784 | 3431 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2797,19 +3444,29 @@ discard block |
||
2797 | 3444 | } |
2798 | 3445 | $diff = array_diff($newmodelsdb,$modelsdb); |
2799 | 3446 | foreach ($diff as $key => $value) { |
2800 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3447 | + if ($globalDebug) { |
|
3448 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3449 | + } |
|
2801 | 3450 | update_db::download('http://data.flightairmap.com/data/models/'.$key,dirname(__FILE__).'/../models/'.$key); |
2802 | 3451 | |
2803 | 3452 | } |
2804 | 3453 | update_db::download('http://data.flightairmap.com/data/models/models.md5sum',dirname(__FILE__).'/../models/models.md5sum'); |
2805 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3454 | + } else { |
|
3455 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3456 | + } |
|
2806 | 3457 | if ($error != '') { |
2807 | 3458 | return $error; |
2808 | - } elseif ($globalDebug) echo "Done\n"; |
|
2809 | - if ($globalDebug) echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3459 | + } elseif ($globalDebug) { |
|
3460 | + echo "Done\n"; |
|
3461 | + } |
|
3462 | + if ($globalDebug) { |
|
3463 | + echo "glTF 2.0 Models from FlightAirMap website : Download..."; |
|
3464 | + } |
|
2810 | 3465 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',$tmp_dir.'modelsgltf2.md5sum'); |
2811 | 3466 | if (file_exists($tmp_dir.'modelsgltf2.md5sum')) { |
2812 | - if ($globalDebug) echo "Check files...\n"; |
|
3467 | + if ($globalDebug) { |
|
3468 | + echo "Check files...\n"; |
|
3469 | + } |
|
2813 | 3470 | $newmodelsdb = array(); |
2814 | 3471 | if (($handle = fopen($tmp_dir.'modelsgltf2.md5sum','r')) !== FALSE) { |
2815 | 3472 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2828,19 +3485,29 @@ discard block |
||
2828 | 3485 | } |
2829 | 3486 | $diff = array_diff($newmodelsdb,$modelsdb); |
2830 | 3487 | foreach ($diff as $key => $value) { |
2831 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3488 | + if ($globalDebug) { |
|
3489 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3490 | + } |
|
2832 | 3491 | update_db::download('http://data.flightairmap.com/data/models/gltf2/'.$key,dirname(__FILE__).'/../models/gltf2/'.$key); |
2833 | 3492 | |
2834 | 3493 | } |
2835 | 3494 | update_db::download('http://data.flightairmap.com/data/models/gltf2/models.md5sum',dirname(__FILE__).'/../models/gltf2/models.md5sum'); |
2836 | - } else $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3495 | + } else { |
|
3496 | + $error = "File ".$tmp_dir.'modelsgltf2.md5sum'." doesn't exist. Download failed."; |
|
3497 | + } |
|
2837 | 3498 | if ($error != '') { |
2838 | 3499 | return $error; |
2839 | - } elseif ($globalDebug) echo "Done\n"; |
|
2840 | - if ($globalDebug) echo "Weather Models from FlightAirMap website : Download..."; |
|
3500 | + } elseif ($globalDebug) { |
|
3501 | + echo "Done\n"; |
|
3502 | + } |
|
3503 | + if ($globalDebug) { |
|
3504 | + echo "Weather Models from FlightAirMap website : Download..."; |
|
3505 | + } |
|
2841 | 3506 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',$tmp_dir.'modelsweather.md5sum'); |
2842 | 3507 | if (file_exists($tmp_dir.'modelsweather.md5sum')) { |
2843 | - if ($globalDebug) echo "Check files...\n"; |
|
3508 | + if ($globalDebug) { |
|
3509 | + echo "Check files...\n"; |
|
3510 | + } |
|
2844 | 3511 | $newmodelsdb = array(); |
2845 | 3512 | if (($handle = fopen($tmp_dir.'modelsweather.md5sum','r')) !== FALSE) { |
2846 | 3513 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2859,25 +3526,35 @@ discard block |
||
2859 | 3526 | } |
2860 | 3527 | $diff = array_diff($newmodelsdb,$modelsdb); |
2861 | 3528 | foreach ($diff as $key => $value) { |
2862 | - if ($globalDebug) echo 'Downloading model '.$key.' ...'."\n"; |
|
3529 | + if ($globalDebug) { |
|
3530 | + echo 'Downloading model '.$key.' ...'."\n"; |
|
3531 | + } |
|
2863 | 3532 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/'.$key,dirname(__FILE__).'/../models/gltf2/weather/'.$key); |
2864 | 3533 | |
2865 | 3534 | } |
2866 | 3535 | update_db::download('http://data.flightairmap.com/data/models/gltf2/weather/models.md5sum',dirname(__FILE__).'/../models/gltf2/weather/models.md5sum'); |
2867 | - } else $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
3536 | + } else { |
|
3537 | + $error = "File ".$tmp_dir.'modelsweather.md5sum'." doesn't exist. Download failed."; |
|
3538 | + } |
|
2868 | 3539 | if ($error != '') { |
2869 | 3540 | return $error; |
2870 | - } elseif ($globalDebug) echo "Done\n"; |
|
3541 | + } elseif ($globalDebug) { |
|
3542 | + echo "Done\n"; |
|
3543 | + } |
|
2871 | 3544 | return ''; |
2872 | 3545 | } |
2873 | 3546 | |
2874 | 3547 | public static function update_liveries() { |
2875 | 3548 | global $tmp_dir, $globalDebug; |
2876 | 3549 | $error = ''; |
2877 | - if ($globalDebug) echo "Liveries from FlightAirMap website : Download..."; |
|
3550 | + if ($globalDebug) { |
|
3551 | + echo "Liveries from FlightAirMap website : Download..."; |
|
3552 | + } |
|
2878 | 3553 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',$tmp_dir.'liveries.md5sum'); |
2879 | 3554 | if (file_exists($tmp_dir.'liveries.md5sum')) { |
2880 | - if ($globalDebug) echo "Check files...\n"; |
|
3555 | + if ($globalDebug) { |
|
3556 | + echo "Check files...\n"; |
|
3557 | + } |
|
2881 | 3558 | $newmodelsdb = array(); |
2882 | 3559 | if (($handle = fopen($tmp_dir.'liveries.md5sum','r')) !== FALSE) { |
2883 | 3560 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2896,25 +3573,35 @@ discard block |
||
2896 | 3573 | } |
2897 | 3574 | $diff = array_diff($newmodelsdb,$modelsdb); |
2898 | 3575 | foreach ($diff as $key => $value) { |
2899 | - if ($globalDebug) echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3576 | + if ($globalDebug) { |
|
3577 | + echo 'Downloading liveries '.$key.' ...'."\n"; |
|
3578 | + } |
|
2900 | 3579 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/'.$key,dirname(__FILE__).'/../models/gltf2/liveries/'.$key); |
2901 | 3580 | |
2902 | 3581 | } |
2903 | 3582 | update_db::download('http://data.flightairmap.com/data/models/gltf2/liveries/liveries.md5sum',dirname(__FILE__).'/../models/gltf2/liveries/liveries.md5sum'); |
2904 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3583 | + } else { |
|
3584 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3585 | + } |
|
2905 | 3586 | if ($error != '') { |
2906 | 3587 | return $error; |
2907 | - } elseif ($globalDebug) echo "Done\n"; |
|
3588 | + } elseif ($globalDebug) { |
|
3589 | + echo "Done\n"; |
|
3590 | + } |
|
2908 | 3591 | return ''; |
2909 | 3592 | } |
2910 | 3593 | |
2911 | 3594 | public static function update_space_models() { |
2912 | 3595 | global $tmp_dir, $globalDebug; |
2913 | 3596 | $error = ''; |
2914 | - if ($globalDebug) echo "Space models from FlightAirMap website : Download..."; |
|
3597 | + if ($globalDebug) { |
|
3598 | + echo "Space models from FlightAirMap website : Download..."; |
|
3599 | + } |
|
2915 | 3600 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',$tmp_dir.'space_models.md5sum'); |
2916 | 3601 | if (file_exists($tmp_dir.'space_models.md5sum')) { |
2917 | - if ($globalDebug) echo "Check files...\n"; |
|
3602 | + if ($globalDebug) { |
|
3603 | + echo "Check files...\n"; |
|
3604 | + } |
|
2918 | 3605 | $newmodelsdb = array(); |
2919 | 3606 | if (($handle = fopen($tmp_dir.'space_models.md5sum','r')) !== FALSE) { |
2920 | 3607 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2933,25 +3620,35 @@ discard block |
||
2933 | 3620 | } |
2934 | 3621 | $diff = array_diff($newmodelsdb,$modelsdb); |
2935 | 3622 | foreach ($diff as $key => $value) { |
2936 | - if ($globalDebug) echo 'Downloading space model '.$key.' ...'."\n"; |
|
3623 | + if ($globalDebug) { |
|
3624 | + echo 'Downloading space model '.$key.' ...'."\n"; |
|
3625 | + } |
|
2937 | 3626 | update_db::download('http://data.flightairmap.com/data/models/space/'.$key,dirname(__FILE__).'/../models/space/'.$key); |
2938 | 3627 | |
2939 | 3628 | } |
2940 | 3629 | update_db::download('http://data.flightairmap.com/data/models/space/space_models.md5sum',dirname(__FILE__).'/../models/space/space_models.md5sum'); |
2941 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3630 | + } else { |
|
3631 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3632 | + } |
|
2942 | 3633 | if ($error != '') { |
2943 | 3634 | return $error; |
2944 | - } elseif ($globalDebug) echo "Done\n"; |
|
3635 | + } elseif ($globalDebug) { |
|
3636 | + echo "Done\n"; |
|
3637 | + } |
|
2945 | 3638 | return ''; |
2946 | 3639 | } |
2947 | 3640 | |
2948 | 3641 | public static function update_vehicules_models() { |
2949 | 3642 | global $tmp_dir, $globalDebug; |
2950 | 3643 | $error = ''; |
2951 | - if ($globalDebug) echo "Vehicules models from FlightAirMap website : Download..."; |
|
3644 | + if ($globalDebug) { |
|
3645 | + echo "Vehicules models from FlightAirMap website : Download..."; |
|
3646 | + } |
|
2952 | 3647 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',$tmp_dir.'vehicules_models.md5sum'); |
2953 | 3648 | if (file_exists($tmp_dir.'vehicules_models.md5sum')) { |
2954 | - if ($globalDebug) echo "Check files...\n"; |
|
3649 | + if ($globalDebug) { |
|
3650 | + echo "Check files...\n"; |
|
3651 | + } |
|
2955 | 3652 | $newmodelsdb = array(); |
2956 | 3653 | if (($handle = fopen($tmp_dir.'vehicules_models.md5sum','r')) !== FALSE) { |
2957 | 3654 | while (($row = fgetcsv($handle,1000," ")) !== FALSE) { |
@@ -2970,15 +3667,21 @@ discard block |
||
2970 | 3667 | } |
2971 | 3668 | $diff = array_diff($newmodelsdb,$modelsdb); |
2972 | 3669 | foreach ($diff as $key => $value) { |
2973 | - if ($globalDebug) echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3670 | + if ($globalDebug) { |
|
3671 | + echo 'Downloading vehicules model '.$key.' ...'."\n"; |
|
3672 | + } |
|
2974 | 3673 | update_db::download('http://data.flightairmap.com/data/models/vehicules/'.$key,dirname(__FILE__).'/../models/vehicules/'.$key); |
2975 | 3674 | |
2976 | 3675 | } |
2977 | 3676 | update_db::download('http://data.flightairmap.com/data/models/vehicules/vehicules_models.md5sum',dirname(__FILE__).'/../models/vehicules/vehicules_models.md5sum'); |
2978 | - } else $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3677 | + } else { |
|
3678 | + $error = "File ".$tmp_dir.'models.md5sum'." doesn't exist. Download failed."; |
|
3679 | + } |
|
2979 | 3680 | if ($error != '') { |
2980 | 3681 | return $error; |
2981 | - } elseif ($globalDebug) echo "Done\n"; |
|
3682 | + } elseif ($globalDebug) { |
|
3683 | + echo "Done\n"; |
|
3684 | + } |
|
2982 | 3685 | return ''; |
2983 | 3686 | } |
2984 | 3687 | |
@@ -3051,7 +3754,9 @@ discard block |
||
3051 | 3754 | } |
3052 | 3755 | |
3053 | 3756 | $error = ''; |
3054 | - if ($globalDebug) echo "Notam : Download..."; |
|
3757 | + if ($globalDebug) { |
|
3758 | + echo "Notam : Download..."; |
|
3759 | + } |
|
3055 | 3760 | update_db::download($globalNOTAMSource,$tmp_dir.'notam.rss'); |
3056 | 3761 | if (file_exists($tmp_dir.'notam.rss')) { |
3057 | 3762 | $notams = json_decode(json_encode(simplexml_load_file($tmp_dir.'notam.rss')),true); |
@@ -3066,14 +3771,30 @@ discard block |
||
3066 | 3771 | $data['fir'] = $q[0]; |
3067 | 3772 | $data['code'] = $q[1]; |
3068 | 3773 | $ifrvfr = $q[2]; |
3069 | - if ($ifrvfr == 'IV') $data['rules'] = 'IFR/VFR'; |
|
3070 | - if ($ifrvfr == 'I') $data['rules'] = 'IFR'; |
|
3071 | - if ($ifrvfr == 'V') $data['rules'] = 'VFR'; |
|
3072 | - if ($q[4] == 'A') $data['scope'] = 'Airport warning'; |
|
3073 | - if ($q[4] == 'E') $data['scope'] = 'Enroute warning'; |
|
3074 | - if ($q[4] == 'W') $data['scope'] = 'Navigation warning'; |
|
3075 | - if ($q[4] == 'AE') $data['scope'] = 'Airport/Enroute warning'; |
|
3076 | - if ($q[4] == 'AW') $data['scope'] = 'Airport/Navigation warning'; |
|
3774 | + if ($ifrvfr == 'IV') { |
|
3775 | + $data['rules'] = 'IFR/VFR'; |
|
3776 | + } |
|
3777 | + if ($ifrvfr == 'I') { |
|
3778 | + $data['rules'] = 'IFR'; |
|
3779 | + } |
|
3780 | + if ($ifrvfr == 'V') { |
|
3781 | + $data['rules'] = 'VFR'; |
|
3782 | + } |
|
3783 | + if ($q[4] == 'A') { |
|
3784 | + $data['scope'] = 'Airport warning'; |
|
3785 | + } |
|
3786 | + if ($q[4] == 'E') { |
|
3787 | + $data['scope'] = 'Enroute warning'; |
|
3788 | + } |
|
3789 | + if ($q[4] == 'W') { |
|
3790 | + $data['scope'] = 'Navigation warning'; |
|
3791 | + } |
|
3792 | + if ($q[4] == 'AE') { |
|
3793 | + $data['scope'] = 'Airport/Enroute warning'; |
|
3794 | + } |
|
3795 | + if ($q[4] == 'AW') { |
|
3796 | + $data['scope'] = 'Airport/Navigation warning'; |
|
3797 | + } |
|
3077 | 3798 | //$data['scope'] = $q[4]; |
3078 | 3799 | $data['lower_limit'] = $q[5]; |
3079 | 3800 | $data['upper_limit'] = $q[6]; |
@@ -3081,8 +3802,12 @@ discard block |
||
3081 | 3802 | sscanf($latlonrad,'%4c%c%5c%c%3d',$las,$lac,$lns,$lnc,$radius); |
3082 | 3803 | $latitude = $Common->convertDec($las,'latitude'); |
3083 | 3804 | $longitude = $Common->convertDec($lns,'longitude'); |
3084 | - if ($lac == 'S') $latitude = '-'.$latitude; |
|
3085 | - if ($lnc == 'W') $longitude = '-'.$longitude; |
|
3805 | + if ($lac == 'S') { |
|
3806 | + $latitude = '-'.$latitude; |
|
3807 | + } |
|
3808 | + if ($lnc == 'W') { |
|
3809 | + $longitude = '-'.$longitude; |
|
3810 | + } |
|
3086 | 3811 | $data['center_latitude'] = $latitude; |
3087 | 3812 | $data['center_longitude'] = $longitude; |
3088 | 3813 | $data['radius'] = intval($radius); |
@@ -3112,10 +3837,14 @@ discard block |
||
3112 | 3837 | $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']); |
3113 | 3838 | unset($data); |
3114 | 3839 | } |
3115 | - } else $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3840 | + } else { |
|
3841 | + $error = "File ".$tmp_dir.'notam.rss'." doesn't exist. Download failed."; |
|
3842 | + } |
|
3116 | 3843 | if ($error != '') { |
3117 | 3844 | return $error; |
3118 | - } elseif ($globalDebug) echo "Done\n"; |
|
3845 | + } elseif ($globalDebug) { |
|
3846 | + echo "Done\n"; |
|
3847 | + } |
|
3119 | 3848 | return ''; |
3120 | 3849 | } |
3121 | 3850 | |
@@ -3140,7 +3869,9 @@ discard block |
||
3140 | 3869 | $airspace_lst = $Common->getData('https://raw.githubusercontent.com/XCSoar/xcsoar-data-repository/master/data/airspace.json'); |
3141 | 3870 | $airspace_json = json_decode($airspace_lst,true); |
3142 | 3871 | foreach ($airspace_json['records'] as $airspace) { |
3143 | - if ($globalDebug) echo $airspace['name']."...\n"; |
|
3872 | + if ($globalDebug) { |
|
3873 | + echo $airspace['name']."...\n"; |
|
3874 | + } |
|
3144 | 3875 | update_db::download($airspace['uri'],$tmp_dir.$airspace['name']); |
3145 | 3876 | if (file_exists($tmp_dir.$airspace['name'])) { |
3146 | 3877 | file_put_contents($tmp_dir.$airspace['name'], utf8_encode(file_get_contents($tmp_dir.$airspace['name']))); |
@@ -3184,8 +3915,11 @@ discard block |
||
3184 | 3915 | return "error : ".$e->getMessage(); |
3185 | 3916 | } |
3186 | 3917 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3187 | - if ($row['nb'] > 0) return false; |
|
3188 | - else return true; |
|
3918 | + if ($row['nb'] > 0) { |
|
3919 | + return false; |
|
3920 | + } else { |
|
3921 | + return true; |
|
3922 | + } |
|
3189 | 3923 | } |
3190 | 3924 | |
3191 | 3925 | public static function insert_last_update() { |
@@ -3210,8 +3944,11 @@ discard block |
||
3210 | 3944 | return "error : ".$e->getMessage(); |
3211 | 3945 | } |
3212 | 3946 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3213 | - if ($row['nb'] > 0) return true; |
|
3214 | - else return false; |
|
3947 | + if ($row['nb'] > 0) { |
|
3948 | + return true; |
|
3949 | + } else { |
|
3950 | + return false; |
|
3951 | + } |
|
3215 | 3952 | } |
3216 | 3953 | |
3217 | 3954 | public static function check_geoid_version($version) { |
@@ -3224,8 +3961,11 @@ discard block |
||
3224 | 3961 | return "error : ".$e->getMessage(); |
3225 | 3962 | } |
3226 | 3963 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3227 | - if ($row['nb'] > 0) return true; |
|
3228 | - else return false; |
|
3964 | + if ($row['nb'] > 0) { |
|
3965 | + return true; |
|
3966 | + } else { |
|
3967 | + return false; |
|
3968 | + } |
|
3229 | 3969 | } |
3230 | 3970 | |
3231 | 3971 | public static function check_marine_identity_version($version) { |
@@ -3238,8 +3978,11 @@ discard block |
||
3238 | 3978 | return "error : ".$e->getMessage(); |
3239 | 3979 | } |
3240 | 3980 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3241 | - if ($row['nb'] > 0) return true; |
|
3242 | - else return false; |
|
3981 | + if ($row['nb'] > 0) { |
|
3982 | + return true; |
|
3983 | + } else { |
|
3984 | + return false; |
|
3985 | + } |
|
3243 | 3986 | } |
3244 | 3987 | |
3245 | 3988 | public static function check_satellite_version($version) { |
@@ -3252,8 +3995,11 @@ discard block |
||
3252 | 3995 | return "error : ".$e->getMessage(); |
3253 | 3996 | } |
3254 | 3997 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3255 | - if ($row['nb'] > 0) return true; |
|
3256 | - else return false; |
|
3998 | + if ($row['nb'] > 0) { |
|
3999 | + return true; |
|
4000 | + } else { |
|
4001 | + return false; |
|
4002 | + } |
|
3257 | 4003 | } |
3258 | 4004 | |
3259 | 4005 | public static function check_airlines_version($version) { |
@@ -3266,8 +4012,11 @@ discard block |
||
3266 | 4012 | return "error : ".$e->getMessage(); |
3267 | 4013 | } |
3268 | 4014 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3269 | - if ($row['nb'] > 0) return true; |
|
3270 | - else return false; |
|
4015 | + if ($row['nb'] > 0) { |
|
4016 | + return true; |
|
4017 | + } else { |
|
4018 | + return false; |
|
4019 | + } |
|
3271 | 4020 | } |
3272 | 4021 | |
3273 | 4022 | public static function check_notam_version($version) { |
@@ -3280,8 +4029,11 @@ discard block |
||
3280 | 4029 | return "error : ".$e->getMessage(); |
3281 | 4030 | } |
3282 | 4031 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3283 | - if ($row['nb'] > 0) return true; |
|
3284 | - else return false; |
|
4032 | + if ($row['nb'] > 0) { |
|
4033 | + return true; |
|
4034 | + } else { |
|
4035 | + return false; |
|
4036 | + } |
|
3285 | 4037 | } |
3286 | 4038 | |
3287 | 4039 | public static function insert_airlines_version($version) { |
@@ -3371,8 +4123,11 @@ discard block |
||
3371 | 4123 | return "error : ".$e->getMessage(); |
3372 | 4124 | } |
3373 | 4125 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3374 | - if ($row['nb'] > 0) return false; |
|
3375 | - else return true; |
|
4126 | + if ($row['nb'] > 0) { |
|
4127 | + return false; |
|
4128 | + } else { |
|
4129 | + return true; |
|
4130 | + } |
|
3376 | 4131 | } |
3377 | 4132 | |
3378 | 4133 | public static function insert_last_notam_update() { |
@@ -3402,8 +4157,11 @@ discard block |
||
3402 | 4157 | return "error : ".$e->getMessage(); |
3403 | 4158 | } |
3404 | 4159 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3405 | - if ($row['nb'] > 0) return false; |
|
3406 | - else return true; |
|
4160 | + if ($row['nb'] > 0) { |
|
4161 | + return false; |
|
4162 | + } else { |
|
4163 | + return true; |
|
4164 | + } |
|
3407 | 4165 | } |
3408 | 4166 | |
3409 | 4167 | public static function insert_last_airspace_update() { |
@@ -3433,8 +4191,11 @@ discard block |
||
3433 | 4191 | return "error : ".$e->getMessage(); |
3434 | 4192 | } |
3435 | 4193 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3436 | - if ($row['nb'] > 0) return false; |
|
3437 | - else return true; |
|
4194 | + if ($row['nb'] > 0) { |
|
4195 | + return false; |
|
4196 | + } else { |
|
4197 | + return true; |
|
4198 | + } |
|
3438 | 4199 | } |
3439 | 4200 | |
3440 | 4201 | public static function insert_last_geoid_update() { |
@@ -3464,8 +4225,11 @@ discard block |
||
3464 | 4225 | return "error : ".$e->getMessage(); |
3465 | 4226 | } |
3466 | 4227 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3467 | - if ($row['nb'] > 0) return false; |
|
3468 | - else return true; |
|
4228 | + if ($row['nb'] > 0) { |
|
4229 | + return false; |
|
4230 | + } else { |
|
4231 | + return true; |
|
4232 | + } |
|
3469 | 4233 | } |
3470 | 4234 | |
3471 | 4235 | public static function insert_last_owner_update() { |
@@ -3495,8 +4259,11 @@ discard block |
||
3495 | 4259 | return "error : ".$e->getMessage(); |
3496 | 4260 | } |
3497 | 4261 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3498 | - if ($row['nb'] > 0) return false; |
|
3499 | - else return true; |
|
4262 | + if ($row['nb'] > 0) { |
|
4263 | + return false; |
|
4264 | + } else { |
|
4265 | + return true; |
|
4266 | + } |
|
3500 | 4267 | } |
3501 | 4268 | |
3502 | 4269 | public static function insert_last_fires_update() { |
@@ -3526,8 +4293,11 @@ discard block |
||
3526 | 4293 | return "error : ".$e->getMessage(); |
3527 | 4294 | } |
3528 | 4295 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3529 | - if ($row['nb'] > 0) return false; |
|
3530 | - else return true; |
|
4296 | + if ($row['nb'] > 0) { |
|
4297 | + return false; |
|
4298 | + } else { |
|
4299 | + return true; |
|
4300 | + } |
|
3531 | 4301 | } |
3532 | 4302 | |
3533 | 4303 | public static function insert_last_airlines_update() { |
@@ -3557,8 +4327,11 @@ discard block |
||
3557 | 4327 | return "error : ".$e->getMessage(); |
3558 | 4328 | } |
3559 | 4329 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3560 | - if ($row['nb'] > 0) return false; |
|
3561 | - else return true; |
|
4330 | + if ($row['nb'] > 0) { |
|
4331 | + return false; |
|
4332 | + } else { |
|
4333 | + return true; |
|
4334 | + } |
|
3562 | 4335 | } |
3563 | 4336 | |
3564 | 4337 | public static function insert_last_schedules_update() { |
@@ -3588,8 +4361,11 @@ discard block |
||
3588 | 4361 | return "error : ".$e->getMessage(); |
3589 | 4362 | } |
3590 | 4363 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3591 | - if ($row['nb'] > 0) return false; |
|
3592 | - else return true; |
|
4364 | + if ($row['nb'] > 0) { |
|
4365 | + return false; |
|
4366 | + } else { |
|
4367 | + return true; |
|
4368 | + } |
|
3593 | 4369 | } |
3594 | 4370 | |
3595 | 4371 | public static function insert_last_tle_update() { |
@@ -3619,8 +4395,11 @@ discard block |
||
3619 | 4395 | return "error : ".$e->getMessage(); |
3620 | 4396 | } |
3621 | 4397 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3622 | - if ($row['nb'] > 0) return false; |
|
3623 | - else return true; |
|
4398 | + if ($row['nb'] > 0) { |
|
4399 | + return false; |
|
4400 | + } else { |
|
4401 | + return true; |
|
4402 | + } |
|
3624 | 4403 | } |
3625 | 4404 | |
3626 | 4405 | public static function insert_last_ucsdb_update() { |
@@ -3650,8 +4429,11 @@ discard block |
||
3650 | 4429 | return "error : ".$e->getMessage(); |
3651 | 4430 | } |
3652 | 4431 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3653 | - if ($row['nb'] > 0) return false; |
|
3654 | - else return true; |
|
4432 | + if ($row['nb'] > 0) { |
|
4433 | + return false; |
|
4434 | + } else { |
|
4435 | + return true; |
|
4436 | + } |
|
3655 | 4437 | } |
3656 | 4438 | |
3657 | 4439 | public static function insert_last_celestrak_update() { |
@@ -3681,8 +4463,11 @@ discard block |
||
3681 | 4463 | return "error : ".$e->getMessage(); |
3682 | 4464 | } |
3683 | 4465 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3684 | - if ($row['nb'] > 0) return false; |
|
3685 | - else return true; |
|
4466 | + if ($row['nb'] > 0) { |
|
4467 | + return false; |
|
4468 | + } else { |
|
4469 | + return true; |
|
4470 | + } |
|
3686 | 4471 | } |
3687 | 4472 | |
3688 | 4473 | public static function check_last_satellite_update() { |
@@ -3700,8 +4485,11 @@ discard block |
||
3700 | 4485 | return "error : ".$e->getMessage(); |
3701 | 4486 | } |
3702 | 4487 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
3703 | - if ($row['nb'] > 0) return false; |
|
3704 | - else return true; |
|
4488 | + if ($row['nb'] > 0) { |
|
4489 | + return false; |
|
4490 | + } else { |
|
4491 | + return true; |
|
4492 | + } |
|
3705 | 4493 | } |
3706 | 4494 | |
3707 | 4495 | public static function insert_last_marine_identity_update() { |
@@ -26,24 +26,24 @@ discard block |
||
26 | 26 | $sql_date = ''; |
27 | 27 | if (isset($_GET['start_date'])) { |
28 | 28 | //for the date manipulation into the query |
29 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
29 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
30 | 30 | if (strtotime($_GET['start_date']) !== false && strtotime($_GET['end_date']) !== false) { |
31 | 31 | //$start_date = $_GET['start_date']." 00:00:00"; |
32 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
32 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
33 | 33 | //$end_date = $_GET['end_date']." 00:00:00"; |
34 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
34 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
35 | 35 | $sql_date = $start_date.",".$end_date; |
36 | 36 | } |
37 | - } else if($_GET['start_date'] != ""){ |
|
37 | + } else if ($_GET['start_date'] != "") { |
|
38 | 38 | if (strtotime($_GET['start_date']) !== false) { |
39 | 39 | //$start_date = $_GET['start_date']." 00:00:00"; |
40 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
40 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
41 | 41 | $sql_date = $start_date; |
42 | 42 | } |
43 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
43 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
44 | 44 | if (strtotime($_GET['end_date']) !== false) { |
45 | 45 | //$end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".$_GET['end_date']." 00:00:00"; |
46 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
46 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
47 | 47 | $sql_date = $end_date; |
48 | 48 | } |
49 | 49 | } else $sql_date = ''; |
@@ -51,21 +51,21 @@ discard block |
||
51 | 51 | |
52 | 52 | if (isset($_GET['highest_altitude'])) { |
53 | 53 | //for altitude manipulation |
54 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
55 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
56 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
54 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
55 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
56 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
57 | 57 | $sql_altitude = $start_altitude.",".$end_altitude; |
58 | - } else if($_GET['highest_altitude'] != ""){ |
|
59 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
58 | + } else if ($_GET['highest_altitude'] != "") { |
|
59 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
60 | 60 | $sql_altitude = $end_altitude; |
61 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
62 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
61 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
62 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
63 | 63 | $sql_altitude = $start_altitude; |
64 | 64 | } else $sql_altitude = ''; |
65 | 65 | } else $sql_altitude = ''; |
66 | 66 | |
67 | 67 | //calculuation for the pagination |
68 | -if(!isset($_GET['limit'])) |
|
68 | +if (!isset($_GET['limit'])) |
|
69 | 69 | { |
70 | 70 | if (!isset($_GET['number_results'])) |
71 | 71 | { |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | $limit_end = 25; |
74 | 74 | $absolute_difference = 25; |
75 | 75 | } else { |
76 | - if ($_GET['number_results'] > 1000){ |
|
76 | + if ($_GET['number_results'] > 1000) { |
|
77 | 77 | $_GET['number_results'] = 1000; |
78 | 78 | } |
79 | 79 | $limit_start = 0; |
80 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
81 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
80 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
81 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
82 | 82 | } |
83 | -} else { |
|
83 | +} else { |
|
84 | 84 | $limit_explode = explode(",", $_GET['limit']); |
85 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
86 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
85 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
86 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
87 | 87 | } |
88 | 88 | $absolute_difference = abs($limit_start - $limit_end); |
89 | 89 | $limit_next = $limit_end + $absolute_difference; |
@@ -112,31 +112,31 @@ discard block |
||
112 | 112 | ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
113 | 113 | (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
114 | 114 | (isset($_GET['dist']) && $_GET['dist'] != '')) |
115 | - ){ |
|
116 | - $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
|
117 | - $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
|
118 | - $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
|
119 | - $manufacturer = filter_input(INPUT_GET, 'manufacturer',FILTER_SANITIZE_STRING); |
|
120 | - $highlights = filter_input(INPUT_GET, 'highlights',FILTER_SANITIZE_STRING); |
|
121 | - $airline = filter_input(INPUT_GET, 'airline',FILTER_SANITIZE_STRING); |
|
122 | - $airline_country = filter_input(INPUT_GET, 'airline_country',FILTER_SANITIZE_STRING); |
|
123 | - $airline_type = filter_input(INPUT_GET, 'airline_type',FILTER_SANITIZE_STRING); |
|
124 | - $airport = filter_input(INPUT_GET, 'airport',FILTER_SANITIZE_STRING); |
|
125 | - $airport_country = filter_input(INPUT_GET, 'airport_country',FILTER_SANITIZE_STRING); |
|
126 | - $callsign = filter_input(INPUT_GET, 'callsign',FILTER_SANITIZE_STRING); |
|
127 | - $owner = filter_input(INPUT_GET, 'owner',FILTER_SANITIZE_STRING); |
|
128 | - $pilot_name = filter_input(INPUT_GET, 'pilot_name',FILTER_SANITIZE_STRING); |
|
129 | - $pilot_id = filter_input(INPUT_GET, 'pilot_id',FILTER_SANITIZE_STRING); |
|
130 | - $mmsi = filter_input(INPUT_GET, 'mmsi',FILTER_SANITIZE_NUMBER_INT); |
|
131 | - $imo = filter_input(INPUT_GET, 'imo',FILTER_SANITIZE_NUMBER_INT); |
|
132 | - $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route',FILTER_SANITIZE_STRING); |
|
133 | - $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
134 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
135 | - $archive = filter_input(INPUT_GET,'archive',FILTER_SANITIZE_NUMBER_INT); |
|
136 | - $origlat = filter_input(INPUT_GET,'origlat',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
137 | - $origlon = filter_input(INPUT_GET,'origlon',FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
138 | - $dist = filter_input(INPUT_GET,'dist',FILTER_SANITIZE_NUMBER_INT); |
|
139 | - $number_results = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
115 | + ) { |
|
116 | + $q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
117 | + $registration = filter_input(INPUT_GET, 'registration', FILTER_SANITIZE_STRING); |
|
118 | + $aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
119 | + $manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
120 | + $highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
121 | + $airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
122 | + $airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
123 | + $airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
124 | + $airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
125 | + $airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
126 | + $callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
127 | + $owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
128 | + $pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
129 | + $pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
130 | + $mmsi = filter_input(INPUT_GET, 'mmsi', FILTER_SANITIZE_NUMBER_INT); |
|
131 | + $imo = filter_input(INPUT_GET, 'imo', FILTER_SANITIZE_NUMBER_INT); |
|
132 | + $departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
133 | + $arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
134 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
135 | + $archive = filter_input(INPUT_GET, 'archive', FILTER_SANITIZE_NUMBER_INT); |
|
136 | + $origlat = filter_input(INPUT_GET, 'origlat', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
137 | + $origlon = filter_input(INPUT_GET, 'origlon', FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
138 | + $dist = filter_input(INPUT_GET, 'dist', FILTER_SANITIZE_NUMBER_INT); |
|
139 | + $number_results = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
140 | 140 | if ($dist != '') { |
141 | 141 | if (isset($globalDistanceUnit) && $globalDistanceUnit == 'mi') $dist = $dist*1.60934; |
142 | 142 | elseif (isset($globalDistanceUnit) && $globalDistanceUnit == 'nm') $dist = $dist*1.852; |
@@ -145,15 +145,15 @@ discard block |
||
145 | 145 | if ($archive == 1) { |
146 | 146 | if ($type == 'aircraft') { |
147 | 147 | $SpotterArchive = new SpotterArchive(); |
148 | - $spotter_array = $SpotterArchive->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
148 | + $spotter_array = $SpotterArchive->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
149 | 149 | } |
150 | 150 | } else { |
151 | 151 | if ($type == 'aircraft') { |
152 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
152 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
153 | 153 | } elseif ($type == 'tracker') { |
154 | - $spotter_array = $Tracker->searchTrackerData($q,$callsign,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
154 | + $spotter_array = $Tracker->searchTrackerData($q, $callsign, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
155 | 155 | } elseif ($type == 'marine') { |
156 | - $spotter_array = $Marine->searchMarineData($q,$callsign,$mmsi,$imo,$sql_date,$limit_start.",".$absolute_difference,$sort,'',$origlat,$origlon,$dist); |
|
156 | + $spotter_array = $Marine->searchMarineData($q, $callsign, $mmsi, $imo, $sql_date, $limit_start.",".$absolute_difference, $sort, '', $origlat, $origlon, $dist); |
|
157 | 157 | } |
158 | 158 | } |
159 | 159 | |
@@ -189,12 +189,12 @@ discard block |
||
189 | 189 | //remove 3D=true parameter |
190 | 190 | $no3D = str_replace("&3D=true", "", $_SERVER['QUERY_STRING']); |
191 | 191 | $kmlURL = str_replace("http://", "kml://", $globalURL); |
192 | - if (!isset($_GET['3D'])){ |
|
192 | + if (!isset($_GET['3D'])) { |
|
193 | 193 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'" class="active"><i class="fa fa-table"></i> '._("Table").'</a></li>'; |
194 | 194 | } else { |
195 | 195 | print '<li><span class="notablet"><a href="'.$globalURL.'/search?'.$no3D.'"><i class="fa fa-table"></i> '._("Table").'</a></span></li>'; |
196 | 196 | } |
197 | - if (isset($_GET['3D'])){ |
|
197 | + if (isset($_GET['3D'])) { |
|
198 | 198 | print '<li><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="active"><i class="fa fa-globe"></i> '._("3D Map").'</a></li>'; |
199 | 199 | } else { |
200 | 200 | print '<li ><a href="'.$globalURL.'/search?'.$no3D.'&3D=true" class="notablet nomobile"><i class="fa fa-globe"></i> '._("3D Map").'</a><a href="'.$kmlURL.'/search/kml?'.htmlentities($_SERVER['QUERY_STRING']).'" class="tablet mobile"><i class="fa fa-globe"></i> 3D Map</a></li>'; |
@@ -215,32 +215,32 @@ discard block |
||
215 | 215 | print '<div class="column">'; |
216 | 216 | print '<div class="info">'; |
217 | 217 | print '<h1>'._("Search Results for").' '; |
218 | - if (isset($_GET['q']) && $_GET['q'] != ""){ print _("Keyword:").' <span>'.$q.'</span> '; } |
|
219 | - if (isset($_GET['aircraft']) && $_GET['aircraft'] != ""){ print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
220 | - if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != ""){ print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
221 | - if (isset($_GET['registration']) && $_GET['registration'] != ""){ print _("Registration:").' <span>'.$registration.'</span> '; } |
|
222 | - if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
223 | - if (isset($_GET['airline']) && $_GET['airline'] != ""){ print _("Airline:").' <span>'.$airline.'</span> '; } |
|
224 | - if (isset($_GET['airline_country']) && $_GET['airline_country'] != ""){ print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
225 | - if (isset($_GET['airline_type']) && $_GET['airline_type'] != ""){ print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
226 | - if (isset($_GET['airport']) && $_GET['airport'] != ""){ print _("Airport:").' <span>'.$airport.'</span> '; } |
|
227 | - if (isset($_GET['airport_country']) && $_GET['airport_country'] != ""){ print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
228 | - if (isset($_GET['callsign']) && $_GET['callsign'] != ""){ print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
229 | - if (isset($_GET['owner']) && $_GET['owner'] != ""){ print _("Owner:").' <span>'.$owner.'</span> '; } |
|
230 | - if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != ""){ print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
231 | - if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != ""){ print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
232 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")){ print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
233 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
234 | - if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != ""){ print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
235 | - if (isset($_GET['mmsi']) && $_GET['mmsi'] != ""){ print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
236 | - if (isset($_GET['imo']) && $_GET['imo'] != ""){ print _("IMO:").' <span>'.$imo.'</span> '; } |
|
237 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == ""){ print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
238 | - if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
239 | - if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != ""){ print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
240 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == ""){ print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
241 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
242 | - if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != ""){ print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
243 | - if (isset($_GET['number_results']) && $_GET['number_results'] != ""){ print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
218 | + if (isset($_GET['q']) && $_GET['q'] != "") { print _("Keyword:").' <span>'.$q.'</span> '; } |
|
219 | + if (isset($_GET['aircraft']) && $_GET['aircraft'] != "") { print _("Aircraft:").' <span>'.$aircraft.'</span> '; } |
|
220 | + if (isset($_GET['manufacturer']) && $_GET['manufacturer'] != "") { print _("Manufacturer:").' <span>'.$manufacturer.'</span> '; } |
|
221 | + if (isset($_GET['registration']) && $_GET['registration'] != "") { print _("Registration:").' <span>'.$registration.'</span> '; } |
|
222 | + if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print _("Highlights:").' <span>'.$highlights.'</span> '; } |
|
223 | + if (isset($_GET['airline']) && $_GET['airline'] != "") { print _("Airline:").' <span>'.$airline.'</span> '; } |
|
224 | + if (isset($_GET['airline_country']) && $_GET['airline_country'] != "") { print _("Airline country:").' <span>'.$airline_country.'</span> '; } |
|
225 | + if (isset($_GET['airline_type']) && $_GET['airline_type'] != "") { print _("Airline type:").' <span>'.$airline_type.'</span> '; } |
|
226 | + if (isset($_GET['airport']) && $_GET['airport'] != "") { print _("Airport:").' <span>'.$airport.'</span> '; } |
|
227 | + if (isset($_GET['airport_country']) && $_GET['airport_country'] != "") { print _("Airport country:").' <span>'.$airport_country.'</span> '; } |
|
228 | + if (isset($_GET['callsign']) && $_GET['callsign'] != "") { print _("Callsign:").' <span>'.$callsign.'</span> '; } |
|
229 | + if (isset($_GET['owner']) && $_GET['owner'] != "") { print _("Owner:").' <span>'.$owner.'</span> '; } |
|
230 | + if (isset($_GET['pilot_id']) && $_GET['pilot_id'] != "") { print _("Pilot id:").' <span>'.$pilot_id.'</span> '; } |
|
231 | + if (isset($_GET['pilot_name']) && $_GET['pilot_name'] != "") { print _("Pilot name:").' <span>'.$pilot_name.'</span> '; } |
|
232 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && (!isset($_GET['arrival_airport_route']) || $_GET['arrival_airport_route'] == "")) { print _("Route out of:").' <span>'.$departure_airport_route.'</span> '; } |
|
233 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] == "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route into:").' <span>'.$arrival_airport_route.'</span> '; } |
|
234 | + if (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != "" && isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != "") { print _("Route between:").' <span>'.$departure_airport_route.'</span> and <span>'.$_GET['arrival_airport_route'].'</span> '; } |
|
235 | + if (isset($_GET['mmsi']) && $_GET['mmsi'] != "") { print _("MMSI:").' <span>'.$mmsi.'</span> '; } |
|
236 | + if (isset($_GET['imo']) && $_GET['imo'] != "") { print _("IMO:").' <span>'.$imo.'</span> '; } |
|
237 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] == "") { print _("Date starting at:").' <span>'.$start_date.'</span> '; } |
|
238 | + if (isset($_GET['start_date']) && $_GET['start_date'] == "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date ending at:").' <span>'.$end_date.'</span> '; } |
|
239 | + if (isset($_GET['start_date']) && $_GET['start_date'] != "" && isset($_GET['end_date']) && $_GET['end_date'] != "") { print _("Date between:").' <span>'.$start_date.'</span> and <span>'.$end_date.'</span> '; } |
|
240 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == "") { print _("Altitude starting at:").' <span>'.number_format($lowest_altitude).' feet</span> '; } |
|
241 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude ending at:").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
242 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] != "" && isset($_GET['highest_altitude']) && $_GET['highest_altitude'] != "") { print _("Altitude between:").' <span>'.number_format($lowest_altitude).' feet</span> '._("and").' <span>'.number_format($highest_altitude).' feet</span> '; } |
|
243 | + if (isset($_GET['number_results']) && $_GET['number_results'] != "") { print _("limit per page:").' <span>'.$number_results.'</span> '; } |
|
244 | 244 | print '</h1>'; |
245 | 245 | print '</div>'; |
246 | 246 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | </select> |
375 | 375 | </div> |
376 | 376 | </div> |
377 | - <script type="text/javascript">getSelect('manufacturer','<?php if(isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
377 | + <script type="text/javascript">getSelect('manufacturer','<?php if (isset($_GET['manufacturer'])) print $manufacturer; ?>')</script> |
|
378 | 378 | <div class="form-group"> |
379 | 379 | <label class="control-label col-sm-2"><?php echo _("Type"); ?></label> |
380 | 380 | <div class="col-sm-10"> |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | </select> |
384 | 384 | </div> |
385 | 385 | </div> |
386 | - <script type="text/javascript">getSelect('aircrafttypes','<?php if(isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
386 | + <script type="text/javascript">getSelect('aircrafttypes','<?php if (isset($_GET['aircraft_icao'])) print $aircraft_icao; ?>');</script> |
|
387 | 387 | <div class="form-group"> |
388 | 388 | <label class="control-label col-sm-2"><?php echo _("Registration"); ?></label> |
389 | 389 | <div class="col-sm-10"> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | </div> |
407 | 407 | </div> |
408 | 408 | <?php |
409 | - }else { |
|
409 | + } else { |
|
410 | 410 | ?> |
411 | 411 | <div class="form-group"> |
412 | 412 | <label class="control-label col-sm-2"><?php echo _("Owner name"); ?></label> |
@@ -419,8 +419,8 @@ discard block |
||
419 | 419 | ?> |
420 | 420 | <div class="form-group"> |
421 | 421 | <div class="col-sm-offset-2 col-sm-10"> |
422 | - <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | - <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true"){ print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
422 | + <!--<div><input type="checkbox" class="form-control" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <label for="highlights"><?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label></div>--> |
|
423 | + <label class="checkbox-inline"><input type="checkbox" name="highlights" value="true" id="highlights" <?php if (isset($_GET['highlights'])) if ($_GET['highlights'] == "true") { print 'checked="checked"'; } ?>> <?php echo _("Include only aircraft with special highlights (unique liveries, destinations etc.)"); ?></label> |
|
424 | 424 | </div> |
425 | 425 | </div> |
426 | 426 | </fieldset> |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | </select> |
435 | 435 | </div> |
436 | 436 | </div> |
437 | - <script type="text/javascript">getSelect('airlinenames','<?php if(isset($_GET['airline'])) print $airline; ?>');</script> |
|
437 | + <script type="text/javascript">getSelect('airlinenames','<?php if (isset($_GET['airline'])) print $airline; ?>');</script> |
|
438 | 438 | <div class="form-group"> |
439 | 439 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
440 | 440 | <div class="col-sm-10"> |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | </select> |
444 | 444 | </div> |
445 | 445 | </div> |
446 | - <script type="text/javascript">getSelect('airlinecountries','<?php if(isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
446 | + <script type="text/javascript">getSelect('airlinecountries','<?php if (isset($_GET['airline_country'])) print $airline_country; ?>');</script> |
|
447 | 447 | <div class="form-group"> |
448 | 448 | <label class="control-label col-sm-2"><?php echo _("Callsign"); ?></label> |
449 | 449 | <div class="col-sm-10"> |
@@ -452,10 +452,10 @@ discard block |
||
452 | 452 | </div> |
453 | 453 | <div class="form-group"> |
454 | 454 | <div class="col-sm-offset-2 col-sm-10"> |
455 | - <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all"){ print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
456 | - <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger"){ print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | - <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "cargo"){ print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | - <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ( $_GET['airline_type'] == "military"){ print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
455 | + <label class="radio-inline"><input type="radio" name="airline_type" value="all" id="airline_type_all" <?php if (!isset($_GET['airline_type']) || $_GET['airline_type'] == "all") { print 'checked="checked"'; } ?>> <?php echo _("All airlines types"); ?></label> |
|
456 | + <label class="radio-inline"><input type="radio" name="airline_type" value="passenger" id="airline_type_passenger" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "passenger") { print 'checked="checked"'; } ?>> <?php echo _("Only Passenger airlines"); ?></label> |
|
457 | + <label class="radio-inline"><input type="radio" name="airline_type" value="cargo" id="airline_type_cargo" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "cargo") { print 'checked="checked"'; } ?>> <?php echo _("Only Cargo airlines"); ?></label> |
|
458 | + <label class="radio-inline"><input type="radio" name="airline_type" value="military" id="airline_type_military" <?php if (isset($_GET['airline_type'])) if ($_GET['airline_type'] == "military") { print 'checked="checked"'; } ?>> <?php echo _("Only Military airlines"); ?></label> |
|
459 | 459 | </div> |
460 | 460 | </div> |
461 | 461 | </fieldset> |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | </select> |
470 | 470 | </div> |
471 | 471 | </div> |
472 | - <script type="text/javascript">getSelect('airportnames','<?php if(isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
472 | + <script type="text/javascript">getSelect('airportnames','<?php if (isset($_GET['airport_icao'])) print $airport_icao; ?>');</script> |
|
473 | 473 | <div class="form-group"> |
474 | 474 | <label class="control-label col-sm-2"><?php echo _("Country"); ?></label> |
475 | 475 | <div class="col-sm-10"> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | </select> |
479 | 479 | </div> |
480 | 480 | </div> |
481 | - <script type="text/javascript">getSelect('airportcountries','<?php if(isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
481 | + <script type="text/javascript">getSelect('airportcountries','<?php if (isset($_GET['airport_country'])) print $airport_country; ?>');</script> |
|
482 | 482 | </fieldset> |
483 | 483 | <fieldset> |
484 | 484 | <legend><?php echo _("Route"); ?></legend> |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | </select> |
491 | 491 | </div> |
492 | 492 | </div> |
493 | - <script type="text/javascript">getSelect('departureairportnames','<?php if(isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
493 | + <script type="text/javascript">getSelect('departureairportnames','<?php if (isset($_GET['departure_airport_route'])) print $departure_airport_route; ?>');</script> |
|
494 | 494 | <div class="form-group"> |
495 | 495 | <label class="control-label col-sm-2"><?php echo _("Arrival Airport"); ?></label> |
496 | 496 | <div class="col-sm-10"> |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | </select> |
500 | 500 | </div> |
501 | 501 | </div> |
502 | - <script type="text/javascript">getSelect('arrivalairportnames','<?php if(isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
502 | + <script type="text/javascript">getSelect('arrivalairportnames','<?php if (isset($_GET['arrival_airport_route'])) print $arrival_airport_route; ?>');</script> |
|
503 | 503 | </fieldset> |
504 | 504 | <fieldset> |
505 | 505 | <legend>Altitude</legend> |
@@ -510,9 +510,9 @@ discard block |
||
510 | 510 | <option></option> |
511 | 511 | <?php |
512 | 512 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
513 | -foreach($altitude_array as $altitude) |
|
513 | +foreach ($altitude_array as $altitude) |
|
514 | 514 | { |
515 | - if(isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
515 | + if (isset($_GET['lowest_altitude']) && $_GET['lowest_altitude'] == $altitude) |
|
516 | 516 | { |
517 | 517 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
518 | 518 | } else { |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | <option></option> |
531 | 531 | <?php |
532 | 532 | $altitude_array = Array(1000, 5000, 10000, 15000, 20000, 25000, 30000, 35000, 40000, 45000, 50000); |
533 | - foreach($altitude_array as $altitude) |
|
533 | + foreach ($altitude_array as $altitude) |
|
534 | 534 | { |
535 | - if(isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
535 | + if (isset($_GET['highest_altitude']) && $_GET['highest_altitude'] == $altitude) |
|
536 | 536 | { |
537 | 537 | print '<option value="'.$altitude.'" selected="selected">'.number_format($altitude).' feet</option>'; |
538 | 538 | } else { |
@@ -655,10 +655,10 @@ discard block |
||
655 | 655 | <div class="col-sm-10"> |
656 | 656 | <select class="form-control" name="number_results"> |
657 | 657 | <?php |
658 | -$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
659 | -foreach($number_results_array as $number) |
|
658 | +$number_results_array = Array(25, 50, 100, 150, 200, 250, 300, 400, 500, 600, 700, 800, 900, 1000); |
|
659 | +foreach ($number_results_array as $number) |
|
660 | 660 | { |
661 | - if(isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
661 | + if (isset($_GET['number_results']) && $_GET['number_results'] == $number) |
|
662 | 662 | { |
663 | 663 | print '<option value="'.$number.'" selected="selected">'.$number.'</option>'; |
664 | 664 | } else { |
@@ -677,7 +677,7 @@ discard block |
||
677 | 677 | <fieldset> |
678 | 678 | <div class="form-group"> |
679 | 679 | <div class="col-sm-offset-2 col-sm-10"> |
680 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
680 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" disabled /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
681 | 681 | <p class="help-block">Disabled in demo</p> |
682 | 682 | </div> |
683 | 683 | </div> |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | <fieldset> |
689 | 689 | <div class="form-group"> |
690 | 690 | <div class="col-sm-offset-2 col-sm-10"> |
691 | - <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"),$globalArchiveKeepMonths); ?></label> |
|
691 | + <label class="checkbox-inline"><input type="checkbox" name="archive" value="1" /><?php echo sprintf(_("Search in archive (older than %s months)"), $globalArchiveKeepMonths); ?></label> |
|
692 | 692 | </div> |
693 | 693 | </div> |
694 | 694 | </fieldset> |
@@ -27,21 +27,30 @@ discard block |
||
27 | 27 | |
28 | 28 | document.cookie = 'MapFormat=3d; expires=Thu, 2 Aug 2100 20:47:11 UTC; path=/' |
29 | 29 | <?php |
30 | - if (isset($_COOKIE['MapType3D'])) $MapType = $_COOKIE['MapType3D']; |
|
31 | - else $MapType = $globalMapProvider; |
|
32 | -// unset($_COOKIE['MapType']); |
|
30 | + if (isset($_COOKIE['MapType3D'])) { |
|
31 | + $MapType = $_COOKIE['MapType3D']; |
|
32 | + } else { |
|
33 | + $MapType = $globalMapProvider; |
|
34 | + } |
|
35 | + // unset($_COOKIE['MapType']); |
|
33 | 36 | |
34 | 37 | if ($MapType != 'Mapbox' && $MapType != 'OpenStreetMap' && $MapType != 'Bing-Aerial' && $MapType != 'Bing-Hybrid' && $MapType != 'Bing-Road' && $MapType != 'offline' && $MapType != 'ArcGIS-Streetmap' && $MapType != 'ArcGIS-Satellite' && $MapType != 'NatGeo-Street') { |
35 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') $MapType = 'Bing-Aerial'; |
|
36 | - else $MapType = 'OpenStreetMap'; |
|
38 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
39 | + $MapType = 'Bing-Aerial'; |
|
40 | + } else { |
|
41 | + $MapType = 'OpenStreetMap'; |
|
42 | + } |
|
37 | 43 | } |
38 | 44 | if (($MapType == 'Bing-Aerial' || $MapType == 'Bing-Hybrid' || $MapType == 'Bing-Road') && (!isset($globalBingMapKey) || $globalBingMapKey == '')) { |
39 | 45 | $MapType = 'OpenStreetMap'; |
40 | 46 | } |
41 | 47 | if ($MapType == 'Mapbox') { |
42 | - if ($_COOKIE['MapTypeId'] == 'default') $MapBoxId = $globalMapboxId; |
|
43 | - else $MapBoxId = $_COOKIE['MapType3DId']; |
|
44 | -?> |
|
48 | + if ($_COOKIE['MapTypeId'] == 'default') { |
|
49 | + $MapBoxId = $globalMapboxId; |
|
50 | + } else { |
|
51 | + $MapBoxId = $_COOKIE['MapType3DId']; |
|
52 | + } |
|
53 | + ?> |
|
45 | 54 | var imProv = Cesium.MapboxImageryProvider({ |
46 | 55 | credit: 'Map data © OpenStreetMap contributors, ' + |
47 | 56 | 'CC-BY-SA, ' + |
@@ -108,13 +117,23 @@ discard block |
||
108 | 117 | credit : 'Imagery courtesy Natural Earth' |
109 | 118 | }); |
110 | 119 | <?php |
111 | - } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
120 | + } elseif (isset($globalMapCustomLayer[$MapType])) { |
|
112 | 121 | $customid = $MapType; |
113 | 122 | ?> |
114 | 123 | var imProv = Cesium.createOpenStreetMapImageryProvider({ |
115 | 124 | url : '<?php print $globalMapCustomLayer[$customid]['url']; ?>', |
116 | - maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) print $globalMapCustomLayer[$customid]['maxZoom']; else print '99'; ?>, |
|
117 | - minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) print $globalMapCustomLayer[$customid]['minZoom']; else print '0'; ?>, |
|
125 | + maximumLevel: <?php if (isset($globalMapCustomLayer[$customid]['maxZoom'])) { |
|
126 | + print $globalMapCustomLayer[$customid]['maxZoom']; |
|
127 | +} else { |
|
128 | + print '99'; |
|
129 | +} |
|
130 | +?>, |
|
131 | + minimumLevel: <?php if (isset($globalMapCustomLayer[$customid]['minZoom'])) { |
|
132 | + print $globalMapCustomLayer[$customid]['minZoom']; |
|
133 | +} else { |
|
134 | + print '0'; |
|
135 | +} |
|
136 | +?>, |
|
118 | 137 | credit: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
119 | 138 | }); |
120 | 139 | <?php |
@@ -506,7 +525,12 @@ discard block |
||
506 | 525 | imageryProvider : imProv, |
507 | 526 | timeline : archive, |
508 | 527 | animation : false, |
509 | - shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) print 'false'; else print 'true'; ?>, |
|
528 | + shadows : <?php if ((isset($globalMap3DShadows) && $globalMap3DShadows === FALSE) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'true')) { |
|
529 | + print 'false'; |
|
530 | +} else { |
|
531 | + print 'true'; |
|
532 | +} |
|
533 | +?>, |
|
510 | 534 | infoBox : false, |
511 | 535 | navigationHelpButton : false, |
512 | 536 | geocoder : false, |
@@ -521,8 +545,11 @@ discard block |
||
521 | 545 | if (isset($_COOKIE['lastcentercoord']) || (isset($globalCenterLatitude) && isset($globalCenterLongitude) && $globalCenterLatitude != '' && $globalCenterLongitude != '')) { |
522 | 546 | if (isset($_COOKIE['lastcentercoord'])) { |
523 | 547 | $lastcentercoord = explode(',',$_COOKIE['lastcentercoord']); |
524 | - if (!isset($lastcentercoord[3])) $zoom = $lastcentercoord[2]*1000000.0; |
|
525 | - else $zoom = $lastcentercoord[3]; |
|
548 | + if (!isset($lastcentercoord[3])) { |
|
549 | + $zoom = $lastcentercoord[2]*1000000.0; |
|
550 | + } else { |
|
551 | + $zoom = $lastcentercoord[3]; |
|
552 | + } |
|
526 | 553 | $viewcenterlatitude = $lastcentercoord[0]; |
527 | 554 | $viewcenterlongitude = $lastcentercoord[1]; |
528 | 555 | } else { |
@@ -642,7 +669,12 @@ discard block |
||
642 | 669 | ?> |
643 | 670 | |
644 | 671 | update_locationsLayer(); |
645 | -setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) print $globalMapRefresh*1000*2; else print '60000'; ?>); |
|
672 | +setInterval(function(){update_locationsLayer()},<?php if (isset($globalMapRefresh)) { |
|
673 | + print $globalMapRefresh*1000*2; |
|
674 | +} else { |
|
675 | + print '60000'; |
|
676 | +} |
|
677 | +?>); |
|
646 | 678 | |
647 | 679 | var currentposition; |
648 | 680 | viewer.camera.moveEnd.addEventListener(function() { |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $Connection = new Connection(); |
69 | 69 | $sth = $Connection->db->prepare($query); |
70 | 70 | $sth->execute(); |
71 | - } catch(PDOException $e) { |
|
71 | + } catch (PDOException $e) { |
|
72 | 72 | return "error : ".$e->getMessage(); |
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $Connection = new Connection(); |
88 | 88 | $sth = $Connection->db->prepare($query); |
89 | 89 | $sth->execute(); |
90 | - } catch(PDOException $e) { |
|
90 | + } catch (PDOException $e) { |
|
91 | 91 | return "error : ".$e->getMessage(); |
92 | 92 | } |
93 | 93 | } |
@@ -100,9 +100,9 @@ discard block |
||
100 | 100 | public function parse($data) { |
101 | 101 | //$data = str_replace(array('\n','\r','\r','\n'),'',$data); |
102 | 102 | $codes = implode('|', array_keys($this->texts)); |
103 | - $regWeather = '#^(\+|\-|VC)?(' . $codes . ')(' . $codes . ')?$#'; |
|
103 | + $regWeather = '#^(\+|\-|VC)?('.$codes.')('.$codes.')?$#'; |
|
104 | 104 | //$pieces = explode(' ',$data); |
105 | - $pieces = preg_split('/\s/',$data); |
|
105 | + $pieces = preg_split('/\s/', $data); |
|
106 | 106 | $pos = 0; |
107 | 107 | if ($pieces[0] == 'METAR') $pos++; |
108 | 108 | elseif ($pieces[0] == 'SPECI') $pos++; |
@@ -112,25 +112,25 @@ discard block |
||
112 | 112 | $result['location'] = $pieces[$pos]; |
113 | 113 | $pos++; |
114 | 114 | if (!isset($pieces[$pos])) return $result; |
115 | - $result['dayofmonth'] = substr($pieces[$pos],0,2); |
|
116 | - $result['time'] = substr($pieces[$pos],2,4); |
|
115 | + $result['dayofmonth'] = substr($pieces[$pos], 0, 2); |
|
116 | + $result['time'] = substr($pieces[$pos], 2, 4); |
|
117 | 117 | $c = count($pieces); |
118 | - for($pos++; $pos < $c; $pos++) { |
|
118 | + for ($pos++; $pos < $c; $pos++) { |
|
119 | 119 | $piece = $pieces[$pos]; |
120 | 120 | if ($piece == 'RMK') break; |
121 | 121 | if ($piece == 'AUTO') $result['auto'] = true; |
122 | 122 | if ($piece == 'COR') $result['correction'] = true; |
123 | 123 | // Wind Speed |
124 | 124 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | - $result['wind']['direction'] = (float)$matches[1]; |
|
125 | + $result['wind']['direction'] = (float) $matches[1]; |
|
126 | 126 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
130 | - $result['wind']['gust'] = (float)$matches[3]; |
|
127 | + if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float) $matches[2])*0.51444444444, 2); |
|
128 | + elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float) $matches[2])*1000, 2); |
|
129 | + elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float) $matches[2]), 2); |
|
130 | + $result['wind']['gust'] = (float) $matches[3]; |
|
131 | 131 | $result['wind']['unit'] = $matches[4]; |
132 | - $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
|
133 | - $result['wind']['max_variation'] = array_key_exists(6,$matches) ? $matches[6] : 0; |
|
132 | + $result['wind']['min_variation'] = array_key_exists(5, $matches) ? $matches[5] : 0; |
|
133 | + $result['wind']['max_variation'] = array_key_exists(6, $matches) ? $matches[6] : 0; |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | /* if (preg_match('#^([0-9]{3})([0-9]{2})(G([0-9]{2}))?(KT|MPS)$#', $piece, $matches)) { |
@@ -151,17 +151,17 @@ discard block |
||
151 | 151 | |
152 | 152 | // Temperature |
153 | 153 | if (preg_match('#^(M?[0-9]{2,})/(M?[0-9]{2,})$#', $piece, $matches)) { |
154 | - $temp = (float)$matches[1]; |
|
154 | + $temp = (float) $matches[1]; |
|
155 | 155 | if ($matches[1]{0} == 'M') { |
156 | - $temp = ((float)substr($matches[1], 1)) * -1; |
|
156 | + $temp = ((float) substr($matches[1], 1))*-1; |
|
157 | 157 | } |
158 | 158 | $result['temperature'] = $temp; |
159 | - $dew = (float)$matches[2]; |
|
159 | + $dew = (float) $matches[2]; |
|
160 | 160 | if ($matches[2]{0} == 'M') { |
161 | - $dew = ((float)substr($matches[2], 1)) * -1; |
|
161 | + $dew = ((float) substr($matches[2], 1))*-1; |
|
162 | 162 | } |
163 | 163 | $result['dew'] = $dew; |
164 | - $result['rh'] = round(100*(exp((17.625*$dew)/(243.04+$dew))/exp((17.625*$temp)/(243.04+$temp)))); |
|
164 | + $result['rh'] = round(100*(exp((17.625*$dew)/(243.04 + $dew))/exp((17.625*$temp)/(243.04 + $temp)))); |
|
165 | 165 | } |
166 | 166 | // QNH |
167 | 167 | if (preg_match('#^(A|Q)([0-9]{4})$#', $piece, $matches)) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $result['QNH'] = $matches[2]; |
172 | 172 | } else { |
173 | 173 | // inHg |
174 | - $result['QNH'] = round(($matches[2] / 100)*33.86389,2); |
|
174 | + $result['QNH'] = round(($matches[2]/100)*33.86389, 2); |
|
175 | 175 | } |
176 | 176 | /* |
177 | 177 | $result['QNH'] = $matches[1] == 'Q' ? $matches[2] : ($matches[2] / 100); |
@@ -192,12 +192,12 @@ discard block |
||
192 | 192 | // Visibility |
193 | 193 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
194 | 194 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
195 | - $result['visibility'] = (float)$matches[3] * 1609.34; |
|
195 | + $result['visibility'] = (float) $matches[3]*1609.34; |
|
196 | 196 | } else { |
197 | 197 | if ($matches[1] == '9999') { |
198 | 198 | $result['visibility'] = '> 10000'; |
199 | 199 | } else { |
200 | - $result['visibility'] = (float)$matches[1]; |
|
200 | + $result['visibility'] = (float) $matches[1]; |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | if (preg_match('#^CAVOK$#', $piece, $matches)) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
220 | 220 | elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
221 | 221 | $cloud['type_code'] = $type; |
222 | - $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
|
222 | + $cloud['level'] = round(((float) $matches[2])*100*0.3048); |
|
223 | 223 | if (isset($matches[3])) $significant = $matches[3]; |
224 | 224 | else $significant = ''; |
225 | 225 | if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | $rvr['runway'] = $matches[1]; |
241 | 241 | $rvr['assessment'] = $matches[2]; |
242 | 242 | $rvr['rvr'] = $matches[3]; |
243 | - $rvr['rvr_max'] = array_key_exists(4,$matches) ? $matches[4] : 0; |
|
244 | - $rvr['unit'] = array_key_exists(5,$matches) ? $matches[5] : ''; |
|
243 | + $rvr['rvr_max'] = array_key_exists(4, $matches) ? $matches[4] : 0; |
|
244 | + $rvr['unit'] = array_key_exists(5, $matches) ? $matches[5] : ''; |
|
245 | 245 | $result['RVR'] = $rvr; |
246 | 246 | } |
247 | 247 | //if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
@@ -254,12 +254,12 @@ discard block |
||
254 | 254 | $result['RVR']['friction'] = $matches[5]; |
255 | 255 | } |
256 | 256 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
257 | + if (isset($matches[5])) $range = array('exact' => (float) $matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | + else $range = array('exact' => (float) $matches[2], 'unit' => 'M'); |
|
259 | 259 | if (isset($matches[3])) { |
260 | 260 | $range = Array( |
261 | - 'from' => (float)$matches[2], |
|
262 | - 'to' => (float)$matches[4], |
|
261 | + 'from' => (float) $matches[2], |
|
262 | + 'to' => (float) $matches[4], |
|
263 | 263 | 'unit' => $matches[5] ? 'FT' : 'M' |
264 | 264 | ); |
265 | 265 | } |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | try { |
313 | 313 | $sth = $this->db->prepare($query); |
314 | 314 | $sth->execute($query_values); |
315 | - } catch(PDOException $e) { |
|
315 | + } catch (PDOException $e) { |
|
316 | 316 | return "error : ".$e->getMessage(); |
317 | 317 | } |
318 | 318 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -328,19 +328,19 @@ discard block |
||
328 | 328 | * @param String $metar METAR text |
329 | 329 | * @param String $date date of the METAR |
330 | 330 | */ |
331 | - public function addMETAR($location,$metar,$date) { |
|
331 | + public function addMETAR($location, $metar, $date) { |
|
332 | 332 | global $globalDBdriver; |
333 | - $date = date('Y-m-d H:i:s',strtotime($date)); |
|
333 | + $date = date('Y-m-d H:i:s', strtotime($date)); |
|
334 | 334 | if ($globalDBdriver == 'mysql') { |
335 | 335 | $query = "INSERT INTO metar (metar_location,metar_date,metar) VALUES (:location,:date,:metar) ON DUPLICATE KEY UPDATE metar_date = :date, metar = :metar"; |
336 | 336 | } else { |
337 | 337 | $query = "UPDATE metar SET metar_date = :date, metar = :metar WHERE metar_location = :location;INSERT INTO metar (metar_location,metar_date,metar) SELECT :location,:date,:metar WHERE NOT EXISTS (SELECT 1 FROM metar WHERE metar_location = :location);"; |
338 | 338 | } |
339 | - $query_values = array(':location' => $location,':date' => $date,':metar' => utf8_encode($metar)); |
|
339 | + $query_values = array(':location' => $location, ':date' => $date, ':metar' => utf8_encode($metar)); |
|
340 | 340 | try { |
341 | 341 | $sth = $this->db->prepare($query); |
342 | 342 | $sth->execute($query_values); |
343 | - } catch(PDOException $e) { |
|
343 | + } catch (PDOException $e) { |
|
344 | 344 | return "error : ".$e->getMessage(); |
345 | 345 | } |
346 | 346 | } |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | try { |
356 | 356 | $sth = $this->db->prepare($query); |
357 | 357 | $sth->execute($query_values); |
358 | - } catch(PDOException $e) { |
|
358 | + } catch (PDOException $e) { |
|
359 | 359 | return "error : ".$e->getMessage(); |
360 | 360 | } |
361 | 361 | } |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | try { |
369 | 369 | $sth = $this->db->prepare($query); |
370 | 370 | $sth->execute(); |
371 | - } catch(PDOException $e) { |
|
371 | + } catch (PDOException $e) { |
|
372 | 372 | return "error : ".$e->getMessage(); |
373 | 373 | } |
374 | 374 | } |
@@ -382,29 +382,29 @@ discard block |
||
382 | 382 | date_default_timezone_set("UTC"); |
383 | 383 | $Common = new Common(); |
384 | 384 | if (isset($globalIVAO) && $globalIVAO) { |
385 | - $Common->download('http://wx.ivao.aero/metar.php',dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
386 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt',"r"); |
|
385 | + $Common->download('http://wx.ivao.aero/metar.php', dirname(__FILE__).'/../install/tmp/ivaometar.txt'); |
|
386 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/ivaometar.txt', "r"); |
|
387 | 387 | } else { |
388 | - $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT',dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
389 | - $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
|
388 | + $Common->download('http://tgftp.nws.noaa.gov/data/observations/metar/cycles/'.date('H').'Z.TXT', dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT'); |
|
389 | + $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT', "r"); |
|
390 | 390 | } |
391 | 391 | if ($handle) { |
392 | 392 | if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
393 | 393 | $date = ''; |
394 | 394 | if ($globalTransaction) $this->db->beginTransaction(); |
395 | - while(($line = fgets($handle,4096)) !== false) { |
|
396 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
397 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
395 | + while (($line = fgets($handle, 4096)) !== false) { |
|
396 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
397 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
398 | 398 | $date = $line; |
399 | 399 | } elseif (trim($line) != '') { |
400 | 400 | if ($date == '') $date = date('Y/m/d H:m'); |
401 | 401 | $pos = 0; |
402 | - $pieces = preg_split('/\s/',$line); |
|
402 | + $pieces = preg_split('/\s/', $line); |
|
403 | 403 | if ($pieces[0] == 'METAR') $pos++; |
404 | 404 | if (strlen($pieces[$pos]) != 4) $pos++; |
405 | 405 | $location = $pieces[$pos]; |
406 | 406 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | - echo $this->addMETAR($location,$line,$date); |
|
407 | + echo $this->addMETAR($location, $line, $date); |
|
408 | 408 | } |
409 | 409 | } |
410 | 410 | fclose($handle); |
@@ -423,23 +423,23 @@ discard block |
||
423 | 423 | if ($globalMETARurl == '') return array(); |
424 | 424 | date_default_timezone_set("UTC"); |
425 | 425 | $Common = new Common(); |
426 | - $url = str_replace('{icao}',$icao,$globalMETARurl); |
|
426 | + $url = str_replace('{icao}', $icao, $globalMETARurl); |
|
427 | 427 | $cycle = $Common->getData($url); |
428 | 428 | $date = ''; |
429 | - foreach(explode("\n",$cycle) as $line) { |
|
430 | - $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
|
431 | - if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
|
429 | + foreach (explode("\n", $cycle) as $line) { |
|
430 | + $line = str_replace(array("\r\n", "\r", "\n"), '', $line); |
|
431 | + if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#', $line)) { |
|
432 | 432 | $date = $line; |
433 | 433 | } |
434 | 434 | if (trim($line) != '') { |
435 | 435 | if ($date == '') $date = date('Y/m/d H:m'); |
436 | 436 | $pos = 0; |
437 | - $pieces = preg_split('/\s/',$line); |
|
437 | + $pieces = preg_split('/\s/', $line); |
|
438 | 438 | if ($pieces[0] == 'METAR') $pos++; |
439 | 439 | if (strlen($pieces[$pos]) != 4) $pos++; |
440 | 440 | $location = $pieces[$pos]; |
441 | 441 | if (strlen($location == 4)) { |
442 | - $this->addMETAR($location,$line,$date); |
|
442 | + $this->addMETAR($location, $line, $date); |
|
443 | 443 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | 444 | } else return array(); |
445 | 445 | } |
@@ -73,8 +73,11 @@ discard block |
||
73 | 73 | } |
74 | 74 | $row = $sth->fetch(PDO::FETCH_ASSOC); |
75 | 75 | $sth->closeCursor(); |
76 | - if ($row['nb'] > 0) return false; |
|
77 | - else return true; |
|
76 | + if ($row['nb'] > 0) { |
|
77 | + return false; |
|
78 | + } else { |
|
79 | + return true; |
|
80 | + } |
|
78 | 81 | } |
79 | 82 | |
80 | 83 | /* |
@@ -104,29 +107,48 @@ discard block |
||
104 | 107 | //$pieces = explode(' ',$data); |
105 | 108 | $pieces = preg_split('/\s/',$data); |
106 | 109 | $pos = 0; |
107 | - if ($pieces[0] == 'METAR') $pos++; |
|
108 | - elseif ($pieces[0] == 'SPECI') $pos++; |
|
109 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
110 | + if ($pieces[0] == 'METAR') { |
|
111 | + $pos++; |
|
112 | + } elseif ($pieces[0] == 'SPECI') { |
|
113 | + $pos++; |
|
114 | + } |
|
115 | + if (strlen($pieces[$pos]) != 4) { |
|
116 | + $pos++; |
|
117 | + } |
|
110 | 118 | $result = array(); |
111 | - if (!isset($pieces[$pos])) return $result; |
|
119 | + if (!isset($pieces[$pos])) { |
|
120 | + return $result; |
|
121 | + } |
|
112 | 122 | $result['location'] = $pieces[$pos]; |
113 | 123 | $pos++; |
114 | - if (!isset($pieces[$pos])) return $result; |
|
124 | + if (!isset($pieces[$pos])) { |
|
125 | + return $result; |
|
126 | + } |
|
115 | 127 | $result['dayofmonth'] = substr($pieces[$pos],0,2); |
116 | 128 | $result['time'] = substr($pieces[$pos],2,4); |
117 | 129 | $c = count($pieces); |
118 | 130 | for($pos++; $pos < $c; $pos++) { |
119 | 131 | $piece = $pieces[$pos]; |
120 | - if ($piece == 'RMK') break; |
|
121 | - if ($piece == 'AUTO') $result['auto'] = true; |
|
122 | - if ($piece == 'COR') $result['correction'] = true; |
|
132 | + if ($piece == 'RMK') { |
|
133 | + break; |
|
134 | + } |
|
135 | + if ($piece == 'AUTO') { |
|
136 | + $result['auto'] = true; |
|
137 | + } |
|
138 | + if ($piece == 'COR') { |
|
139 | + $result['correction'] = true; |
|
140 | + } |
|
123 | 141 | // Wind Speed |
124 | 142 | if (preg_match('#(VRB|\d\d\d)(\d\d)(?:G(\d\d))?(KT|MPS|KPH)(?: (\d{1,3})V(\d{1,3}))?$#', $piece, $matches)) { |
125 | 143 | $result['wind']['direction'] = (float)$matches[1]; |
126 | 144 | $result['wind']['unit'] = $matches[4]; |
127 | - if ($result['wind']['unit'] == 'KT') $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
128 | - elseif ($result['wind']['unit'] == 'KPH') $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
129 | - elseif ($result['wind']['unit'] == 'MPS') $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
145 | + if ($result['wind']['unit'] == 'KT') { |
|
146 | + $result['wind']['speed'] = round(((float)$matches[2])*0.51444444444,2); |
|
147 | + } elseif ($result['wind']['unit'] == 'KPH') { |
|
148 | + $result['wind']['speed'] = round(((float)$matches[2])*1000,2); |
|
149 | + } elseif ($result['wind']['unit'] == 'MPS') { |
|
150 | + $result['wind']['speed'] = round(((float)$matches[2]),2); |
|
151 | + } |
|
130 | 152 | $result['wind']['gust'] = (float)$matches[3]; |
131 | 153 | $result['wind']['unit'] = $matches[4]; |
132 | 154 | $result['wind']['min_variation'] = array_key_exists(5,$matches) ? $matches[5] : 0; |
@@ -210,27 +232,49 @@ discard block |
||
210 | 232 | //$this->addCloudCover($matches[1], ((float)$matches[2]) * 100, isset($matches[3]) ? $matches[3] : ''); |
211 | 233 | $type = $matches[1]; |
212 | 234 | $cloud = array(); |
213 | - if ($type == 'SKC') $cloud['type'] = 'No cloud/Sky clear'; |
|
214 | - elseif ($type == 'CLR') $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
215 | - elseif ($type == 'NSC') $cloud['type'] = 'No significant cloud'; |
|
216 | - elseif ($type == 'FEW') $cloud['type'] = 'Few'; |
|
217 | - elseif ($type == 'SCT') $cloud['type'] = 'Scattered'; |
|
218 | - elseif ($type == 'BKN') $cloud['type'] = 'Broken'; |
|
219 | - elseif ($type == 'OVC') $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
220 | - elseif ($type == 'VV') $cloud['type'] = 'Vertical visibility'; |
|
235 | + if ($type == 'SKC') { |
|
236 | + $cloud['type'] = 'No cloud/Sky clear'; |
|
237 | + } elseif ($type == 'CLR') { |
|
238 | + $cloud['type'] = 'No cloud below 12,000ft (3700m)'; |
|
239 | + } elseif ($type == 'NSC') { |
|
240 | + $cloud['type'] = 'No significant cloud'; |
|
241 | + } elseif ($type == 'FEW') { |
|
242 | + $cloud['type'] = 'Few'; |
|
243 | + } elseif ($type == 'SCT') { |
|
244 | + $cloud['type'] = 'Scattered'; |
|
245 | + } elseif ($type == 'BKN') { |
|
246 | + $cloud['type'] = 'Broken'; |
|
247 | + } elseif ($type == 'OVC') { |
|
248 | + $cloud['type'] = 'Overcast/Full cloud coverage'; |
|
249 | + } elseif ($type == 'VV') { |
|
250 | + $cloud['type'] = 'Vertical visibility'; |
|
251 | + } |
|
221 | 252 | $cloud['type_code'] = $type; |
222 | 253 | $cloud['level'] = round(((float)$matches[2]) * 100 * 0.3048); |
223 | - if (isset($matches[3])) $significant = $matches[3]; |
|
224 | - else $significant = ''; |
|
225 | - if ($significant == 'CB') $cloud['significant'] = 'Cumulonimbus'; |
|
226 | - elseif ($significant == 'AC') $cloud['significant'] = 'Altocumulus'; |
|
227 | - elseif ($significant == 'CBS') $cloud['significant'] = 'Cumulonimbus'; |
|
228 | - elseif ($significant == 'CC') $cloud['significant'] = 'Cirrocumulus'; |
|
229 | - elseif ($significant == 'CU') $cloud['significant'] = 'Cumulus'; |
|
230 | - elseif ($significant == 'CI') $cloud['significant'] = 'Cirrus'; |
|
231 | - elseif ($significant == 'CS') $cloud['significant'] = 'Cirrostratus'; |
|
232 | - elseif ($significant == 'TCU') $cloud['significant'] = 'Towering Cumulus'; |
|
233 | - else $cloud['significant'] = $significant; |
|
254 | + if (isset($matches[3])) { |
|
255 | + $significant = $matches[3]; |
|
256 | + } else { |
|
257 | + $significant = ''; |
|
258 | + } |
|
259 | + if ($significant == 'CB') { |
|
260 | + $cloud['significant'] = 'Cumulonimbus'; |
|
261 | + } elseif ($significant == 'AC') { |
|
262 | + $cloud['significant'] = 'Altocumulus'; |
|
263 | + } elseif ($significant == 'CBS') { |
|
264 | + $cloud['significant'] = 'Cumulonimbus'; |
|
265 | + } elseif ($significant == 'CC') { |
|
266 | + $cloud['significant'] = 'Cirrocumulus'; |
|
267 | + } elseif ($significant == 'CU') { |
|
268 | + $cloud['significant'] = 'Cumulus'; |
|
269 | + } elseif ($significant == 'CI') { |
|
270 | + $cloud['significant'] = 'Cirrus'; |
|
271 | + } elseif ($significant == 'CS') { |
|
272 | + $cloud['significant'] = 'Cirrostratus'; |
|
273 | + } elseif ($significant == 'TCU') { |
|
274 | + $cloud['significant'] = 'Towering Cumulus'; |
|
275 | + } else { |
|
276 | + $cloud['significant'] = $significant; |
|
277 | + } |
|
234 | 278 | //$cloud['significant'] = isset($matches[3]) ? $matches[3] : ''; |
235 | 279 | $result['cloud'][] = $cloud; |
236 | 280 | } |
@@ -254,8 +298,11 @@ discard block |
||
254 | 298 | $result['RVR']['friction'] = $matches[5]; |
255 | 299 | } |
256 | 300 | if (preg_match('#^(R[A-Z0-9]{2,3})/([0-9]{4})(V([0-9]{4}))?(FT)?$#', $piece, $matches)) { |
257 | - if (isset($matches[5])) $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
258 | - else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
301 | + if (isset($matches[5])) { |
|
302 | + $range = array('exact' => (float)$matches[2], 'unit' => $matches[5] ? 'FT' : 'M'); |
|
303 | + } else { |
|
304 | + $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
|
305 | + } |
|
259 | 306 | if (isset($matches[3])) { |
260 | 307 | $range = Array( |
261 | 308 | 'from' => (float)$matches[2], |
@@ -288,8 +335,11 @@ discard block |
||
288 | 335 | if (isset($matches[3])) { |
289 | 336 | $text[] = $this->texts[$matches[3]]; |
290 | 337 | } |
291 | - if (!isset($result['weather'])) $result['weather'] = implode(' ', $text); |
|
292 | - else $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
338 | + if (!isset($result['weather'])) { |
|
339 | + $result['weather'] = implode(' ', $text); |
|
340 | + } else { |
|
341 | + $result['weather'] = $result['weather'].' / '.implode(' ', $text); |
|
342 | + } |
|
293 | 343 | } |
294 | 344 | } |
295 | 345 | return $result; |
@@ -305,8 +355,11 @@ discard block |
||
305 | 355 | if (isset($globalMETARcycle) && $globalMETARcycle) { |
306 | 356 | $query = "SELECT * FROM metar WHERE metar_location = :icao"; |
307 | 357 | } else { |
308 | - if ($globalDBdriver == 'mysql') $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
309 | - else $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
358 | + if ($globalDBdriver == 'mysql') { |
|
359 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= DATE_SUB(UTC_TIMESTAMP(), INTERVAL 10 HOUR) LIMIT 1"; |
|
360 | + } else { |
|
361 | + $query = "SELECT * FROM metar WHERE metar_location = :icao AND metar_date >= now() AT TIMEZONE 'UTC' - '10 HOUR'->INTERVAL LIMIT 0,1"; |
|
362 | + } |
|
310 | 363 | } |
311 | 364 | $query_values = array(':icao' => $icao); |
312 | 365 | try { |
@@ -378,7 +431,9 @@ discard block |
||
378 | 431 | */ |
379 | 432 | public function addMETARCycle() { |
380 | 433 | global $globalDebug, $globalIVAO, $globalTransaction; |
381 | - if (isset($globalDebug) && $globalDebug) echo "Downloading METAR cycle..."; |
|
434 | + if (isset($globalDebug) && $globalDebug) { |
|
435 | + echo "Downloading METAR cycle..."; |
|
436 | + } |
|
382 | 437 | date_default_timezone_set("UTC"); |
383 | 438 | $Common = new Common(); |
384 | 439 | if (isset($globalIVAO) && $globalIVAO) { |
@@ -389,28 +444,42 @@ discard block |
||
389 | 444 | $handle = fopen(dirname(__FILE__).'/../install/tmp/'.date('H').'Z.TXT',"r"); |
390 | 445 | } |
391 | 446 | if ($handle) { |
392 | - if (isset($globalDebug) && $globalDebug) echo "Done - Updating DB..."; |
|
447 | + if (isset($globalDebug) && $globalDebug) { |
|
448 | + echo "Done - Updating DB..."; |
|
449 | + } |
|
393 | 450 | $date = ''; |
394 | - if ($globalTransaction) $this->db->beginTransaction(); |
|
451 | + if ($globalTransaction) { |
|
452 | + $this->db->beginTransaction(); |
|
453 | + } |
|
395 | 454 | while(($line = fgets($handle,4096)) !== false) { |
396 | 455 | $line = str_replace(array("\r\n","\r", "\n"), '', $line); |
397 | 456 | if (preg_match('#^([0-9]{4})/([0-9]{2})/([0-9]{2}) ([0-9]{2}):([0-9]{2})$#',$line)) { |
398 | 457 | $date = $line; |
399 | 458 | } elseif (trim($line) != '') { |
400 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
459 | + if ($date == '') { |
|
460 | + $date = date('Y/m/d H:m'); |
|
461 | + } |
|
401 | 462 | $pos = 0; |
402 | 463 | $pieces = preg_split('/\s/',$line); |
403 | - if ($pieces[0] == 'METAR') $pos++; |
|
404 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
464 | + if ($pieces[0] == 'METAR') { |
|
465 | + $pos++; |
|
466 | + } |
|
467 | + if (strlen($pieces[$pos]) != 4) { |
|
468 | + $pos++; |
|
469 | + } |
|
405 | 470 | $location = $pieces[$pos]; |
406 | 471 | //if ($location == 'LFLL') echo 'location: '.$location.' - date: '.$date.' - data: '.$line."\n"; |
407 | 472 | echo $this->addMETAR($location,$line,$date); |
408 | 473 | } |
409 | 474 | } |
410 | 475 | fclose($handle); |
411 | - if ($globalTransaction) $this->db->commit(); |
|
476 | + if ($globalTransaction) { |
|
477 | + $this->db->commit(); |
|
478 | + } |
|
479 | + } |
|
480 | + if (isset($globalDebug) && $globalDebug) { |
|
481 | + echo "Done\n"; |
|
412 | 482 | } |
413 | - if (isset($globalDebug) && $globalDebug) echo "Done\n"; |
|
414 | 483 | } |
415 | 484 | |
416 | 485 | /* |
@@ -420,7 +489,9 @@ discard block |
||
420 | 489 | */ |
421 | 490 | public function downloadMETAR($icao) { |
422 | 491 | global $globalMETARurl; |
423 | - if ($globalMETARurl == '') return array(); |
|
492 | + if ($globalMETARurl == '') { |
|
493 | + return array(); |
|
494 | + } |
|
424 | 495 | date_default_timezone_set("UTC"); |
425 | 496 | $Common = new Common(); |
426 | 497 | $url = str_replace('{icao}',$icao,$globalMETARurl); |
@@ -432,16 +503,24 @@ discard block |
||
432 | 503 | $date = $line; |
433 | 504 | } |
434 | 505 | if (trim($line) != '') { |
435 | - if ($date == '') $date = date('Y/m/d H:m'); |
|
506 | + if ($date == '') { |
|
507 | + $date = date('Y/m/d H:m'); |
|
508 | + } |
|
436 | 509 | $pos = 0; |
437 | 510 | $pieces = preg_split('/\s/',$line); |
438 | - if ($pieces[0] == 'METAR') $pos++; |
|
439 | - if (strlen($pieces[$pos]) != 4) $pos++; |
|
511 | + if ($pieces[0] == 'METAR') { |
|
512 | + $pos++; |
|
513 | + } |
|
514 | + if (strlen($pieces[$pos]) != 4) { |
|
515 | + $pos++; |
|
516 | + } |
|
440 | 517 | $location = $pieces[$pos]; |
441 | 518 | if (strlen($location == 4)) { |
442 | 519 | $this->addMETAR($location,$line,$date); |
443 | 520 | return array('0' => array('metar_date' => $date, 'metar_location' => $location, 'metar' => $line)); |
444 | - } else return array(); |
|
521 | + } else { |
|
522 | + return array(); |
|
523 | + } |
|
445 | 524 | } |
446 | 525 | } |
447 | 526 | return array(); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
8 | 8 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
9 | 9 | */ |
10 | - function buildcloud($lat,$long,$height,$c) { |
|
10 | + function buildcloud($lat, $long, $height, $c) { |
|
11 | 11 | |
12 | 12 | $w = 1000.0; |
13 | 13 | $h = 1000.0; |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | $vdist = 1; |
16 | 16 | |
17 | 17 | $c = 5; |
18 | - $count = ($c + (mt_rand()-0.5)-$c); |
|
19 | - for ($j = 0;$j < $count; $j++) { |
|
18 | + $count = ($c + (mt_rand() - 0.5) - $c); |
|
19 | + for ($j = 0; $j < $count; $j++) { |
|
20 | 20 | $x = 0.0; |
21 | 21 | $y = 0.0; |
22 | 22 | $z = 0.0; |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | for ($k = 0; $k < $vdist; $k++) { |
28 | 28 | $z += (mt_rand()/$vdist); |
29 | 29 | } |
30 | - $x = $w * ($x - 0.5) + $lat; // N/S |
|
31 | - $y = $w * ($y - 0.5) + $long; // E/W |
|
32 | - $z = $h * $z + $height; // Up/Down. pos[2] is the cloudbase |
|
30 | + $x = $w*($x - 0.5) + $lat; // N/S |
|
31 | + $y = $w*($y - 0.5) + $long; // E/W |
|
32 | + $z = $h*$z + $height; // Up/Down. pos[2] is the cloudbase |
|
33 | 33 | // addcloud |
34 | 34 | echo 'x: '.$x.'/y: '.$y.'/z: '.$z."\n"; |
35 | 35 | } |
@@ -38,12 +38,12 @@ discard block |
||
38 | 38 | function buildcloudlayer($metar) { |
39 | 39 | //print_r($metar); |
40 | 40 | $result = array(); |
41 | - foreach($metar['cloud'] as $key => $data) { |
|
41 | + foreach ($metar['cloud'] as $key => $data) { |
|
42 | 42 | $alt_m = $metar['cloud'][$key]['level']; |
43 | 43 | $alt_ft = $alt_m*3.28084; |
44 | 44 | $pressure = $metar['QNH']; |
45 | - $cumulus_base = 122.0 * ($metar['temperature'] - $metar['dew']); |
|
46 | - $stratus_base = 100.0 * (100.0 * $metar['rh'])*0.3048; |
|
45 | + $cumulus_base = 122.0*($metar['temperature'] - $metar['dew']); |
|
46 | + $stratus_base = 100.0*(100.0*$metar['rh'])*0.3048; |
|
47 | 47 | $coverage_norm = 0.0; |
48 | 48 | if ($metar['cloud'][$key]['type'] == 'Few') { |
49 | 49 | $coverage_norm = 2.0/8.0; |
@@ -65,9 +65,9 @@ discard block |
||
65 | 65 | $layer_type = 'ns'; |
66 | 66 | } |
67 | 67 | } else { |
68 | - if ($cumulus_base * 0.80 < $alt_m && $cumulus_base * 1.20 > $alt_m) { |
|
68 | + if ($cumulus_base*0.80 < $alt_m && $cumulus_base*1.20 > $alt_m) { |
|
69 | 69 | $layer_type = 'cu'; |
70 | - } elseif ($stratus_base * 0.80 < $alt_m && $stratus_base * 1.40 > $alt_m) { |
|
70 | + } elseif ($stratus_base*0.80 < $alt_m && $stratus_base*1.40 > $alt_m) { |
|
71 | 71 | $layer_type = 'st'; |
72 | 72 | } else { |
73 | 73 | if ($alt_ft < 2000) { |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | } |
81 | 81 | } |
82 | 82 | //echo 'coverage norm : '.$coverage_norm.' - layer_type: '.$layer_type."\n"; |
83 | - $result[] = array('cov' => $coverage_norm, 'type' => $layer_type,'alt' => $alt_m,'rh' => $metar['rh']); |
|
83 | + $result[] = array('cov' => $coverage_norm, 'type' => $layer_type, 'alt' => $alt_m, 'rh' => $metar['rh']); |
|
84 | 84 | } |
85 | 85 | if (count($result) < 2 && $metar['rh'] > 60) { |
86 | - $result[] = array('cov' => 0.75, 'type' => 'cu','alt' => 4000,'rh' => $metar['rh']); |
|
86 | + $result[] = array('cov' => 0.75, 'type' => 'cu', 'alt' => 4000, 'rh' => $metar['rh']); |
|
87 | 87 | } |
88 | 88 | return $result; |
89 | 89 | } |
90 | 90 | |
91 | - function generateRandomPoint ($latitude,$longitude, $radius) { |
|
91 | + function generateRandomPoint($latitude, $longitude, $radius) { |
|
92 | 92 | $x0 = $longitude; |
93 | 93 | $y0 = $latitude; |
94 | 94 | |
95 | 95 | // Convert Radius from meters to degrees. |
96 | - $rd = $radius / 111300; |
|
97 | - $u = (float)rand()/(float)getrandmax(); |
|
98 | - $v = (float)rand()/(float)getrandmax(); |
|
99 | - $w = $rd * sqrt($u); |
|
100 | - $t = 2 * pi() * $v; |
|
101 | - $x = $w * cos($t); |
|
102 | - $y = $w * sin($t); |
|
103 | - $xp = $x / cos($y0); |
|
104 | - return array('latitude' => $y + $y0,'longitude' => $xp + $x0); |
|
96 | + $rd = $radius/111300; |
|
97 | + $u = (float) rand()/(float) getrandmax(); |
|
98 | + $v = (float) rand()/(float) getrandmax(); |
|
99 | + $w = $rd*sqrt($u); |
|
100 | + $t = 2*pi()*$v; |
|
101 | + $x = $w*cos($t); |
|
102 | + $y = $w*sin($t); |
|
103 | + $xp = $x/cos($y0); |
|
104 | + return array('latitude' => $y + $y0, 'longitude' => $xp + $x0); |
|
105 | 105 | } |
106 | 106 | } |
107 | 107 | /* |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?> |
51 | 51 | </tr></table></div> |
52 | 52 | <?php |
53 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
53 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
54 | 54 | ?> |
55 | 55 | <script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
56 | 56 | <?php |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | <script src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
75 | 75 | <?php |
76 | 76 | } |
77 | - } |
|
77 | + } |
|
78 | 78 | ?> |
79 | 79 | |
80 | 80 | <div id="sidebar" class="sidebar collapsed"> |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | <li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
86 | 86 | <li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
87 | 87 | <?php |
88 | - //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
88 | + //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
89 | 89 | if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) { |
90 | 90 | ?> |
91 | 91 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
92 | 92 | <?php |
93 | 93 | } |
94 | - //} |
|
94 | + //} |
|
95 | 95 | ?> |
96 | 96 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
97 | 97 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | ?> |
106 | 106 | |
107 | 107 | <?php |
108 | - if (isset($globalMap3D) && $globalMap3D) { |
|
108 | + if (isset($globalMap3D) && $globalMap3D) { |
|
109 | 109 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
110 | 110 | ?> |
111 | 111 | <li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | <li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
116 | 116 | <?php |
117 | 117 | } |
118 | - } |
|
118 | + } |
|
119 | 119 | ?> |
120 | 120 | </ul> |
121 | 121 | |
@@ -247,15 +247,15 @@ discard block |
||
247 | 247 | </div> |
248 | 248 | </li> |
249 | 249 | <?php |
250 | - if (isset($globalDemo) && $globalDemo) { |
|
250 | + if (isset($globalDemo) && $globalDemo) { |
|
251 | 251 | ?> |
252 | 252 | <li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li> |
253 | 253 | <?php |
254 | - } else { |
|
254 | + } else { |
|
255 | 255 | ?> |
256 | 256 | <li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li> |
257 | 257 | <?php |
258 | - } |
|
258 | + } |
|
259 | 259 | ?> |
260 | 260 | </ul> |
261 | 261 | <ul> |
@@ -274,82 +274,82 @@ discard block |
||
274 | 274 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
275 | 275 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
276 | 276 | else $MapType = $_COOKIE['MapType']; |
277 | - ?> |
|
277 | + ?> |
|
278 | 278 | <select class="selectpicker" onchange="mapType(this);"> |
279 | 279 | <?php |
280 | 280 | } else { |
281 | 281 | if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
282 | 282 | else $MapType = $_COOKIE['MapType3D']; |
283 | - ?> |
|
283 | + ?> |
|
284 | 284 | <select class="selectpicker" onchange="mapType3D(this);"> |
285 | 285 | <?php |
286 | 286 | } |
287 | - ?> |
|
287 | + ?> |
|
288 | 288 | <?php |
289 | 289 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
290 | - ?> |
|
290 | + ?> |
|
291 | 291 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
292 | 292 | <?php |
293 | 293 | } else { |
294 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
295 | - ?> |
|
294 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
295 | + ?> |
|
296 | 296 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
297 | 297 | <?php |
298 | - } |
|
299 | - ?> |
|
298 | + } |
|
299 | + ?> |
|
300 | 300 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
301 | 301 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
302 | 302 | <?php |
303 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
304 | - ?> |
|
303 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
304 | + ?> |
|
305 | 305 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
306 | 306 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
307 | 307 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
308 | 308 | <?php |
309 | - } |
|
310 | - ?> |
|
309 | + } |
|
310 | + ?> |
|
311 | 311 | <?php |
312 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
313 | - ?> |
|
312 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
313 | + ?> |
|
314 | 314 | <?php |
315 | 315 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
316 | - ?> |
|
316 | + ?> |
|
317 | 317 | <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
318 | 318 | <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
319 | 319 | <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
320 | 320 | <?php |
321 | 321 | } |
322 | - ?> |
|
322 | + ?> |
|
323 | 323 | <?php |
324 | 324 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
325 | - ?> |
|
325 | + ?> |
|
326 | 326 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
327 | 327 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
328 | 328 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
329 | 329 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
330 | 330 | <?php |
331 | 331 | } |
332 | - ?> |
|
332 | + ?> |
|
333 | 333 | <?php |
334 | 334 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
335 | - ?> |
|
335 | + ?> |
|
336 | 336 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
337 | 337 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
338 | 338 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
339 | 339 | <?php |
340 | 340 | } |
341 | - ?> |
|
341 | + ?> |
|
342 | 342 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
343 | 343 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
344 | 344 | <?php |
345 | - } |
|
346 | - ?> |
|
345 | + } |
|
346 | + ?> |
|
347 | 347 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
348 | 348 | <?php |
349 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
349 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
350 | 350 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
351 | 351 | else $MapBoxId = $_COOKIE['MapTypeId']; |
352 | - ?> |
|
352 | + ?> |
|
353 | 353 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
354 | 354 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
355 | 355 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -364,16 +364,16 @@ discard block |
||
364 | 364 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
365 | 365 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
366 | 366 | <?php |
367 | - } |
|
368 | - ?> |
|
367 | + } |
|
368 | + ?> |
|
369 | 369 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
370 | 370 | <?php |
371 | 371 | } |
372 | - ?> |
|
372 | + ?> |
|
373 | 373 | </select> |
374 | 374 | </li> |
375 | 375 | <?php |
376 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
376 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
377 | 377 | ?> |
378 | 378 | <li><?php echo _("Type of Terrain:"); ?> |
379 | 379 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | </select> |
385 | 385 | </li> |
386 | 386 | <?php |
387 | - } |
|
387 | + } |
|
388 | 388 | ?> |
389 | 389 | |
390 | 390 | <?php |
391 | - if (isset($globalMap3D) && $globalMap3D) { |
|
391 | + if (isset($globalMap3D) && $globalMap3D) { |
|
392 | 392 | ?> |
393 | 393 | <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> |
394 | 394 | <?php |
395 | - } |
|
395 | + } |
|
396 | 396 | ?> |
397 | 397 | <?php |
398 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
398 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
399 | 399 | ?> |
400 | 400 | <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> |
401 | 401 | |
@@ -418,17 +418,17 @@ discard block |
||
418 | 418 | <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> |
419 | 419 | <?php |
420 | 420 | } |
421 | - } |
|
421 | + } |
|
422 | 422 | ?> |
423 | 423 | <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> |
424 | 424 | <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> |
425 | 425 | <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> |
426 | 426 | <?php |
427 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
427 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
428 | 428 | ?> |
429 | 429 | <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> |
430 | 430 | <?php |
431 | - } |
|
431 | + } |
|
432 | 432 | ?> |
433 | 433 | <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> |
434 | 434 | <?php |
@@ -444,82 +444,82 @@ discard block |
||
444 | 444 | } |
445 | 445 | ?> |
446 | 446 | <?php |
447 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
447 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
448 | 448 | ?> |
449 | 449 | <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> |
450 | 450 | <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> |
451 | 451 | <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> |
452 | 452 | <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> |
453 | 453 | <?php |
454 | - } |
|
455 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
454 | + } |
|
455 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
456 | 456 | ?> |
457 | 457 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
458 | 458 | <?php |
459 | - } |
|
459 | + } |
|
460 | 460 | ?> |
461 | 461 | <?php |
462 | 462 | if (function_exists('array_column')) { |
463 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
464 | - ?> |
|
463 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
464 | + ?> |
|
465 | 465 | <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> |
466 | 466 | <?php |
467 | - } |
|
467 | + } |
|
468 | 468 | } elseif (isset($globalSources)) { |
469 | - $dispolar = false; |
|
470 | - foreach ($globalSources as $testsource) { |
|
471 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
472 | - } |
|
473 | - if ($dispolar) { |
|
474 | - ?> |
|
469 | + $dispolar = false; |
|
470 | + foreach ($globalSources as $testsource) { |
|
471 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
472 | + } |
|
473 | + if ($dispolar) { |
|
474 | + ?> |
|
475 | 475 | <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> |
476 | 476 | <?php |
477 | - } |
|
478 | - } |
|
479 | - ?> |
|
477 | + } |
|
478 | + } |
|
479 | + ?> |
|
480 | 480 | <?php |
481 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
481 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
482 | 482 | ?> |
483 | 483 | |
484 | 484 | <?php |
485 | 485 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
486 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
487 | - ?> |
|
486 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
487 | + ?> |
|
488 | 488 | <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> |
489 | 489 | <?php |
490 | 490 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
491 | - ?> |
|
491 | + ?> |
|
492 | 492 | <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> |
493 | 493 | <?php |
494 | 494 | } |
495 | - } |
|
496 | - } |
|
497 | - ?> |
|
495 | + } |
|
496 | + } |
|
497 | + ?> |
|
498 | 498 | <?php |
499 | 499 | if (isset($globalMarine) && $globalMarine === TRUE) { |
500 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
501 | - ?> |
|
500 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
501 | + ?> |
|
502 | 502 | <li><?php echo _("Marine icon color:"); ?> |
503 | 503 | <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'; ?>"> |
504 | 504 | </li> |
505 | 505 | <?php |
506 | - } |
|
507 | - } |
|
508 | - ?> |
|
506 | + } |
|
507 | + } |
|
508 | + ?> |
|
509 | 509 | <?php |
510 | 510 | if (isset($globalTracker) && $globalTracker === TRUE) { |
511 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
512 | - ?> |
|
511 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
512 | + ?> |
|
513 | 513 | <li><?php echo _("Tracker icon color:"); ?> |
514 | 514 | <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'; ?>"> |
515 | 515 | </li> |
516 | 516 | <?php |
517 | - } |
|
518 | - } |
|
519 | - ?> |
|
517 | + } |
|
518 | + } |
|
519 | + ?> |
|
520 | 520 | <?php |
521 | 521 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
522 | - ?> |
|
522 | + ?> |
|
523 | 523 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
524 | 524 | <div class="range"> |
525 | 525 | <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'; ?>"> |
@@ -528,9 +528,9 @@ discard block |
||
528 | 528 | </li> |
529 | 529 | <?php |
530 | 530 | } |
531 | - ?> |
|
531 | + ?> |
|
532 | 532 | <?php |
533 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
533 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
534 | 534 | ?> |
535 | 535 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
536 | 536 | <div class="range"> |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | </li> |
569 | 569 | <?php |
570 | 570 | } |
571 | - } |
|
571 | + } |
|
572 | 572 | ?> |
573 | 573 | <li><?php echo _("Distance unit:"); ?> |
574 | 574 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -601,19 +601,19 @@ discard block |
||
601 | 601 | <ul> |
602 | 602 | <?php |
603 | 603 | if (!isset($globalAircraft) || $globalAircraft) { |
604 | - ?> |
|
604 | + ?> |
|
605 | 605 | <?php |
606 | 606 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
607 | - ?> |
|
607 | + ?> |
|
608 | 608 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
609 | 609 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
610 | 610 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
611 | 611 | <?php |
612 | 612 | } |
613 | - ?> |
|
613 | + ?> |
|
614 | 614 | <?php |
615 | 615 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
616 | - ?> |
|
616 | + ?> |
|
617 | 617 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
618 | 618 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
619 | 619 | <?php } ?> |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | <?php } ?> |
623 | 623 | <?php |
624 | 624 | } |
625 | - ?> |
|
625 | + ?> |
|
626 | 626 | <li><?php echo _("Display airlines:"); ?> |
627 | 627 | <br/> |
628 | 628 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -642,14 +642,14 @@ discard block |
||
642 | 642 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
643 | 643 | } |
644 | 644 | } |
645 | - ?> |
|
645 | + ?> |
|
646 | 646 | </select> |
647 | 647 | </li> |
648 | 648 | <?php |
649 | 649 | $Spotter = new Spotter(); |
650 | 650 | $allalliancenames = $Spotter->getAllAllianceNames(); |
651 | 651 | if (!empty($allalliancenames)) { |
652 | - ?> |
|
652 | + ?> |
|
653 | 653 | <li><?php echo _("Display alliance:"); ?> |
654 | 654 | <br/> |
655 | 655 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -663,18 +663,18 @@ discard block |
||
663 | 663 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
664 | 664 | } |
665 | 665 | } |
666 | - ?> |
|
666 | + ?> |
|
667 | 667 | </select> |
668 | 668 | </li> |
669 | 669 | <?php |
670 | 670 | } |
671 | - ?> |
|
671 | + ?> |
|
672 | 672 | <?php |
673 | 673 | } |
674 | - ?> |
|
674 | + ?> |
|
675 | 675 | <?php |
676 | 676 | if (isset($globalAPRS) && $globalAPRS) { |
677 | - ?> |
|
677 | + ?> |
|
678 | 678 | <li><?php echo _("Display APRS sources name:"); ?> |
679 | 679 | <select class="selectpicker" multiple onchange="sources(this);"> |
680 | 680 | <?php |
@@ -698,18 +698,18 @@ discard block |
||
698 | 698 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
699 | 699 | } |
700 | 700 | } |
701 | - ?> |
|
701 | + ?> |
|
702 | 702 | </select> |
703 | 703 | </li> |
704 | 704 | <?php |
705 | 705 | } |
706 | - ?> |
|
706 | + ?> |
|
707 | 707 | <?php |
708 | 708 | if (!isset($globalAircraft) || $globalAircraft) { |
709 | - ?> |
|
709 | + ?> |
|
710 | 710 | <?php |
711 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
712 | - ?> |
|
711 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
712 | + ?> |
|
713 | 713 | <li><?php echo _("Display airlines of type:"); ?><br/> |
714 | 714 | <select class="selectpicker" onchange="airlinestype(this);"> |
715 | 715 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -719,21 +719,21 @@ discard block |
||
719 | 719 | </select> |
720 | 720 | </li> |
721 | 721 | <?php |
722 | - } |
|
723 | - ?> |
|
722 | + } |
|
723 | + ?> |
|
724 | 724 | <?php |
725 | 725 | } |
726 | - ?> |
|
726 | + ?> |
|
727 | 727 | <?php |
728 | 728 | if (isset($globalMarine) && $globalMarine) { |
729 | - ?> |
|
729 | + ?> |
|
730 | 730 | <li> |
731 | 731 | <?php echo _("Display vessels with MMSI:"); ?> |
732 | 732 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
733 | 733 | </li> |
734 | 734 | <?php |
735 | 735 | } |
736 | - ?> |
|
736 | + ?> |
|
737 | 737 | <li> |
738 | 738 | <?php echo _("Display with ident:"); ?> |
739 | 739 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -746,7 +746,7 @@ discard block |
||
746 | 746 | </form> |
747 | 747 | </div> |
748 | 748 | <?php |
749 | - if (isset($globalSatellite) && $globalSatellite) { |
|
749 | + if (isset($globalSatellite) && $globalSatellite) { |
|
750 | 750 | ?> |
751 | 751 | <div class="sidebar-pane" id="satellites"> |
752 | 752 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -786,14 +786,14 @@ discard block |
||
786 | 786 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
787 | 787 | } |
788 | 788 | } |
789 | - ?> |
|
789 | + ?> |
|
790 | 790 | </select> |
791 | 791 | </li> |
792 | 792 | </ul> |
793 | 793 | </form> |
794 | 794 | </div> |
795 | 795 | <?php |
796 | - } |
|
796 | + } |
|
797 | 797 | ?> |
798 | 798 | </div> |
799 | 799 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | require_once('require/class.Satellite.php'); |
6 | 6 | |
7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
8 | 8 | if ($trackident != '') { |
9 | 9 | require_once('require/class.SpotterLive.php'); |
10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
16 | 16 | } else { |
17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
18 | 18 | } |
19 | 19 | /* |
20 | 20 | } else { |
@@ -201,7 +201,7 @@ discard block |
||
201 | 201 | <div class="form-group"> |
202 | 202 | <label><?php echo _("From:"); ?></label> |
203 | 203 | <div class='input-group date' id='datetimepicker1'> |
204 | - <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 /> |
|
204 | + <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 /> |
|
205 | 205 | <span class="input-group-addon"> |
206 | 206 | <span class="glyphicon glyphicon-calendar"></span> |
207 | 207 | </span> |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | <div class="form-group"> |
211 | 211 | <label><?php echo _("To:"); ?></label> |
212 | 212 | <div class='input-group date' id='datetimepicker2'> |
213 | - <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'; ?>" /> |
|
213 | + <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'; ?>" /> |
|
214 | 214 | <span class="input-group-addon"> |
215 | 215 | <span class="glyphicon glyphicon-calendar"></span> |
216 | 216 | </span> |
@@ -378,9 +378,9 @@ discard block |
||
378 | 378 | <li><?php echo _("Type of Terrain:"); ?> |
379 | 379 | <select class="selectpicker" onchange="terrainType(this);"> |
380 | 380 | <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
381 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
382 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
383 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
381 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
382 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
383 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
384 | 384 | </select> |
385 | 385 | </li> |
386 | 386 | <?php |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | <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> |
453 | 453 | <?php |
454 | 454 | } |
455 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
455 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
456 | 456 | ?> |
457 | 457 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
458 | 458 | <?php |
@@ -633,10 +633,10 @@ discard block |
||
633 | 633 | $Spotter = new Spotter(); |
634 | 634 | $allairlinenames = $Spotter->getAllAirlineNames(); |
635 | 635 | } |
636 | - foreach($allairlinenames as $airline) { |
|
636 | + foreach ($allairlinenames as $airline) { |
|
637 | 637 | $airline_name = $airline['airline_name']; |
638 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
639 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
638 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
639 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
640 | 640 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
641 | 641 | } else { |
642 | 642 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
656 | 656 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
657 | 657 | <?php |
658 | - foreach($allalliancenames as $alliance) { |
|
658 | + foreach ($allalliancenames as $alliance) { |
|
659 | 659 | $alliance_name = $alliance['alliance']; |
660 | 660 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
661 | 661 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -691,8 +691,8 @@ discard block |
||
691 | 691 | */ |
692 | 692 | $Source = new Source(); |
693 | 693 | $datasource = $Source->getLocationInfoByType('gs'); |
694 | - foreach($datasource as $src) { |
|
695 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
694 | + foreach ($datasource as $src) { |
|
695 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
696 | 696 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
697 | 697 | } else { |
698 | 698 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
781 | 781 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
782 | 782 | |
783 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
783 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
784 | 784 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
785 | 785 | } else { |
786 | 786 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -52,7 +52,10 @@ discard block |
||
52 | 52 | <?php |
53 | 53 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
54 | 54 | ?> |
55 | -<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
55 | +<script src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
56 | + print '?tsk='.$tsk; |
|
57 | +} |
|
58 | +?>"></script> |
|
56 | 59 | <?php |
57 | 60 | if (!isset($globalAircraft) || $globalAircraft) { |
58 | 61 | ?> |
@@ -145,8 +148,14 @@ discard block |
||
145 | 148 | ?> |
146 | 149 | <form> |
147 | 150 | <ul> |
148 | - <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> |
|
149 | - <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> |
|
151 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
152 | + print 'checked'; |
|
153 | +} |
|
154 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
155 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
156 | + print 'checked'; |
|
157 | +} |
|
158 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
150 | 159 | </ul> |
151 | 160 | </form> |
152 | 161 | <?php |
@@ -154,8 +163,14 @@ discard block |
||
154 | 163 | ?> |
155 | 164 | <form> |
156 | 165 | <ul> |
157 | - <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> |
|
158 | - <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> |
|
166 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
167 | + print 'checked'; |
|
168 | +} |
|
169 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
170 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
171 | + print 'checked'; |
|
172 | +} |
|
173 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
159 | 174 | </ul> |
160 | 175 | <p>This layers are in Beta, this can and will crash.</p> |
161 | 176 | </form> |
@@ -166,14 +181,32 @@ discard block |
||
166 | 181 | <h1>NOTAM</h1> |
167 | 182 | <form> |
168 | 183 | <ul> |
169 | - <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> |
|
184 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
185 | + print 'checked'; |
|
186 | +} |
|
187 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
170 | 188 | <li><?php echo _("NOTAM scope:"); ?> |
171 | 189 | <select class="selectpicker" onchange="notamscope(this);"> |
172 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
173 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
174 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
175 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
176 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
190 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
191 | + print ' selected'; |
|
192 | +} |
|
193 | +?>>All</option> |
|
194 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
195 | + print ' selected'; |
|
196 | +} |
|
197 | +?>>Airport/Enroute warning</option> |
|
198 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
199 | + print ' selected'; |
|
200 | +} |
|
201 | +?>>Airport warning</option> |
|
202 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
203 | + print ' selected'; |
|
204 | +} |
|
205 | +?>>Navigation warning</option> |
|
206 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
207 | + print ' selected'; |
|
208 | +} |
|
209 | +?>>Enroute warning</option> |
|
177 | 210 | </select |
178 | 211 | </li> |
179 | 212 | </ul> |
@@ -201,7 +234,10 @@ discard block |
||
201 | 234 | <div class="form-group"> |
202 | 235 | <label><?php echo _("From:"); ?></label> |
203 | 236 | <div class='input-group date' id='datetimepicker1'> |
204 | - <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 /> |
|
237 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
238 | + print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; |
|
239 | +} |
|
240 | +?>" required /> |
|
205 | 241 | <span class="input-group-addon"> |
206 | 242 | <span class="glyphicon glyphicon-calendar"></span> |
207 | 243 | </span> |
@@ -210,7 +246,10 @@ discard block |
||
210 | 246 | <div class="form-group"> |
211 | 247 | <label><?php echo _("To:"); ?></label> |
212 | 248 | <div class='input-group date' id='datetimepicker2'> |
213 | - <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'; ?>" /> |
|
249 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') { |
|
250 | + print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; |
|
251 | +} |
|
252 | +?>" /> |
|
214 | 253 | <span class="input-group-addon"> |
215 | 254 | <span class="glyphicon glyphicon-calendar"></span> |
216 | 255 | </span> |
@@ -242,8 +281,20 @@ discard block |
||
242 | 281 | </script> |
243 | 282 | <li><?php echo _("Playback speed:"); ?> |
244 | 283 | <div class="range"> |
245 | - <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'; ?>"> |
|
246 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
284 | + <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
285 | + print $_POST['archivespeed']; |
|
286 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
287 | + print $_COOKIE['archive_speed']; |
|
288 | +} else { |
|
289 | + print '1'; |
|
290 | +} |
|
291 | +?>"> |
|
292 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
293 | + print $_COOKIE['archive_speed']; |
|
294 | +} else { |
|
295 | + print '1'; |
|
296 | +} |
|
297 | +?></output> |
|
247 | 298 | </div> |
248 | 299 | </li> |
249 | 300 | <?php |
@@ -272,14 +323,20 @@ discard block |
||
272 | 323 | <li><?php echo _("Type of Map:"); ?> |
273 | 324 | <?php |
274 | 325 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
275 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
276 | - else $MapType = $_COOKIE['MapType']; |
|
326 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
327 | + $MapType = $globalMapProvider; |
|
328 | + } else { |
|
329 | + $MapType = $_COOKIE['MapType']; |
|
330 | + } |
|
277 | 331 | ?> |
278 | 332 | <select class="selectpicker" onchange="mapType(this);"> |
279 | 333 | <?php |
280 | 334 | } else { |
281 | - if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
|
282 | - else $MapType = $_COOKIE['MapType3D']; |
|
335 | + if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') { |
|
336 | + $MapType = $globalMapProvider; |
|
337 | + } else { |
|
338 | + $MapType = $_COOKIE['MapType3D']; |
|
339 | + } |
|
283 | 340 | ?> |
284 | 341 | <select class="selectpicker" onchange="mapType3D(this);"> |
285 | 342 | <?php |
@@ -288,23 +345,44 @@ discard block |
||
288 | 345 | <?php |
289 | 346 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
290 | 347 | ?> |
291 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
348 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
349 | + print ' selected'; |
|
350 | +} |
|
351 | +?>>Natural Earth (local)</option> |
|
292 | 352 | <?php |
293 | 353 | } else { |
294 | 354 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
295 | 355 | ?> |
296 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
356 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
357 | + print ' selected'; |
|
358 | +} |
|
359 | +?>>Natural Earth (local)</option> |
|
297 | 360 | <?php |
298 | 361 | } |
299 | 362 | ?> |
300 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
301 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
363 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
364 | + print ' selected'; |
|
365 | +} |
|
366 | +?>>ArcGIS Streetmap</option> |
|
367 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
368 | + print ' selected'; |
|
369 | +} |
|
370 | +?>>ArcGIS Satellite</option> |
|
302 | 371 | <?php |
303 | 372 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
304 | 373 | ?> |
305 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
306 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
307 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
374 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
375 | + print ' selected'; |
|
376 | +} |
|
377 | +?>>Bing-Aerial</option> |
|
378 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
379 | + print ' selected'; |
|
380 | +} |
|
381 | +?>>Bing-Hybrid</option> |
|
382 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
383 | + print ' selected'; |
|
384 | +} |
|
385 | +?>>Bing-Road</option> |
|
308 | 386 | <?php |
309 | 387 | } |
310 | 388 | ?> |
@@ -314,59 +392,143 @@ discard block |
||
314 | 392 | <?php |
315 | 393 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
316 | 394 | ?> |
317 | - <option value="Here-Aerial"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Aerial</option> |
|
318 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Hybrid</option> |
|
319 | - <option value="Here-Road"<?php if ($MapType == 'Here') print ' selected'; ?>>Here-Road</option> |
|
395 | + <option value="Here-Aerial"<?php if ($MapType == 'Here') { |
|
396 | + print ' selected'; |
|
397 | +} |
|
398 | +?>>Here-Aerial</option> |
|
399 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here') { |
|
400 | + print ' selected'; |
|
401 | +} |
|
402 | +?>>Here-Hybrid</option> |
|
403 | + <option value="Here-Road"<?php if ($MapType == 'Here') { |
|
404 | + print ' selected'; |
|
405 | +} |
|
406 | +?>>Here-Road</option> |
|
320 | 407 | <?php |
321 | 408 | } |
322 | 409 | ?> |
323 | 410 | <?php |
324 | 411 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
325 | 412 | ?> |
326 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
327 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
328 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
329 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
413 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
414 | + print ' selected'; |
|
415 | +} |
|
416 | +?>>Google Roadmap</option> |
|
417 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
418 | + print ' selected'; |
|
419 | +} |
|
420 | +?>>Google Satellite</option> |
|
421 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
422 | + print ' selected'; |
|
423 | +} |
|
424 | +?>>Google Hybrid</option> |
|
425 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
426 | + print ' selected'; |
|
427 | +} |
|
428 | +?>>Google Terrain</option> |
|
330 | 429 | <?php |
331 | 430 | } |
332 | 431 | ?> |
333 | 432 | <?php |
334 | 433 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
335 | 434 | ?> |
336 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
337 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
338 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
435 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
436 | + print ' selected'; |
|
437 | +} |
|
438 | +?>>MapQuest-OSM</option> |
|
439 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
440 | + print ' selected'; |
|
441 | +} |
|
442 | +?>>MapQuest-Aerial</option> |
|
443 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
444 | + print ' selected'; |
|
445 | +} |
|
446 | +?>>MapQuest-Hybrid</option> |
|
339 | 447 | <?php |
340 | 448 | } |
341 | 449 | ?> |
342 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
343 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
450 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
451 | + print ' selected'; |
|
452 | +} |
|
453 | +?>>Yandex</option> |
|
454 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
455 | + print ' selected'; |
|
456 | +} |
|
457 | +?>>Natural Earth</option> |
|
344 | 458 | <?php |
345 | 459 | } |
346 | 460 | ?> |
347 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
461 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
462 | + print ' selected'; |
|
463 | +} |
|
464 | +?>>National Geographic Street</option> |
|
348 | 465 | <?php |
349 | 466 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
350 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
351 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
467 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
468 | + $MapBoxId = 'default'; |
|
469 | + } else { |
|
470 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
471 | + } |
|
352 | 472 | ?> |
353 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
354 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
355 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
356 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
357 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
358 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
359 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
360 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
361 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
362 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
363 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
364 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
365 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
473 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
474 | + print ' selected'; |
|
475 | +} |
|
476 | +?>>Mapbox GL</option> |
|
477 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
478 | + print ' selected'; |
|
479 | +} |
|
480 | +?>>Mapbox default</option> |
|
481 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
482 | + print ' selected'; |
|
483 | +} |
|
484 | +?>>Mapbox streets</option> |
|
485 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
486 | + print ' selected'; |
|
487 | +} |
|
488 | +?>>Mapbox light</option> |
|
489 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
490 | + print ' selected'; |
|
491 | +} |
|
492 | +?>>Mapbox dark</option> |
|
493 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
494 | + print ' selected'; |
|
495 | +} |
|
496 | +?>>Mapbox satellite</option> |
|
497 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
498 | + print ' selected'; |
|
499 | +} |
|
500 | +?>>Mapbox streets-satellite</option> |
|
501 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
502 | + print ' selected'; |
|
503 | +} |
|
504 | +?>>Mapbox streets-basic</option> |
|
505 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
506 | + print ' selected'; |
|
507 | +} |
|
508 | +?>>Mapbox comic</option> |
|
509 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
510 | + print ' selected'; |
|
511 | +} |
|
512 | +?>>Mapbox outdoors</option> |
|
513 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
514 | + print ' selected'; |
|
515 | +} |
|
516 | +?>>Mapbox pencil</option> |
|
517 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
518 | + print ' selected'; |
|
519 | +} |
|
520 | +?>>Mapbox pirates</option> |
|
521 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
522 | + print ' selected'; |
|
523 | +} |
|
524 | +?>>Mapbox emerald</option> |
|
366 | 525 | <?php |
367 | 526 | } |
368 | 527 | ?> |
369 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
528 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
529 | + print ' selected'; |
|
530 | +} |
|
531 | +?>>OpenStreetMap</option> |
|
370 | 532 | <?php |
371 | 533 | } |
372 | 534 | ?> |
@@ -377,10 +539,22 @@ discard block |
||
377 | 539 | ?> |
378 | 540 | <li><?php echo _("Type of Terrain:"); ?> |
379 | 541 | <select class="selectpicker" onchange="terrainType(this);"> |
380 | - <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
381 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
382 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
383 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
542 | + <option value="stk"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'stk') { |
|
543 | + print ' selected'; |
|
544 | +} |
|
545 | +?>>stk terrain</option> |
|
546 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
547 | + print ' selected'; |
|
548 | +} |
|
549 | +?>>ellipsoid</option> |
|
550 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
551 | + print ' selected'; |
|
552 | +} |
|
553 | +?>>vr terrain</option> |
|
554 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
555 | + print ' selected'; |
|
556 | +} |
|
557 | +?>>ArticDEM</option> |
|
384 | 558 | </select> |
385 | 559 | </li> |
386 | 560 | <?php |
@@ -390,66 +564,126 @@ discard block |
||
390 | 564 | <?php |
391 | 565 | if (isset($globalMap3D) && $globalMap3D) { |
392 | 566 | ?> |
393 | - <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> |
|
567 | + <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') { |
|
568 | + print 'checked'; |
|
569 | +} |
|
570 | +?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
394 | 571 | <?php |
395 | 572 | } |
396 | 573 | ?> |
397 | 574 | <?php |
398 | 575 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
399 | 576 | ?> |
400 | - <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> |
|
577 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
578 | + print 'checked'; |
|
579 | +} |
|
580 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
401 | 581 | |
402 | 582 | <?php |
403 | 583 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
404 | 584 | ?> |
405 | - <!--<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>--> |
|
406 | - <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> |
|
407 | - <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> |
|
408 | - <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> |
|
409 | - <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> |
|
585 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
586 | + print 'checked'; |
|
587 | +} |
|
588 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
589 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
590 | + print 'checked'; |
|
591 | +} |
|
592 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
593 | + <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)) { |
|
594 | + print 'checked'; |
|
595 | +} |
|
596 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
597 | + <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)) { |
|
598 | + print 'checked'; |
|
599 | +} |
|
600 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
601 | + <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)) { |
|
602 | + print 'checked'; |
|
603 | +} |
|
604 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
410 | 605 | <?php |
411 | 606 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
412 | 607 | ?> |
413 | - <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> |
|
608 | + <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)) { |
|
609 | + print 'checked'; |
|
610 | +} |
|
611 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
414 | 612 | <?php |
415 | 613 | } |
416 | 614 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
417 | 615 | ?> |
418 | - <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> |
|
616 | + <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)) { |
|
617 | + print 'checked'; |
|
618 | +} |
|
619 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
419 | 620 | <?php |
420 | 621 | } |
421 | 622 | } |
422 | 623 | ?> |
423 | - <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> |
|
424 | - <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> |
|
425 | - <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> |
|
624 | + <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'])) { |
|
625 | + print 'checked'; |
|
626 | +} |
|
627 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
628 | + <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))) { |
|
629 | + print 'checked'; |
|
630 | +} |
|
631 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
632 | + <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))) { |
|
633 | + print 'checked'; |
|
634 | +} |
|
635 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
426 | 636 | <?php |
427 | 637 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
428 | 638 | ?> |
429 | - <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> |
|
639 | + <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))) { |
|
640 | + print 'checked'; |
|
641 | +} |
|
642 | +?> ><?php echo _("Display weather on 3D map"); ?></label></div></li> |
|
430 | 643 | <?php |
431 | 644 | } |
432 | 645 | ?> |
433 | - <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> |
|
646 | + <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))) { |
|
647 | + print 'checked'; |
|
648 | +} |
|
649 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
434 | 650 | <?php |
435 | 651 | if (isset($globalFires)) { |
436 | 652 | ?> |
437 | - <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> |
|
653 | + <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))) { |
|
654 | + print 'checked'; |
|
655 | +} |
|
656 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
438 | 657 | <?php |
439 | 658 | } |
440 | 659 | if (isset($globalMap3D) && $globalMap3D) { |
441 | 660 | ?> |
442 | - <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
661 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if (isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') { |
|
662 | + print 'checked'; |
|
663 | +} |
|
664 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
443 | 665 | <?php |
444 | 666 | } |
445 | 667 | ?> |
446 | 668 | <?php |
447 | 669 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
448 | 670 | ?> |
449 | - <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> |
|
450 | - <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> |
|
451 | - <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> |
|
452 | - <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> |
|
671 | + <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')) { |
|
672 | + print 'checked'; |
|
673 | +} |
|
674 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
675 | + <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')) { |
|
676 | + print 'checked'; |
|
677 | +} |
|
678 | +?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
679 | + <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)) { |
|
680 | + print 'checked'; |
|
681 | +} |
|
682 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
683 | + <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'])) { |
|
684 | + print 'checked'; |
|
685 | +} |
|
686 | +?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
453 | 687 | <?php |
454 | 688 | } |
455 | 689 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -462,17 +696,25 @@ discard block |
||
462 | 696 | if (function_exists('array_column')) { |
463 | 697 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
464 | 698 | ?> |
465 | - <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> |
|
699 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
700 | + print 'checked'; |
|
701 | +} |
|
702 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
466 | 703 | <?php |
467 | 704 | } |
468 | 705 | } elseif (isset($globalSources)) { |
469 | 706 | $dispolar = false; |
470 | 707 | foreach ($globalSources as $testsource) { |
471 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
708 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
709 | + $dispolar = true; |
|
710 | + } |
|
472 | 711 | } |
473 | 712 | if ($dispolar) { |
474 | 713 | ?> |
475 | - <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> |
|
714 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
715 | + print 'checked'; |
|
716 | +} |
|
717 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
476 | 718 | <?php |
477 | 719 | } |
478 | 720 | } |
@@ -485,11 +727,21 @@ discard block |
||
485 | 727 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
486 | 728 | if (extension_loaded('gd') && function_exists('gd_info')) { |
487 | 729 | ?> |
488 | - <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> |
|
730 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
731 | + print 'checked'; |
|
732 | +} |
|
733 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
489 | 734 | <?php |
490 | 735 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
491 | 736 | ?> |
492 | - <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> |
|
737 | + <li><?php echo _("Aircraft icon color:"); ?><input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
738 | + print $_COOKIE['IconColor']; |
|
739 | +} elseif (isset($globalAircraftIconColor)) { |
|
740 | + print $globalAircraftIconColor; |
|
741 | +} else { |
|
742 | + print '1a3151'; |
|
743 | +} |
|
744 | +?>"></li> |
|
493 | 745 | <?php |
494 | 746 | } |
495 | 747 | } |
@@ -500,7 +752,14 @@ discard block |
||
500 | 752 | if (extension_loaded('gd') && function_exists('gd_info')) { |
501 | 753 | ?> |
502 | 754 | <li><?php echo _("Marine icon color:"); ?> |
503 | - <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'; ?>"> |
|
755 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
756 | + print $_COOKIE['MarineIconColor']; |
|
757 | +} elseif (isset($globalMarineIconColor)) { |
|
758 | + print $globalMarineIconColor; |
|
759 | +} else { |
|
760 | + print '1a3151'; |
|
761 | +} |
|
762 | +?>"> |
|
504 | 763 | </li> |
505 | 764 | <?php |
506 | 765 | } |
@@ -511,7 +770,14 @@ discard block |
||
511 | 770 | if (extension_loaded('gd') && function_exists('gd_info')) { |
512 | 771 | ?> |
513 | 772 | <li><?php echo _("Tracker icon color:"); ?> |
514 | - <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'; ?>"> |
|
773 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
774 | + print $_COOKIE['TrackerIconColor']; |
|
775 | +} elseif (isset($globalTrackerIconColor)) { |
|
776 | + print $globalTrackerIconColor; |
|
777 | +} else { |
|
778 | + print '1a3151'; |
|
779 | +} |
|
780 | +?>"> |
|
515 | 781 | </li> |
516 | 782 | <?php |
517 | 783 | } |
@@ -522,8 +788,22 @@ discard block |
||
522 | 788 | ?> |
523 | 789 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
524 | 790 | <div class="range"> |
525 | - <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'; ?>"> |
|
526 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
791 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
792 | + print $_COOKIE['AirportZoom']; |
|
793 | +} elseif (isset($globalAirportZoom)) { |
|
794 | + print $globalAirportZoom; |
|
795 | +} else { |
|
796 | + print '7'; |
|
797 | +} |
|
798 | +?>"> |
|
799 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
800 | + print $_COOKIE['AirportZoom']; |
|
801 | +} elseif (isset($globalAirportZoom)) { |
|
802 | + print $globalAirportZoom; |
|
803 | +} else { |
|
804 | + print '7'; |
|
805 | +} |
|
806 | +?></output> |
|
527 | 807 | </div> |
528 | 808 | </li> |
529 | 809 | <?php |
@@ -534,17 +814,40 @@ discard block |
||
534 | 814 | ?> |
535 | 815 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
536 | 816 | <div class="range"> |
537 | - <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'; ?>"> |
|
538 | - <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output> |
|
817 | + <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'])) { |
|
818 | + print $_COOKIE['resolutionScale']; |
|
819 | +} else { |
|
820 | + print '1'; |
|
821 | +} |
|
822 | +?>"> |
|
823 | + <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) { |
|
824 | + print $_COOKIE['resolutionScale']; |
|
825 | +} else { |
|
826 | + print '1'; |
|
827 | +} |
|
828 | +?></output> |
|
539 | 829 | </div> |
540 | 830 | </li> |
541 | 831 | <?php |
542 | 832 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
543 | 833 | ?> |
544 | - <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> |
|
545 | - <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"); ?> |
|
834 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
835 | + print 'checked'; |
|
836 | +} |
|
837 | +?> > <?php echo _("Use airlines liveries"); ?></li> |
|
838 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
839 | + print 'checked'; |
|
840 | +} |
|
841 | +?> > <?php echo _("Force Aircraft color"); ?> |
|
546 | 842 | <!--<li><?php echo _("Aircraft icon color:"); ?>--> |
547 | - <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'; ?>"> |
|
843 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
844 | + print $_COOKIE['IconColor']; |
|
845 | +} elseif (isset($globalAircraftIconColor)) { |
|
846 | + print $globalAircraftIconColor; |
|
847 | +} else { |
|
848 | + print 'ff0000'; |
|
849 | +} |
|
850 | +?>"> |
|
548 | 851 | </li> |
549 | 852 | <?php |
550 | 853 | } |
@@ -552,9 +855,19 @@ discard block |
||
552 | 855 | <?php |
553 | 856 | if (isset($globalMarine) && $globalMarine === TRUE) { |
554 | 857 | ?> |
555 | - <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"); ?> |
|
858 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
859 | + print 'checked'; |
|
860 | +} |
|
861 | +?> ><?php echo _("Force Marine color"); ?> |
|
556 | 862 | <!--<li><?php echo _("Marine icon color:"); ?>--> |
557 | - <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'; ?>"> |
|
863 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
864 | + print $_COOKIE['MarineIconColor']; |
|
865 | +} elseif (isset($globalMarineIconColor)) { |
|
866 | + print $globalMarineIconColor; |
|
867 | +} else { |
|
868 | + print 'ff0000'; |
|
869 | +} |
|
870 | +?>"> |
|
558 | 871 | </li> |
559 | 872 | <?php |
560 | 873 | } |
@@ -562,9 +875,19 @@ discard block |
||
562 | 875 | <?php |
563 | 876 | if (isset($globalTracker) && $globalTracker === TRUE) { |
564 | 877 | ?> |
565 | - <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"); ?> |
|
878 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
879 | + print 'checked'; |
|
880 | +} |
|
881 | +?> ><?php echo _("Force Tracker color"); ?> |
|
566 | 882 | <!--<li><?php echo _("Tracker icon color:"); ?>--> |
567 | - <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'; ?>"> |
|
883 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
884 | + print $_COOKIE['TrackerIconColor']; |
|
885 | +} elseif (isset($globalTrackerIconColor)) { |
|
886 | + print $globalTrackerIconColor; |
|
887 | +} else { |
|
888 | + print 'ff0000'; |
|
889 | +} |
|
890 | +?>"> |
|
568 | 891 | </li> |
569 | 892 | <?php |
570 | 893 | } |
@@ -572,22 +895,46 @@ discard block |
||
572 | 895 | ?> |
573 | 896 | <li><?php echo _("Distance unit:"); ?> |
574 | 897 | <select class="selectpicker" onchange="unitdistance(this);"> |
575 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
576 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
577 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
898 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
899 | + echo ' selected'; |
|
900 | +} |
|
901 | +?>>km</option> |
|
902 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
903 | + echo ' selected'; |
|
904 | +} |
|
905 | +?>>nm</option> |
|
906 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
907 | + echo ' selected'; |
|
908 | +} |
|
909 | +?>>mi</option> |
|
578 | 910 | </select> |
579 | 911 | </li> |
580 | 912 | <li><?php echo _("Altitude unit:"); ?> |
581 | 913 | <select class="selectpicker" onchange="unitaltitude(this);"> |
582 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
583 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
914 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
915 | + echo ' selected'; |
|
916 | +} |
|
917 | +?>>m</option> |
|
918 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
919 | + echo ' selected'; |
|
920 | +} |
|
921 | +?>>feet</option> |
|
584 | 922 | </select> |
585 | 923 | </li> |
586 | 924 | <li><?php echo _("Speed unit:"); ?> |
587 | 925 | <select class="selectpicker" onchange="unitspeed(this);"> |
588 | - <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> |
|
589 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
590 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
926 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
927 | + echo ' selected'; |
|
928 | +} |
|
929 | +?>>km/h</option> |
|
930 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
931 | + echo ' selected'; |
|
932 | +} |
|
933 | +?>>mph</option> |
|
934 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
935 | + echo ' selected'; |
|
936 | +} |
|
937 | +?>>knots</option> |
|
591 | 938 | </select> |
592 | 939 | </li> |
593 | 940 | |
@@ -605,9 +952,18 @@ discard block |
||
605 | 952 | <?php |
606 | 953 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
607 | 954 | ?> |
608 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
609 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
610 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
955 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['ShowVATSIM']) && $_COOKIE['ShowVATSIM'] == 'true') || !isset($_COOKIE['ShowVATSIM'])) { |
|
956 | + print 'checked'; |
|
957 | +} |
|
958 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
959 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['ShowIVAO']) && $_COOKIE['ShowIVAO'] == 'true') || !isset($_COOKIE['ShowIVAO'])) { |
|
960 | + print 'checked'; |
|
961 | +} |
|
962 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
963 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['ShowVMS']) && $_COOKIE['ShowVMS'] == 'true') || !isset($_COOKIE['ShowVMS'])) { |
|
964 | + print 'checked'; |
|
965 | +} |
|
966 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
611 | 967 | <?php |
612 | 968 | } |
613 | 969 | ?> |
@@ -615,10 +971,16 @@ discard block |
||
615 | 971 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
616 | 972 | ?> |
617 | 973 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
618 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
974 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['ShowSBS1']) && $_COOKIE['ShowSBS1'] == 'true') || !isset($_COOKIE['ShowSBS1'])) { |
|
975 | + print 'checked'; |
|
976 | +} |
|
977 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
619 | 978 | <?php } ?> |
620 | 979 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
621 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
980 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['ShowAPRS']) && $_COOKIE['ShowAPRS'] == 'true') || !isset($_COOKIE['ShowAPRS'])) { |
|
981 | + print 'checked'; |
|
982 | +} |
|
983 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
622 | 984 | <?php } ?> |
623 | 985 | <?php |
624 | 986 | } |
@@ -635,7 +997,9 @@ discard block |
||
635 | 997 | } |
636 | 998 | foreach($allairlinenames as $airline) { |
637 | 999 | $airline_name = $airline['airline_name']; |
638 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
1000 | + if (strlen($airline_name) > 30) { |
|
1001 | + $airline_name = substr($airline_name,0,30).'...'; |
|
1002 | + } |
|
639 | 1003 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
640 | 1004 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
641 | 1005 | } else { |
@@ -653,7 +1017,10 @@ discard block |
||
653 | 1017 | <li><?php echo _("Display alliance:"); ?> |
654 | 1018 | <br/> |
655 | 1019 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
656 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
1020 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
1021 | + echo ' selected'; |
|
1022 | +} |
|
1023 | +?>><?php echo _("All"); ?></option> |
|
657 | 1024 | <?php |
658 | 1025 | foreach($allalliancenames as $alliance) { |
659 | 1026 | $alliance_name = $alliance['alliance']; |
@@ -712,10 +1079,22 @@ discard block |
||
712 | 1079 | ?> |
713 | 1080 | <li><?php echo _("Display airlines of type:"); ?><br/> |
714 | 1081 | <select class="selectpicker" onchange="airlinestype(this);"> |
715 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
716 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
717 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
718 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
1082 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
1083 | + echo ' selected'; |
|
1084 | +} |
|
1085 | +?>><?php echo _("All"); ?></option> |
|
1086 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
1087 | + echo ' selected'; |
|
1088 | +} |
|
1089 | +?>><?php echo _("Passenger"); ?></option> |
|
1090 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
1091 | + echo ' selected'; |
|
1092 | +} |
|
1093 | +?>><?php echo _("Cargo"); ?></option> |
|
1094 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
1095 | + echo ' selected'; |
|
1096 | +} |
|
1097 | +?>><?php echo _("Military"); ?></option> |
|
719 | 1098 | </select> |
720 | 1099 | </li> |
721 | 1100 | <?php |
@@ -729,14 +1108,20 @@ discard block |
||
729 | 1108 | ?> |
730 | 1109 | <li> |
731 | 1110 | <?php echo _("Display vessels with MMSI:"); ?> |
732 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
1111 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
1112 | + print $_COOKIE['filter_mmsi']; |
|
1113 | +} |
|
1114 | +?>" /> |
|
733 | 1115 | </li> |
734 | 1116 | <?php |
735 | 1117 | } |
736 | 1118 | ?> |
737 | 1119 | <li> |
738 | 1120 | <?php echo _("Display with ident:"); ?> |
739 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
1121 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
1122 | + print $_COOKIE['filter_ident']; |
|
1123 | +} |
|
1124 | +?>" /> |
|
740 | 1125 | </li> |
741 | 1126 | </ul> |
742 | 1127 | </form> |
@@ -752,7 +1137,10 @@ discard block |
||
752 | 1137 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
753 | 1138 | <form> |
754 | 1139 | <ul> |
755 | - <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> |
|
1140 | + <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'])) { |
|
1141 | + print 'checked'; |
|
1142 | +} |
|
1143 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
756 | 1144 | <li><?php echo _("Type:"); ?> |
757 | 1145 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
758 | 1146 | <?php |
@@ -760,25 +1148,45 @@ discard block |
||
760 | 1148 | $types = $Satellite->get_tle_types(); |
761 | 1149 | foreach ($types as $type) { |
762 | 1150 | $type_name = $type['tle_type']; |
763 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
764 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
765 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
766 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
767 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
768 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
769 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
770 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
771 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
772 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
773 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
774 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
775 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
776 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
777 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
778 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
779 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
780 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
781 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
1151 | + if ($type_name == 'musson') { |
|
1152 | + $type_name = 'Russian LEO Navigation'; |
|
1153 | + } else if ($type_name == 'nnss') { |
|
1154 | + $type_name = 'Navi Navigation Satellite System'; |
|
1155 | + } else if ($type_name == 'sbas') { |
|
1156 | + $type_name = 'Satellite-Based Augmentation System'; |
|
1157 | + } else if ($type_name == 'glo-ops') { |
|
1158 | + $type_name = 'Glonass Operational'; |
|
1159 | + } else if ($type_name == 'gps-ops') { |
|
1160 | + $type_name = 'GPS Operational'; |
|
1161 | + } else if ($type_name == 'argos') { |
|
1162 | + $type_name = 'ARGOS Data Collection System'; |
|
1163 | + } else if ($type_name == 'tdrss') { |
|
1164 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
1165 | + } else if ($type_name == 'sarsat') { |
|
1166 | + $type_name = 'Search & Rescue'; |
|
1167 | + } else if ($type_name == 'dmc') { |
|
1168 | + $type_name = 'Disaster Monitoring'; |
|
1169 | + } else if ($type_name == 'resource') { |
|
1170 | + $type_name = 'Earth Resources'; |
|
1171 | + } else if ($type_name == 'stations') { |
|
1172 | + $type_name = 'Space Stations'; |
|
1173 | + } else if ($type_name == 'geo') { |
|
1174 | + $type_name = 'Geostationary'; |
|
1175 | + } else if ($type_name == 'amateur') { |
|
1176 | + $type_name = 'Amateur Radio'; |
|
1177 | + } else if ($type_name == 'x-comm') { |
|
1178 | + $type_name = 'Experimental'; |
|
1179 | + } else if ($type_name == 'other-comm') { |
|
1180 | + $type_name = 'Other Comm'; |
|
1181 | + } else if ($type_name == 'science') { |
|
1182 | + $type_name = 'Space & Earth Science'; |
|
1183 | + } else if ($type_name == 'military') { |
|
1184 | + $type_name = 'Miscellaneous Military'; |
|
1185 | + } else if ($type_name == 'radar') { |
|
1186 | + $type_name = 'Radar Calibration'; |
|
1187 | + } else if ($type_name == 'tle-new') { |
|
1188 | + $type_name = 'Last 30 days launches'; |
|
1189 | + } |
|
782 | 1190 | |
783 | 1191 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
784 | 1192 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |